A fork is a form of an upgrade to the software of a blockchain-based application. Cryptocurrencies (as applications that live on a decentralized and distributed ledger) require updates from time to time to improve functionality.
Updating apps on your phone is easy. One simple click, and your phone is updated with the latest upgrades. In most cases, you barely even notice that there has been an update as everything is handled in the background.
However, when cryptocurrencies on the blockchain need to add a few changes and upgrades to their code, things get a little complicated. The network inevitably splits, forming a fork.
These updates are called forks as they always result in a split on the old blockchain forming a new one with the updated code. Figuratively, the result is a fork-shaped blockchain instead of a single blockchain hence the name ‘forks.’
To get a better understanding, let’s dive deeper into the working mechanisms of a blockchain.
How the blockchain works
Blockchains as the name suggest, are made up of a series of blocks of transactions. The technology operates as an immutable ledger of transactional records stored in blocks and connected one block to the other.
Each block is secured with a cryptographic hash that can only be broken if the hash of the previous block is broken. Since there are thousands of blocks already published and interlinked, the possibility of cracking the code is impractical considering the work that needs to be done just to break one of the cryptographic hashes.
A copy of all the blocks is duplicated across a distributed network of computers. Therefore, at any one point, there is only one ledger of the recorded transactions and even if the ledger is deleted on one of the computers on the network, the data is easily restored from the other nodes.
A consensus protocol ensures that all computers on that network agree on the validity of the original ledger.
If all the computers on the network agree to the validity of the ledger, you can see how an invalid change in the ledger on one of these computers can be easily detected.
This consensus mechanism where all the nodes on the network agree on the validity of one ledger adds to the security of a blockchain-based application; however, it limits the flexibility of those applications.
For instance, if there was a critical error in the code of a cryptocurrency that runs on the blockchain, correcting that error would require a developer to change the code on all the computers in the network at the same time or simply create a new network.
What’s more, the developer would have to go back to the very first block and make changes since all blocks are interconnected. It is for this reason that forks are necessary.
What exactly is a fork?
As discussed earlier, a fork is a change in the code of a cryptocurrency (a blockchain application) that results in a split of that cryptocurrencies’ blockchain network. Since blockchains cannot be changed as the code published on their networks remains immutable, developers looking to make changes will copy the original code and make modifications in a new network. Even as the old project lives on, a new blockchain will be created with the added updates and changes.
The old and new blockchain can exist separately; however they will both have a common history as the new is a copy of the old.
Who decides on fork creation?
A blockchain is a distributed and decentralized network with many participants ranging from developers, miners, and full node users. Therefore, who gets to decide when a fork should happen on the blockchain?
As blockchains are made of a community of participants fulfilling different roles, there is no single entity that gets to decide on creating a fork. The community has to agree, and the majority wins.
Let’s look at a breakdown of the main decision-makers of a fork and their different roles.
Miners on a network have the task of securing the network as they determine which of the blocks is valid and which one isn’t. If the miners are compromised, a majority group of miners would be able to create a double-spending scenario and get away with it. However, the miners operate under a proof of work consensus protocol that requires each of them to provide proof of the resources they have dedicated to the work of publishing new blocks to the network. Each miner is rewarded for their effort.
Developers manage the code of the blockchain. Their work is to contribute to the network by suggesting updates that could improve the network. On certain blockchains, developers are also rewarded if their proposals are passed and implemented.
Full node users
These participants form the backbone of any blockchain-based project. Their work entails maintaining a copy of the entire blockchain as they validate, send, and receive block transactions. In most cases, miners will also set up full nodes for this purpose. Light node users (cold and hot wallets, phones, and laptops connected to the blockchain) are also in the picture; however, they don’t get to participate in the decision-making process.
Types of forks
There are two kinds of folks that can take place on a blockchain. One is called a hard fork, and the other is a soft fork. The difference between the two is that one results in a completely new blockchain and the other retains compatibility with the old blockchain, thereby retaining the old rules.
A soft fork is an upgrade to a blockchain that doesn’t clash with older rules. This type of upgrade is considered backward-compatible as the new blockchain is still capable of communicating with the older blockchain.
Compared to a hard fork, a soft fork is much easier to implement as only a majority of the network’s participants need to upgrade to the new changes. All other participants in the network will still recognize the new blocks in the networks as valid even though they have not upgraded to the new network. One thing to consider however is that nodes in the network that have yet to upgrade to the new rules will not be able to function at full capacity.
The Segregated Witness or SegWit fork is a great example of a soft fork. The upgrade was suggested by Pieter Wuille, a Bitcoin core developer, who proposed a reduction in the size of each Bitcoin transaction, thereby enabling more transactions to fit in one block.
A decrease in the size of a transaction considers the fact that there is a limit to the size of a single Bitcoin block. However, there is no limit to how small that block can be. Therefore, by reducing the size of each transaction, you effectively reduce the size of each block.
A soft fork to this regard, therefore, will be an upgrade to the code with rules that only accept blocks with reduced transaction size while rejecting old blocks with bigger transactions.
This type of upgrade will not disconnect old blocks from the network as the old and new will still communicate, but a filter will be placed in the new network to only allow small block sizes. This is the design of the SegWit soft fork.
The update was cleverly crafted such that the old nodes could still validate blocks and transactions without necessarily having to understand every aspect of the new upgraded code. Nodes that upgrade to the new software will feature some advantages, but there is no real urgency for all nodes to upgrade as the new rules don’t conflict with the old.
A hard fork is a backward-incompatible software update to the blockchain since backward compatibility is the attribute of new software being interoperable and compatible with older legacy systems, a backward-incompatible update conflicts with the rules of the older blockchain.
In blockchain terms, a backward-incompatible update will result in two completely separate networks where you have one network with the new rules and updates and another with the older software.
Even though the two networks might run parallel to one another and even share a similar history, they will feature different blocks of transactions after the hard fork.
The history that both blockchains now share will result in two cryptocurrencies for everyone who owned cryptocurrencies in the older branch of the network before the fork. Therefore if you were holding 5 BTC before the hard fork that resulted in BCH (Bitcoin Cash), your wallet will be automatically updated with an extra 5 BCH.
Examples of hard forks
The Bitcoin Cash hard fork was not the first hard fork on the Bitcoin network. Contentions and disagreements started early with the Bitcoin XT hard fork that was borne out of varying opinions for achieving scalability-an age-old problem in the Bitcoin community.
As early as 2010, the challenge of scalability was considered a tangible threat, and a change to the consensus rules was inevitable. At the time, philosophical and technical differences arose, with some individuals suggesting an increase in the block size to allow enough room in a block for more transactions.
Another larger faction of the Bitcoin community opposed the idea.
The argument was that an increase in the block size would necessitate an increase in computing power and network capabilities for full node operators, thereby centralizing control to a few full nodes capable of making the upgrade.
Bitcoin XT was launched albeit unsuccessfully, as the project lost user interest and got abandoned. Despite the decline of Bitcoin XT, some members in the Bitcoin community still wanted an increase in block size leading to other hard forks such as the 2016 Bitcoin Classic hard fork and the Bitcoin Unlimited hard fork.
Out of the hard fork events that have occurred on the Bitcoin blockchain in regards to an increase in block size, Bitcoin Cash remains the most successful as the BCH is now the 11th biggest cryptocurrency by market capitalization.
Ethereum’s hard forks
After a significant hack on a third-party application running on the Ethereum blockchain in 2016, millions of dollars worth of Ethereum were stolen. More than 3.5 million ETH was stolen in what amounted to about $50 million at the time.
Considering the amount of ETH in circulation at the time was around 73 million ETH, the hack resulted in a loss of about 5 % of ETH in existence at the time. Ethereum’s core developers resolved to implement a hard fork on the network as a solution for retrieving the money from its original owners.
A new Ethereum token would emerge, thereby restoring the original balance of stolen Ethereum. The network would then migrate to the new Ethereum network and abandon the old one.
A smaller fraction of the Ethereum community, however, had some philosophical disagreements that advocated for preserving the old ledger. This led to the emergence of the Ethereum Classic and Ethereum.
Ethereum (the new blockchain) remains the more popular network, and Ethereum classic the less popular one.
Can anyone fork a coin?
Yes, anyone can grab the code of a given cryptocurrency on GitHub and create a copy of that coin. This has been the strategy for several alternative coins that have simply copied the Bitcoin blockchain, made a few alterations, and rebranded that fork as a new project. However, without the backing of miners, node operators, and developers, a fork on any blockchain will lose traction and fail. To date, there have been very few successfully forked coins. All forks (soft or hard) require a level of consensus with a majority of network users.
What happens to miners who don’t upgrade during a hard fork?
It depends on the level of support the old network receives during a hard fork. If a majority of miners upgrade to a new blockchain network, the miners who fail to upgrade will be left stuck on an incompatible chain following old rules. They will not be able to mine blocks on the new blockchain unless they upgrade. If a majority of the miners remain on the old network, there is no loss for the miner as the old network retains its superiority.
Which is better between a hard and soft fork?
Comparing a soft and hard fork is similar to comparing apples and oranges. Both forks serve different purposes, and it depends on the upgrades coming to the blockchain. In most cases, hard forks are contentious and can divide communities. A contentious hard fork will often create a new chain by introducing major changes incompatible with the old rules, as is the case with Bitcoin Cash.
There is also a planned hard fork where all network users agree to switch to the newly enhanced network resulting in the death of the old chain. In any case, a hard fork will require a drastic change.
Soft forks on the other hand are a much gentler option of introducing upgrades to the network however they limit the degree of change such that new upgrades should always remain compatible with the old software.
Any seasoned blockchain developer will admit that forks are an inevitable part of cryptocurrencies and blockchain development. While some are legitimate, others are outright scams.
However, forks offer a strategy for blockchains to upgrade and update their software with new features. Most forks will be accepted as long as the proposed change is in line with the principles of decentralization and open-source code.
Since most blockchain networks are community-owned, there is a lot of skepticism whenever new features are introduced to a network, as there are multiple vulnerabilities to consider.