1

Pretty straightforward question :

When a miner is trying to find a 18-leading-zeros hash, does it always start with a nonce at zero ? I suppose it doesn't, because other miners in the world may have found out that the first 1000 nonces won't give a sufficient hash.

My question is then, how does a miner knows which nonce to start with ?

2

The entire block header enters as input in the hashing process.

Along with nonce and some other fixed fields there is a "Merkle root" field in the block header that each miner has different.

So each miner can search the nonce range from 0 to the last - in order; because of different Merkle root each miner will have different block header hash for the same nonce and other fixed fields.

NOTE: Why each miner has different Merkle root? That's because in the transactions miners include in the block (from which Merkle root is derived) there is one special transaction called "coinbase transaction" that each miner has unique. Therefore the Merkle root is also unique. "Coinbase transaction" is included by the miner himself along with regular transactions and is the transaction that gives mining reward to miner's own address.

  • Thanks for your answer. Could you elaborate the reason why the Merkle Root is different for each miner ? According to what I read, it is the root of all the transactions in the block, so why would it be different depending on the miner ? – Arthur Attout Nov 27 '17 at 22:21
  • 1
    Good reasoning. But from these transactions there is one special transaction called "coinbase transaction" that each miner has unique. Therefore the Merkle root is also unique. "Coinbase transaction" is included by the miner himself along with regular transactions and is the transaction that gives mining reward to miner's own address. – croraf Nov 27 '17 at 22:23
  • 1
    @croraf - could you add that to your answer? Comments are transient and may be deleted. – Max Vernon Nov 28 '17 at 17:37

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.