<p>It is possible for two miners find blocks at the same height simultaneously, and for those two blocks to have an overlap of included transactions. Each block is valid in it's own right, but eventually only one can be included in the longest chain, and the other will become an 'stale block'. Lets call these two blocks <code>Block A</code> and <code>Block B</code>.</p>
<p>When the blocks are found, the lucky miners will immediately broadcast them to the network. <a href="http://bitcoinfibre.org/" rel="nofollow noreferrer">Block propagation has been optimized</a> very well over the years, so in reality it takes very little time for the entire network to hear about a new block (and miners generally stay very well connected to the network), but lets pretend it takes much longer than normal. In this situation, some nodes may hear about <code>Block A</code> first, and other nodes will hear about <code>Block B</code> first. Many nodes follow the rule of 'first seen is valid', so they will reject the second block they hear about (even though it is valid). This creates a fork, since the network is not all agreeing on a common history.</p>
<p>This situation resolves once the next block is found**. Miners run nodes as well, so each miner will begin mining the next block on top of whichever block they heard about first. So if a miner that saw <code>Block A</code> finds the next block, then <code>Block A</code> will be included in the final blockchain history, and <code>Block B</code> will be made stale (and vice versa). This brings the network back in sync, as all nodes that heard about <code>Block B</code> first would drop <code>Block B</code> in order to stay in sync with what is now the longest chain.</p>
<p>** <em>note that it is possible for the situation to repeat, and for a miner on each side of the fork to again find blocks simultaneously. The resolution is no different, but now the stale blocks will be two deep, instead of just one. In practice it is very rare for this situation to occur (it is equal to the probability of a stale block occurring, squared)</em></p>

CC BY-SA 4.0
2022-08-24T10:17:52.037Z
But what would that mean to the remaining transactions within the other block? 1 of the 2 blocks is accepted and appended to the chain, right? Let's assume that 50 similar transactions existed in both blocks. Will these be automatically removed from the block that didn't make it and the miner needs to add 50 different ones?
Oliver
CC BY-SA 4.0
2022-08-31T18:41:34.100Z
@Oliver: There can be only one block at every height in the chain. As soon as the winning block emerges, every node reorganizes their view of the chain to the best chain-tip, and the stale block is essentially ignored as if it had never existed.
Murch
CC BY-SA 4.0
2018-05-24T19:07:44.513Z
2022-08-31T21:55:42.683Z
2022-08-31T21:55:42.683Z
chytrik
<p>If both blocks are broadcast at the same time, and we assume both miners are equally connected to the network, a fork may occur.</p>

<p>Since the default mining policy is mining on the top of the longest chain, or the first one heard in case of a fork, the network should mine in two different blocks until a new one is found, moment when all should go back to "normal".</p>

CC BY-SA 4.0
2018-05-24T13:22:20.490Z
2018-05-24T13:22:20.490Z
sr_gi
<p>What happens when two miners include same or set of transaction in their block, mine it and then broadcast it at same time? Can the transaction be included in two separate block like this OR a fork happens?</p>

<bitcoin-core><blockchain>
What happens when a transaction is included in more than one block?
user2203937
# What happens when a transaction is included in more than one block?

(Asked by: username_0 on 2018-05-24)

What happens when two miners include same or set of transaction in their block, mine it and then broadcast it at same time? Can the transaction be included in two separate block like this OR a fork happens?

**Tags:** bitcoin-core, blockchain


---

## 2 answers

### Answer by username_1 on 2018-05-24. Score: 1

It is possible for two miners find blocks at the same height simultaneously, and for those two blocks to have an overlap of included transactions. Each block is valid in it's own right, but eventually only one can be included in the longest chain, and the other will become an 'stale block'. Lets call these two blocks `Block A` and `Block B`.

When the blocks are found, the lucky miners will immediately broadcast them to the network. [Block propagation has been optimized](http://bitcoinfibre.org/) very well over the years, so in reality it takes very little time for the entire network to hear about a new block (and miners generally stay very well connected to the network), but lets pretend it takes much longer than normal. In this situation, some nodes may hear about `Block A` first, and other nodes will hear about `Block B` first. Many nodes follow the rule of 'first seen is valid', so they will reject the second block they hear about (even though it is valid). This creates a fork, since the network is not all agreeing on a common history.

This situation resolves once the next block is found\*\*. Miners run nodes as well, so each miner will begin mining the next block on top of whichever block they heard about first. So if a miner that saw `Block A` finds the next block, then `Block A` will be included in the final blockchain history, and `Block B` will be made stale (and vice versa). This brings the network back in sync, as all nodes that heard about `Block B` first would drop `Block B` in order to stay in sync with what is now the longest chain.

\*\* *note that it is possible for the situation to repeat, and for a miner on each side of the fork to again find blocks simultaneously. The resolution is no different, but now the stale blocks will be two deep, instead of just one. In practice it is very rare for this situation to occur (it is equal to the probability of a stale block occurring, squared)*

> **Comments:**
> **username_2**: But what would that mean to the remaining transactions within the other block? 1 of the 2 blocks is accepted and appended to the chain, right? Let's assume that 50 similar transactions existed in both blocks. Will these be automatically removed from the block that didn't make it and the miner needs to add 50 different ones?  
> **username_3**: @username_2: There can be only one block at every height in the chain. As soon as the winning block emerges, every node reorganizes their view of the chain to the best chain-tip, and the stale block is essentially ignored as if it had never existed.  

---

### Answer by username_4 on 2018-05-24. Score: 1

If both blocks are broadcast at the same time, and we assume both miners are equally connected to the network, a fork may occur.

Since the default mining policy is mining on the top of the longest chain, or the first one heard in case of a fork, the network should mine in two different blocks until a new one is found, moment when all should go back to "normal".


---

