The differences between a hard fork, a soft fork, and a chain split, and what they mean for the future of bitcoin

Note: In this post, I will describe soft and hard forks in the context of the bitcoin protocol specifically, but generally speaking, these definitions and effects are the same for other blockchain protocols as well.

Update #1 07/31/17: Since the time that I first started writing this, a small group of bitcoin miners have decided to run software called “Bcash” that will initiate a hard fork on August 1, 2017. Godspeed to them.

Ever since the New York Agreement led to a new implementation of bitcoin called btc1, the topic of a bitcoin hard fork has been top of mind for many people in the bitcoin community, including myself. The btc1 implementation is designed to activate a hard fork (“Segwit2x”) approximately three months after the activation of Segregated Witness (“SegWit”), a soft fork upgrade to the bitcoin protocol.

With SegWit activation seemingly just around the corner, anxiety is building about the upcoming Segwit2x hard fork activation. But what is a hard fork, how is it different than a soft fork, and why are people so anxious about it?

To illustrate the difference between a hard fork and a soft fork, and the potential effects each may have on the bitcoin network, I will create several hypothetical scenarios. These scenarios will be intentionally extreme so that a hard fork and a soft fork can be shown in stark contrast and the differences may be clearly understood. By the end, I hope to permanently put to rest any misconceptions about each style of change and any misunderstandings about their definitions.

Soft forks

A soft fork is a change to the bitcoin protocol that restricts the ruleset enforced by full nodes that upgrade to enforce the soft fork rules. A block that is considered valid before the soft fork activates will be considered invalid by upgraded full nodes if it violates the new soft fork rules after the soft fork activates.

An example is a soft fork that restricts the block size limit from 1MB to 500kB. Even though a 1MB block was previously considered valid, full nodes that upgrade to support this soft fork will reject any blocks larger than 500kB after the soft fork activates.

Soft fork scenarios

In these example scenarios, I will show a soft fork “activating” even if there are no nodes or miners forcing activation simply for the sake of illustration. Imagine that there is software that would have activated the soft fork if it had been deployed.

All full nodes and all miners upgrade

SF - All nodes and all miners upgrade

In this scenario, there are no full nodes enforcing legacy rules and no miners producing blocks that conform to the legacy rules. All full nodes have upgraded to enforce the soft fork rules and all miners are producing blocks that conform to the soft fork rules. As a result, there is no chain split.

The winning blockchain in this scenario is the soft fork blockchain.

All full nodes but one upgrade and all miners but one with 1% of the hashpower upgrade

SF - All but one full node upgrades and all but one miner with 1% of the hashpower upgrades

In this scenario, there is one full node enforcing the legacy rules and one miner with 1% of the hashpower producing blocks that conform to the legacy rules. The rest of the full nodes are enforcing the new soft fork rules and the rest of the miners are mining blocks that conform to the new soft fork rules.

Since soft fork blocks are compatible with legacy rules, and the miners producing soft fork blocks have more hashing power than the one miner producing legacy blocks, both legacy nodes and soft fork nodes will follow the soft fork blockchain. As a result, there is no chain split.

The winning blockchain in this scenario is almost cerainly the soft fork blockchain. The only way the legacy blockchain could win in this scenario is if it can attract substantial economic investment to catch up to the soft fork blockchain and overtake it. If it can do that, then in the eyes of the legacy nodes, the legacy blockchain will cause a reorganization of the blockchain and wipe out the soft fork blockchain. Soft fork nodes will not be aware of the legacy blockchain and will be safe from a blockchain reorganization.

All full nodes but one upgrade and only one miner with 1% of the hashpower upgrades

SF - All but one full node upgrades and only 1% of the hashpower upgrades

In this scenario, there is one full node enforcing the legacy rules and one miner with 1% of the hashpower producing blocks that conform to the soft fork rules. The rest of the full nodes are enforcing the new soft fork rules and the rest of the miners are mining blocks that conform to the legacy rules.

Since legacy blocks are incompatible with soft fork rules, and legacy miners have more hashpower than the one miner producing soft fork blocks, legacy nodes and soft fork nodes will each see two different versions of the blockchain. This creates a chain split, albeit one that progresses very slowly on the soft fork side since the soft fork miner has only 1% of the hashpower.

However this scenario is not as clear-cut as it may seem. Remember that all full nodes but one have upgraded to support the soft fork rules, while all but one miner with 1% of the hashpower are producing legacy blocks. The miners on the legacy blockchain have only one full node that they can sell legacy bitcoin to, since all of the soft fork full nodes are rejecting legacy blocks.

Either the one legacy node will have to have a lot of purchasing power to sustain the legacy miners’ hashpower or the legacy miners will have to quickly upgrade to conform to the soft fork rules so that their blocks will be accepted by the larger soft fork-supporting full node network. This scenario is most likely to occur as a User Activated Soft Fork, a soft fork that is intended to be signaled by economic full nodes ahead of the activation date to give the miners time to upgrade and avoid a chain split.

The winning blockchain in this scenario is uncertain, depending on the relative economic power of the nodes enforcing the new soft fork rules and their willingness to experience long confirmation delays in the event of a chain split. The longer they can wait after a split, the more economic pressure they can put on the miners to upgrade.

If the miners do not upgrade, the soft fork blockchain will need to attract substantial economic investment to keep it safe from a 51% attack. With enough investment in hashpower, the soft fork blockchain could cause either a sustained chain split or, if it can catch up and overtake the legacy blockchain, a blockchain reorganization that wipes out the legacy blockchain.

Only one full node upgrades and only one miner with 1% of the hashpower upgrades

SF - Only one full node upgrades and only 1% of the hashpower upgrades

In this scenario, there is only one full node enforcing the soft fork rules and only one miner with 1% of the hashpower producing blocks that conform to the soft fork rules. The rest of the nodes are enforcing the legacy rules and the rest of the miners are producing legacy blocks.

Since the miners producing legacy blocks have more hashpower than the one miner producing soft fork blocks, the legacy nodes will follow the version of the blockchain produced by legacy miners. However because legacy blocks are considered invalid by the one soft fork node, there is a chain split, albeit one that progresses very slowly since the soft fork miner has only 1% of the hashpower.

The winning blockchain in this scenario is almost certainly the legacy blockchain unless the soft fork blockchain attracts substantial economic investment to keep it safe from a 51% attack, in which case the soft fork blockchain could cause either a sustained chain split or, with enough hashpower, a blockchain reorganization that wipes out the legacy blockchain.

No full nodes upgrade and no miners upgrade

SF - No nodes upgrade and no miners upgrade

In this scenario, all full nodes are enforcing the legacy rules and all miners are producing blocks that conform to the legacy rules. No full nodes have upgraded to enforce the soft fork rules, so there is no chain split.

The winning blockchain in this scenario is the legacy blockchain.

Hard forks

A hard fork is a change to the bitcoin protocol that loosens the ruleset enforced by full nodes that upgrade to enforce the hard fork rules. A block that is considered invalid before the hard fork activates will be considered valid by upgraded full nodes if it follows the new hard fork rules after the hard fork has activated.

An example is a hard fork that increases the block size limit from 1MB to 2MB. Even though a 2MB block was previously considered invalid, full nodes that upgrade to support this hard fork will accept any blocks up to 2MB in size after the hard fork has activated.

Hard fork scenarios

In these example scenarios, I will show a hard fork “activating” even if there are no nodes or miners forcing activation simply for the sake of illustration. Imagine that there is software that would have activated the hard fork if it had been deployed. I will also assume that the new hard fork rules do not contain a soft fork rule that makes legacy blocks invalid.

All full nodes and all miners upgrade

HF - All nodes and all miners upgrade

In this scenario, there are no full nodes enforcing legacy rules. All full nodes have upgraded to enforce the hard fork rules and all miners are producing blocks that conform to the hard fork rules, so there is no chain split.

The winning blockchain in this scenario is the hard fork blockchain.

All full nodes but one upgrade and all miners but one with 1% of the hashpower upgrade

HF - All but one full node upgrades and all but one miner with 1% of the hashpower upgrades

In this scenario, there is one full node enforcing the legacy rules and one miner with 1% of the hashpower producing blocks that conform to the legacy rules. The rest of the full nodes are enforcing the new hard fork rules and the rest of the miners are mining blocks that conform to the new hard fork rules.

Since hard fork blocks are incompatible with legacy rules, and there is one full node enforcing the legacy rules, there is a chain split, albeit one that progresses very slowly since the miner producing legacy blocks has only 1% of the hashpower.

The winning blockchain in this scenario is almost certainly the hard fork blockchain. For all intents and purposes, legacy nodes and miners have been “forked off” the network. The only way the legacy blockchain could survive is if it attracts a substantial economic investment to keep it protected from a 51% attack, in which case there could be a sustained chain split or, with enough hashpower, a blockchain reorganization that wipes out the hard fork blockchain.

All full nodes but one upgrade and only one miner with 1% of the hashpower upgrades

HF - All but one full node upgrades and only 1% of the hashpower upgrades

In this scenario, there is one full node enforcing the legacy rules and one miner with 1% of the hashpower producing blocks that conform to the hard fork rules. The rest of the full nodes are enforcing the new hard fork rules and the rest of the miners are mining blocks that conform to the legacy rules.

Since legacy blocks are compatible with hard fork rules, but hard fork blocks are not compatible with legacy rules, the legacy blockchain will out-compete the hard fork blockchain and both hard fork nodes and legacy nodes will follow the legacy blockchain. As a result, there is no chain split.

The winning blockchain in this scenario is almost certainly the legacy blockchain. Although identical in network topology, this scenario ends differently than the soft fork version described above because hard fork nodes will not reject legacy blocks. So even though the vast majority of the network is running hard fork full nodes, there is no chain split and no economic pressure on miners to upgrade.

The only way the hard fork blockchain could win in this scenario is if it can attract substantial economic investment to catch up to the legacy blockchain and overtake it. If it can do that, then in the eyes of the hard fork nodes, the hard fork blockchain will cause a reorganization of the blockchain and wipe out the legacy blockchain. Legacy full nodes will not be aware of the hard fork blockchain and will be safe from a blockchain reorganization.

Only one full node upgrades and only one miner with 1% of the hashpower upgrades

HF - All but one full node upgrades and only 1% of the hashpower upgrades

In this scenario, there is only one full node enforcing the hard fork rules and only one miner with 1% of the hashpower producing blocks that conform to the hard fork rules. The rest of the nodes are enforcing the legacy rules and the rest of the miners are producing legacy blocks.

Since legacy blocks are compatible with hard fork rules, but hard fork blocks are not compatible with legacy rules, the legacy blockchain will out-compete the hard fork blockchain and both hard fork nodes and legacy nodes will follow the legacy blockchain. As a result, there is no chain split.

The winning blockchain in this scenario is almost certainly the legacy blockchain unless the hard fork blockchain can attract substantial economic investment to catch up to the legacy blockchain and overtake it. If it can do that, then in the eyes of the hard fork nodes, the hard fork blockchain will cause a reorganization of the blockchain and wipe out the legacy blockchain. Legacy full nodes will not be aware of the hard fork blockchain and will be safe from a blockchain reorganization.

No full nodes upgrade and no miners upgrade

HF - No nodes upgrade and no miners upgrade

In this scenario, all full nodes are enforcing the legacy rules and all miners are producing blocks that conform to the legacy rules. No miners have upgraded to produce hard fork blocks, so there is no chain split.

The winning blockchain in this scenario is the legacy blockchain.

Chain splits

As described in some of the scenarios above, a chain split is a scenario where there are two or more competing versions of the blockchain that share the same history up to the point that their rulesets diverge. While the term “chain split” can elicit feelings of fear among even the most battle-hardened bitcoin veterans, a chain split is not always the disaster scenario that some make it out to be.

As shown in the above hypothetical scenarios, it is possible for both a soft fork and a hard fork to cause a chain split. For example, in July 2016 a planned soft fork rule change called BIP66 led to a chain split and blockchain reorganizations due to some miners not validating the rules of the blocks they were mining on. Bitcoin recovered and here we are today.

Equally important to note is that it is possible for both a soft fork and a hard fork to avoid a chain split. The barrier to avoiding a disruptive chain split is much higher for a hard fork due to its incompatibility with legacy full nodes, but it is technically possible. For example, in August 2013 a planned hard fork was deployed in order to fix a bug that caused a chain split and blockchain reorganization in March 2013. The August 2013 hard fork resulted in virtually no disruption to the network since nearly all miners and economic nodes had upgraded their software by then.

It is also worth noting that chain splits can occur without a planned soft or hard fork rule change. A chain split can be caused by an unintentional incompatibility between two different versions of full node software, such as with the March 2013 chain split. Chain splits can even occur during normal bitcoin network operations as miners race to build a “winning” version of the blockchain that earns them new block rewards. The latter happens quite regularly, which is likely one reason why older versions of the Bitcoin Core wallet suggested waiting six confirmations before considering a transaction settled.

Sustained chain splits

The type of chain split that is perhaps most damaging to bitcoin, at least in the short term, is the sustained chain split. In a sustained chain split, there is sufficient economic and hashpower support on two or more versions of the blockchain to lead to there being multiple competing versions of the blockchain for an extended period of time. Holders of bitcoin on the “legacy” blockchain will also control an equal balance of “forkcoin” on each version of the blockchain that is extended when the divergence occurs.

There are several technical issues that can arise with a sustained chain split. One is the issue of replay attacks, where transactions meant for one blockchain are confirmed on another, which can lead to accidental losses of money. Another issue is the blockchain reorganization, where one version of the blockchain gets overtaken by another, potentially leading to a loss of funds by users who were relying on the history of the blockchain that was overtaken.

One of the biggest issues with a sustained chain split is longer-term and more social than technical: which blockchain gets to keep the name “bitcoin”? And will the brand confusion between the multiple competing versions of the blockchain damage investor confidence in bitcoin? These are questions that cannot be answered with a simple software patch, instead requiring subjective decision-making on the part of developers and industry leaders with regards to branding and public relations.

What these differences mean for bitcoin now and in the future

The version of SegWit that is activating soon is a soft fork. As of the time of this writing, 100% of the last 100 blocks are signaling support for SegWit (you can monitor this progress here). If this trend continues, then SegWit will activate with 0% chance of a temporary or permanent chain split. However three months after SegWit activates, btc1 will trigger the activation of the Segwit2x hard fork. Miners representing over 80% of the network hashpower committed in writing to supporting Segwit2x, leaving 20% who may continue to support the legacy blockchain, or possibly another blockchain, potentially causing a temporary or sustained chain split.

There is also the possibility of an “emergency” hard fork (EHF) at the time of the Segwit2x hard fork if there is a large enough part of the economy that rejects Segwit2x. This EHF may include a difficulty adjustment and/or a change to the Proof of Work algorithm to preserve the usability and security of the EHF blockchain. If users take this route, then Segwit2x could still lead to a chain split even with 100% legacy miner adoption. The probability of this happening depends on how strong the negative feelings are that users have towards Segwit2x.

This year will be looked back on as a pivotal year in the history of bitcoin. Given the incentives built into the system, I am confident that bitcoin will come out of all of this stronger than it was before. Multiple forks of the bitcoin blockchain may be competing for liquidity as a result of various fork proposals, and that’s okay as long as there is no unnecessary brand confusion in the marketplace. The incentives ensure that miners will eventually converge on the most valuable blockchain, or else go bankrupt.

I know what blockchain I’ll be using: the blockchain that secures the most value, with the most hashpower, the greatest potential for future adoption, and the best ability to preserve the “golden rule” of transaction immutability.

Header image via http://distributingchains.info/resources/the-blockchain-is/

Bitcoin tips accepted:

Bitcoin address (what’s this?) (QR code)

1Cj8hNg9joC8FnS8D2FVFCvQUVy975VJZi

Bitcoin payment code (what’s this?) (QR code)

PM8TJSxeAdmFzCyejSZsKwD5AN1Zxqm5Y4px6bJYTS63Lvu9x6patBZKHo693QCHxYKjgvZwrZN5cmgzwQgNzUPpri42NYHkhTe7A8cZoC6fdHDhS7TJ

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s