Operation Flow

The HyperGraph project is based on serving high-performance public chains to meet the data needs of the application development boom, while reducing the threshold of developers and the cost of maintaining back-end services by itself.HyperGraph aims to build a high-performance blockchain data service network, and this high performance includes two aspects, on the one hand, meeting the needs of high-performance blockchains like HECO, and on the other hand, it must itself meet the needs of decentralized services while having efficient service capabilities. On the other hand, it must be able to meet the decentralized service itself while having efficient service capability. In this data service network, HyperGraph core developer team builds infrastructure and standards, provides development, optimization and maintenance solutions, and coordinates network operation. Index nodes build network nodes according to standards, provide data storage, index query, API services, etc., and participate in the joint construction of the network to gain revenue. Developers define data acquisition needs according to their own business and use network resources to serve their own and third-party business needs. Pass holders can pledge their passes to support network node construction and gain value-added revenue from their own digital assets, forming an overall effective data service ecology.


In order to provide high-performance blockchain data services, HyperGraph develops standards and works with various participants to build a cloud-based infrastructure, which consists of two parts, a data indexing network consisting of the underlying layers of each node and tools, APIs and user interaction interfaces using the cloud-based facilities. The schematic is shown in Figure 1, where it is important to note that the nodes in Figure 1 are not operated by a specific entity in the network, but are decentralized node members in the HyperGraph network. The incentive coordination between them is also coordinated by the contracts on the blockchain with each other and messaging, truly allowing developers to apply HyperGraph services to achieve full-stack decentralization.

Developers interactively submit their own requirements for data querying and indexing through the interface, such as GraphQL query language, sub-graph dataset definition, etc. Use the tools for easy querying and node construction, querying data using APIs or combining the HyperGraph API with the Web3 API to initiate services such as meta-transaction signatures to the HyperGraph network.

Data Indexing

Unlike the traditional database, the data stored on the blockchain does not have the concept of fields, and there is no relational query language available, and all applications share the same repository. Therefore, it becomes extremely difficult to query data compared with traditional database. Take DEX business as an example, there is no quick way to query the transaction volume and transaction details of a transaction pair within a certain time period. This is a very inefficient way of calculation.

At present, there are projects like TheGraph that provide open source processing, but there are two key points, one is that the majority of open source software currently only supports the Ethernet network, and for the time being, it does not quickly support other high-performance blockchain networks, and even if it does, it has a relatively long time cycle. The second is that those services themselves are designed to rely on the Ethernet network, many of the design, especially the performance and so on is not optimized for high-performance blockchain networks.

Of course developers can also build their own data analysis nodes using open source software, just like the era of no cloud computing, users also set up their own servers to IDC. but self-built nodes have the following costs and risk points.

1. DApp projects focus on the development of their own business logic, smart contracts, etc., and then increase the deployment of server-side nodes, which puts higher requirements on personnel and inevitably increases manpower costs

2、Because the blockchain public chain storage itself is large, the full node mode requires more storage space and good machine performance, and synchronizing the full amount of data for its own partial business query brings a waste of hardware cost.

3、Building query index nodes by itself is a pure input, and there is also a single point of failure to some extent. The accumulation of experience in performance and other aspects of optimization is also a longer-term process.

To sum up, HyperGraph has built a data indexing network in order to let developers focus on their own business. HyperGraph chooses the hardware and software to match the data network for open source software that can support data indexing, specifically for high-performance blockchain, and does optimization of parameters, storage, and other aspects to be able to scale in parallel and add some special features. At the same time, the index nodes are not only provided by HyperGraph developers, but also use HGT to incentivize to build nodes together, on the one hand, more decentralized, better avoid single point of failure, and improve the quality of service by user voting and incentive. On the other hand, it also forms a larger data indexing network to leverage the value of data.

Business Interaction

Figure 2 outlines the specific data and business interaction flow, which is illustrated here with a concrete example. Taking the user's Swap digital asset on DEX as an example, it illustrates how the data is generated from the user side, then stored on the blockchain network, then analyzed and stored by the index node, and then fetched by the front-end developer for display.

1. DApps are generally Serverless applications, which means that there is no database on the server side and no dynamic scripts for server-side processing directly related to the user. The program consists of two parts, one is the smart contract, responsible for routing, transaction pair generation, transaction and liquidity pool logic processing, etc., deployed on the blockchain, and the other part is static resources and scripts, including images, CSS, JavaScript, etc., deployed on the static server and provided to the user through CDN acceleration, and the user interacts with the DApp through the wallet's support for the Web3 API to interact.

2. Users use DEX to exchange from one asset to another. For example, using HUSD to exchange WHT, the user selects the currency of the transaction pair on the interface, as shown in Figure 3.

3. Since the first time to use HUSD HRC20 Token, so first to Approve, Approve is to authorize the contract to use your Token amount, and then Swap, since HUSD and HT do not have a direct liquidity pool or a direct liquidity pool does not have the ideal price, and now there is better liquidity or more ideal price of HUSD and HBTC and HBTC and WHT (WHT can be understood as the HRC20 mapping of the native Gas asset HT) pool, so add a layer of intermediate exchange, by the contract automatically converts HUSD into HBTC and then into WHT, thus completing the process of the user getting HT.

4. Such an operation involves a considerable number of operations and entities, including the user (a certain address), routing contracts (for forwarding transaction routes), transaction contracts (to handle multi-layer exchange logic), transaction pair contracts (to update the inventory of transaction pairs), the various currency contracts involved (to check the ownership, balance, etc.).

5. In this process, in addition to the obvious transaction from one address to another such transaction, there will be a large number of events generated, there are authorized Approval, Swap, Sync, etc. of exchanging assets, as shown in Figure 4

6. It is due to the generation and up-chaining of these events that there is not only a need for data analysis, but also a rich source of data analysis. HyperGraph network nodes continuously analyze and scan high-performance blockchain data according to the definition of requirements, and analyze the data defined in the sub-graph requirements. Since HyperGraph is optimized for high-performance blockchain, it has more custom optimization means and node optimization suggestions to ensure efficient operation compared to Graph Node on the Ethernet network.

7. HyperGraph nodes process data according to defined subgraphs and transaction handlers. For events in the blockchain network, HyperGraph built-in procedures create and update entities in HyperGraph's storage database.

DApps, or pages that do not support Web3, can also access remote query data. Developers use GraphQL to make queries to HyperGraph remote nodes. The data is obtained in JSON format and returned. Then the developer displays it on the interface as needed.

This iteration completes the process of using the HyperGraph node.

Last updated