Fork – Mangrove

GlossaryBlockchain basics

Fork

Definition: A fork is a split in a blockchain's history, or a change to its rules, after which nodes may follow different versions of the chain.

Nodes, the computers that store a blockchain and check new blocks, accept a block only if it follows the consensus rules, the rules every node uses to decide whether a block is valid. The word fork covers three cases. In a regular fork, as the Bitcoin developer glossary calls it, two miners find blocks at nearly the same time; the Bitcoin whitepaper says nodes “work on the first one they received, but save the other branch in case it becomes longer”, and the tie ends when one branch grows longer (Nakamoto). A soft fork tightens the rules. Bitcoin Improvement Proposal (BIP) 99 defines it as a change in which “everything that was previously invalid remains invalid” while some blocks that were valid become invalid (BIP 99). Older nodes still accept the new blocks, so the Bitcoin developer glossary calls a soft fork “backward-compatible” (Bitcoin developer glossary). A hard fork loosens the rules: BIP 99 defines it as a change “that makes previously invalid blocks valid” and says “hardforks require all users to upgrade.” Nodes that do not upgrade reject the new blocks, and NIST says this “results in two versions of the blockchain existing simultaneously” (NIST, Blockchain Technology Overview).

For example, a change that lowered the maximum block size would be a soft fork, because blocks built under the new limit also pass the old one. A change that raised the limit would be a hard fork, because nodes running the old software would reject the larger blocks. NIST’s example of a hard fork is Ethereum’s DAO fork. The DAO, short for decentralized autonomous organization, was a smart contract, a separate entry, from which an attacker drained “over 3.6 million ETH” in 2016 (ethereum.org). On 20 July 2016, the fork moved the funds to a new contract with a single function, withdraw, so that people who lost funds could reclaim them. Ethereum.org says some miners refused to fork “because the DAO incident wasn’t a defect in the protocol” and “went on to form Ethereum Classic”, which it describes as the most notable case of a network splitting permanently over a fork.

Nakamoto’s 2008 whitepaper described regular forks as competing branches of the chain. Jorge Timon’s BIP 99, numbered in June 2015, set out “a taxonomy of the different types of consensus forks”, including the soft and hard forks described above.