Blockchain forks, chain reorganizations, and stale blocks
You are confusing some separate concepts. Since there is no central coordination, sometimes two miners will randomly find a new block at the same time. Since each of the competing blocks is seen first by some nodes and each has the same amount of the total working chain, the network differs briefly about the best chain. Let’s say the block is 500 and the blocks are 500_A and 500_B.
Naturally, the two competing blocks have a lot of the same transactions, with both miners viewing the same uncertain transactions and picking whatever saves the most transaction fees. There may be a transaction in the block that conflicts with a transaction in the best chain.
However, the best chain can only contain one block at a height of 500! From the perspective of the nodes that saw 500_A first, the other block, 500_B is not part of the best chain and doesn’t count. From the perspective of the nodes that saw 500_B first, 500_A is not part of the best chain and doesn’t count.
In the end, another block was found. Let’s say it’s 501_A and builds above 500_A. Since the 500_A + 501_A end of the chain is longer and has more work than the 500_B end of the chain, the link is broken and each node recognizes the best chain. Nodes that were already following the end of the chain with 500_A simply add the new 501_A block. Those who saw the losing block 500_B first reorganization To best chain, roll back to block 499 and apply 500_A and 501_A. We call the block 500_B which does not become part of the best chain A meaningless block. From a best-chain perspective, it doesn’t matter if the stale block is found at all. It is not part of the best series.
Side chains are Other Feature Blockchain networks linked to the Bitcoin blockchain. They can use different consensus mechanisms, allow for other rules, and have specialized purposes such as more private methods of transactions or enabling additional smart contract functionality.
“An honest miner has a double spend in his blocks”
In Bitcoin, we keep track of every amount of Bitcoin that can be spent separately in the form of Unspent Transaction Outputs (UTXOs). Each transaction output is uniquely identifiable. When creating a transaction, the transaction explicitly specifies the UTXOs you spend. The output of each transaction can only be spent once.
Double spending is an attempt to spend the same transaction output twice. Such an attempt could for example entail creating a transaction that spends a UTXO to send Alice money, and a second transaction that spends the same UTXO sending money to the attacker. The attacker then shows Alice the transaction sending the money to Alice, but tries to get the transaction back to themselves included in the block instead. Since these two transactions conflict with each other, they can never be included in the same transaction history, let alone in a single block.
The honest node validates all the uncertain transactions they hear about before adding them to their memo collection. A miner builds its block template from its own memory pool. An honest miner will never have two conflicting transactions in their memory pool at the same time, and therefore won’t include them both in the same block, because they will notice that the UTXO is already spent when validating the second transaction of the conflicting pair before accepting the transaction to their mempool .
If the miner does not validate the transactions before creating the blocks, and ends up producing an invalid block, then it will be It’s their fault For not following the rules of consensus.
There is no honest participant in the network that accepts invalid blocks
Transactions that spend money that was previously spent are invalid. Blocks containing invalid parameters are invalid. Nodes do not accept invalid blocks. An attacker trying to broadcast an invalid block is simply blocked and ignored.