Introduction to Forking
What is Forking?
A public blockchain can only exist by many node computers running the same software, which collectively maintains the record of the past of the network. Public blockchains offer completely open-source code, which allows any developer to iterate off of the existing code and make any changes that they desire. If either the collective record or the software that maintains it is questioned, there can be a fork in the network.
Forks are related to the fact that different parties need to use common rules to maintain the history of the blockchain. When parties are not in agreement, alternative chains may emerge. While most forks are short-lived some are permanent. Short-lived forks are due to the difficulty of reaching fast consensus in a distributed system. Whereas permanent forks (in the sense of protocol changes) have been used to add new features to a blockchain, to reverse the effects of hacking, or catastrophic bugs on a blockchain as was the case with the bitcoin fork on 6 August 2010 or the fork between Ethereum and Ethereum Classic
Forking implies any divergence in Blockchain- temporary or permanent. Very simply, forking is said to happen when a Blockchain splits into two branches. It can happen as a result of a change in consensus algorithm or other software changes.
Source: Digital Asset Research
Types of Fork
Forks can be classified as accidental or intentional. Accidental fork happens when two or more miners find a block at nearly the same time. The fork is resolved when subsequent block(s) are added and one of the chains becomes longer than the alternative(s). The network abandons the blocks that are not in the longest chain (they are called orphaned blocks). Intentional forks that modify the rules of a blockchain can be classified as follows:
A hard fork is a rule change such that the software validating according to the old rules will see the blocks produced according to the new rules as invalid. In case of a hard fork, all nodes meant to work in accordance with the new rules need to upgrade their software.
If one group of nodes continues to use the old software while the other nodes use the new software, a split can occur. For example, Ethereum has hard-forked to “make whole” the investors in The DAO, which had been hacked by exploiting a vulnerability in its code. In this case, the fork resulted in a split creating Ethereum and Ethereum Classic chains. In 2014 the Nxt community was asked to consider a hard fork that would have led to a rollback of the blockchain records to mitigate the effects of a theft of 50 million NXT from a major cryptocurrency exchange. The hard fork proposal was rejected, and some of the funds were recovered after negotiations and ransom payment. Alternatively, to prevent a permanent split, a majority of nodes using the new software may return to the old rules, as was the case of bitcoin split on 12 March 2013.
In contrast to a hard fork, a soft fork is a change of rules that still creates new blocks recognized as valid by the old software, i.e., it is backwards-compatible. A soft fork can also split the blockchain when non-upgraded software creates blocks not considered valid by the new rules
A soft fork happen when a change to the software protocol keeps it backward compatible. What this means is that the new forked chain will follow the new rules and will also honor the old rules. The original chain will continue to follow the old rules. This kind of fork requires only a majority of the miners upgrading to enforce the new rules, as opposed to a hard fork which requires (almost) all nodes to upgrade and agree on the new version.
A common way in which a fork occurs is when the separate groups of nodes reach have different copies of the blockchain ledger. This can happen when there’s a high transaction volume, and nodes find multiple new blocks which can be confirmed within the rules of the system. In Proof of Work models, the longest chain will always win, so the network will ultimately return to a global consensus quite quickly.