BitcoinMachine
TECHNICAL_DOC // BLOCK / NONCE
NONCE
The nonce is a 4-byte (32-bit) field in the block-header/">block header that miners increment to change the block hash output without altering any transaction data. By cycling through all ~4.3 billion possible nonce values, a miner searches for a hash below the difficulty target. Modern ASICs exhaust the nonce space in milliseconds, requiring additional entropy sources called the extraNonce.
80-BYTE BLOCK HEADER — NONCE POSITION
Offset Size Field ────────────────────────────────────── 0 4 version 4 32 previous block hash 36 32 merkle root 68 4 time 72 4 bits (nBits) 76 4 nonce ← miners change this Miner loop: for nonce = 0 to 0xFFFFFFFF (4,294,967,295): header[76:80] = nonce as uint32 LE hash = SHA256(SHA256(header)) if hash < target: FOUND! broadcast block. At modern hashrates (100+ TH/s per ASIC): 4.3 billion nonces exhausted in < 0.05 milliseconds → extraNonce required almost immediately
extraNonce — Extending the Search Space
MINING TECHNIQUE
When the 32-bit nonce space is exhausted, miners increment an extraNonce value embedded in the coinbase transaction, which changes the Merkle root and resets the effective nonce space.
Coinbase transaction structure: [4 bytes] version [input] coinbase input: prev_hash: 00...00 (32 zero bytes) prev_vout: 0xFFFFFFFF scriptSig: [block height] [extraNonce1] [extraNonce2] [text] ↑ pool field ↑ miner field [output] block reward + fees [4 bytes] locktime extraNonce is typically 8 bytes (2 × 4 bytes in pool mining): Incrementing extraNonce → new coinbase tx New coinbase tx → new TXID → new Merkle root New Merkle root → completely different header → fresh 4B nonce space to search Effective search space: 2^32 nonces × 2^64 extraNonces
In pooled mining, extraNonce1 is assigned by the pool (identifies each miner), while extraNonce2 is incremented by the individual miner.
TERMINOLOGY_INDEX
Nonce
A 4-byte field in the block header that miners increment to change the hash output. Range: 0 to 2^32-1.
extraNonce
Additional entropy in the coinbase scriptSig. Incremented when the 32-bit nonce space is exhausted.
Nonce Space
The 4.29 billion possible nonce values (2^32). Exhausted in milliseconds by modern ASICs.
Hashrate
The speed at which a miner tries nonce values. Measured in hashes per second (H/s, TH/s, EH/s).