Forks give blockchain communities the capacity to change the rules as preferences may change or an update is proposed as a bug is fixed for instance. Some of these changes may be very profound and cannot be bridged with earlier versions or a part of the community may not endorse them. As a result, forks may lead to chain split, in other words, the creation of a new blockchain in addition to the old one.
In earlier editions of the Bridge, we explored how mining works and consensus is employed in blockchains. In this edition, we venture into different types of forks, why they occur, and how they affect blockchains.
What is a fork?
Every blockchain is governed by a set of rules that are named consensus algorithms. A fork is a change in the underlying rules of a blockchain. The change in rules may or may not be backward compatible. These changes may or may not occur with every stakeholder’s consensus.
What do forks really mean?
Due to its decentralised structure, blockchain borrows ideas from democracy. To make a change in the rules, or the laws, that govern the system, every eligible person is free to propose an initiative to improve or change some rules. If this initiative receives adequate (majority) backing by community, rules are updated and imposed to all others.
In some situations, the new rules do not please a part of the community in such a way that it wants to make secession. In the blockchain world, a secession is a chain split.
Forking is thus an important right given to the community to govern the system it is using. By granting this right, a blockchain with many users means that is has a strong support from the community and is stable.
What are the different types of forks?
A fork is called a soft fork if it is backward compatible, meaning that the changes allow nodes on the network govern themselves based on the previous set of rules. For example, when a phone pushes an operating system upgrade, not all the users need to upgrade to a newer version of the operating system. Older versions still work but users cannot take advantage of the feature upgrades in the newer version. Regarding soft forks, shown in figure 1, the new rules must ensure that old transactions are valid. Therefore, new transaction rules are a subset of old transaction rules. It essentially means that with new rules, the universe of valid transactions should strictly reduce. As new rules have to make sure that old rules are still valid, soft forks are difficult to design for developers. However, soft forks are more convenient for users as they are not forced to upgrade their software.
Figure 1: Soft forks
A hard fork is when old rules are no longer valid, and nodes must adapt to the new rules to participate in the new consensus. An analogy of hard fork is Play Station 4 versus Play Station 3. Users cannot play PS4 games on PS3 and vice-versa.
Hard forks can further be divided into strictly expanding hard forks and bilateral hard forks. Strictly expanding hard fork is where new rules are applicable in the old version but nodes with older version need to upgrade to validate new transactions.
Figure 2a: Strictly expanding hard fork
Bilateral forks are where old and new rules are not compatible with each other. Hard forks allow more flexibility to developers as they do not have to ensure compatibility of new rules with the old ones. Bilateral forks are also known as chain splits as the old and the new chains are no longer compatible with each other.
Figure 2b: Bilateral hard fork
An explanation of soft and hard forks using Bitcoin’s example
Scaling1 bitcoin has always been the point of contention among the bitcoin community. There were two groups with their ideologies as to how bitcoin should be scaled further. We will not cover the detailed arguments of both the sides here but the gist is that one wanted to increase the block size and the other wanted to do minimum changes at the base layer protocol and scale bitcoin by using layer two scaling solutions2.
The group that was not in favour of increasing the block size of the base layer chain proposed a solution called Segregated Witness (SegWit). At a high level, SegWit increases the capacity of the block by segregating the transaction data from signature data. SegWit was launched by the bitcoin core as a soft fork. Therefore, nodes running on the previous version of the software could continue checking transactions. As of now the number of transactions in a block that use SegWit hovers around 55%.
In August 2017, the group that was in favour of increasing the block size from 1MB to 8MB hard forked the original blockchain into a new blockchain called Bitcoin Cash (BCH). After the fork, bitcoin transactions were no longer compatible on the bitcoin cash blockchain. Till the fork, Bitcoin and Bitcoin Cash share the same history of the transaction.
Why forks take place?
Just as any software needs regular maintenance and upgrades, blockchains also need regular upkeep. These upgrades are nothing but forks. Apart from regular maintenance, forks also take place when the community is divided as it was the case with Bitcoin and Bitcoin Cash. Accidental or unintentional forks take place when two different miners propose different valid blocks around the same time. The tie is resolved based on which branch has done more work. If that is the same, miners work on whichever block they received first, and the tie is resolved based on whichever branch is used to build the next block on.
Though such accidental forks are common and are resolved quickly, they can also be the evidence of an ongoing attack. Attackers may try to fork the blockchain to rewrite transactions. This fork monitor keeps an eye on possible contentious forks on BTC, BCH, and Bitcoin Satoshi Vision (BSV) blockchains.
Impact of blockchain forks
Soft forks are easy to deal with as there is backward compatibility. Hard forks that turn into splitting of the network often arise out of disagreements within the community and are detrimental for both the chains. Chain splits have an impact on the network itself as well as the stakeholders. Before assessing the impact of controversial forks, it is important to understand the different stakeholders in a blockchain ecosystem.
Table 1 shows different stakeholders and how contentious forks affect them
Table 1: Different stakeholders and chain split’s impact on them
Impact on the network
As there is contention, some of the miners leave the older system in favour of a newer one and this results in a drop in hashrate. The drop in hashrate means the network is less secure and vulnerable to attacks. The second risk arising out of hashrate imbalance is that the chain with significantly higher hashrate can easily attack the chain with lower hashrate to reorg blocks to double-spend or censor transactions. This type of hostile takeover can turn catastrophic for blockchains. We will dive deeper into this type of attack in the next edition where we discuss different types of attacks on blockchains.
The distributed nature of the public blockchains allows them to split in case of disagreements. However, the freedom to separate comes with a cost. It is a double-edged sword. Such splits can prove to be catastrophic in terms of security. And though there is freedom, the network effects seem to stay only with a handful of blockchains. Therefore, it is in the best interest of the communities to resolve differences without causing a chain split.
1The capacity of bitcoin network to carry out the number of transactions per second is low. Efforts are ongoing to increase the throughput of bitcoin blockchain. This is commonly referred to as scaling. ↵
2 Layer two solutions are protocols being built on top of existing blockchain infrastructure to scale the base layer. A prominent example of layer two scaling is Lightning Network built on top of bitcoin. ↵