Bitcoin mining is often described as repeatedly changing a nonce until a block hash meets the network's target. That description leaves an obvious question: what happens when the miner runs out of nonce values?

The answer involves two different places in a candidate block. One is the nonce field in the block header. The other is adjustable data in the block's special first transaction, commonly used as an extra nonce. Connecting them explains how miners keep generating fresh work without making the header's nonce field larger.

Bitcoin Core's block-header definition contains a 32-bit unsigned nNonce, alongside the version, previous-block hash, merkle root, timestamp and encoded target. That nonce has 2³² possible values: 4,294,967,296.

For any otherwise fixed header, exhausting those values exhausts that particular nonce search. Counting upward does not guarantee that one of the resulting hashes will meet the target. The Bitcoin white paper describes proof of work as a search for a qualifying hash; the nonce is an input to that search, not a counter showing progress toward a promised solution.

The practical consequence is straightforward. Repeating exactly the same header and nonce repeats the same hash. Useful additional work requires a different header candidate.

The extra nonce lives outside the header

Every block begins with a coinbase transaction. Here, “coinbase” refers to Bitcoin's special transaction structure, not the exchange company. Unlike an ordinary payment input, its input does not point to a previously spendable transaction output.

The coinbase input contains a script field with room for miner-supplied data. Miners commonly use some of that space for an extra nonce. The Bitcoin transaction reference documents both the special input and this use of its data field.

The extra nonce stays in the coinbase transaction rather than being appended to the 80-byte header. From there, it can influence a field already present in that header.

Its size and arrangement are implementation details within the coinbase's constraints. Bitcoin Core's transaction checks require the entire coinbase input script to be between two and 100 bytes. That limit applies to the whole field, not to an extra nonce alone.

A small change reaches the merkle root

The header connects to transaction data through its merkle root. The Bitcoin block reference describes a tree built from transaction identifiers, with the coinbase transaction first.

Changing extra-nonce data changes the coinbase transaction's identifier. Recomputing the affected path through the tree produces a new merkle root, which goes into the header. The miner now has different header data against which nonce values can be tried again.

The conceptual chain is:

Change coinbase data → recompute its transaction identifier → update the merkle root → hash new header candidates.

Ordinary customer payments need not be rewritten for that change. The altered coinbase supplies the variation. The developer mining guide describes this mechanism and explains how mining software can rebuild the necessary parts of the merkle tree rather than starting every calculation from scratch.

Adjustable does not mean unconstrained

Some coinbase data has a required purpose. BIP 34 requires the block height as the first item in the coinbase input script. An implementation must preserve that encoding while arranging its additional data.

The height and extra nonce do different jobs. Height identifies the candidate block's position in the chain; the extra nonce can change across many attempts to mine at that same height. Increasing extra-nonce data does not advance the blockchain by a block.

Mining interfaces also distinguish coinbase information from the header target. For example, BIP 22's getblocktemplate specification describes coinbase auxiliary data and the total value available to the coinbase. Having room to vary transaction data does not authorize a miner to increase that value arbitrarily.

Fresh work does not make the target easier

Extra-nonce changes expand the supply of distinct candidate headers. They do not lower the proof-of-work requirement or make a failed attempt count as a fraction of a successful block.

This is a conceptual explanation, not a claim that every mining system completes a full nonce sweep before changing another field. Mining software can coordinate and queue work in different ways. The developer mining guide explicitly notes parallel execution in actual implementations; the block-header reference also identifies permitted timestamp changes as another source of variation.

The useful distinction is between the search space and the acceptance rule. Coinbase variation helps miners keep searching. The resulting block must still satisfy the applicable target and the rest of Bitcoin's validation rules.