1. Home
  2. Docs
  3. Hyperchain data structure and algorithm in a nut shell
  4. Maintaining consistency

Maintaining consistency

The unified addressing chain space is the main index for Hyperchain nodes to maintain data global consistency.

In Hyperchain, the relationship between Hyperblocks, Local Chains, and Local Chain blocks is formed during consensus. This relationship is determined by forward-dependent data structures and hash integrity verification.

Hyperchain data consistency tracing is divided into two parts: Hyperblock tracing and Local Chain tracing.

Hyperblock tracing

Nodes request the latest global Hyperblock from neighbor nodes and save the latest global Hyperblock confirmed by the majority of nodes.

If a node cannot obtain the latest global Hyperblock recognized by the majority of nodes from its neighbor nodes, it needs to wait for a random period of time to obtain the latest global Hyperblock again.

When a node obtains the latest Hyperblock, it starts to obtain the predecessor Hyperblock from neighbor nodes and verify the data integrity. This process will continue to iterate until the obtained Hyperblock is the latest Hyperblock cached locally before this tracing or the genesis Hyperblock.

Local Chain tracing

After the Hyperblock tracing iteration is completed, for multiple Local Chains between any two consecutive Hyperblocks, nodes can expand the tracing of one or more Local Chain block data according to their needs.

Finality

The finality strategy can be determined by nodes themselves. The chain space allows for explicit finality or probabilistic finality during consistency tracing.

With explicit finality strategy, nodes can avoid the problem of optimal chain oscillation by taking the risk of system forking or halt.

With probabilistic finality strategy, nodes can avoid the problem of forking or system shutdown by taking the risk of optimal chain oscillation.

Forking has a negative impact on finality, and Hyperchain provides a fast detection algorithm for nodes to recognize forks and determine their own fork. By using binary search on their own set of Hyperblocks, nodes can quickly generate a hash root to identify the fork. By comparing with the hash roots of other nodes, nodes can determine whether their fork is also recognized by other nodes, and then decide on which fork to maintain finality status based on their own needs.

Was this article helpful to you? Yes No