Blockchain Basics - Fork


A Blockchain is a decentralized database that is composed of a network of computers which have a copy of Blockchain node software running. A Blockchain uses a chain of blocks to store the data. Blocks in the chain are created and exchanged among nodes based on consensus.

The chain of blocks is synced to every single node in the Blockchain network. Same as any other software, the Blockchain node software could have bugs or feature changes. When bugs or feature changes are related to block formation and validation rules, we need to create a fork.

The DAO Hack

Ethereum is a version of Blockchain that supports smart contract. A smart contract is a program that runs automatically when all conditions are met. It is a very efficient way to fuel business activities. DAO stands for Decentralized Autonomous Organization. It is a smart contract framework written with Solidity for Ethereum. Its goal is to codify the rules and decision-making apparatus of an organization, eliminating the need for documents and people in governing, creating a structure with decentralized control. A DAO is not owned by anyone.

Here’s how it works.

  • A group of people creates a DAO with their own contract terms (rules) on Ethereum
  • Fund the DAO by selling the tokens
  • After the funding period, the DAO begins to operate
  • People then can make proposals to the DAO on how to spend the money, and the members who bought tokens can vote to approve these proposals

The creator of DAO is a German startup, A company building smart locks that lets the people share their stuff in a decentralized version of Airbnb. launched an instance of DAO framework, The DAO, on April 30, 2016, with a 28-day funding window. It was very popular and raised $150m. After the initial funding period of the DAO, Stephan Tual, one of The DAO’s creators announced on 12th June that a “recursive call bug” hand been found in the DAO framework. At that moment, more than 50 project proposals were waiting for The DAO’s token holders to vote on them. The Ethereum network has no much bugs and has been working perfectly all the time. While programmers of DAO framework were working on fixing bugs, an unknown attacker began using the bug to start draining ether collected in The DAO. By Saturday, 18th June, the attacker managed to drain more than 3.6m ether into a “child DAO” that has the same structure as The DAO. How to fix it? The answer is Fork.

What is Fork?

A fork is a chain difference that happens at one point on a Blockchain. It is a result of changes in the block creating and validating rules.



There are two types of forks: Accidental fork and Intentional fork.

Accidental fork

Accidental fork, also called temporary fork, happens when two or more miners find a new block at nearly the same time. Therefore, multiple chains are co-existing at that moment. Different chains start to race with each other to see which chain grows longer. Eventually, the longer chain wins the race and overtake the short chains. The Blockchain network consolidates to one unique chain again.

Intentional Fork

Intentional fork, also called permanent fork, happens when common rules are changed. On a Blockchain, all nodes create and exchange blocks based on common rules. Blocks created without following those common rules are treated as invalid and will be rejected by the Blockchain network. However, the rules could have limitations or bugs. Therefore, they need to be changed to provide improvements or fixes. After rules are changed, new blocks are different with old blocks, therefore, the Blockchain network starts to have two chains. The intentional fork may not be resolvable, means those two chains co-exists forever and split the network into two.

There are two types of intentional forks: soft fork and hard fork.

Soft fork

A soft fork is a change to common rules. The change is forward compatible. The new rules allow a subset of the previous valid blocks, therefore all blocks that are valid in the new rules are also valid in the old rules. This means only nodes that create blocks need to be upgraded to only create blocks to follow new rules. Therefore, only miner nodes need to be upgraded. One example of a software fork is a change to implement BIP 66 (Bitcoin Improvement Proposal 66) for Bitcoin. It changed Bitcoin’s signature validation rules.

Hard fork

A hard fork is also a change to common rules. The change is not forward compatible. Old blocks are still valid in the new rule, but new blocks are not valid in old rules. Because all existing nodes can’t accept new blocks anymore, so everybody needs to upgrade their node software to accept new blocks. One example of the hard fork is Bitcoin Cash. It is a change for Bitcoin to introduce 8mb block size. Because not every node on the Bitcoin network agree on this change, so the original Bitcoin network was split into the Bitcoin network and Bitcoin Cash network.


Another example is that a change to MAX_BLOCK_SIZE made by Satoshi Nakamoto. This change introduced a hard fork for the Bitcoin network in 2010.

Solution to The DAO hack

On June 17, 2016, Vitalik Buterin, the co-founder of Ethereum, proposed a soft fork which will mark any transactions that make calls/callcodes/deletatoncalls to draw money from The DAO and children DAO as invalid. The soft fork is starting from block 1760000. It is just a temporary remedy to prevent people from spending Ether from The DAO contract or its children contract. On July 15, 2016, Jeffrey Wilcke proposed a hard fork to move all Ether from The DAO and children DAO to a refund smart contract. The new contract would have only one function: withdraw. But, not everybody agrees on the hard fork. Nodes who agree on the hard fork upgrade their full node software to get the changes. Nodes who don’t agree on the hard fork continue to use the existing full node software. The network is split into two: Ethereum and Ethereum Classic. Correspondingly, the source code of Ethereum on Github is forked into a new project organization, Ethereum Project.

Some Major Forks

There are many forks in cryptocurrency/blockchain history. Those forks either dramatically impacted the Blockchain community or generated new cryptocurrencies. The following are some examples,

Bitcoin Cash

  • Forked from Bitcoin at block 478558, August 1, 2017
  • The purpose of this fork is to increase bitcoin block size limit

Bitcoin Gold

  • Forked from Bitcoin at block 491407, October 24, 2017
  • The purpose of this fork is to restore the mining functionality with common GPU

Bitcoin Private

  • Forked from Bitcoin at block 511346, February 28, 2018
  • The purpose of this fork is to set sender, receiver, and amount as private

Ethereum Classic

  • Forked from Ethereum at block 1920001, July 20, 2016
  • The purpose of this fork is to not have changed for the DAO hack

Because Blockchain is a decentralized database, it is much more difficult to maintain than regular software. An intentional soft fork or hard fork should only be considered when there are no other alternative solutions. A successful fork needs consensus from major nodes on a network.

Similar Articles