Blockchain Dojo - Episode 5, Forks

brought to you by Sovryn author, MickeyMaler

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.

Why Blockchains Fork

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:

  • Bitcoin Version 0.1 - longest chain rule
  • Mentions that started to occur by the end of 0.1 to 2018 - longest chain rule mixed with the heaviest chain rule
  • Currently used terms, which refer to a “valid chain with the most cumulative proof of work”, measured using the difficulty target algorithm:
  • “heaviest valid chain”
  • “difficulty-wise longest well-formed chain”

Additional details:

  • The longest chain is the one that carries the most work
  • The proof of work security arises from a blockchain’s heaviness.
  • The heavier a chain is, (which means the more blocks with some heavy PoW a blockchain has) the more secure it becomes since these blocks are harder to “undo”.

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.

  • Historically, there have been various signalling methods used including miner signalling and social signalling, see these examples for SegWit:
  • Miner signalling
  • Social signalling

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:

  • Soft forks are considered easier because not all miners and nodes have to update for the fork to be safe to activate with no risk of a chain split. Whereas with a hard fork, you generally need all miners and nodes to update to avoid a chain split.

Soft fork

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 majority (or all) nodes and miners agree to update and support the changes proposed by a soft fork. Then, there will be no chain split because the chain with the new rules will outweigh any version of the chain built by miners who haven’t updated (and nodes running the old rules will consider the chain with the new rules to be valid since it’s a soft fork). In this case, the soft fork acts as a software update in a decentralized manner.

A new chain (even though not fully supported) will be created if:

  • A majority of miners stay on the old rules, but a minority are mining on the new rules. Then, there will be a chain split (because those mining on the old rules will be extending a chain that updated nodes do not consider valid).

When a soft fork occurs:

Hard fork

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.

Additional consideration

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”.

  1. There is the issue of replay transactions, where sending tokens on the old chain results in the same transaction being sent on the new chain, and vice versa.
  1. There are blockchain interoperability protocols like IBC that enable users to create transactions on one chain that affect transactions on another chain.

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:

  • If there are miners on both the old rules and the new rules, there will be a chain split, regardless of whether it’s a minority or a majority on either side. In case a majority is upgraded, the old nodes will create an active fork as they don’t recognize the longest chain as valid.

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).

What do forks mean for cryptocurrencies?

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.

Conclusion

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.

This series is mirrored on the Sovryn Wiki here. It is also published on Hackernoon.

See you later in episode 6, where we will investigate blockchain transactions.

Until then, stay Sovryn!

You May Also Like

Margin Trading Updates

Thanks to you Margin Trading just got a whole lot better!

Read More

5 Amazing Benefits of Staking SOV

Decision-making power, earning rewards and establishing true financial sovereignty, all require one simple action.

Read More

LNSOV Bridge is LIVE on Mainnet!

Completely decentralized swaps between RBTC and BTC⚡ are now available for everyone! Try it now!

Read More

Lorem Ipsum is simply dummy text of the printing and typesetting industry.