Efficient data retrieval method based on improved block storage structure

By designing a three-layer search model in the blockchain, combining the improved Merkel tree and B+ tree structure, the problem of low blockchain data retrieval efficiency is solved, fast and stable data retrieval and scope query are achieved, and the improvement of the Blockchain data retrieval performance.

CN112800065BActive Publication Date: 2024-11-22BEIJING UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110182161.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-09
Publication Date
2024-11-22
Estimated Expiration
2041-02-09

AI Technical Summary

Technical Problem

Data retrieval efficiency in blockchain is low. The existing technology needs to traverse all data in terms of query, resulting in inefficiency and increasing traffic.

Method used

A three-layer search model was designed, combining the improved Merkel tree and B+ tree structure, and by adding index data on nodes, the data retrieval capabilities are improved, scope query is supported, and the effectiveness of the tree structure is verified through experiments. and usability.

Benefits of technology

It improves the speed and stability of data retrieval, shortens the query path, realizes rapid retrieval of thousands of data, maintains retrieval efficiency within the average time, and supports scope query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112800065B_ABST
    Figure CN112800065B_ABST
Patent Text Reader

Abstract

The present invention discloses an efficient data retrieval method based on an improved block storage structure. According to the efficiency problems existing in the current blockchain storage and retrieval, starting from the block structure, a three-layer retrieval model based on the blockchain system is firstly proposed; secondly, according to the advantages of stable search performance and short query path of the B+ tree, combined with the excellent verification performance of the Merkle tree, the storage structure of the Merkle tree is improved, and corresponding index data is added to the nodes. Under the premise of ensuring the verification efficiency, the data retrieval capability is improved, and range query is supported, and corresponding construction algorithm and query algorithm are designed; finally, the effectiveness and usability of the proposed tree structure are tested through experiments, and it has good query performance and stable performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a data retrieval method in a blockchain, mainly aims at the design of a data structure of a block in a blockchain, and designs a data retrieval model based on the blockchain, belonging to the field of blockchain. Background Art

[0002] Blockchain technology has the characteristics of decentralization and immutability. It can safely and effectively reduce the cost of new appointments and store data safely. It is currently a hot topic in the computer field. Blockchain has the characteristics of openness, transparency, verifiability, data traceability and immutability. It is a decentralized distributed ledger composed of blocks connected one after another with timestamp information. The synchronization of block data mainly relies on the consensus mechanism.

[0003] Blockchain technology originated from the paper "Bitcoin: A Peer-to-Peer Electronic Cash System" published by Satoshi Nakamoto in 2008, which laid the foundation for cryptocurrency. Since then, Bitcoin and many other cryptocurrencies have become buzzwords in the industry and academia. As one of the most successful cryptocurrencies, Bitcoin has achieved great success, and its capital market has reached 100 million US dollars in 2016. As the underlying support technology of Bitcoin, blockchain technology has the characteristics of openness, transparency and non-tamperability, and its security and reliability are mainly guaranteed by cryptographic technology. In terms of security, it mainly includes data signature technology, public key and private key system ideas, and timestamp mechanism; in terms of reliability, it mainly uses consensus mechanism to realize node and data verification. It solves the Byzantine Generals' Problem, such as distributed consensus mechanisms such as workload consensus mechanism and equity proof mechanism. It solves the traditional trust problem and double-spending attack problem, and reduces the traditional trust economic cost; in terms of data storage, Merkle tree technology is mainly used. Androulaki et al. introduced the Hyperledger architecture: a scalable true blockchain system that supports modular consensus protocols and identity authentication, allowing the system to be customized for specific trust models and application scenarios. In addition, it is also the first blockchain system that supports running standard general programming languages, supports more advanced programming languages ​​for contract development and deployment, and runs "smart contract" rules in containers. McConaghy et al. proposed BigChainDB, a large-scale decentralized database. By combining the decentralized control and immutability of blockchain technology, it introduced blockchain technology to traditional databases, improved data security, proposed a blockchain database consistency strategy, and in terms of the storage capacity of blockchain, increased data capacity to support the storage of larger data. Wilkinson et al. proposed an end-to-end blockchain storage network, where users transmit and share data without relying on third-party data providers, cancel central control, and use regular passwords to check file availability and integrity. Dinh et al. built a system framework for testing blockchain systems, conducted a comprehensive evaluation of data models, consensus algorithms and hyperledgers, separated storage, execution engines and consensus layers, and then independently optimized and expanded them, and tested the query capabilities of UStore data to help developers identify system bottlenecks and improve the platform accordingly. Tsai et al. analyzed the requirements of blockchain application systems in terms of consistency, scalability and database, and developed the "Beihang Chain" with a dual-chain architecture model with scalability as the goal.Li et al. proposed an efficient blockchain retrieval method using MongoDB as a repository, which supports range queries and Top-K queries and has good flexibility. However, Li et al. also used a combination of on-chain and off-chain databases to achieve efficient retrieval. They used MongoDB database to store data, stored blockchain data in the form of KV key-value pairs off-chain, and used its characteristics for querying. This did not solve the query efficiency problem of the blockchain itself, and increased the communication volume.

[0004] Merkle tree is a binary tree consisting of a set of leaf nodes, a set of intermediate nodes and a root node. It is mainly used for fast verification. B+ tree is a variant of B tree. It is widely used, mainly in database index query and file system. B+ tree has three main nodes: leaf node, root node and internal node. It has good search characteristics and is a multi-way search tree that supports range query. Summary of the invention

[0005] Based on the efficiency problems of current blockchain storage and retrieval, this solution first proposes a three-layer retrieval model based on the blockchain system, starting from the block structure; secondly, based on the stable search performance of the B+ tree and the advantages of short query paths, combined with the excellent verification performance of the Merkle tree, the storage structure of the Merkle tree is improved, and corresponding index data is added to the nodes. While ensuring the verification efficiency, the data retrieval capability is improved, and range queries are supported. The corresponding construction algorithm and query algorithm are designed; finally, the effectiveness and usability of the proposed tree structure are tested experimentally, and it has good query performance and stable performance. The data retrieval model is mainly divided into three layers, including the user layer, the query layer and the storage layer. Figure 1 shown.

[0006] When a user initiates a data query request, he first accesses the user layer and queries the cached data in the user layer. If the matching data is found in the cache, the search is completed and the result is returned; otherwise, the query layer is accessed. The query layer divides the query business and the ordinary node verification business according to the stability and computing power of the node, and returns the query data to the user layer. The storage layer is located at the bottom layer and is mainly responsible for storing blockchain data and responding to query requests from the query layer. For the storage structure of the block, a storage structure based on the improved Merkle tree is proposed.

[0007] The blockchain storage structure based on the M_H+ tree structure combines the efficient verification of the Merkle tree and the fast retrieval of the B+ tree. The data structure is as follows Figure 2 As shown in the figure, the node mainly improves the storage structure of the Merkle tree, which mainly consists of the hash value, index address, and endpoint index value size.

[0008] The main designs are insertion algorithm and search algorithm.

[0009] M_H+ tree establishment algorithm steps:

[0010] Step 1: Determine the structure of the B+ tree;

[0011] Step 2: According to the result of step 1, take out the leaf data N of the B+ tree;

[0012] Step 3: Determine whether N is a M_H+ tree leaf node;

[0013] Step 4: Insert N nodes;

[0014] Step 5: Repeat step 2;

[0015] Algorithm: M_H+ tree building algorithm

[0016] Input: Constructed B+ tree structure;

[0017] Output: M_H+ tree structure storage model;

[0018] 1. Confirm the constructed B+ tree structure;

[0019] 2. According to the structure of B+ tree, process data from the bottom node;

[0020] 3.for(B+tree node N){

[0021] 4.if(leaf node){

[0022] 5. Hash data;

[0023] 6.}

[0024] 7.else{

[0025] 8. Get the minimum value index;

[0026] 9. Get the maximum value index;

[0027] 10. Record the minval and maxval values ​​of this node;

[0028] 11. Data hashing;

[0029] 12.}

[0030] 13.N = N-1;

[0031] 14.}

[0032] 15. The final root is saved as the result in the block header;

[0033] The query algorithm steps are as follows:

[0034] Step 1: Enter the block data query index index;

[0035] Step 2: Determine the block header;

[0036] Step 2: Access the block header data to obtain minval and maxval;

[0037] Step 3: Determine whether index is between minval and maxval and enter the next layer;

[0038] Step 4: Return data or fail to find data;

[0039] Algorithm: M_H+ tree query algorithm

[0040] Input: blockchain data, query condition index;

[0041] Output: transaction result.

[0042] 1.If(the node does not meet the stability condition){

[0043] 2. Find neighboring super nodes

[0044] 3.}

[0045] 4.For(traversal block){

[0046] 5. Access the minval and maxval values ​​of the block header tree root;

[0047] 6.while(minval≤Index≤maxval){

[0048] 7.If(leaf node){

[0049] 8.For (traverse leaf nodes) {

[0050] 9.If(find index){

[0051] 10.Return data;

[0052] 11.}

[0053] 12.}

[0054] 13.}

[0055] 14. Get new node information;

[0056] 15. Update minval and maxval;

[0057] 16.}

[0058] 17. Access the next block;

[0059] }

[0060] In the current storage structure of blockchain, the block body is mainly based on the storage of the Merkle tree structure. The Merkle tree is a tree with fast verification speed, but it needs to traverse all data in terms of query, which is inefficient. The technology of the present invention is based on the block storage structure and designs an improved Merkle tree storage structure, which is mainly based on the advantages of the B+ tree: stable search performance, short query path, and support for range query. The retrieval speed is improved while the original fast verification is not changed. Search performance: The retrieval efficiency of data is almost maintained within an average time, and there is no problem of large differences in the retrieval time of different data. Short query path: According to the characteristics of the B+ tree, the three-layer B+ tree can store thousands of data, while the Merkle tree requires a tree height of more than ten layers. Range query: The designed tree structure has ordered data connected by a linked list at the bottom layer, which can query a whole segment of data according to the data range. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 Data retrieval model.

[0062] Figure 2 Data structures.

[0063] Figure 3 New tree structure. DETAILED DESCRIPTION

[0064] The present invention is described in detail below with reference to the accompanying drawings and embodiments. The implementation mainly includes the process of establishing a tree and retrieving data. The following is the process of establishing a tree:

[0065] The keyword to be inserted is key.

[0066] 1) If it is an empty tree, create a new leaf node and insert the record into the leaf node. At this time, the leaf node is also the root node, and the insertion operation is completed.

[0067] 2) For leaf type nodes: find the leaf node according to the key value and insert the record into this leaf node. After insertion, if the number of keys of the current node is not greater than m-1, the insertion is completed. Otherwise, split this leaf node into two leaf nodes, the left leaf node contains the first m / 2 records, and the right node contains the remaining records. Carry the key of the m / 2+1th record into the parent node (the parent node must be an index type node), carry the left child pointer of the parent node to the left node, and the right child pointer to the right node. Point the pointer of the current node to the parent node, and then execute the next step.

[0068] 3) For index type nodes: If the number of keys in the current node is less than or equal to m-1, the insertion is completed. Otherwise, split this index type node into two index nodes, the left index node contains the first (m-1) / 2 keys, and the right node contains m-(m-1) / 2 keys. Carry the m / 2th key into the parent node, and the left child of the key carried to the parent node points to the left node, and the right child of the key carried to the parent node points to the right node. Point the pointer of the current node to the parent node, and then repeat the operation.

[0069] like Figure 3 The diagram for inserting into a B+ tree shows that keywords 40, 45, and 62 are inserted in sequence.

[0070] The search method is to first query from the application layer to check whether the queried data is already in the cache. If so, the data is returned directly. Otherwise, go to the query layer to find the super node for query, and then go to the storage layer for query through the super node. The storage structure of the storage layer is an improved Merkle tree structure, which is queried through the query algorithm.

[0071] like Figure 3 In the M_H+ tree shown, to find the data with index address 69, first judge from the root node, the index range 25-99 meets the interval where 69 is located, and find the first child node by accessing the root node (2589), and find the node of the subtree with node range 25-69, which meets the interval. According to the node information (255067), find the third child node, traverse to find the result and return the data information to the search node.

Claims

1. An efficient data retrieval method based on an improved block storage structure. The data retrieval model that implements this method is mainly divided into three layers, including the user layer, the query layer, and the storage layer; Features: When a user initiates a data query request, the user layer is first accessed to query the cached data in the user layer. If matching data is found in the cache, the search is completed and the result is returned; otherwise, the query layer is accessed again. The query layer handles query services and common node verification services according to the stability and computing power of the nodes, and returns query data to the user layer. The storage layer is at the bottom layer and is responsible for storing blockchain data and responding to query requests from the query layer. The blockchain storage structure based on the M_H+ tree structure combines the verification of the Merkle tree and the retrieval characteristics of the B+ tree; the storage structure of the node Merkle tree consists of several parts: hash value, index address, and endpoint index value size; M_H+ tree building steps: Step 1: Determine the structure of the B+ tree; Step 2: According to the result of step 1, take out the leaf data N of the B+ tree; Step 3: Determine whether N is a M_H+ tree leaf node; Step 4: Insert N nodes; Step 5: Repeat step 2; The query steps are as follows: Step 1: Enter the block data query index index; Step 2: Determine the block header; Step 2: Access the block header data to obtain minval and maxval; Step 3: Determine whether index is between minval and maxval and enter the next layer; Step 4: Return data or fail to find data; The process of building a tree and retrieving data is as follows: The tree building process: The keyword to be inserted is key; 1) If it is an empty tree, create a new leaf node and insert the record into the leaf node. At this time, the leaf node is also the root node, and the insertion operation is completed; 2) For leaf type nodes: find the leaf node according to the key value and insert the record into the leaf node; after the insertion, if the number of keys of the current node is not greater than m-1, the insertion is completed; otherwise, the leaf node is split into two leaf nodes, the left leaf node contains the first m / 2 records, and the right node contains the remaining records. The key of the m / 2+1th record is carried to the parent node, and the left child pointer of the parent node points to the left node, and the right child pointer points to the right node; the pointer of the current node points to the parent node; 3) For index type nodes: if the number of keys of the current node is less than or equal to m-1, the insertion ends; Otherwise, split this index type node into two index nodes, the left index node contains the first (m-1) / 2 keys, and the right node contains m-(m-1) / 2 keys. The m / 2th key is carried into the parent node, and the left child of the key carried to the parent node points to the left node, and the right child of the key carried to the parent node points to the right node; point the pointer of the current node to the parent node.

Citation Information

Patent Citations

  • An indexing method for a keyword key on a block chain database

    CN109165224A

  • Block chain-based data storage method, electronic integral processing method and system

    CN112035491A