What is the extraNonce?

19

3

This question helps identify the various components of the getwork "data" field, but I'm curious where the extraNonce comes from. My hunch is it's the first four bytes of the second half of the data, because I believe this is still part of the Merkle root (and yet, being in the second half of the data, it won't be part of the midstate). Is this correct? And if so, how does one increment the extraNonce, and what does it mean to do so?

Example getwork data: 00000001a10bacc7e639d1c69a01014bc5db6f2604b3477a3f273a4e019a232700000000a5942372cc60477c8a276e59c8f1a3f58654ea2f6c4402bf1b18e48455b5b8f64f10868b1c07475200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000

Is the extraNonce (in little-endian, I know), 55b5b8f6?

ConstableJoe

Posted 2012-10-13T01:28:36.410

Reputation: 615

Answers

9

extraNonce gets put into the input of the generation transaction. getwork clients can't see transactions, so they can't update extraNonce. Some miners instead modify nTime slightly to give them more nonce space.

extraNonce is used by bitcoind, but it's not part of the protocol. There is no extraNonce field in blocks or transactions.

theymos

Posted 2012-10-13T01:28:36.410

Reputation: 8 228

Ah, interesting. And nTime is the same as the timestamp described here, correct?

ConstableJoe 2012-10-13T05:03:34.927

Yes, nTime is a field inside the block header.Pieter Wuille 2012-10-13T12:30:02.497

10

This really helped me understand it:

A solo miner increments Nonce until it overflows. Then it increments extraNonce and resets Nonce. extraNonce is located in the coinbase transaction, so changing it alters the Merkle root. extraNonce is reset based on the time.

Geremia

Posted 2012-10-13T01:28:36.410

Reputation: 3 665