What is the Blockchain Fork?

The fork of blockchain needs to start from ‘system upgrades’. As we all know, blockchain builds decentralized system, while most of our traditional systems are centralized.

For centralized systems, the upgrade is relatively simple, mainly including Sever Upgrade and Client Upgrade. For Sever Upgrade, as long as they are deployed in the background, you can carry out the key upgrade. For the Clients Upgrade, you can choose to upgrade directly in the software library or APP store, and the inconsistent version of the terminal will not affect the use of its services by customers.

For decentralized systems, the upgrade is more complex. Since it has no central organization and sever, there is no server upgrade. For terminal upgrades, you can download, install, and then complete the upgrade in their respective communities. It should be kept in mind that inconsistent terminal version can affect customers’ use of their services and eventually lead to fork.

Blockchain fork refers to the divergence of opinions in the upgrading process of blockchain, which results in the fork of blockchain, that is, the terminal version is inconsistent. Without centralized institutions, every ‘code upgrade’ of digital currency needs to be unanimously recognized by the community. And if the community can’t agree, blockchain will fork.

‘Upgrading’ may lead to different ‘consensus mechanisms’, which can be divided into the following types:

Consensus algorithm: NBFT/CFT: Paxos、Raft;BFT:PBFT、 POW、POX

Block size: 1MB、2MB、8MB、32MB、64MB

Account model: UTXO、Account balance

Difficulty in mining: Time interval、Hash function

Monetary aggregates

Blockchain fork classification

In the case of blockchain upgrade or terminal version upgrade, if the blocks in the new version and the old version are compatible with each other, it is called ‘soft fork’. If not, we call it ‘hard fork’.

Both soft and hard forks are ‘backward compatible’ so that new nodes can verify blockchain from the beginning. The soft fork can also be ‘forward compatible’, which means that the old version of the terminal can accept the blocks generated by the new version of the terminal, as shown in the figure below.

The longest chain principle of bitcoin

In bitcoin mining, when two miners work out a problem or hash value at the same time, it means that they have successfully mined at the same time. In this case, two miners will generate two blocks with different data. Let’s analyze these two blocks.

The first transaction recorded in these two blocks was the CoinBase transaction. The deal does not have a forwarding address, because no one pays the miners this money, which comes from the system. As a result, miners can legitimately record that they have earned 12.5 bitcoins; Since all nodes recognize the miners’ records, the miners receive the income. Since each miner only transfers mining income to his own address, and because each miner’s address is different, the first record in the two blocks must be different.

In addition, the transaction data packaged in the two blocks is also different. Due to the different transaction costs, miners will prefer to package higher transaction. When the same transaction fee exists, each miner will have different choices.

Since the two miners have different block data, the result of solving the problem is also different, that is, the hash value calculated is different, but both are correct answers, only the blocks are different. As a result, there are two different blocks in the blockchain that meet the requirements.

So what should all the miners do now?

Since the distance of network broadcast in blockchain is different, miners will receive a block first according to the distance. Normally, miners copy the block they received first and then start a new mining in the block. So, what happens?

Taking the POW consensus mechanism as an example, starting from the fork block, since different miners follow different blocks, there are differences in hash rate on two different fork chains.

Since the hash rate is proportional to the number of miners, the two chains grow at different rates, and over time, one chain is always longer than the other.

Miners always think the longest chain is right. When a miner finds a longer chain in the whole network, he will abandon his current chain, copy back all the new longer chain, and continue mining on the basis of this chain. Once all the miners have done that, the chain becomes the main chain.

As shown in the figure below, the forked chain is discarded and then disappears. In this process, all miners follow the same mechanism, which is ‘follow the longest chain principle’.

Blockchain fork analysis

Blockchain fork includes the following four cases:

1. Internal mechanism of blockchain — blockchain generates lone blocks (soft fork);

Due to technical reasons such as network delay, there may be two different content for normal bookkeeping of digital currency. When one block is followed by more blocks, the other block and the short chain behind it will be abandoned and become ‘lone block’, which is called ‘follow the longest chain principle’.

2. Terminal version upgrade — soft fork;

Soft fork means that the old nodes are unaware that the blockchain code has changed and continue to accept blocks created by the new nodes. Miners may not be aware that the blockchain has forked.

3. Terminal version upgrade — hard fork

Hard fork upgrade requires everyone to upgrade to the new version, if someone still uses the old version, will produce two mutually recognized fork chains, then the ‘longest chain principle’ is invalid. But the old version of block is usually not supported by transactions, block reward is worthless. So when users of old version find that no one is following him to produce blocks, they will immediately update the version, and the chain of the old version will disappear.

4. The diversion of community, chain and token — permanent fork (hard fork)

If two incompatible versions do not coexist by accident, but because some people support the features of different versions and firmly oppose the other one. Two versions have always been supported to run at the same time, and each does not accept the other version of the characteristics of the chain. Therefore, the new blockchain is permanently divided into two chains, the tokens recorded on the chain are divided into two types, and the community is also divided into two communities.

Conclusion

When will blockchain fork disappear?

Internal mechanism of blockchain — blockchain generates lone blocks (soft fork);

Terminal version upgrade — soft fork;

Terminal version upgrade — hard fork

When will blockchain fork not disappear?

The diversion of community, chain and token — permanent fork (hard fork)

The permanent fork is not a technical one, but a human and profitable one, for now, seems intractable.

--

--

Trustworthy and Reliable Intelligent Autonomous Systems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store