Blockchain across Oracle
上QQ阅读APP看书,第一时间看更新

Soft fork versus hard fork

There are also forks that are not related to the generation of blocks during normal runtime. A blockchain is still a piece of software, and development of this software can continue. In the traditional sense of software development, a fork means that a different party copies the source code and continues development separate from the original party. In blockchain, a software fork can be divided into two types of forks: soft forks and hard forks. This may sound contradictory but, in short, a soft fork means that the rules of the blockchain protocol are made tougher (or stricter), whereas a hard fork eases the rules.

Soft fork

A soft fork is a backward-compatible change in the blockchain software where the rules become stricter, and less is permitted than in the situation before. An example of a soft fork would be increasing the generation time of blocks, or reducing the block size from 2 MB to 1 MB. By reducing the block size, the rules are made "tougher," with the result that blocks larger than 1 MB are no longer accepted by nodes that are upgraded to the new code. Older nodes that are not yet upgraded to the new code don't have any problems with blocks created by the upgraded nodes, because the new rules don't conflict with the existing rules. The new block size still fits inside of the old block size. The old nodes don't need to upgrade to the new code immediately, but eventually they will have to. If non-upgraded nodes continue to create blocks, these blocks are not accepted any longer by the upgraded nodes. The downside of a soft fork is that if it is only supported by a minority of the network's power, it can become the shortest chain and be orphaned, or it can even lead to a hard fork because the chain can splinter off. The following diagram shows a comparison between the (non)-compatibility of rules between a soft fork and a hard fork:

Comparison: soft fork introduces new backward-compatible rules, whereas a hard fork introduces non-compatible rules

Hard fork

When the rules are smoothed, or "weakened," it is known as a hard fork. A hard fork is a non-backward compatible change in the blockchain software that introduces a new rule to the network. For example, the block size can be expanded from 1 MB to 2 MB, which smooths out the rules. When nodes in the network won't update their software, they can't follow the chain any more because the new 2 MB rule conflicts with the maximum block size of 1 MB that they currently accept. If non-upgraded nodes continue their work, they will view the new transactions as invalid.

With a hard fork, all of the nodes in the network need to upgrade. The disadvantage of a hard fork is that if an impasse is reached, a portion of the nodes will not upgrade because they prefer the old rules. In this case, both chains may continue and eventually have their own identity. This happened with Ethereum in 2016, and with the original Bitcoin in August 2017. The latter split up into Bitcoin Cash (new) and Bitcoin (old), because some leaders in the community wanted to expand the block size as it was getting too small to handle the current number of transactions.