7

I'm reading up on the bitcoin/blockchain technology. Usually, the part about proof of work and how to create a block is well explained. However, what is never explained is how/why the communication of blocks over the network allows for a 'blockchain' to converge.

Let me explain: what if two miners create a new block at the same time, and broadcast it at the same time ? Roughly 50% of the nodes would have each one a new (different) block, and build on it. Now, imagine this happens again etc. Then, there is not a single blockchain that is worked on, as now miners all work on several forks. The bitcoin proposal addresses this by saying that the longest chain must be used but:

  • at a given time there could be two forked chains with the same size, and growing roughly at the same pace
  • knowing which chain is the longest requires to "backtrack" possibly to the beginning, which means that no transaction on any chain can be "validated" as we are not sure to be on the correct chain

Are these issues addressed by the bitcoin protocol? Basically, it seems that there is no proof that adding blocks in a distributed fashion over the network converges cleanly into a single chain.

3
  • You say, "at a given time there could be 2 forked chains with the same size, and growing at roughly the same pace". But "roughly" is not "exactly" -- on average, if the chain difficulty is set well and a block takes about ten minutes to mine, two parallel chains will have about five minutes between their two next-block discoveries. That is ages in computer time -- easily enough for the longer chain to communicate itself to the whole network and have four minutes to spare. Jan 23, 2021 at 14:44
  • 1
    @DanielWagner why would they necessarily be 5 minutes apart. It could be milliseconds apart, and then a 10 minute wait?
    – Tim
    Jan 23, 2021 at 16:09
  • @Tim It isn't necessarily 5 minutes apart. It is five minutes apart on average, as I said. Jan 23, 2021 at 17:57

2 Answers 2

7

Bitcoin nodes consider the chain with the most accumulated proof-of-work the best chain. Whenever one chain tip pulls ahead by adding another block, all nodes will reorganize to that chaintip as soon as they learn about it.

Another reason for the network to quickly converge on one best chain follows from how Bitcoin miners get paid. When miners construct their block templates, each includes a unique coinbase transaction which pays the block reward to themselves. This means that finding a valid block results in the block author paying themselves the block reward via the coinbase transaction they included. However, the outputs of coinbase transactions are subject to a maturation period of 100 confirmations. This means that only blocks that spawn at least 99 successors can be spent. This essentially means that a block reward only gets paid out when a block becomes part of the best chain. As mining operations incur large hardware and power expenses regardless of success, miners bleed money when they work on blocks that do not end up in the best chain. Therefore, even when occasionally two miners find blocks at the same time and produce two competing chaintips, even the "losing" miner usually reorganizes quickly to the best chaintip and works on extending that as soon as one pulls ahead, because the stale block that has fallen behind is highly disadvantaged in its bid to become part of the best chain.

While the individual mining efforts are not centrally coordinated, it is uncommon for two competing blocks to be found at the same height: it only happens about once per month. Bitcoin mining is a Poisson process which aims to produce about one block every ten minutes. The cadence is regulated by difficulty adjustments that occur every 2016 blocks, which reset the difficulty target such that the next 2016 blocks are expected to take 14 days under the assumption that the network continues to produce the same amount of hashrate as observed for the previous epoch.

4
  • Thanks, I think I understand. But it feels like this basically assume that there will be a 'main' branch and like 2 subchains with each 1 or 2 oustanding blocks. In this setup, indeed it's simple to identify which chain should be the "main" one by checking the longest. My initial question was more about the (theoretical) possibility that new blocks are mined so fast in a chaotic way such that no one can really agree where the main chain is. Basically if, from the initial block, there are always 10 different next nodes mines and it keep branching out in all directions
    – lezebulon
    Jan 23, 2021 at 12:39
  • If blocks are found very quickly, the difficulty increases until the cadence returns to about one block per ten minutes. A scenario where numerous competing chaintips are found is therefore unlikely to happen by chance and it would be very expensive for miners to bring about on purpose.
    – Murch
    Jan 23, 2021 at 15:27
  • 1
    @lezebulon In general 10 minutes is substantailly longer than it takes to announce a new block, so the chaotic period is short compared to the steady state period where no new blocks are suddenly appearing. However, in infant blockchains, there are real concerns about what happens when a malicious actor suddenly buys a lot of AWS time and makes a bunch of blocks really fast (because they had a large fraction of the total mining CPU time). Bitcoin is large, with lots of miners so that is unlikely to happen... but theoretically possible.
    – Cort Ammon
    Jan 23, 2021 at 20:11
  • It can be left to the individual bitcoin user to decide whether the risk of such a successful attack is sufficient to bring the bitcoin system into question.
    – Cort Ammon
    Jan 23, 2021 at 20:11
2

Now image this happens again etc.

For the two chains to remain even, the new blocks would have to be found repeatedly at exactly the same time. It gets less and less likely that this will happen repeatedly.

The probability depends on block interval, which is regulated at 10 minutes, and how fast the new block announcements propagate on the network.

Currently bitcoin network sees stale blocks about once in 10 000 blocks. Two miners getting a block at the same time is a random and independent event, so we can calculate that having two chaintips with 2 unique blocks each would be 1 in 100 million chance. With block interval of 10 minutes this would occur on average once in 2 000 years.

Before Bitcoin Core 0.10.0 of 2015 it used to be that network propagation was slower and the stale block rate was closer to 1 in 100. But even then, getting a stale chain of 3 blocks would only occur once in 20 years. It is in miner's best interest to speed up block propagation, and as such stale blocks are a much less common occurrence.

3
  • ok I get that, thanks. What I'm more worried about in this situation is it the network itself starts to fail or incorrectly deliver blocks. It feels like, this relies on the assumption that the HTTP transport layer is properly working and that info always end up propagating fast enough
    – lezebulon
    Jan 23, 2021 at 12:34
  • @lezebulon You can suppose a situation where the network splits completely due to some major internet traffic issue. In that case a fork is unpreventable because there is no communication between the halves.
    – jpa
    Jan 23, 2021 at 12:45
  • We had a two block fork in November and it was not the first. I think once every 2000 years sounds a bit optimistic. :)
    – Murch
    Jan 23, 2021 at 15:24

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.