Margin Trading Updates
Thanks to you Margin Trading just got a whole lot better!Read More
Forking is only one way of updating a blockchain, but it’s an important one in the tricky context of decentralized networks. Another interesting use of forking is to have your own copy of a particular blockchain and be able to do whatever you want with it.
A fork is a word commonly used in the world of open-source software development to describe a project splitting into two (or more) versions of itself, usually following a disagreement on the path to take. In a blockchain context, forking can lead to a “chain split”, a condition where the state of the blockchain diverges into different chains, where each chain starts following separate consensus rules. It is also a method that is applied when everyone is willing to switch to a new version of the software together at the same time. The forking mentioned in this article are forks that are applied to change the consensus rules or to apply them on the same chain, or on the chain that is created as a fork from the original chain. Meaning: forking for blockchains, mentioned in this article, is only relevant in the context of the consensus component.
Consensus forks are a way of allowing a community to change certain rules while maintaining the security that comes with the longest chain rule. The longest chain rule ensures that the network will recognize the “valid chain with most work” as the main chain. A chain’s work is equal to the expected number of hashes it would take for someone to replicate a chain of the same number of blocks and the exact same difficulty steps.
Now, please, allow me to do a little detour. This detour should answer the question:
“Why can we sometimes encounter the term ‘heaviest’ instead of the ‘longest’ chain rule in Proof-of-Work-based (PoW) blockchains?”
In the Bitcoin White Paper, Satoshi didn’t initially realize that choosing the correct chain by just counting blocks allows for some extremely easy attacks. Bitcoin Version 0.1 only counted the number of blocks to ascertain the main chain. That’s why the White Paper just says “longest” chain. The idea of “chain work” was added a little later and that’s how the term “heaviest” chain got into use.
Bitcoin’s historical “longest chain rule” labelling:
Forking is also a way to apply software updates or upgrades, add new features, enhance current capabilities, and improve the reliability of security protocols in a decentralized world. That’s right, since we are in the decentralized world of blockchains now, we can’t do a simple update as we are used to doing on our home computers or our company servers. What we need to do is to apply a new set of consensus rules and wait for their activation. When the consensus rules are changed, and when triggered, the blockchain splits into two forks. These rules change at a specific block height and the new (forked/updated consensus rules) chain history begins to diverge from the old (previous consensus rules) chain history at that block height.
Before applying the planned changes that modify existing characteristics or add new features, you have to find out if your supporters, miners and node providers are in favor of these changes or not. This could be done by a public referendum open to anyone or a vote between members of the community. However, when it comes to actually activating a fork there is only one way: miners and economic nodes must run the software in sync to support and enforce the change.
Forking is particularly useful in situations where people cannot find common ground about a planned blockchain update or change in direction that might go against the blockchain’s original principles or ideas. One of the main benefits behind blockchain forking is that it allows developers to start from a single blockchain, where everyone agrees on the blockchain’s current state, and use that agreement as to the starting point for the future blockchain state. They can separate from the original blockchain, taking the last validated state on that blockchain with them, and continue from there. People simply diverge and start agreeing on another path for the blocks in the new chain.
This leaves us with one big question: What will happen to the original chain after the fork? Well, this depends on whether we are discussing a hard or a soft fork. There can be “soft” forks and “hard” forks, but don’t let these terms mislead you. The term “soft” doesn’t mean that it will be easy and “hard” will be more demanding. They don’t describe the difficulty of the task, but how different the end state of the chain will be after the forking process. However, in some ways, yes that actually is what the terms are referring to:
With a soft fork, the rules get more strict. This means nodes running an older version of the software can still participate on the network, but they can’t mine new blocks.
Example: With the old rules, there is a maximum fee of 10 tokens. Under the new rules, the maximum fee is 5 tokens. The old node will not reject blocks that others mined taking 5 tokens, since 5 is less than 10. But if the old node tries to mine a block taking 10 tokens, the other (upgraded) nodes will reject it.
The acceptance of a soft fork is a continuation of the original (still the same blockchain), but enhanced with new code, features, and fixes introduced by the fork.
Applying a soft fork does not create new tokens if the fork does not result in a chain split.
A new chain will not be created if:
A new chain (even though not fully supported) will be created if:
When a soft fork occurs:
A hard fork creates two blockchains where the forked one is, essentially, a clone with changed consensus rules of the original one prior to the moment of forking. At the block height of the fork, one path follows the forked blockchain and its new consensus rules, and the other path continues along with the old consensus rules.
With a hard fork, the rules get less strict. This means nodes running an older version of the software aren’t able to participate in the new forked network once there is a transaction that relies on the new hard fork rules to be considered valid
Example: With the old rules there is a maximum fee of 5 tokens. Under the new rules, the maximum fee is 10 tokens. The old node will reject blocks from other (updated) nodes as they mine blocks taking 10 tokens, which is more than the allowed 5. The old node could participate in mining, it will just be mining on a different chain than the forked nodes.
A hard fork is a permanent divergence from the previous version of the blockchain, and transactions between these two blockchains are no longer possible. Switching to a hard fork requires all nodes to upgrade and agree on the latest version.
To make the above statement exactly true, we need to consider another two points, depending on what we mean by “transactions between these two blockchains”.
The result of a hard fork is two distinct blockchains instead of one. This is only true if there are miners on either the new hard fork chain or the old pre-hard fork chain who build blocks to extend that chain. If all miners update to the new consensus rules (or if all miners fail to update) then there will only be one chain.
When a hard fork occurs:
In contrast to a soft fork, a hard fork creates new tokens and a new blockchain. Users with a stake in the original blockchain automatically obtain a similar stake in the new fork (at a 1:1 ratio).
When a hard fork occurs, sometimes, the cryptocurrency tokens are copied, resulting in two versions, identical in every respect except in name. But this is not always the case. Some hard forks result in non-identical versions since a hard fork can introduce any arbitrary rule changes, there could certainly be changes to the tokens. For example, some people in the BSV community want to hard fork the blockchain and give the coins that they think are Satoshi’s unmoved coins to CSW. (Even though, if CSW were Satoshi, he should have the private keys and be able to move them himself anyway, right? 🙃)
In addition, the owners of the original tokens obtain the same amount of new tokens. However, the value of the tokens is initially zero but often rises quickly through speculation. Furthermore, in anticipation of a hard fork, the value of the original tokens can rise as well, since obtaining them before the fork means getting more forked tokens “for free”, and the increased demand drives the value up.
Hard forks usually split the community of the currency into two camps, the “old-chain supporters” and the “new-chain supporters”, each of whom supports the fork they deem more viable.
Hard forks can be controversial and create volatility but are necessary from time to time. For example, if an enhancement intended as a soft fork is not accepted by the stakeholders, the owner of the enhancement can choose to diverge their version to a hard fork.
When a soft fork is applied, on the other hand, there are no free cryptocurrency tokens for the taking, but there may be free upgrades (but only if there’s no chain split, which isn’t guaranteed to be the case.). For instance, if a code change introduced to the blockchain via a soft fork improves the efficiency of the mining, everyone on the blockchain benefits from this.
For example, in 2017, Bitcoin introduced a soft fork known as Segwit, which increased the available data stream volume through a block. This method increased the capacity of the blockchain by removing signature data from transactions. Therefore, the approval process for each soft fork can be crucial for the future of the entire blockchain.
Forks are a risky event in the life of a blockchain. In a decentralized world, applying a software update is not as easy as updating an app on your phone. A blockchain’s developers may want to use a fork to add additional features or fix bugs in the software (or even occasionally, reverse “problematic” transactions as in the case of The DAO hack, which resulted in Ethereum forking into a new chain, with the original chain now called “Ethereum Classic”. Ethereum Classic has hard forked a few times since then too, is the current Ethereum Classic chain the same as the “original chain”? This is mostly a philosophical question, I would argue no though :D).
However, developers are only part of the puzzle – many different groups must be aligned to support an update without a chain split. Miners, node operators, devs, and users must all agree on the future of a chain, and if the majority disagrees, a plan B in the shape of the hard fork may occur. That being said, when a blockchain with its cryptocurrency token forks, it often results in holders of that coin getting some additional assets, so it’s not all bad!
Sovryn explorer: If you are hungry for additional knowledge and want to get your understanding of the blockchain forking to another level, continue with the comprehensive article made by Sovryn community blockchain guru, John Light.
Congratulations. You made the fourth step in becoming a blockchain expert.
See you later in episode 6, where we will investigate blockchain transactions.
Until then, stay Sovryn!