Just like in any other network, blockchains undergo network upgrades. However, the decentralization of the digital ledger leads to disagreements between blockchain nodes about the state of the network. A protocol embedded in the blockchain’s software code determines its state, and any change or upgrade it undergoes is known as a Blockchain fork. Some forks don’t change much in the blockchain structure, while other forks split the ledger into two valid blockchains.Â
This article will give you a better understanding of what blockchain forks are, why they occur, and the different types of forks that might affect the distributed ledger.Â
Blockchain Consensus
Let’s first delve into the structure of a blockchain network. The blockchain operates on a peer-to-peer network where nodes come to an agreement on its current state. Therefore, the general consensus result in a single valid blockchain. This single blockchain is where all transactions get validated and verified b the network, and blocks of transactions get added accordingly.
However, it’s hard to get thousands of nodes to always have a unanimous agreement. This happens when certain nodes agree on a network update while the rest do not. This leads to the splitting of the blockchain into two valid chains, where one has undergone an update and the other did not. This concept is known as blockchain forks.Â
What Are Blockchain Forks?
So, what are blockchain forks exactly? Forks occur when a blockchain splits into two or more separate chains. These two chains share their transaction history up until the point of the split. Why do blockchains split into multiple chains? This is due to any change or modifications happening to the original protocol.Â
When all network nodes agree on the modifications proposed, the change is made without the needing of a fork. However, this is rather tricky in a decentralized network. Most of the time, the network doesn’t agree on the proposed upgrade and ends up splitting the blockchain into two chains.Â
There are many types of blockchain forks that exist. Some forks don’t change much about the original blockchain, some result in the splitting of the ledger, and others are made by developers who modify the original code of the blockchain.Â
The tree structure below illustrates how different forks are categorized. The big two categories are codebase forks and live blockchain forks. Live blockchain forks are split into two categories, accidental forks, and intentional forks. And finally, intentional forks split into the well-known soft forks and hard forks.Â
Codebase Forks
Blockchains are open-source softwares. This means that anyone has access to the ledger’s copy, and therefore can copy it and modify it. A codebase fork is exactly that. Codebase forks occur when someone takes the code of an existing blockchain such as Bitcoin, and modify it to create a completely new blockchain with specific features.Â
This is how most of the Altcoins were created. Bitcoin is the mother of all blockchains, and thus, many other projects have benefitted from its open-source nature to create their own versions of the blockchain. After making the necessary modifications, these projects can therefore release the new blockchains as independent ledgers.Â
Codebase forks occur for various reasons such as allowing developers to experiment with different ideas, protocols, or consensus mechanisms, leading to the creation of a new and improved blockchain.Â
Live Blockchain Forks
These blockchain forks occur in a running blockchain itself. This is where a single blockchain splits into two or more chains, and these forks can be either accidental or intentional.Â
Accidental Forks
Accidental forks generally occur due to the network’s latency issues. Meaning, when two miners mine a block and broadcast them at approximately the same time, due to latency, might propagate to the network at different times, resulting in different blockchains. Some nodes might consider one block as the valid one and other nodes might pick the other block. This creates a discontinuation of the blockchain and it splits into two different chains.Â
Accidental forks typically resolve themselves. However, as miners add more blocks to the forked chain, the fork becomes longer, which increases the chances of it persisting. This is resolved when one of the chains becomes significantly longer, as per the longest chain principles, and thus the shorter chain gets discarded (or gets orphaned).Â
The network can mitigate these accidental forks by enforcing the right consensus algorithm, adjusting the mining difficulty, and optimizing the block propagation protocol.Â
Intentional Forks
Unlike accidental forks which happen unintentionally, nodes implement some forks intentionally as part of a software upgrade. This generates two types of blockchain forks, which are the most well-known, Soft forks and Hard forks.Â
Soft Forks
Soft forks occur when a blockchain protocol is altered in a backward-compatible way. Here, the new upgrade doesn’t clash with the existing protocol. This occurs when the nodes running the old software can still recognize and validate the blocks from the new update. This way, the main chain doesn’t split in half and it remains one single blockchain.Â
Soft forks offer the network many benefits such as the ability to upgrade the ledger with minimal disruption since the network can continue operating with minimal changes.Â
An example of this blockchain fork would be the Segregated Witness (SegWit) upgrade that the Bitcoin blockchain overwent. This update introduced changes to the transaction block size calculation without splitting up the blockchain.Â
Hard Forks
Hard forks occur when a blockchain protocol is updated in a non-backward-compatible way. This is the opposite of soft forks. In a hard fork, nodes do not take the change made to the blockchain as valid. Here, the blockchain splits into two or more chains that operate on separate rules.Â
In addition, a hard fork leads to the creation of a new cryptocurrency or token associated with the new chain. Holders of the original cryptocurrency at the time of the hard fork will usually receive an equivalent amount of the new cryptocurrency.Â
There are various reasons why a hard fork might take place. For example, it could simply be because of a disagreement between nodes regarding the future development of the blockchain. It could also be because of a fundamental protocol change.Â
Blockchain Forks: Do They Ever End?
A decentralized network will always have disagreements on the state of its structure. However, we might see more soft forks than hard forks in the future as they are less disruptive and don’t need as much consensus to work. On the other hand, as the blockchain network grows, and more nodes participate in the blockchain, it will be even harder to agree on an update, thus, more hard forks.Â
However, it is soon to tell what the future of the blockchain may be. A new way of updating the network might emerge that doesn’t require forks in the first place. Check out this concept that explains why agreement in a decentralized network is vital!