I am trying to understand how the consensus mechanism works. My understanding is that multiple nonces can satisfy the target hash requirement. What I'm trying to understand now is: if two miners come up with two different nonces, how does consensus take place?

Is this "tie" broken with the longest chain rule or is there another tie-breaking mechanism?


The tie is broken by the first of the two that gets extended with a child block.

In practice, in case two conflicting blocks at the same height appear on the network, every node will pick the one they saw first as winner. Because communication across the earth happens at a finite speed, some miners may see one side of the fork first, and other miners may see another one first, even if there is some time between them (up to ~seconds). However, the one that was actually first will most likely reach more other miners first than the other one, and that one will thus have the most chance of being built upon first.

Note that in theory it is possible for this discrepancy to persist: it is possible that a block is found on both sides of the split ~simultaneously again. In that case, it will be the block after that that determines the winner, and so forth. However, under reasonable assumptions, the probability that this persists for long is extremely small, and that is also what is observed in practice. Reorganizations of more than 2 blocks deep are extremely rare.

  • Are there historical records with exact numbers on this? For instance, "only 32 reorganizations of depth 3 happened in the history of bitcoin, and 0 of depth 4". Not an expert, just curious. Oct 12 at 11:11
  • I don't have an actual source (as observing reorganizations isn't deterministic - it depends on which blocks you see first), but it wouldn't surprise me if the only reorg more than 2 deep after 2010 was the July 2015 BIP66 activation fork, where some new miners kept mining on top of an invalid block produced by an old node through spy mining. IIRC that was around ~30 blocks deep before it was resolved. Oct 12 at 11:42
  • What happens if by some fluke both miners find the nonce at the exact same time, down to the nanosecond?
    – nick012000
    Oct 12 at 11:50
  • 1
    It doesn't matter how close the two blocks are found, the procedure is the same: every node will accept the first one they see, but switch over when the other one is extended first. Oct 12 at 11:52

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.