Introduction
By now, you should be familiar with the consensus scheme of blockchains. To recap, miners follow a protocol, and this leads to a single chain.
But disagreements about the protocol can arise. Some users might want to make an update to the protocol, while other users don’t. It is not uncommon that there are different opinions on which updates should be implemented, how they should look, and what features are to be changed.
Some updates can have enormous implications for miners, wallets, and users. That’s why they are discussed controversially. And in some cases, the community cannot agree. This can lead to a fork.
There are different definitions of what a fork is:
Basically, a fork is a situation when a blockchain diverges into two branches. Such forks happen if there are two blocks with the same height (or block number).
The branches share the same history until the split occurs. This means coins belonging to one address before the fork, belong on both branches to this address.
There are three main reasons for forks.
- Race conditions
- Network split
- Introduction of new protocol rules (hard forks and soft forks)
Race Conditions
The first is that two miners find a block at the same time. In such a situation, we would have a race condition, and the network finally decides on what chain it builds on. If the network latency is low enough and the block finding time high enough, such issues are resolved quickly without disturbing the network.
You can read more about the block finding time and mining difficulty here.
Network Split
If a certain part of the network is disconnected from the rest of the network, blocks and transactions cannot be sent to all nodes. The result is that each network fraction builds on its own chain.
Network splits can occur for various reasons. Technical issues or natural disasters could disconnect large geographic areas from the rest of the internet. Also, political decisions could cause such a disconnection. If the network reconnects after some time, the longest chain would be chosen as the canonical chain. This makes a network split so dangerous. All transactions created after the split and which were processed in the shorter chain would suddenly disappear.
New Protocol Rules
If new protocol rules are introduced, accepting those rules is voluntary. Each miner can decide whether or not to follow the new rules or to stick to the old ones. If old and new rules don’t fit together, this can have severe consequences for the network.
There are three basic outcomes:
- Blocks created according to the new rules are invalid by the old rules. But blocks created according to the old rules are still accepted by the new rules. This means that the protocol got less restricted. An example could be the increase of the maximum block size.
- Blocks created according to the old rules are invalid by the new rules. But blocks created by the new rules are still accepted by the old rules. Here, the rules got stricter. This could happen if the block size is reduced.
- The rules are incompatible. This could happen if a new hashing algorithm is introduced, for example.
In the following topics, we explain those implications in-depth, and we introduce the concept of hardfork and softfork.