In bitcoin PoW process,if miner does not found the nonce, I understand that he must to increase nonce and rehash the entire block header again to mine the new block. so if nonce defined 4byte[between 0 and 2^31], goes from 0 to 2^31 finally and even not found the target hash, does the miner rehash the Merkle Tree including coinbase transaction? And what algorithm for miner to change coinbase transaction?


Not necessarily. If a miner runs out of nonces, there are still other things in the block header he can change. The version number and timestamp can both be changed to effectively increase the number of nonces that can be tried. However there are not as many possible version numbers of timestamps that can be used as they have to fit within certain constraints.

If the miner does not change those, then he will change the merkle root. This is most commonly done by incrementing a value in the coinbase transaction known as the extranonce. This value is stored in the coinbase script where miners are free to place up to 96 bytes of arbitrary data. By incrementing the extranonce, the merkle root will change and the miner can continue with searching through nonces again.

If the miner runs out of nonces and extranonces, he can reselect transactions to be included or reorder transactions, both of which will also change the merkle root.

  • so does it mean miner change the Merkle Tree's transaction and increment nonce from 0, repeat this circle until found the solution? I think this very randomly and how the network difficulty adjustment can say that it will found block in 10 minutes? – kinjia Feb 1 at 1:45
  • Yes, that is what they do. The point of this is that it is a random process. There is no guarantee that a block will be found within 10 minutes; it is just that the average time between blocks is 10 minutes. – Andrew Chow Feb 1 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.