226 / 691XNONCE

Extranonce

Additional mutable data for mining

Extranonce expands the mining search space by changing coinbase and its header commitment. It is not another standalone header field, and a pool does not give every miner freedom to change all its bytes.

Extranonce is mutable data commonly inserted into the coinbase transaction input. Changing it provides new input for the Merkle root and header hashing without enlarging the header’s 32-bit nonce field.

The nonce field has 32 bits, offering 2^32 values for an otherwise identical header. Extranonce does not extend this field. It changes data elsewhere so miners can construct another header and try nonce values again. [Bitcoin Developer Guide — Mining and nonce space]

Changing coinbase extranonce changes its serialization and TXID; the corresponding Merkle-tree branch and header Merkle root are recomputed. Other transactions need not change. The old Merkle root cannot simply be retained without recomputation. [Bitcoin Developer Guide — Mining and nonce space]

Two fully free bytes permit 2^16 variants. In a model with a 32-bit nonce and otherwise fixed data, this gives 2^48 input combinations. This is a space of different attempts, not a count of blocks found or a guarantee of success after searching it. [Bitcoin Developer Guide — Mining and nonce space]

BIP 34 requires the correctly encoded block height at the start of coinbase scriptSig. The 100-byte limit applies to the entire coinbase scriptSig, not just extranonce. The free area must not overwrite height or violate transaction formatting. [BIP 34 — Height in coinbase] [Bitcoin Developer Reference — Coinbase input]

Stratum V2 divides extended extranonce into a fixed upstream prefix, a locally reserved part and downstream space. Partitioning avoids wasteful overlapping searches. An assigned extranonce_prefix is not automatically an area the end miner may change freely. [Stratum V2 — Extended extranonce and jobs]

For SubmitSharesExtended, coinbase is assembled in the order coinbase_tx_prefix, extranonce_prefix, extranonce and coinbase_tx_suffix. Submitted extranonce bytes must have the negotiated length. The same number encoded with fewer bytes need not produce the same transaction. [Stratum V2 — Extended extranonce and jobs]

A Stratum V2 Standard Job uses a fixed Merkle root; only permitted parts of version, nonce and nTime vary. A standard device therefore does not itself submit extranonce as an extended channel does. An upstream node can handle coinbase changes when preparing a new job. [Stratum V2 — Extended extranonce and jobs]

Stratum V2’s SetExtranoncePrefix applies to jobs sent after that message on the specified channel. A result must remain associated with the correct job_id and allocated space. The latest prefix cannot replace records of which job produced an older result. [Stratum V2 — Extended extranonce and jobs]

For the clearest picture, read this entry together with Nonce, Merkle tree, Mining Share, Block Template. The reverse links also lead from Block Template, getblocktemplate.

DOC · 001Bitcoin Developer Guide — Mining and nonce spaceDocumentationDOC · 002Stratum V2 — Extended extranonce and jobsSpecificationDOC · 003BIP 34 — Height in coinbaseSpecificationDOC · 004Bitcoin Developer Reference — Coinbase inputDocumentation
Source-first · No investment advice