1. What happens in the bitcoin network when two miners solve a block at the same time?
Both miners will propagate their new blockchain through the entire network resulting in different sections of the blockchain network nodes tracking/replicating competing blockchain solutions.
Both solutions will exist within the network until the next block is appended to the blockchain resulting in one of the two competing blockchains growing in length with respect to the other.
Once one of the two competing blockchains is longer than the other blockchain record all nodes within in the blockchain network will track this new longer blockchain resulting in the node releasing their original blockchain ledger. Released blockchains are termed “stale blocks” or “orphaned blocks” with the transactions recorded within these blockchain returning to the mempool for later processing onto to end of the newly formed blockchain.
2. What is a stale block?
A “stale block” is a previously hashed block containing UTXOs which were not incorporated within the blockchain ledger. These released UTXOs are returned to the mempool for later processing within a new block to be added to the end of the blockchain.
3. How do stale blocks occur?
Two or more miners propagate their blockchain through the network resulting in different nodes of the blockchain network tracking/replicating competing blockchain solutions.
These competing blockchain ledgers will coexist within the network until the next block is appended to the blockchain ledger at which point one of the two competing blockchains will grow in length with respect to the other. Once the blockchain length is increased all network nodes will resort to tracking the new longer blockchain resulting in “stale blocks” (incomplete blockchains) being released by network. The resulting released UTXOs return to the mempool so that these UTXOs can be correctly appended to the longest blockchain ledger.
4. Why is it important to wait for more than one block to be confirmed when sending or receiving a transaction?
The blockchain network automatically adjusts the target difficulty (target number) to ensure the time taken to produce a newly hash block is maintained at 10 minutes. The value of the target number is inversely proportional to the number of miners competing within the network.
By maintaining the time taken to produce new hashed blocks to 10 minutes the number of competing blocks released to the blockchain ledger by competing miners is limited/restricted reducing the probability of coincident blockchains occuring at the same time. Also the time taken to resolve competing blockchain ledgers, and thus forming multiple coincident stale blocks, is reduced since all network nodes refresh their blockchain ledger every 10 minutes.
By waiting for the blockchain ledger to growth by 6 blocks 60 minutes have elapsed reducing the probability that your blockchain transaction was include included within a stale block and not confirmed.