If node A picked 10 unconfirmed transactions to solve in a block and node B picked the same 10 transaction in A plus another 10 transactions to solve. If node A finished solving the block informed all nodes and placed the block on the chain, what happens to the same transactions being mined by Node B?

up vote 1 down vote accepted

Since node B didn't find a block, nothing it does has any effect. As miners find out about the block mined by A and confirm that it is valid, they'll start working on a new block to come after that block. They'll include some subset of the transactions that can be validly included in a new block after the block mined by A.

Transactions already included in the block mined by A are not valid in a block after it because their inputs no longer exist. Transactions that try to consume those same inputs (if there are any) would also no longer be valid. Any transactions still valid (whether or not B tried to include them) might get included in the candidate blocks that miners work on after that.

Effectively, every time a valid block is found, miners start over working on finding a new block to go after it. They have to recompute which transactions to include in that new block. If they include a transaction that's now invalid, any block they mine will be invalid. If they fail to include valid transactions that pay high fees, they'll reduce their income should they find a block. So miners are incentivized to try to pack the blocks they find with valid transactions that pay high fees relative to the block space they occupy.

  • Thanks David S, I think you last paragraph sums it up for me. When a block is solved all miners will go and fetch new valid transactions to put into the block they are about to mine. Therefore it is practically impossible to have 2 blocks solved successfully by 2 miners at the same time and they happened to share some valid transactions in their blocks. Only one block will be chosen to be linked to the chain, the other must be thrown away even if it was successfully mined at the same exact time. – David Vella Sep 16 at 19:06
  • @DavidVella Right. Every block includes a reference to the block before it, so they can't both exist in the same chain regardless of whether they have overlapping transactions or not. Eventually, one or the other of them will be embedded in the longest chain. – David Schwartz Sep 16 at 21:55

When node B gets informed about block A being mined he would start working on a new block that does not conflict with the first one.

If block B happens to be mined around the same time as block A there would be a fork. All nodes in the network that hear about both blocks will keep both branches and will wait for the conflict to be resolved.

The miner that mines the next block will have to place his new block on top of one of the branches. When that happens and the new block gets broadcasted, all nodes will pick the branch with the most work and the other branch will become orphan.

  • Thanks for your answer. So block B will get discarded as soon as A is added to the chain. There can only be one block resolved every 10 minutes. – David Vella Sep 14 at 12:38
  • @DavidVella No, there can be multiple blocks in a 10 minute period but they cannot contain the same transactions.This is true for any blocks. Each transaction can only be in one block. – Mike D Sep 14 at 13:01

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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