Let’s assume 2 miners, A and B, are adding / validating transactions and build a block. Both blocks contain 50 identical transactions. All other transactions differ. Now one miner, B, solves the mathematical puzzle and appends his block to the chain. What would then happen to the remaining transactions within the other block of miner A?

When miner A receives the block constructed by B, A will remove the transactions in its mempool that conflict with that block, which in your case includes at least the 50 common transactions.

Subsequent block candidates A tries to construct will be drawn from that mempool, which has been updated to not include the conflicts anymore.

Will these be automatically removed from the block that didn’t make it and the miner needs to add 50 different ones?

Blocks once produced cannot be changed, but A in your scenario never constructed a block. A has been constructing block candidates (which don’t satisfy proof of work) based on its mempool, and the mempool changed, so future candidates will reflect that change.

Or does miner A needs to start all over from zero?

Miner A is already, continuously, “starting over” all the time. It is entirely irrelevant for the miners in A whether the mempool the transactions are drawn from, or the block it is building on, changed in between two attempts. It’s just a new attempt like any other.

It’s important to see that mining is progress free. There is not a single special block that all miners are competing to find first. There are an infinite number of potentially valid solutions, and miners are all looking for different ones. Mining proceeds by constructing candidate blocks, computing their hash, and if the hash does not have enough zeroes, continue with another candidate block. Each attempt has the same probability of success, independent of how many candidates the miner has already tried, and independent of how many candidates anyone else has already tried.

How’s that solved and does this actually happen in reality?

Yes, it happens all the time. Every time someone finds a block, all other miners will update their mempools so their future block candidates reflect the state after the found block.

Leave a Reply

Your email address will not be published. Required fields are marked *