1

In Mastering Bitcoin, page 196, it says "While the protocol always allows a chain to be undone by a longer chain and while the possibility of any block being reversed always exists, the probability of such an event decreases as time passes..."

How and when will a chain be undone? How and when a block be reversed? Does Bitcoin core actually allow/support such operations?

2

Bitcoin is a distributed system. At any given time, there are n different representations of the network, where n is the number of nodes participating in the network. These nodes have a consensus protocol (defined by the Bitcoin specification) which allows each of the nodes to maintain a state consistent with all of the other nodes on the network. The consensus mechanism in Bitcoin is related to the chain of blocks (hence the namesake, "blockchain"), essentially, the longest chain wins.

Blocks can be created by any miner participating in the network, anywhere in the world. When a block is created it needs to be propagated across the entire network, to all n nodes in the world. This can take time, and there is a chance that a new block is created before this process completes. That new block could then get propagated to nodes which haven't heard of the prior block (think network locality). When this happens your network has a fork.

The way the consensus protocol deal with this fork is by seeing which version of the chain the next block is built on top of--that chain will then be 1 block longer than the other and the nodes that see this will consider this the main chain, and the true representation of the Bitcoin ledger.

Interesting cases can come in where there is a major segmentation of the network (say an intercontinental cable is severed and India drops off the internet). Different segments of the network will have a different understanding of the state of the Bitcoin ledger, and thus, could begin building a diverging set of chains. When networks are rejoined, nodes again regain consensus by comparing chain length and choosing the longes; the shorter chain's blocks become invalid.

As time goes on, the ability of a network segmentation unseating a chain is reduced--the likelihood your transactions are on an invalid chain (i.e. the likelihood there is a longer chain being mined by a different portion of a segmented network) goes to zero.

  • Thank you - very detailed. Where do you get such good information or understanding from? Looking for you to teach me how to fish for this sort of info. – Boon Sep 26 '18 at 22:20
  • What about the part where a block can be reversed? – Boon Sep 26 '18 at 22:22
  • @Boon By virtue of those blocks no longer being in the longest chain, those transactions are no longer considered valid. Therefore any coins spent in those invalid chains are available to be spent again. It's not about actually reversing blocks, it's that nodes no longer consider them valid. – Motoma Sep 26 '18 at 22:32
  • @Boon I mined Bitcoin back in '11 and wrote Bitcoin apps in the years following. I've worked with Bitcoin, Ethereum, and a handful of other cryptocurrencies in the time since then. There's no one place I got this information, it's just built up over time. If you are technically minded, or have some programming experience, I would point you to the excellent article "Learn Blockchains by Building One": hackernoon.com/… – Motoma Sep 26 '18 at 22:40
  • By saying the longest chain wins, does it mean the entire chain is broadcasted when a new block is mined? Isn’t that a lot of data? – Boon Sep 27 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.