What is a fork
This blog post will cover:
- Types of blockchain forks
- Hard fork
- Soft fork
- Side effects
Blockchain requires a special way of organization, it works using a consensus mechanism. This means that all participants or nodes of the network should have an agreement about certain points. When there is a consensus, blockchain works as a whole system. However, it happens sometimes that nodes cannot maintain a consensus. Then blockchain may split into two different blockchains. This may be done on purpose or because of the mistake during some actions.
So the fork is a change in the software protocol of a blockchain. Since every kind of software needs updates from time to time, forks cannot be avoided.
Types of blockchain forks
There are two types of forks:
- hard fork,
- soft fork.
A hard fork is a type of a permanent change in the network. This is the most radical solution to the lack of consensus problem. This means that the network’s protocol is being changed. Previously invalid transactions and nodes can now become valid, and vice versa. The hard fork means a total update of nodes. Basically there is a conflict between the newest version of the blockchain and an older version of nodes. Then the necessity to upgrade appears. A part of the blockchain follows the newest version, and the other part proceeds the same way as it used to. Thus the fork happens.
The main reasons for the hard fork to happen:
- The necessity to add new functions to the system.
- The necessity to correct bugs.
- The necessity to improve system's protection.
The basic idea of a soft fork is the same as an idea of a hard fork. It means changes in the blockchain. The main difference is the scale. When the soft fork happens, usually it concerns only previously valid blocks. They become invalid. Not all the nodes have to update, the old ones still can communicate with the new ones. Although the soft fork is about updates, it does not lead to a blockchain split. As a result there is still one blockchain as before.
There are two types of the soft fork:
- The miner-activated soft fork. The updates are coming from miners.
- The user-activated soft fork. The updates are coming from users.
The security of the soft fork depends on the number of miners/users who want to participate. The more, the better.
- Lack of security. A lot of users think of forks as something dangerous. Luckily developers learn more about how to execute the procedure of blockchain splitting. The more information they get, the easier it is to protect users.
- Confusion. When there is one blockchain all rules are clear. When the blockchain splits it may seem confusing and hard to choose one to follow.
- Loss of funds. When the blockchain splits there is a chance for users appears to make transactions to both blockchains accidentally. In this case transaction cannot be finished and the user may lose money.
It is also interesting to mention the phenomenon of a temporary or accidental fork. The term "accidental" shows that this is not a desirable change in a blockchain. This may happen if different miners find the same block at the same time. It leads to a break in a process of the consensus formation. As a result the blockchain temporarily is divided into two. This change is not permanent. It is corrected when one part of the transaction is validated and the other one is discarded.
The fork is a very natural course of events for the blockchain. When it happens it is important to stay out of panic, calm mind will help to avoid losing some assets. Everything gets clear in a short time.