0

According to another similar question on Bitcoin Stack Exchange, https://en.bitcoin.it/wiki/Block_hashing_algorithm shows how the mining algorithm works for Bitcoin. The problem is, it shows the nonce as being not larger than 2^32. When someone has gone through all the values the nonce can have, it seems the time changes and the search for a proper nonce begins anew, as even changing the second by 1 is enough to warrant testing the nonces again in the hashing algorithm.

As it relates to the actual mining algorithm/software, with all this in mind, how can mining hardware provide billions or trillions of hashes per second when each second only provides ~4.3 billion different nonces and requires a new "second of time" to change the time so as to begin anew with the nonces? It seems as though in the most extreme circumstances, even having the "merkle root" changing due to the addition of a transaction to the block would not occur frequently enough for the most powerful ASICs to always have work to do.

To the extent that it is possible I am seeking a potentially elaborate yet easy to understand answer.

1 Answer 1

3

The timestamp in blocks does not need to be set to the actual time of the current hash. So during mining, the timestamp can be moved when the nonce is exhausted even if the actual time is not that timestamp.

There are also other ways to change block headers that do not require changing the timestamp. Miners frequently add a value to the coinbase part of their coinbase transaction which is referred to as an extranonce. Miners will increment that in order to change the merkle root every time they exhaust one set of nonces so as to allow for even more nonce possibilities. Furthermore, other things can be done such as permuting transaction order, selecting new transactions, changing coinbase output scripts, etc. All of these ways of changing the block hash allows for miners to do trillions of hashes per second.

1
  • The timestamp chosen by the miner is subject to sanity checks: "greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours" en.bitcoin.it/wiki/Block_timestamp Jun 7, 2021 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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