3

If two miners pick up exactly the same transaction for mining, how do we ensure that the transaction is not included in the two different blocks created by each of the two miners.

3 Answers 3

2

It doesn't matter if it's included in 10 blocks, as far as one of them will survive in the longest chain.

All others will be in obsolete forks or orphaned blocks.

2

In each blockchain branch there can only be one block at every height as every block references their ancestor.
If a block includes a transaction that was already confirmed by one of their ancestors, the block is invalid. Invalid blocks are rejected by the nodes in the network. Therefore, one chain branch can never confirm the same transaction more than once.

If there are two blocks at the same height in the blockchain confirming the same transaction, that's fine. They are already competing as only one of them can be part of the longest chain anyway. The other will become stale as the majority chain moves forward.

2
  • So, if two miners create valids block in the same height, one of the will not gain reward for that mining? Mar 13, 2020 at 19:52
  • 1
    Correct, only one block can be part of the best chain at the same height. Block rewards only mature (become spendable) after 100 blocks, so the stale block's miner will not be able to spend theirs.
    – Murch
    Mar 13, 2020 at 20:19
1

It will be included in two (or more) different blocks. But only one of those blocks will propagated to the network and get picked up by other miners, become part of the "longest chain" and subsequently be extended.

So it doesn't matter if at any one time there are forks at the end of the "blockchain", it matters only that one representation is persistent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.