As the adoption of blockchain grows, so does the need to understand the lexicon around it. A fork is a common blockchain technical term used specifically in the ongoing scaling debate, yet it causes a lot of confusion, particularly for those new to the technology.

Knowing what it means puts you in a better position to follow discourses at Bitcoin events and in online forums.

A recap: The Blockchain

The blockchain is a public ledger on which the Bitcoin peer-to-peer network records transactions. The network arrives at a consensus on the status of the ledger through rules defined in the core software.

Transactions confirmed in a timespan of ten minutes form a batch known as a block. Computers in the network, known as miners, compete (mine) every ten minutes to put transactions into a block, hash the block, and broadcast the value to the rest of the network.

The first miner to complete these tasks within the rules stipulated in the core software has its block recognised as valid. The new block attaches to the previous block in a chain (blockchain) and the miner receives a reward of newly released bitcoins—currently 12.5.

Once the network learns that a valid block has been found, the process of mining begins again to find the next one. A fork happens when the blockchain splits into two branches and miners have to find new blocks on both.

Disagreements over transaction history

The common cause of a fork in the blockchain is failure by miners to agree on the sequence of newly mined blocks. This happens when two miners find valid blocks almost at the same time. The miners are then confused about which of the two branches to add the next block. Some will mine on one and others on the other, creating a split in the network.

Since the odds of finding the next blocks on both of the branches at the same time are low, one branch grows longer than the other. Soon miners drop (orphan) the shorter one and join the one that is longer.

Forking happens several times in a week, but resolves itself with little setback to users. No transactions are lost during the normal forking process. Transactions on the orphaned block, if they were not already added to the valid block, are rebroadcasted to the network and added into the next valid block.

Changing rules

Another situation that can cause the blockchain to fork happens when participants in the Bitcoin network disagree on the rules to follow for confirming transactions and blocks. This type of fork is deliberate and happens when some miners or nodes upgrade to a new version of the core software that contains a new set of rules.

The process of adding new rules to the Bitcoin core software starts when a developer proposes changes through a Bitcoin improvement proposal (BIP), an announcement and explanation to the community. The developer provides the code and describes how it will improve the network.

After the Bitcoin community debates the changes, supporters collaborate to release a new version of the core software that contains the changes. If the entire network upgrades, a fork is avoided. If any portion of nodes fail or choose not to upgrade, however, and instead they continue running the old version of the software, a fork will happen.

Soft versus hard forks

Forks caused by a change in rules or protocol occur as one of two types: soft or hard. A “soft fork” occurs when new rules in the core software recognise as valid the blocks that have been mined using the old version.

When the newer rules no longer recognise blocks from miners running the old rules, this results in a “hard fork.”

Forks enforced by miners or full nodes

Bitcoin’s peer-to-peer network is made up of miners and full nodes. Miners add and secure transactions in blocks, while full nodes confirm miners are following the rules in the core software. Full nodes also broadcast new transactions and finished blocks across the network.

Finally, forks are also categorized in one of four ways, depending on whether full nodes or miners enforce changes to the mining rules. These are:

  • User-activated soft fork (UASF)—a soft fork enforced by full nodes that refuse to validate blocks from miners who choose not to run a version with specific rules.
  • User-activated hard fork (UAHF)—a hard fork enforced by full nodes in a manner similar to a UASF.
  • Miner-activated soft fork (MASF)—a soft fork enforced by miners that upgrade to a new version of the core software.
  • Miner-activated hard fork (MAHF)—a hard fork activated by miners in manner similar to MASF.

The fork feature is necessary for the growth, scaling and improvement of a blockchain project. It offers an opportunity for users, miners and developers to propose changes to the protocol and influence the path they want the project to follow.