What is a Bitcoin Fork?10 min read
The Bitcoin blockchain provides a secure and permanent way to record data. To identify and keep a measure of these records accurately every block that is mined in Bitcoin has an associated block height value. The first block ever mined is known as the genesis block and has a block height of zero. The block height represents the number of blocks confirmed in the complete history of the Bitcoin network – from the genesis block until the most recent block. Two blocks may be mined simultaneously with the same block height in some situations. Blocks are created when miners solve a cryptographic problem also known as mining. Hence, if the same problem is solved simultaneously by more than one miner, two blocks will be created with the same block height. This may cause a Bitcoin Fork or result in a block being orphaned. Whichever outcome occurs, duplicate blocks or records cannot appear in Bitcoin.
In an open and public system like Bitcoin, anyone can push updates and adjust the protocol as they want. Additionally, full nodes can opt-in and choose which version of the Bitcoin software they want to run. A fork occurs when the state of blockchain conflicts into different versions or truths. It means that part of the network has a different history of transactions or rules. This phenomenon can occur naturally, accidentally, or deliberately. In Bitcoin there is no central authority that validates the truth, instead, there are five major groups that control the network: miners, users, developers, merchants, and exchanges. When a change or upgrade is proposed the majority of full nodes need to come into agreement. A fork can occur due to a split in consensus or change in protocol rules initiated by any of the group(s).
Network forks happen quite regularly in Bitcoin, about 2-3 times a week. In Bitcoin, miners worldwide are trying to find valid proof of work for the next block. Due to the timing difference of the propagation of blocks across the network, two miners might find the winning proof of work for a block almost simultaneously. When this happens, both miners will propagate their version of the block to the network. As a result, different nodes will validate different blocks. As these conflicting but valid blocks are added and distributed to the network, there will be competing chains and thus a temporary fork is created. This is where the Bitcoins consensus protocol would come into play. Nodes in the network will temporarily keep both blocks since both have a valid proof of work. However, there can not be two valid chains. In such a case, the nodes will wait until miners find the proof of work for the subsequent blocks and append it to the blockchain. Eventually, one chain will become longer than the other, and the nodes will replace it with the longest chain (most proof of work). The block(s) that were part of the shorter chain are abandoned and are called orphaned block(s). The transactions that were not validated and abandoned will go back to the mempool and be mined again by miners. To reduce such a phenomenon from occurring too frequently, the Bitcoin block weight is limited. This allows blocks to be propagated quickly across the network, reducing the probability of forks.
Bitcoin Soft Fork
A soft fork is a backward-compatible upgrade, activated by adding extra validation or rules into the protocol. This is often referred to as tightening the consensus rules as additional validation is done. In the case of soft forks, new rules are added, but the new rules are still valid under the old rules. It simply means that the new rules will still honor the old rules. This is the preferred way to do an upgrade in Bitcoin as it does not force participants out of consensus because of not upgrading. This is why the first version of Bitcoin is still accepted and compatible by the network.
A soft fork requires only a majority of the nodes upgrading to enforce the new rules, unlike a hard fork, which requires (almost) all nodes to upgrade and agree on the latest version. If most nodes do not agree, then the upgrade fails, and the original rules remain. When a soft fork upgrade occurs, all nodes, regardless of whether they are updated or not, will recognize new blocks and maintain compatibility with the network; however, a non-upgraded node’s functionality may be affected. For example if a new rule reduces the block size from the current 1MB to 800KB. The non-upgraded nodes will still recognize newly mined blocks with the new rules. However, the non-upgraded miner will not be able to mine blocks, with the old rule as the majority network will reject it. This incentivizes the non-upgraded nodes to also upgrade as it might reduce their functionality.
How Bitcoin Soft Forks are activated
To activate a soft fork, participants need to agree to the change in consensus rules. In order to coordinate between all participants, Bip 34, Bip 9 were used and a new method called speedy trial is being introduced with Taproot.
Bip 34 used the block version to signal if miners are ready to implement the new consensus changes. Bip 34 required that the coinbase transaction’s input to include a specific block height with a version number. Before this, miners could include any arbitrary data in the coinbase field along with a set version number of 1. However, with the implementation of Bip 34, blocks had to contain a specific block height at the beginning of the coinbase and be identified with a version number 2 or greater. To signal that the miners are ready for the consensus change, they had to set their block version to 2 instead of 1. The changes do not occur immediately; there is a rolling period of 1000 blocks. If 750 of the 1,000 blocks use version 2, the network switches over, but version 1 blocks are still accepted. However, if 950 of the 1000 blocks are version 2, the network will switch over, and all version 1 blocks will be rejected. This type of signaling was used later again to make other upgrades like Bip 65 and Bip 66.
Bip 9 changed the block version field from an integer to a bit field. This was done because previously, only one fork could be activated at a time and did not provide a reliable way for signaling activation. With the implementation of Bip 9, the version number is changed to a bit field. A single bit is chosen as the bit for an upgrade. This means that miners can now simultaneously signal their readiness to multiple different proposals. Additionally, a duration for the signaling period is also set so that miners do not have to signal forever and the bit could be reused for a different proposal. Miners will mine blocks by choosing a bit between 0 or 1, signaling their support for the upgrade within the given duration. If 95% (hash power) of the miners signal support during the signaling period the upgrade takes place.
Taproot is pushing forward a different activation process called speedy trial. To start the activation process 90% of the mined blocks have to signal the deployment by their mining pools. The signalling method is called Speedy Trial and it works in periods of 2016 blocks, meaning that within a 2016 block period, 90%, or 1815 of the 2016 blocks have to signal for readiness. It’s not necessarily over if one period fails to reach 90%, it just means that the upgrade will have to wait until the next period. If the threshold is reached, then activation takes place after a six-month “locked-in” period. During this time frame, the upgrade will take place, but the activation is delayed to make sure there are no problems.
Bitcoin Hard Fork
A Bitcoin hard fork is a backward-incompatible upgrade; everyone has to upgrade their software, or else the network gets split. When new rules are added such that it conflicts with the old rules it will likely cause a hard fork. It occurs when the Bitcoin protocol is changed such that the old nodes refuse to accept blocks created by the newer nodes. Most hard forks are done maliciously and therefore it is important to avoid all hard forks. When a part of the network can’t agree on how Bitcoin should evolve they decide to split by creating a hard fork. This is done by specifying a block number at which point the fork takes place. When that block number is reached the community is split. Some nodes decide to support the original Bitcoin protocol while others decide to support the fork. Each group then adds new blocks to the fork they want to support. At this point both blockchains will be incompatible with each other. Because the fork is based on the original blockchain they will have the same history of transactions, meaning that all transactions that happened on the original blockchain happened on the fork. They’ll both continue to propagate blocks and transactions, but will no longer work on the same blockchain.
Bitcoin is an open-source protocol, and anyone can cause a Bitcoin fork. It is vital to have a single version of the truth in a distributed and open system like Bitcoin. Forks occur when a part of the network has a different history of transactions or rules. There are two primary varieties of forks: network forks and consensus forks. Network forks occur naturally in the network due to the timing difference of the propagation of blocks but are resolved by replacing it with the longest chain (most proof of work). A consensus fork occurs when a change or upgrade is proposed. A soft fork occurs when the Bitcoin protocol changes rules, such that old nodes don’t realize the rules are different and continue to accept blocks created by newer nodes that follow the changed ruleset. A hard fork is when the Bitcoin protocol changes rules such that old nodes refuse to accept blocks created by newer nodes. Hard forks are avoided at all costs within the Bitcoin community, while soft forks are strongly preferred.
Past Examples of Bitcoin Forks
BIP 16 – Pay to Script Hash (P2SH): A soft fork that resulted in multi-signature addresses on the Bitcoin network. BIP 16 was a significant improvement for Bitcoin’s flexibility, enabling cheaper, more private multi-signature transactions, greater smart contract capability, and backwards compatibility for SegWit.
Segwit: Segregated Witness is a soft-fork upgrade to Bitcoin implemented in 2017 to reduce transaction backlogs and add more bandwidth into the network. The upgrade removed parts of the block signature in order to make blocks lighter.
Bitcoin Cash is the most famous hard fork of Bitcoin that occurred on August 1, 2017, in response to segwit as a scaling solution. A part of the network decided to fork by keeping the same ledger going from Bitcoin but added a backward incompatible change (larger blocks and replay protection via a different signature hash). The increase in block size pushed the cost of scale to nodes leading to decentralization.