MultiversX Tracker is Live!

How 2 chains co-exist together?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 175 Views

Blockchain forks, chain reorganizations, and stale blocks

You're mixing up a few separate concepts. Since there is no central coordination, occasionally two miners will randomly find a new block at the same time. As each of the competing blocks is seen first by some nodes and they both have the same amount of total chainwork, the network briefly disagrees on what the best chaintip is. Let's say the blockheight is 500 and the blocks are 500_A and 500_B.

Naturally the two competing blocks include much of the same transactions, since both miners were seeing the same unconfirmed transactions and picked whatever provided the most transaction fees. Perhaps there is even a transaction in block 500_A that conflicts with a transaction in block 500_B.

However, the best chain can only have one block at height 500! From the perspective of nodes that saw the 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.

Eventually, another block is found. Let's say it is 501_A and builds on top of 500_A. As the chain-tip consisting of 500_A+501_A is now longer and has more work than the chain-tip 500_B, the tie is broken and every node recognizes the same best chain. The nodes that were already following that chain-tip with 500_A simply add the new block 501_A. The ones that had seen the block 500_B first reorganize to the new best chain-tip by reverting block 500_B, then applying 500_A and 501_A. We call the block 500_B which does not become part of the best chain a stale block. From the perspective of the best chain, it does not matter whether the stale block was ever found. It's not part of the best chain.

Sidechains

Sidechains are distinct other blockchain networks that are pegged to the Bitcoin blockchain. They can use different consensus mechanisms, allow other rules, and have specialized purposes such as more private ways of transacting or enabling additional smart contract functionality. Examples for sidechains include Liquid, and RSK.

"An honest miner includes a doublespend in his block"

In Bitcoin we track every spendable amount of bitcoin separately in the form of unspent transaction outputs (UTXOs). Every transaction output is uniquely identifiable. When creating a transaction, the transaction explicitly specifies which UTXOs it spends. Each transaction output can be spent only once.

A doublespend is an attempt to spend the same transaction output twice. Such an attempt could for example entail creating a transaction that spends the UTXO to send Alice money, and a second transaction that spends the same UTXO to send money to the attacker. The attacker then shows Alice the transaction sending money to Alice, but tries to get the transaction that returns the money to themselves included in a block instead. Since these two transactions conflict with each other, they can never be included in the same transaction history, let alone in one block.

An honest node validates all unconfirmed transactions they hear about before adding them to their own mempool. A miner builds their block template from their mempool. An honest miner would never have two conflicting transactions in their mempool at the same time, and therefore would never include them both in the same block, because they would notice that the UTXO is already spent when validating the second transaction of the conflicting pair before accepting the transaction to their mempool.

If a miner does not validate transactions before building blocks, and they end up producing an invalid block, it is their fault for not following the consensus rules.

No honest network participant accepts invalid blocks

Transactions that spend money that has been spent before are invalid. Blocks that include invalid transactions are invalid. Nodes do not accept invalid blocks. An attacker that tries to broadcast an invalid block is simply banned and ignored.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments