When two miners mine a block at the same time, doesn’t your tx have a high chance to be inside two chains at the same time? If so, what happens to the transactions in stale blocks that got confirmed in the winning chain? Does it automatically get deleted from the mempool because it already got confirmed?
If your fee is above average I would say it has a pretty good chance to be in both blocks but nevertheless miners pick what transactions they want to add to their block. (It would be logical for a miner to choose the ones with the highest fees.) Due to the latency of the internet (data propagation) all miners won’t have the same data at the same time which means they will all have different transactions in their block.
There is no stale block that is in the winning chain. A stale block is a block that was a part of the blockchain but is no longer a part of it. When there was a conflict one block went stale and the other one is the part of the real truth.
The block that won in the conflict of truth is just like any other block, the transactions inside are accepted as the real truth. They are no longer in the mempool and you cannot reverse the transaction anymore. When it comes to the stale block, I believe that the transactions simply go back to the mempool and wait for a miner to pick them up again.
Hope this helps.
Hello Mauro,
I think you misunderstood my question here:
I am talking about the same transactions that exist now in both the winning chain and the losing chain. If transactions from the stale blocks get put back in the mempool, does the network delete the ones that already got put in the winning chain?
Thanks for your time
I am not sure if it deletes it. But they will be invalid. If you send 1 btc to someone and it got confirmed in the winning chain and they see the same transaction again they will see it as invalid.
Really good question… Got me thinking because yes as you said one transaction (that is, lets say had a high tx fee, in both the winning block and the stale. The winning block writes to the ledger that bob sent alex 10 btc (yes, bob is rich) and on the stale block that same transaction was send back to the mempool where it was picked up by another miner 1-4 blocks ahead. Would there now be 2 transactions on the ledger?
Im not gonna sleep today if I don’t figure this out. Lol
Edit: Turns out it can happen and it has happened in October . A double spending but it was NOT an attack.
@Jirure