23

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
  • 655
  • 2
  • 7
  • 14

2 Answers2

14

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
  • 4,626
  • 5
  • 38
  • 75
13

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
  • 8,994
  • 42
  • 37