Heard about soft and hard forks, but not sure what they mean? Both are an integral part of blockchain development as they allow upgrades and updates to improve network efficiency. Keep reading for a simple, easy to follow breakdown of soft and hard forks.
Understanding The Rules Of Blockchain
Before we dive straight into the differences between a hard and soft fork, it is worth recapping a few crucial pieces of blockchain terminology. The first is “node”, which refers to anyone connected to a blockchain. Blockchain networks are “decentralised”, which means they rely on individual participants to help maintain, add, and verify new blocks.
In the scenario below, both John and Sally act as nodes
If John wants to give Sally 20 coins, they would agree to do so (as long as the blockchain rules are adhered to), and that transaction becomes a new block on the blockchain. From that moment on, the 20 coins John gave to Sally are written into the uneditable digital ledger that is the blockchain.
The blockchain rules that John, Sally, and any other node connected to the network have to follow are integral to the success of blockchains. In a blockchain scenario, this collection of rules is referred to as the “protocol”. The protocol is responsible for making sure that everyone uses a blockchain in the same way. In reality, the protocol is made up of a series of incredibly complex rules, but there are some simple examples we can use.
Sally decides that she would like to give John his 20 coins back. However, since their initial transaction, Sally has spent her 20-coin balance. To make sure Sally has the balance needed to complete another transaction, she has to satisfy the rules of the blockchain. In this example, the network checks the history of the ledger to find out that Sally has spent everything she has; therefore, the transaction is denied. This is just one example of the rules that make up a protocol, but they are also used to define actions like the maximum size of a block uploaded to the blockchain, or the rewards nodes are eligible for.
Changing The Rules Of A Blockchain Results In Either A Soft Or Hard Fork
Let’s assume that we want to change the protocol, and alter or upgrade some of the rules of a blockchain. We might do this to improve efficiency on the network, or to fix a security risk. As a blockchain is continually growing, there will nearly always be a need for updates or amendments to the protocol. This isn’t a problem in itself, but how we implement the changes impacts how nodes will be able to access the blockchain.
What Is A Soft Fork?
A soft fork is when a change to the protocol is backwards compatible. On a decentralised network, every connected node is responsible for maintaining a copy of the blockchain. If we change the rules, but a node hasn’t updated their copy of the blockchain, any transactions uploaded won’t be rejected as long as they don’t break the newly instigated rules. Nodes can continue to add blocks, but the process will not be as efficient as if they updated their copy of the blockchain to the latest version. Over time, everyone will update to the newest version of the blockchain and transactions will continue as usual.
What Is A Hard Fork?
A hard fork is when changes to the protocol are not backwards compatible. Rather than allowing a transaction to take place (as long as it doesn’t break the new rules), if a node hasn’t updated their copy of the blockchain, the transaction will be blocked. A hard fork requires that every node upgrades to the latest version of the blockchain before they can participate again. All previous transactions and token balances are carried over to the new blockchain, so in theory, once a node has updated, transactions would continue as usual.
However, if a selection of nodes decides they don’t like the new rules being implemented, they can choose to stick with the original blockchain. This presents us with a problem though, as we now have two separate, incompatible blockchains. Blockchain networks rely on active nodes to operate, so splitting a user base isn’t usually a good idea unless absolutely necessary.
Both Forks Are Legitimate Ways For Blockchains To Develop
Hard forks shouldn’t be seen as inherently detrimental; in reality, they may be necessary. However, unplanned hard forks or changes to the protocol that parts of the community don’t agree with can lead to problems. The size or impact of the update will affect whether it is necessary to implement a hard or soft fork. Due to the nature of blockchains, there will always be a need to amend or update the protocol. The important thing is that active nodes are made sufficiently aware of any significant changes to the blockchain protocol.
To reduce the risk of a controversial hard fork, many blockchains allow participants to vote on upgrades or updates. This ensures that even if a hard fork takes place, the community remains united, rather than divided.
We hope this clears up the basics on these two key aspects of blockchain tech. Keep an eye out for more articles on blockchain basics!