Blockchain Soft Fork & Hard Fork Explained
Last Updated: 1st November 2018
The decentralized nature of public blockchains such as Bitcoin means that participants on the network must be able to come to an agreement as to the shared state of the blockchain. Complete consensus amongst network participants results in a single blockchain of verified data that everyone deems as correct. A blockchain fork will occur when there is a departure from consensus, which can occur in three scenarios:
- Temporary Fork
- Soft Fork
- Hard Fork
Temporary Fork
Temporary forks are forks that occur when miners, on cryptocurrency systems, discover a block at the same time. This results in two split competing blockchains. Temporary forks are resolved in proof-of-work systems such as Bitcoin when miners select which chain to form subsequent blocks upon. The longest blockchain is viewed as being the ‘true’ blockchain, and will win out, whilst the shorter chain will be abandoned.
Soft Fork and Hard Fork
Soft forks and hard forks differ to temporary forks in that they represent a permanent change in the underlying rules of the protocol. Reasons for effecting such a change can occur for various reasons, including:
- Adding extra functionality to the network in the form of upgrades
- Changing a core rule in the protocol, such as increasing the network block size
Soft forks and hard forks differ to temporary forks because changes that are made are permanent, and thus, require changes at the protocol layer.
Soft Fork
A soft fork is a backward compatible method of upgrading a blockchain. In other words, a soft fork is software upgrade that is backward compatible with previous versions of the software. Soft forks do not require nodes on the network to upgrade to maintain consensus, because all blocks on the soft-forked blockchain follow the old set of consensus rules as well as the new ones. However, blocks produced by nodes conforming to the old set of consensus rules will violate the new set of consensus rules, and as a result, will likely be made stale by the upgrading mining majority. This is because for a soft fork to work, a majority of miners need to recognize and enforce the new set of consensus rules. If this majority is reached, then the older network will fall into disuse, with the newer blockchain gaining recognition as the ‘true’ blockchain.
An example of a soft fork would be the implementation of a new rule changing the network block size from 1MB to 500KB. Nodes that have not upgraded will continue to see incoming transactions as valid, as these nodes follow the old set of consensus rules as well as the new. However, mining nodes that have not upgraded and attempt to mine new blocks will have these blocks rejected, as it does not conform to the new set of consensus rules (block sizes of 500KB). Thus, the blockchain with 1MB sized blocks is likely to fall into disuse as miners enforce the new consensus rule of 500KB.
Examples of prior soft forks include:
- Bitcoin Improvement Proposal (BIP) 66: A soft fork on Bitcoin’s signature validation
- Pay to Script Hash (P2SH): A soft fork that resulted in multi-signature addresses on the Bitcoin network
Hard Fork
A hard fork is a permanent divergence from the previous version of a blockchain; a new set of consensus rules are introduced into the network that is not compatible with the older network. In other words, a hard fork can be thought of as a software upgrade that is not compatible with previous versions of the software. All network participants are required to upgrade to the latest version of the software in order to continue verifying and validating new blocks of transactions. Under a hard fork, blocks that are confirmed by nodes that are not yet upgraded to the latest version of the protocol software will be invalid. Nodes running the previous version of the software will have to follow the new set of consensus rules in order for their blocks to be valid on the forked network. In the event of a hard fork, if there is still mining support for the minority chain, then two blockchains can continue to exist simultaneously.
Hard forks can usually fall into two sub-categories, they can either be a planned hard fork or a contentious hard fork.
Planned Hard Fork: A planned hard fork is simply an upgrade to the protocol that had already been made clear in advance by the project developers. Usually, a high-degree of consensus from the project developers and the community would already have been reached before the hard fork occurred. Examples of planned hard forks include Monero’s hard fork in January of 2017, which saw the addition of a new privacy feature known as Ring Confidential Transactions (RingCT).
Contentious Hard Fork: These types of hard forks occur when there is severe disagreement between various stakeholders in the project, which can include: project developers, network users, and miners. Contentious hard forks normally take place because one portion of the community believe that major changes in a cryptocurrency’s code will produce a superior blockchain. A well-known example of a contentious hard fork was the Bitcoin Cash hard fork. Where it was believed by a portion of the community that increasing Bitcoin’s block size from 1MB to 8MB would allow for the faster processing of transactions on the network.