Hard Forks and Soft Forks. What are they and what’s their difference?

In the world of cryptocurrencies, the prospects of hard forks and soft works are always the subject of intense debates among the experts, as well as a source of concern and uncertainty among traders and speculators. But what do these terms really mean?

Ettore Murabito
The Startup

--

Simply put, hard forks and soft forks are for cryptocurrencies what updates are for common computer programs.

The software that implements a blockchain consensus protocol (for example the software that runs the Bitcoin network) is usually curated by a community of developers who incessantly work to define, propose and implement best practice solutions and improvements to the code. When this community introduces an update on the software, the blockchain is said to “fork”.

When it comes to updates of common computer programs, we are all familiar with the notion of backward compatibility (or incompatibility). If the update is such that the files created with the new version of the program can be still opened and worked on using the old version , then we have a backward compatible update, otherwise the update is said to be backward incompatible. For blockchain consensus protocols it works pretty much the same way. A soft fork is an update on the blockchain protocol that is backward compatible, i.e. it introduces some changes in the code that do not severe the functional continuity with its previous version. On the contrary, a hard fork consists of changing the blockchain protocol in a way that is not backward compatible, hence introducing a discontinuity with the previous version.

Now, what does all this mean in practice? Let’s try to answer this question through some examples.

An example of soft fork. The adoption of SegWit.

Firs of all, let’s clarify one point. Contrary to what our intuition may suggest,

A hard fork consists of loosing up some of the rules implemented in the non updated version of the protocol, while a soft fork consists on tightening up some of those rules.

Let’s consider a famous example of a soft fork, the adoption of SegWit. The bitcoin community had long debated on what was the best way to increase the bitcoin transaction speed. Since a new block of transactions is mined every 10 minutes in average (and this point was not up for debate), the idea was to increase the number of transactions that could be included in each block. To do so, the community proposed a solution called Segregated Witness (in short SegWit). The basic idea was to free up some space in each block that could be used to include a bigger number of transactions. This was achieved by removing from the block the public key and the signature associated with each transaction and sending them through a different messaging channel. Because the public key and the signature occupy about 60% of the whole transaction size, by sending them separately it was possible to double the number of transactions in each block. The reason why this approach was called Segregated Witness is that the “witness” (another name for signature) of the transaction was segregated (i.e. sent separately) from the transaction itself.

This change in the protocol was implemented in a way that allowed blocks forged in the old fashion to be also correctly recognised and processed (in this sense the new protocol is more permissive as it allows for both the new and the old block formats). In other words the protocol update was backward compatible.

An example of hard fork. The birth of Bitcoin Cash.

A notable example of hard fork is provided by the split between Bitcoin (BTC) and Bitcoin Cash (BCH) occurred the 1st of August 2017. The split was due to a fundamental disagreement on whether SegWit was the best approach to increase the number of transactions processed per block. Those who were unhappy with SegWit decided to implement a different solution consisting of increasing the maximum block size from 1 to 8 MB. This solution was not backward compatible as we will see shortly, and because there was not unanimous consensus about its adoption it resulted in the split of the blockchain into two branches. The branch that implemented the change re-branded their blockchain as Bitcoin Cash, while the branch that did not implement the change maintained the original name of Bitcoin.

The reason why the change proposed by the Bitcoin Cash supporters is not backward compatible is easy to understand. On the one hand any block with a size smaller or equal to 1MB is considered valid by both the BCH updated protocol and the BTC protocol. On the other hand any block with a size greater than 1MB is considered valid only by the BCH protocol. This backward incompatibility is the result of loosening up the constraint on the maximum block size in the BCH protocol. As a consequence, from the time of implementing this change, the history of the two blockchains started to diverge.

Figure 1 — A hard fork occurred on the 1st of August 2017 leading to the split between Bitcoin (BTC) and Bitcoin Cash (BCH). The updated version of the protocol implemented by BCH allowed for a bigger size limits of the blocks.

At this point it is important to point out that when a blockchain splits, so does its underlying currency. If that was not the case, then any block with a size compatible with both protocols, would be processed by both blockchains resulting in a double spending problem. The issue is avoided by creating a new currency that shares the same history as the old one up until the time of the split, and then becomes independently managed and transacted. This means that at the time of the split, any holder of bitcoins was granted the same amount of coins in BCH, which then could (and had) be transacted independently from the original coins.

Some final remarks

Is Hard Fork synonymous with Split?

No. A hard fork does not have to result in a split. If a general consensus is reached to implement a change on the blockchain protocol that is not backward compatible, then the new protocol will replace the old one without the blockchain being split into two branches nor a new currency being created.

Can a soft fork result in a split if no consensus is reached?

There is no reason for a split in the case of a soft fork. The key aspect to keep in mind is that a soft fork is initiated only when the vast majority of the community agrees on the new rules.

Let’s recall that a soft fork consists on tightening up some of the rules of the existing protocol. This means that all the blocks compliant with the new protocol are also compliant with the old one. On the contrary some of the blocks mined following the old protocol won’t be valid based on the new set of rules. Now, because the majority of the nodes in the network agreed to run on the new protocol, the blockchain created with the tighter set of rules will elongate faster than the other one. As we know from my article on PoF-based consensus protocols, the longest chain replaces the shorter one whenever two different versions of the ledger are detected by the network. This results in a number of orphaned blocks originally mined following the old protocol. This situation forces the minority of the nodes still running the old protocol to adopt the new one. If they don’t, they will lose money by keeping mining less blocks that will be eventually orphaned (and for which they won’t receive any remuneration). The picture below shows what happens in a fictitious soft fork where the protocol update consists of reducing the block size limit from 1 MB to 0.5 MB.

Figure 2 — A soft fork is initiated only when the majority of the community agrees on the protocol update. This gives the new protocol an advantage over the old one in terms of hashing power. The miners who did not update the protocol will be able to mine less blocks — some of which will also be orphaned (like the block with the red cross in the picture) — due to the hashing power disadvantage. This will push those miners to adopt the new protocol so as to avoid being remunerated less for mining a fewer number of valid blocks.

Other notable forks

The introduction of SegWit and the birth of Bitcoin Cash are among the most notable examples of soft and hard fork respectively. There are others, however, worth noticing; some involving again the bitcoin blockchain, some involving other cryptocurrencies or even smart contracts. For a list of these forks, just query the web. There is an overwhelming amount of resources you can tap into. Here are some:

--

--

Ettore Murabito
The Startup

My interests are in both technology (Smart-Cities, Blockchain) and spirituality (Consciousness, Meditation, Personal Growth, etc.). I write about them all.