Soft fork vs. hard fork

Blockchain is a decentralized peer-to-peer network. A blockchain network consists of nodes following the protocols defined by the blockchain. Protocols consist of everything from the transaction format to the consensus algorithm. These protocols need to be upgraded to keep up with technological advances.

What is a fork?

Forks represent an upgrade to the blockchain’s underlying protocols initiated by the blockchain community. Forks divide the blockchain into two chains. Sometimes, the two chains are compatible, resulting in a soft fork. Other times, the changes in the protocols are so significant that the two chains are not compatible anymore, resulting in a hard fork.

The types of forks

Note: Hard forks and soft forks are intentional forks. However, there is another type of fork called accidental or natural fork. This happens when two miners mine a block simultaneously, and both are deemed valid by the validators. The blockchain accepts the longer chain (the one of the two chains in which the most number of blocks are added after the natural fork).

Soft fork vs. hard fork

The differences between a soft fork and a hard fork are listed below:

Soft fork

Hard fork

Backward compatible

Not backward compatible

Result in 1 chain

Results in 2 chains

Updating to the new protocol is optional

Updating to the new protocol is compulsory

Soft fork

A soft fork is considered to be the most reasonable of the two. It is an intentional fork usually used to update the protocols slightly while ensuring that the new protocol remains backward compatible with blocks formed prior to the fork. This means that updating the new protocol is optional for nodes, resulting in only one chain.

A soft fork

Hard fork

The hard fork is usually an intentional fork resulting in the chains being incompatible. The chains continue following different paths from the point of the fork. One chain follows the new protocol, while the other continues to follow the old protocols.

A hard fork

Hard forks have been used previously to add functionalities, improve the network’s speed, and decrease gas fees. The most famous examples of hard forks are Bitcoin cash which was hard forked from the Bitcoin blockchain in 2017. Bitcoin cash increased the speed of the transactions and lowered the gas fee as intended.

However, the hard fork is not performed at all times to add functionalities. Sometimes, it is used to rectify security risks and hacks. The most famous example is the decentralized autonomous organization (DAO) hack. Due to this hack, Ether worth millions of dollars were stolen from the smart contracts of DAO due to a security flaw caused by a bug in the smart contracts deployed on the Ethereum network. Following the attack, Ethereum went through a hard fork resulting in the Ethereum that we know today and Ethereum classic. The hard fork enabled the network’s history to be reset to the pre-hack, therefore nullifying the hack. However, Ethereum classic continued mining the original chain where the hacker still possessed the stolen Ether.

Copyright ©2024 Educative, Inc. All rights reserved