Transactions & Network

Nonce

A nonce (number used once) is a value that miners change repeatedly when attempting to find a valid block hash. By iterating through nonce values, miners search for a hash below the network's difficulty target, which is the core mechanism of proof-of-work mining.

How It Works

Bitcoin mining is a search for a specific number. Miners construct a candidate block header containing the previous block hash, a Merkle root of the included transactions, a timestamp, the difficulty target, and a nonce field. They hash this header with SHA-256 twice and check if the resulting hash is below the difficulty target. If not, they increment the nonce and try again. This process repeats billions of times per second across the entire mining network.

The nonce is a 32-bit field in the block header, giving roughly 4.3 billion possible values. At modern hash rates, miners exhaust the entire nonce space in a fraction of a second. To continue searching, they modify other parts of the block header — typically the coinbase transaction's extra nonce field or the timestamp — which changes the Merkle root and creates an entirely new set of 4.3 billion nonce values to try.

The beauty of this system is that there is no shortcut. You cannot predict which nonce will produce a valid hash — you must do the computational work. This is what makes proof-of-work secure: the block producer must demonstrably expend energy to create each block. Verifying the solution, however, takes a single hash computation. This asymmetry — hard to produce, trivial to verify — is the foundation of Bitcoin's security model.

Key Points

  • 32-bit number in the block header that miners iterate to search for valid hashes
  • No shortcut exists — each attempt requires actual computation (proof-of-work)
  • Modern mining exhausts the 4.3 billion nonce space in under a second
  • Extra nonce in the coinbase transaction extends the search space
  • Hard to find, trivial to verify — the fundamental asymmetry securing Bitcoin