<blockquote>
<p>Now image this happens again etc.</p>
</blockquote>
<p>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.</p>
<p>The probability depends on block interval, which is regulated at 10 minutes, and how fast the new block announcements propagate on the network.</p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2021-01-23T12:34:26.803Z
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
CC BY-SA 4.0
2021-01-23T12:45:15.267Z
@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
CC BY-SA 4.0
2021-01-23T15:24:48.280Z
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
CC BY-SA 4.0
2021-01-23T11:43:09.480Z
2021-01-23T11:43:09.480Z
jpa
<p>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.</p>
<p>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 <a href="https://bitcoin.stackexchange.com/q/4571/5406">coinbase transaction</a> 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 &quot;losing&quot; 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.</p>
<p>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.</p>

CC BY-SA 4.0
2021-01-23T12:39:50.873Z
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
CC BY-SA 4.0
2021-01-23T15:27:24.873Z
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
CC BY-SA 4.0
2021-01-23T20:11:19.780Z
@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
CC BY-SA 4.0
2021-01-23T20:11:43.870Z
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
CC BY-SA 4.0
2021-01-23T04:58:55.987Z
2021-01-23T19:47:19.087Z
2021-01-23T19:47:19.087Z
Murch
<p>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.</p>
<p>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:</p>
<ul>
<li>at a given time there could be two forked chains with the same size, and growing roughly at the same pace</li>
<li>knowing which chain is the longest requires to &quot;backtrack&quot; possibly to the beginning, which means that no transaction on any chain can be &quot;validated&quot; as we are not sure to be on the correct chain</li>
</ul>
<p>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.</p>

CC BY-SA 4.0
2021-01-23T14:44:35.003Z
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.
Daniel Wagner
CC BY-SA 4.0
2021-01-23T16:09:53.203Z
@DanielWagner why would they necessarily be 5 minutes apart. It could be milliseconds apart, and then a 10 minute wait?
Tim
CC BY-SA 4.0
2021-01-23T17:57:54.407Z
@Tim It isn't necessarily 5 minutes apart. It is five minutes apart on average, as I said.
Daniel Wagner
<blockchain><mining-theory><consensus><chain-reorganization><best-chain>
How does the BTC protocol guarantee that a "main" blockchain emerges?
lezebulon
# How does the BTC protocol guarantee that a "main" blockchain emerges?

(Asked by: username_0 on 2021-01-23)

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.

**Tags:** blockchain, mining-theory, consensus, chain-reorganization, best-chain

> **Comments:**
> **username_1**: 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.  
> **username_2**: @username_1 why would they necessarily be 5 minutes apart. It could be milliseconds apart, and then a 10 minute wait?  
> **username_1**: @username_2 It isn't necessarily 5 minutes apart. It is five minutes apart on average, as I said.  

---

## 2 answers

### Answer by username_4 on 2021-01-23. Score: 7 | Accepted answer

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](https://bitcoin.stackexchange.com/q/4571/5406) 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.

> **Comments:**
> **username_0**: 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  
> **username_4**: 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.  
> **username_5**: @username_0 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.  
> **username_5**: 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.  

---

### Answer by username_3 on 2021-01-23. Score: 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.

> **Comments:**
> **username_0**: 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  
> **username_3**: @username_0 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.  
> **username_4**: We had a two block fork in November and it was not the first. I think once every 2000 years sounds a bit optimistic. :)  

---

