TeachMeBitcoin

Nonce Overflow & Extra Nonce

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Nonce Overflow & Extra Nonce

Since the 4-byte Nonce is exhausted in microseconds, miners use a technique called the Extra Nonce to create an effectively infinite search space.

1. Where is the Extra Nonce?

The "Extra Nonce" is not a field in the block header. Instead, it is a piece of data hidden inside the Coinbase Transaction.

2. The Chain of Change

When a miner increments the Extra Nonce:

  1. The Coinbase Transaction data changes.

  2. The Hash of the Coinbase Transaction (TXID) changes.

  3. The Merkle Root in the Block Header changes.

  4. The Block Header Hash is now completely different, even with the same nonce!

3. Stratum Protocol Coordination

Mining pools use the Stratum Protocol to coordinate this. The pool sends a "subscription" to the miner that includes:

This allows the pool to distribute work to thousands of ASICs without any two miners ever checking the same combination of data.

4. The Effective Search Space

By combining the 4-byte header nonce with an 8-byte extra nonce in the coinbase, miners have a total search space of $2^{96}$. This is $7.9 \times 10^{28}$ unique combinations—more than enough to keep all the world's ASICs busy for the lifetime of the universe.

Nonce Type Location Size
Standard Nonce Block Header 4 Bytes
Extra Nonce Coinbase ScriptSig Variable (usually 8+ bytes)
IMPORTANT

This is why miners are considered "transaction builders." Every time they run out of nonces, they are essentially "editing" the coinbase transaction and re-calculating a Merkle branch to keep the work flowing.

Next, we will analyze the Nonce Distribution to see if miners follow any specific patterns.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!