<blockquote>
  <p>How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block?</p>
</blockquote>

<p>If the miner is trying to build on top of the block that was received, then he will have to drop the 200 transactions that were included in the other block. He will also not be able to include the other transactions in the next block that were present in the block he received. Apart from this, he is not restricted which valid transaction he can include. He can fill in more valid transactions, remove some or remove all the transactions and just mine the block with coinbase transaction. It's up to his discretion.</p>

<blockquote>
  <p>Two blocks are created almost at the same time and they each have some of the same and some different transactions.</p>
</blockquote>

<p>Imagine a scenario where two miners find a solution at the same time and both the blocks are valid. As soon as they find the solution, they will relay the block to the full nodes. The nodes will add the block that reaches to them first and add it on top of the existing blockchain. However, when they receive the other block at the same height, they will not discard it but maintain a copy of it. So here you have a blockchain fork, where around half the nodes have a different version of the blockchain at the best height. Other mining nodes will start mining the subsequent block based on the copy of the blockchain that they are seeing (on top of the block that they received first.) Now, one of the miner will find a solution and propagate it to the network. More likely than not, it will not happen to be simultaneous like the previous block. So when that block is propagated, the network converges back to a shared state. Now, as the network converges the full nodes will discard the transactions from the mempool that are already confirmed.</p>

CC BY-SA 4.0
2019-03-26T00:29:37.193Z
Superbly explained. Many thanks for the effort.
rossmclochness
CC BY-SA 4.0
2019-04-24T17:01:32.927Z
@rossmclochness if you think it adequately answers your question you can click the tick mark near the answer so others know this is an accepted answer and they find it helpful
Ugam Kamat
CC BY-SA 4.0
2020-03-13T20:08:42.510Z
so, if two miners create valids block in the same height (with transactions in common), is probably that one of them will not gain any ravenue for that mining???
Eduardo Pascual Aseff
CC BY-SA 4.0
2020-03-15T07:23:24.263Z
@eduardopascualaseff Yes. When a miner mines a block, the payout comes through the coinbase transaction. This coinbase transaction is not spendable until 100 blocks following the mining of the block. Most reorganizations settle themselves within 2-3 blocks. So one of the miner's payout transaction will never be included in the main chain.
Ugam Kamat
CC BY-SA 4.0
2019-03-25T13:12:54.070Z
2019-03-25T13:12:54.070Z
Ugam Kamat
<p>A miner is in the process of creating and mining a block of 1400 transactions. Suddenly they receive a broadcast that a new block was confirmed with 200 of the transactions currently in that miner's block. How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block? </p>

<p>In a second scenario, two blocks are created almost at the same time and they each have some of the same and some different transactions. I'm assuming (a) that there is then a race to consensus for each and the first to 51% wins a confirmation. If so, then similar to above (b) the block with losing transactions has all the dissimilar transactions dumped back in the mempool. But what if a second chain surfaces with two blocks? Now all the confirmations in (a) that aren't confirmed in this second block get dumped back into the mempool and hopefully finally mined into the blockchain?</p>

<p>The takeway for me >>> Obviously this system does work since its very popular! But it seems that transactions can take a very long time and no way to really guarantee that they will occur unless a payor decides to pay a high fee to almost confirm that miners will pay attention to his transactions first and most will include that transaction into the miner's next block to add to the chain.</p>

<blockchain><unconfirmed-transactions>
How do miners know how to remove recently confirmed transactions?
rossmclochness
# How do miners know how to remove recently confirmed transactions?

(Asked by: username_0 on 2019-03-25)

A miner is in the process of creating and mining a block of 1400 transactions. Suddenly they receive a broadcast that a new block was confirmed with 200 of the transactions currently in that miner's block. How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block?

In a second scenario, two blocks are created almost at the same time and they each have some of the same and some different transactions. I'm assuming (a) that there is then a race to consensus for each and the first to 51% wins a confirmation. If so, then similar to above (b) the block with losing transactions has all the dissimilar transactions dumped back in the mempool. But what if a second chain surfaces with two blocks? Now all the confirmations in (a) that aren't confirmed in this second block get dumped back into the mempool and hopefully finally mined into the blockchain?

The takeway for me >>> Obviously this system does work since its very popular! But it seems that transactions can take a very long time and no way to really guarantee that they will occur unless a payor decides to pay a high fee to almost confirm that miners will pay attention to his transactions first and most will include that transaction into the miner's next block to add to the chain.

**Tags:** blockchain, unconfirmed-transactions


---

## 1 answers

### Answer by username_1 on 2019-03-25. Score: 2 | Accepted answer

> How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block?

If the miner is trying to build on top of the block that was received, then he will have to drop the 200 transactions that were included in the other block. He will also not be able to include the other transactions in the next block that were present in the block he received. Apart from this, he is not restricted which valid transaction he can include. He can fill in more valid transactions, remove some or remove all the transactions and just mine the block with coinbase transaction. It's up to his discretion.

> Two blocks are created almost at the same time and they each have some of the same and some different transactions.

Imagine a scenario where two miners find a solution at the same time and both the blocks are valid. As soon as they find the solution, they will relay the block to the full nodes. The nodes will add the block that reaches to them first and add it on top of the existing blockchain. However, when they receive the other block at the same height, they will not discard it but maintain a copy of it. So here you have a blockchain fork, where around half the nodes have a different version of the blockchain at the best height. Other mining nodes will start mining the subsequent block based on the copy of the blockchain that they are seeing (on top of the block that they received first.) Now, one of the miner will find a solution and propagate it to the network. More likely than not, it will not happen to be simultaneous like the previous block. So when that block is propagated, the network converges back to a shared state. Now, as the network converges the full nodes will discard the transactions from the mempool that are already confirmed.

> **Comments:**
> **username_0**: Superbly explained. Many thanks for the effort.  
> **username_1**: @username_0 if you think it adequately answers your question you can click the tick mark near the answer so others know this is an accepted answer and they find it helpful  
> **username_2**: so, if two miners create valids block in the same height (with transactions in common), is probably that one of them will not gain any ravenue for that mining???  
> **username_1**: @username_2 Yes. When a miner mines a block, the payout comes through the coinbase transaction. This coinbase transaction is not spendable until 100 blocks following the mining of the block. Most reorganizations settle themselves within 2-3 blocks. So one of the miner's payout transaction will never be included in the main chain.  

---

