5

I have been reading the SHA256 hash creation with a random nonce. So, my understanding is every miner would pull uncommited transactions and would try to create a Hash of the transactions with a random nonce starting with 0 and increment from there on. So, if every node/miner is performing the same hash with the nonce sequence starting from 0, it would always be the miner with the maximum computing power always outrun the smaller ones. How would a miner with lesser computing power ever be able to create a hash quicker than the largest one?

My second question is every time a block is added to the chain, would every miner stop their current process and restart all over again since the next block would depend on the hash of the currently added block?

1

1 Answer 1

7

The block hash has to be below a certain value and the block hash depends (among others) on the nonce and on the Merkle root.

The Merkle root depends on the sequence of transactions. Note that it's a sequence, not a set, meaning the order is important.

Different miners choose many different lists of transactions. For every list of transactions with the other fields which go into the block hash, chances are there is no 32 bit nonce which will make the block hash low enough to qualify as a new block on the blockchain. So miners add a transaction, or remove one, or permute some to get a different Merkle root all the time.

I'll just calculate the time an AntMiner S9 with a hash rate of 14 TH/s takes to go through all the numbers in a 32 bit field (2^32 hashes) for you:

2^32 H / (14 TH/s) = 2^32 / 14 / 10^12 * s = 0.30678 ms

To answer your second question: Network traffic takes longer than 0.3 ms. To give you an impression on it: In fiberoptic cables, signals travel with about a third of the speed of light. With the speed of light, something travels 90 km in that time, so signals in fiberoptic cables can travel about 30 km in it. Many miners are more than 90 km away from each other and attempting to travel more than 90 km in that time turns out to piss physicists off, a lot.

1
  • Hi, could i bruteforce extra nonce with random bytes too? Should i update Merkle root after changing extra nonce. Maybe some good links where i can read about all this stuff explained from viewpoint of programming own mining software? Commented Oct 13, 2017 at 7:07

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