What happens in the bitcoin network when two miners solve a block at the same time?
When two miners solve a block at the same time each block is propagated to nearby nodes, validated and appended to the chain. Once one of those blocks encounters the other already appended to the chain, the network yields to that longer chain and returns the late-arriving block to the mempool since it cannot be used. The late block contains an out-dated hash of prior transactions, since a block was added after the late block was composed. The previous block header in the late block is really the second to last (penultimate) block header (or even perhaps an earlier block header), which does not preserve the chain.
What is a stale block?
A stale block is one that contains an out-dated hash of the prior block which represents all prior transactions. It cannot be added to the chain since at least one block was added after the stale block was composed.
How do stale blocks occur?
Stale blocks are the result of race conditions in calculation and block propagation.
Randomness in the effect of nonce to yield a target hash value can occasionally out-pace the networkâs ability to propagate and validate blocks. Variations in the networkâs bandwidth also impact the ability to completely validate each block before introducing a new block.
Why is it important to wait for more than one block to be confirmed when sending or receiving a transaction?
Confirmations push a transaction deeper and deeper into the blockchain, so that its immutable characteristic takes hold forming a solid basis for subsequent transactions.