Chain Reorg Explained: An Introduction to Chain Reorganisation in Blockchain Technology
Blockchain technology is a combination of complex processes that guarantee the safety and reliability of data distribution in a decentralized manner. It can also be described as a system of recording information in such a way that it becomes difficult or impossible to change, hack, or cheat the system.
Sadly, despite its limitless potential, blockchain technology is not entirely flawless, and regularly has to deal with a variety of obstacles, including one inherent in hard forks. For the purpose of clarity, a fork refers to a radical change made to the protocol of a blockchain network that effectively results in the split of its block.
While forks can be carried out due to various factors, they can have the adverse effect of resulting in a less secure network, leaving it vulnerable to malicious attacks. One of the ways to mitigate the impact of this, is through chain reorganization (aka., chain reorg). In this article, we will provide an in-deoth explanation of what chain reorg means in the blockchain sector, how it works, and what role it plays across different blockchain networks. First off, let us examine the base concept of chain reorganization.
Understanding Chain Reorganization
To grasp the concept of chain reorganization, one must first understand some key fundamental concepts in blockchain technology. Among these fundamental concepts is the node operator network—a composition of specialists responsible for the secure distribution of data on a given blockchain network.
Notably, each active copy of a distributed ledger or blockchain is stored by a node, which is equally responsible for the reliability of the stored data. Moreover, nodes must keep their copies of the blockchain up to date in order to enable them to effectively authenticate transactions made on a blockchain network within which they operate.
To put it in other words, blockchain nodes are network stakeholders whose devices (i.e., validating/mining hardware) are authorized to keep track of the distributed ledger and serve as communication hubs for various network tasks. More specifically, a blockchain node’s primary task is to confirm the legality of each subsequent batch of network transactions, known as blocks.
In this regard, it is important to note that there are numerous parties involved in a network of nodes; each node in the network is allocated a unique identifier to easily distinguish one node from another.
When a node validates a blockchain transaction, a new block is generated and added to the existing chain of blocks, which act as data storage units within the network. While that may sound like a simple task, validating nodes are sometimes overwhelmed by bulk orders and are forced to place pending transactions into groups, rather than confirm them individually.
Likewise, because numerous nodes (in this case, validators) compete for the same task, especially on blockchain networks that utilize a Proof of Work (PoW) consensus algorithm, multiple blocks (usually two) may be generated simultaneously, resulting in a fork – multiple blocks containing an identical, or near-identical history of transactions.
It is at this point that a chain reorganization is effected, implying that the confirmed block is propagated to all of the nodes across the network in order to ensure its validity, while the replica block is eliminated or set aside as an “orphan block”, whereby all transactions within are marked as invalid. So how does chain reorg work from a technical angle?
How/When Does Chain Reorganization Take Place?
Chain reorg typically occurs when two nodes independently mine a new block simultaneously, typically as a result of network congestion, or targeted attacks. However, that’s not the issue here. The main problem arises when each of the miners responsible for the resulting duplicate block need to decide which block was first, and should therefore be retained in the existing string of blocks.
In such a case, one resolution would be to implement the “longest chain rule (LCR)”, which suggests that the longest chain is the more valid one, implying that the longer the chain the more effort it took to build.
What does this mean? You may ask. Adding a new block to the blockchain requires significant processing power, meaning that each block in the chain consumes energy to get there. So, the more blocks present in a chain, the more energy it will have taken to build compared with a chain of fewer blocks; as a general rule, nodes will adopt such chains over shorter ones.
Essentially, the block in a node’s previous longest chain will be deactivated in favor of the blocks in the new longest chain. In this case, a block would be deleted or removed from the blockchain to allow for more blocks to be added to the chain.
In the event that the miners of the duplicate blocks fail to address the conflict appropriately, another resolution would be to decide based on the discretion of the node that would add the subsequent block. In other words, the node adding the next block has to choose which side of the fork is the correct chain.
If no resolution is reached through these methods, the alternative is the possibility of a reorganization attack, through which nodes would receive blocks from an entirely new chain, while the old chain continues to run in parallel. The result would be that the chain is split, creating a “forked”, or duplicate, version of the blockchain.
Advantages of Chain Reorg
Chain reorganization offers many advantages to any blockchain, including, but not limited to, the following:
1. Increased efficacy in blockchain operations—a unified ledger that runs on each node would be impossible to maintain without chain reorganization.
2. Assurance that all nodes are running on the same copy of the ledger, thereby ensuring that all recorded transactions are valid and minimizing the chance of errors.
3. The chain reorganization process is quite easy to carry out and will work effortlessly.
Drawbacks of Chain Reorg in Blockchain Technology
On the other side of the coin, chain reorganization can bring some notable effects to a blockchain, including increased node costs, transaction delays, poor user experience, uncertainty, and vulnerability to attacks. Let’s break those down a little further:
1. Increased Node Fees: Over time, reorg often results in an increased number of nodes in a blockchain. Such state changes require substantial amounts of additional memory and disc space when moving to a new fork, thereby increasing costs.
2. 51% Attacks: 51% attacks occur when illicit actors control 51% or more of the nodes in a network. By ousting miners that have not “reorged,” hackers can launch a “double-spend attack”, in which the cryptocurrency held on the duplicated chain is spent, or in other cases, pending transactions are forcefully reversed.
In some cases, a malicious miner or group of miners that control a new block prevent other participants (i.e., minority nodes) on the network from participating its its development. By taking control of the majority of the network’s mining power in this way, the exploiters are able to a new branch of the blockchain and force the rest of the network to recognize it as genuine. If any transactions are executed before the hackers complete the “fork”, they are undone.
3. Transaction Delays: Reorgs also increase the potential for delayed transactions. This can lead to serious issues for exchanges, as they mostly rely on their transactions being completed on time, or face the implications to their liquidity of having to wait extended periods for deposits to be processed.
What Happens to Reorg After the Merge?
It is no longer news that the Ethereum Network has completed its transition from PoW to PoS, unifying both infrastructures in its most recent upgrade – ‘The Merge‘. However, the change in operational model has left many wondering what the network’s next steps are, given that the legacy infrastructure still utilizing PoW is likely to be heavily affected by chain reorg.
The challenge facing a reorg will only continue increase gradually over time. Therefore, with the Ethereum Beacon Chain implementing the Proof of Stake consensus mechanism, a new fork rule, dubbed ‘Gasper‘, is set to be introduced
With Gasper in place, attacking the entirety of the Ethereum blockchain becomes extremely difficult, as the new rule further introduces what is described as “attester votes and attestations“.
According to Ethereum’s official website, attestation is a new voting method by which validators must vote in favor of a specific validator’s view of the chain, particularly in terms of the most recently justified block, and the first block in the current epoch (known as the “source“ and “target“ checkpoints).
In general terms, the Gasper fork choice rule intends to give more weight to blocks, making them more tamper-resistent and, ultimately, less vulnerable to malicious attack.
Essentially, anyone looking to take control of the validation process would first have to control the attesters. This means that attacks on a select few controlling validators would have to contend with hundreds of thousands of attesters, making single-block reorgs more difficult.
Why You Should Care
Chain reorganization typically ocurrs when two blocks are mined simultaneously. There is no set number of blocks that any given chain reorganization can cover, and, depending on the specific situation, they tend to be executed across various blocks.
The technical methodology is an important aspect of blockchain technology. Despite the drawbacks it has the potential to bring, blockchain operations cannot yet afford to replace the complex process, as it often goes a long way in ensuring the seamless operation of a blockchain.
Find why RPC is critical for blockchain development:
What Is RPC and Why Is it Crucial For Blockchain Development?
Learn more about blockchain and its use cases:
Blockchain Use Cases: Top 12 Real World Applications For Blockchain Technology in 2022
Text source: DailyCoin.com