In Hyperchain system, the main data structures are Hyperblocks and Local Chains. Hyperblocks are used as forward dependency data blocks for Local Chains in periodic consensus, and when consensus is completed, a new Hyperblock is generated to provide integrity verification for Local Chains. Hyperblocks and Local Chain blocks are interrelated and can be mutually verified.
Hyperblock
The Hyperblock data structure consists of two parts: the block header and the block body.
The block header stores the Hyperblock ID, block version number, predecessor Hyperblock hash, global consensus script hash, Local Chain index information, and timestamp. The expandable information field also includes system reward rule identifiers, cross-chain record verification information, and Local Chain data payload scores.
The block body stores consensus reward records, global consensus scripts, all Local Chain block verification information, and the signature of the Hyperblock generator.
Local Chain
A Local Chain consists of a series of forward-dependent Local Chain blocks, also known as Local Blocks. The data structure of Local Blocks is also divided into block headers and block bodies.
The block header contains the block version number, block ID, predecessor block hash, predecessor Hyperblock hash, verification information of the block body, verification information of the Local Block data payload, local consensus script hash, and timestamp. The optional information field includes application type identifiers, random number salts, etc.
The block body contains the local consensus script, data payload, and the signature of the block generator.
Support for applications by data structures
At least one blockchain is required to support business operations in a blockchain application. In Hyperchain, applications can use a single-chain blockchain logically composed of Local Blocks to meet business needs. The internal structure and logical dependencies of the data payload in the Local Blocks are customized by the application when participating in consensus. By saving the Hyperblocks and Local Block data related to the single-chain business on the node, the application can ensure the continuity of its business operations.
To create a single chain for an application, you simply need to utilize the program interface provided by the Hyperchain node. By submitting a genesis block that includes application-specific information and consensus rules, and get it confirmed through consensus, you can import this genesis block and consensus rules into any Hyperchain node. Once imported, the node can actively participate in the consensus block generation process for the application’s single chain.