Basics of Blockchain 4 – Forks
Publish on 2022-02-15
What Is a Fork?
In the software development domain, fork is a common term and means “copies and modifications”. It mainly refers to software upgrades, that is, copying and modifying the software code of the old version and upgrading them to the new version. There are certain differences between the two versions in terms of specific functions. With regard to blockchain, a fork is also known as a blockchain fork, which happens whenever a community makes a change or software upgrade to the blockchain’s protocol, or basic set of rules.
How do Blockchain Forks Work?
Take Bitcoin as an example, a Bitcoin fork refers to a change or software upgrade to the Bitcoin protocol. As we know, the Bitcoin protocol is actually a piece of software consisting of complicated codes. Node operators need to download the Bitcoin client before engaging in the operations of the Bitcoin network. Like WeChat, Taobao and other software that is upgraded every once in a while, the Bitcoin protocol also needs to be upgraded regularly, in order to fix bugs, improve the system performance and enhance the functions of the protocol.
However, different from Wechat, Taobao and other software whose software upgrades only need to be decided and executed by Tencent and Alibaba’s teams, the decision-making and implementation of a Bitcoin fork needs to involve participants consisting of Bitcoin developers, miners and full node operators.
The developers are responsible for the updates to the code itself. If no one creates updated codes, the user will not be able to participate in the running of the software. Please note that, however, while Bitcoin is open source that its code is publicly available to everyone, and anyone can copy, create, and update the code, creating updated codes does not equal to protocol upgrades. The updated codes created by Bitcoin developers need to be submitted to other developers for review, and the final deployment and implementation of the codes requires the joint decision of the entire Bitcoin community.
The miners are mainly responsible for the safety operations of the Bitcoin network, and provide computing resources to generate new blocks. The full node operators mainly focus on verifying, sending and receiving blocks and transactions, and storing and maintaining the complete data copies of Bitcoin blockchain. Bitcoin miners and Bitcoin full-node operators are the main participants and implementers of Bitcoin protocol upgrades. Developers need to get a vote from miners and full-node operators to submit or change the bitcoin protocol code.
To sum it up, the decision-making and implementation of a Bitcoin fork needs to involve Bitcoin developers, miners and full node operators. If any of the three parties disagree on the upgrade, it may lead to the failure of the upgrade or even the permanent fragmentation of the blockchain (not the same as temporary forks).
Types of Forks
(1) Hark Forks
A hard fork is a backward incompatible protocol upgrade, which means the upgraded nodes can’t communicate with the non-upgraded nodes. All nodes are required to be upgraded in a hard fork. If not, they will not be able to access to the new version. To simply put, the old blocks are incompatible with the new blocks.
For instance, the SegWit block capacity change in 2017 is a typical hark fork.
Before the upgrade, the old rules defined the maximum block capacity which was 1MB, that is, all miners accepted and verified blocks with an upper limit of 1MB. After the upgrade, the new rules specify that the maximum block capacity can be 8MB, which means that the upgraded miners can accept and verify blocks with an upper limit of 8MB. In other words, if a miner generates a block of 8MB, it will not be recognized in the old rules, but there will be no problem in the new rules. Therefore, if a miner wants to verify 8MB blocks from other miners, they must upgrade to the new rules.
Ideally, all miners should upgrade their software at the same time in a hark fork. However, the reality is that not all miners will agree to the upgrade. As a result, some miners who choose to upgrade will continue farming by following the new rules, while others who decline the upgrade will bypass the new rule and continue to operate based on the old rules. The blocks created by these non-upgraded nodes will be kept on the previous separate chain, evolving apart from the new chain composed of blocks generated by the upgraded nodes. At this point, the original blockchain is divided into two permanently, that is, what we now see the BTC chain (the old chain) and BCH chain (the new chain).
It needs to note that not all hark forks will lead to the permanent split of a blockchain. Generally, as long as a consensus has been basically reached before a hark fork upgrade deploy, a temporary blockchain fork due to differences in network conditions can be revamped after a timely upgrade deploy to the upgraded nodes. (The temporarily forked chain will be abandoned without the support of the majority of nodes.)
Pros and Cons of a Hard Fork
The pros of a hard fork: With regard to a blockchain, a hark fork protocol upgrade can enhance the system’s performance, increase technical explorations, promote the optimization and upgrade of the blockchain, and has notable advantages in upgrade execution efficiency and system performance improvement. In addition, the potential risk of hard forks-led permanent fragmentation of the blockchain may be a good thing for some traders, which means traders are likely to earn the forked tokens.
The cons of a hard fork: During an upgrade, it is impossible to guarantee that all nodes run on the same chain, which will increase the instability of the system and the risk of community division. Plus, the protocol changes involved in the hard fork may increase the operating cost of nodes.
Generally speaking, a hard fork upgrade is more radical as all nodes of the blockchain network need to reach a consensus on the upgrade to ensure the success of the upgrade. Otherwise, it will lead to a permanent blockchain split. Generally, this method will be adopted when major adjustments or changes are made to a blockchain protocol or software, such as the overall route upgrade of the blockchain protocol, fixing severe bugs in the protocol software, and so on. However, there are some special cases where people use hard forks to create new chains and tokens directly, such as the LTC chain.
(2) Soft Forks
Contrary to a hard fork, a soft fork is backward compatible, which means that the upgraded nodes can communicate with the non-upgraded nodes. In a soft fork, users can still access to the new version without upgrade, but they might be restricted from using some of new features contained in the new version. To sum up, the old blocks are compatible with the new blocks. The Segregated Witness (Segwit) is a soft fork upgrade to the Bitcoin network.
Pros and Cons of a Soft Fork
The pros of a soft fork:
1. A soft fork ensures all nodes run on the same chain, effectively reducing the risk of fragmentation between a blockchain and the community.
2. A soft fork does not require all nodes to upgrade at the same time and allows them to upgrade gradually, without affecting the system stability during the upgrade.
The cons of a soft fork:
1. For executing a soft fork, sometimes simple features will get complicated in design, thus increasing the bug risk of the system.
2. The premise of deploying a soft fork is based on that the nodes of the old version can always accept the nodes of the new version. Since some new features or changes are difficult to be perceived by the non-upgraded nodes, which to some extent violates the principle that verification can be completed by a single node.
Overall, a soft fork is a stable protocol upgrade. Nodes can add some new rules or restrictions in a way that do not conflict with the rules of the old nodes. Users can upgrade in a compatible and moderate way, without obvious changes to user experience.
Why Is This Important?
A Blockchain fork refers to adjustments or modifications to the set of rules of the blockchain protocol, aiming to improve the performance of the blockchain network and maintain the safety operations of the whole network. Whether it is successful or not will often have a significant impact on the overall development of the blockchain. If all nodes and community members of the blockchain protocol reach a consensus on the fork, then it can be successfully deployed and implemented, thus helping enhance the performance of the blockchain network as expected, which will promote the overall development of the network in the long run.
However, it needs to be noted that both a hard and soft fork are the ways to upgrade the blockchain protocol. No matter which one is selected, the fork scheme needs to be agreed by all parties involved in the operation of the network before the fork is deployed, and preparations should be made in advance for the various problems that may be encountered during the upgrade in order to ensure the smooth implementation of the fork.