Forks

Published by Mario Oettler on

In the past sections, we learned that miners adhere to the protocol. But from time to time, it is necessary to make updates to the protocol. However, those updates are not always agreed upon by every miner, user, wallet developer, and so on. What happens in this case?

Let us assume there is a blockchain that uses SHA-256 as a hash algorithm for creating block hashes. Some people might find SHA-256 not good enough and want to switch to a hash function called SHA-3. Others, however, would like to upgrade to SHA-512. If the network cannot agree on which hash function is to be used, there will be a group supporting SHA-512 and another group supporting SHA-3. A block created with SHA-512 is not compatible with a block created with SHA-3. Therefore, each group will reject blocks created by the other group.

This is called a fork. Both chains share the same history, but after introducing the change, the history splits into two separate chains.

Fork with two branches
Fork with two branches

Sharing the same history until the fork means that each transaction in the blocks before the split is valid in both branches. In other words, the funds on an address exist on both branches.

The big question now is which branch is the correct one. From a technical perspective, both branches are correct. But more important is how many miners, users, wallets, and exchanges support a certain branch. If there are only a very few miners that support the SHA-3 branch, it is very insecure and should attract only a few users, exchanges, etc. After a while, such branches with low community support die.

But it can also happen that both branches have strong support and flourish. In such a case, we have to new chains that share a common history.

This also means that all funds on addresses from before the fork are available on both chains. Yes, right, the amount of coins has doubled. Let us consider an example. In Block B was a transaction that granted you 1 coin. In block D, we saw the fork. Now, your address and the coins on it are available in both branches. If you spend your coin in Block E in branch I your balance would there be zero. But in branch II you would still have this coin. How valuable are those coins after a fork? This depends on the community and demand and supply. If, for example, many people don’t trust branch II they would sell their coins on this branch and the price would drop. But if they think both branches are equally trustworthy, coins on both branches will have the same price.

Categories:

if()