Forking, in simple words, implies divergence. This divergence can be temporary or permanent. It happens when a blockchain diverges or splits into a new branch as a result of a change in consensus or software protocols, for example, when a set of miners believe they can enhance the capabilities of the current blockchain. Forks occur on a specific block and every block following that block obeys the new rules implemented by the nodes. Forking means when the laws or the rules governing the blockchain changes. These changes are done by the nodes to increase scalability, speed, or any other quality of blockchain to pass it through an upgrade in its software or implementation. There are two types of forks described below:
Under Hard Forks, all the previous rules and structure goes invalid. All the users, nodes, and blocks have to comply and upgrade according to the new rules of the Blockchain. If there are two users on a different side of hard forks, they can’t interact with each other. Usually, if there is any change required in the structure of the block, for e.g. the hashing algorithm, a hard fork is required. If there are cryptocurrencies operating in the blockchain, each coin will split or mirrored.
Contentious hard fork
Not all hard forks are unanimously agreed on by the community of the nodes. A “contentious hard fork” occurs when significant numbers of miners disagree with each other on which version of software to run.
The biggest example to consider here is of DAO (Decentralized Autonomous Organization), which is a completely automated organization constructed with the help of Smart Contracts on Ethereum’s blockchain. The organization completed its crowdfunding and gathered $160 million in Ether (ETH), the cryptocurrency working on Ethereum’s blockchain. An attacker found a weakness in their architecture and transferred $50 million to his wallet. 89% of ETH holders voted affirmative to the proposal and a new blockchain was generated that was successful in returning the stolen funds. Following the hard fork, the blockchain is split and each coin in the network is mirrored. All the operations will now function on the new blockchain and the old coins will not be used. In ETH’s case, the nodes transferred the new coins to the new system and retained the old coins by naming it Ethereum Classic. a
Soft Fork is a softer and lenient version of forking. Soft Fork happens only in a subset of a set of blocks. Soft fork also brings changes to the rules of the blockchain but only on the subset of the blocks and is backward compatible. Backward Compatible means the old nodes will recognize the new blocks as valid. In other words, the soft fork doesn’t require all the nodes to upgrade because all the blocks with the new soft fork rules also follow the old rules. Although certain transactions will be turned invalid, new transactions can be added as soft forks requiring the users and nodes to understand the rules of the new transaction type. In contrast to the hard fork, the upgrades will not prevent users and nodes who do not adopt the changes occurred. Where hard fork requires all the nodes to agree to the new changes, soft fork only requires agreement only from the majority of the nodes. The only way to reverse a soft fork is by doing a hard fork.
Bitcoin’s SegWit update is a prime example of a soft fork. When SegWit activated, a new class of addresses (Bech32) was created. But those using older P2SH addresses were not affected by the addition. As long as at least 51% of the hashing power switches over to the updated soft fork, it can be used. The older versions of the software will continue to work.