TERM_DEF // BLOCK / NONCE
NONCE
Nonce. A 32-bit field miners increment while searching for a valid block-hash/">block hash.
This page sits in the Block section — The 80-byte header and the transaction batch beneath it — what miners actually produce. Read on for what it is, why it exists, how it works under the hood, and what to watch out for.
This page sits in the Block section — The 80-byte header and the transaction batch beneath it — what miners actually produce. Read on for what it is, why it exists, how it works under the hood, and what to watch out for.
WHAT_NONCE_IS
Nonce — at a glance
BLOCK
The nonce is the 4-byte field at the tail of a Bitcoin block header that miners increment trillions of times per second searching for a hash below the network target. It is the only field a miner can freely vary without altering any transaction — that constraint is what makes Bitcoin's proof-of-work a fair lottery rather than a brute-force rewrite of history.
Why it exists
DESIGN
Mining needs a degree of freedom: a value a miner can twiddle to produce a different header hash without invalidating the rest of the block. The nonce is that knob. Placing it in the header (and not the transactions) means every nonce attempt costs one double-SHA-256 on 80 bytes — cheap enough to do ~10²⁰ times per day worldwide, expensive enough that finding a winning hash takes ~10 minutes globally.
HOW_IT_WORKS
Mechanism
HOW IT WORKS
The nonce sits at offset 76 of the 80-byte header, as a 32-bit little-endian unsigned integer. The mining loop sets nonce=0, computes SHA256(SHA256(header)), checks whether the resulting 32-byte hash interpreted as a 256-bit integer is below the current target, and if not increments the nonce and tries again. Modern ASIC farms exhaust the entire 2³² nonce space in well under a second — long before a 10-minute block. When that happens, the miner mutates the coinbase extraNonce instead, which changes the merkle root in the header and resets the 32-bit nonce search.
1. Assemble the 80-byte header: version, prev_block_hash, merkle_root, time, bits, nonce.
2. Set nonce = 0.
3. Compute hash = SHA256(SHA256(header)).
4. If hash interpreted as a 256-bit integer is below the target encoded in bits → broadcast the block.
5. Otherwise nonce++. At 2³²-1, roll over: bump extraNonce in the coinbase, recompute merkle_root, restart from step 2.
6. Every full node re-runs steps 1 and 3 in microseconds to verify the work.
WORKED_EXAMPLE
Block 100,000 — header field by field
EXAMPLE
Field Bytes Value (displayed big-endian; stored little-endian)
─────────────────────────────────────────────────────────────────────────────
version 4 0x00000001
prev_block_hash 32 000000000002d01c1fccc21636b607dfd930d31d01c3a62104612a1719011250
merkle_root 32 f3e94742aca4b5ef85488dc37c06c3282295ffec960994b2c0d5ac2a25a95766
time 4 0x4dd7f5c7 (Wed 30 Dec 2010 21:30:47 UTC)
bits (target) 4 0x1b04864c
nonce 4 0x1dac2b7c ← the winning value: 274,148,111
block hash = SHA256(SHA256(header))
= 000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506
(≈ 50 leading zero bits — well below the target of that era)
Hashes tried by the global network for this block ≈ 2⁵⁰ ≈ 10¹⁵.
At today's ~600 EH/s (2024), the same difficulty would be solved in microseconds.
KEY_PROPERTIES
WIDTH
32 bits, unsigned, little-endian. Range 0–4,294,967,295. Exhausted in milliseconds at modern hashrates.
POSITION
Offset 76–79 of the 80-byte header. Always the final field. Changing it changes only the header hash, nothing else.
EXTRA-NONCE
When the 32-bit space is empty, miners bump a counter inside the coinbase scriptSig — that re-randomises the merkle root and grants another 2³² nonces.
NO SECRET
The nonce is public the moment a block is broadcast. Its only role is to drive the search; it carries no information.
COMMON_PITFALLS
Things that catch people out
PITFALLS
- Calling the coinbase's extraNonce "the nonce" — they are distinct fields. The header nonce is 4 bytes; the extraNonce lives in coinbase scriptSig and is typically 8 bytes (extraNonce1 from the pool, extraNonce2 from the miner).
- Assuming the 4-byte nonce alone is the search space. With 2³² exhausted instantly, the real search space is nonce × extraNonce × time × transaction selection.
- Reading the nonce as big-endian. Like every multi-byte field in the block header, it is stored little-endian on the wire.
- Expecting the winning nonce to be small or "low entropy" — it is uniformly random across [0, 2³²), with no exploitable structure.
WHERE_YOU'LL_SEE_IT
RELATED_CONCEPTS
Other terms from Block — click any to read its page:
TERMINOLOGY_INDEX
TERMINOLOGY
Nonce
A 32-bit field miners increment while searching for a valid block hash.
Block Header
An 80-byte structure containing version, previous block hash, Merkle root, timestamp, bits, and nonce — the input miners hash.
Block Hash
HASH256 of the 80-byte header; the value miners must drive below the target.
Block Height
Zero-based index of a block from genesis; not part of the header — derived by counting.
Block Reward
Coinbase output value: subsidy + transaction fees.
Block Subsidy
The newly-minted bitcoin in the coinbase, halving every 210,000 blocks.
Block Time (10 minutes)
Target average interval between blocks, maintained by the difficulty-adjustment/">difficulty adjustment.
Block Size
The serialized byte length of a block; SegWit replaced this with weight as the consensus limit.