Efficient blockchain query method and system based on Bloom filter skip list structure
By using the query method of Bloom filter table jump structure on the blockchain, the index jump technology is used to improve query efficiency, and the problem of inefficient blockchain query is solved, efficient retrieval and low maintenance overhead are achieved, while resisting attack.
Patent Information
- Application Number
- CN202210405532.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-04-18
AI Technical Summary
Blockchain query is inefficient, especially when it is necessary to efficiently retrieve personal information, the existing technology is difficult to meet the needs of efficient query and low maintenance overhead.
Using a query method based on the Bloom filter table jump structure, by creating a Bloom filter for each block, storing the certificate number of adjacent blocks, and using exponential jump technology to shorten the search time and improve query efficiency .
It significantly improves the time efficiency of blockchain query, reduces maintenance overhead, and can effectively resist attacks, improving space utilization and security.
Smart Images

Figure CN114817401B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and relates to a blockchain query method and system, and specifically to an efficient blockchain query method and system based on a Bloom filter skip list structure. Background Art
[0002] The technology of blockchain originated from Bitcoin. Satoshi Nakamoto first proposed a peer-to-peer electronic cash system, Bitcoin, which does not require a trusted third party. It uses the reference of the previous block by the next block and uses encryption technology to ensure that the blockchain cannot be modified. The longest chain comes from the CPU with the strongest computing power. This blockchain uses Merkle Hash to ensure its immutability. Each block calculates the hash value of the block based on the block header and is pointed to by the next block. In addition, blockchain can also be applied to smart contracts, public services, the Internet, the Internet of Things, reputation systems, and security services. These fields support blockchain in many ways. First, blockchain is immutable. Once a transaction is packaged into the blockchain, it cannot be tampered with. Enterprises that require high reliability and honesty can use blockchain to attract customers. In addition, blockchain is distributed, avoiding single point failures and has the characteristics of high availability.
[0003] Due to the characteristics of blockchain structure, its block-based sequential access hinders efficient query processing, so it is crucial to design a reasonable blockchain-based query algorithm. LevelDB is used as the underlying data storage system of most blockchain systems. It is convenient to write data but slow to read data, which makes its query efficiency very low; most existing information management blockchain applications focus on the storage mode of personal data. Among them, a few focus on practicality such as short response time for secure retrieval processing, but lack details. Due to the time overhead of accurate query of huge stored items, blockchain may suffer from inefficiency. Therefore, it is very necessary to design an efficient retrieval method on blockchain and apply it to personal information management system. Summary of the invention
[0004] In order to solve the technical problem of low efficiency of query methods on blockchain, the present invention provides an exponential jump filtering index and a corresponding efficient blockchain retrieval method and system to achieve higher query efficiency and lower maintenance overhead.
[0005] The technical solution adopted by the method of the present invention is: an efficient blockchain query method based on a Bloom filter skip list structure, including establishing a query index and a blockchain query;
[0006] The query index is established by creating a corresponding Bloom filter for each block in the blockchain system. Each Bloom filter node BF i Externally link to the i-th block, internally store the i+2-th 0 ,i+2 1 ,i+2 2 ,…,i+2 n The certificate number in the block, n is the certificate number that satisfies i+2 n Less than the maximum number of total blocks; start searching from the -2 BloomFilter node, where BF -2 Only the certificate number of block 0 is stored, BF -1 Store the certificate numbers of blocks 0 and 1;
[0007] Whenever a new block number i is packaged and put into the blockchain, a corresponding new Bloom filter number i will be generated, and the records in the block will also be written to i-2 logi and i-2 logi-1 Number Bloom filter;
[0008] The blockchain query: When searching, first start from BF -2 Traverse the search until BF a The first hit indicates that the target block number target may be a+2 x , x∈N (N represents a natural number, and a+2 x The range does not exceed the maximum block number), at this time, you need to find the BF that hits the second time. b , indicating that the target block number target may be b+2 y , y∈N (N represents a natural number, and b+2 y The range does not exceed the maximum block number); suppose there exist x and y such that a, b, and target satisfy equation (1), and x and y satisfy equation (2). We only need to find a and b, and then we can find the target block number through equations (1) and (2);
[0009] a+2 x =b+2 y =target (1)
[0010] x=y+1 (2)
[0011] If the preset range is searched but no hit is found in the first search, no further search is required.
[0012] The technical solution adopted by the system of the present invention is: an efficient blockchain query system based on a Bloom filter skip list structure, including establishing a query index module and a blockchain query module;
[0013] The query index module is established: a corresponding Bloom filter is created for each block in the blockchain system, and each Bloom filter node BF i Externally link to the i-th block, internally store the i+2-th 0 ,i+2 1 ,i+2 2 ,…,i+2 n The certificate number in the block, n is the certificate number that satisfies i+2 n Less than the maximum number of total blocks; start searching from the -2 Bloom Filter node, where BF -2 Only the certificate number of block 0 is stored, BF -1 Store the certificate numbers of blocks 0 and 1;
[0014] Whenever a new block number i is packaged and put into the blockchain, a corresponding new Bloom filter number i will be generated, and the records in the block will also be written to i-2 logi and i-2 logi-1 Number of bloom filters.
[0015] The blockchain query module: When searching, first start from BF -2 Traverse the search until BF a The first hit indicates that the target block number target may be a+2 x , x∈N (N represents a natural number, and a+2 x The range does not exceed the maximum block number), at this time, you need to find the BF that hits the second time. b , indicating that the target block number target may be b+2 y , y∈N (N represents a natural number, and b+2 y The range does not exceed the maximum block number); suppose there exist x and y such that a, b, and target satisfy equation (1), and x and y satisfy equation (2). We only need to find a and b, and then we can find the target block number through equations (1) and (2);
[0016] a+2 x =b+2 y =target (1)
[0017] x=y+1 (2)
[0018] If the preset range is searched but no hit is found in the first search, no further search is required.
[0019] Compared with the traversal mode, the present invention improves time efficiency and space utilization by using Bloom filters. In addition, when performing maintenance, new blocks only need to be quickly mapped to two Bloom filters. At the same time, it can effectively resist attacks from known plaintext. Assuming that an attacker tries to guess the content in the Bloom filter and performs 300,000 queries, the probability of a hit is at most 2.1010 when the Bloom filter bit width is 150. -40 . BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a schematic diagram of an embodiment of the invention, wherein ce represents a certificate containing data information, and CE represents a set of all certificates of a certain block;
[0021] Figure 2 The following is an example of application of the embodiment of the invention in a medical information management system. DETAILED DESCRIPTION
[0022] In order to facilitate ordinary technicians in the field to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0023] Please see Figure 1 , the present invention provides an efficient blockchain query method based on a Bloom filter skip list structure, including establishing a query index and a blockchain query;
[0024] In this embodiment, a query index is established: a corresponding Bloom filter is created for each block in the blockchain system. Each Bloom filter node BF i Externally link to the i-th block, internally store the i+2-th 0 ,i+2 1 ,i+2 2 ,…,i+2 n The certificate number in the block, n is the certificate number that satisfies i+2 n Less than the maximum number of total blocks; To ensure that blocks 0 and 1 can also be searched, we added BF -2 and BF -1 Two Bloom filters, BF-2 only stores the certificate number in block 0, and BF -1 Stores the certificate number within block 0 and block 1.
[0025] Whenever a new block number i is packaged and put into the blockchain, a corresponding new Bloom filter number i will be generated, and the records in the block will also be written to i-2 0 ,i-2 1,i-2 2 ,…,i-2 n Bloom filter, until i-2 n is a negative number;
[0026] Blockchain query in this embodiment: When searching, first start from BF -2 Traverse the search until BF a The first hit indicates that the target block number target may be a+2 x (x∈N, N represents a natural number, and a+2 x The range does not exceed the maximum block number) At this time, you need to find the BF that hits the second time. b , indicating that the target block number target may be b+2 y (y∈N, N represents a natural number, and b+2 y The range does not exceed the maximum block number); suppose there exist x and y such that a, b, and target satisfy equation (1), and x and y satisfy equation (2). We only need to find a and b, and then we can find the target block number through equations (1) and (2);
[0027] a+2 x =b+2 y =target (1)
[0028] x=y+1 (2)
[0029] If the preset range is searched but no hit is found in the first search, no further search is required.
[0030] In this embodiment, we need to find a and b that satisfy the relationship a+2 y = b, that is, after the first search hits Bloom filter a, there is no need to continue linear traversal, but to search a+2 in an exponential jump manner i The content in the block (i∈N, N represents a natural number) until the second hit, the Bloom filter of the second hit is the a+2th y = Bloom filter number b.
[0031] In order to shorten the search time from the first hit to the second hit, Starting the second search from the BloomFilter node can maximize the search efficiency. In addition, in order to prevent endless searching, it is found through mathematical proof that in the first search, if the max(2 t-1 -1,n-2 t ) BloomFilters are not hit, it means that there is no certificate number on the blockchain and there is no need to continue searching; where n represents the number of blocks in the blockchain system, and t satisfies 2 t ≤n<2 t+1 .
[0032] As the basic technology of Bitcoin, blockchain has attracted more and more attention from the industry and academia. In the medical scenario, many medical blockchain systems have been developed to save patients' conditions and ensure the authenticity of health records. However, due to the large scale of patient health records, existing medical blockchain systems generally have problems such as low throughput, lack of corresponding index structure, and unsatisfactory retrieval efficiency.
[0033] Please see Figure 2 , is an example of the application of the embodiment of the invention on the medical information management system. The medical information management system of this embodiment includes 4 participants, namely, data owner, data user, server (hospital and other institutions) and query node. The data owner and data user are light nodes that only store block headers, while the hospital and query node are represented as full nodes that store the entire blockchain data. The query node establishes an exponentially jumping Bloom filter index structure, which stores the keywords of the health record in sequence on the blockchain to perform efficient queries.
[0034] When the data owner receives the electronic medical record from the doctor, the server automatically extracts the non-sensitive but important attributes and packages the non-sensitive records. The server then converts the health record into a hash value and uploads it to the blockchain after each node verifies and accepts the new block. At the same time, the query node creates an exponential jump Bloom filter index for each block. When the data user needs to query specific EHR information, he first sends a request to the data owner to obtain authorization, and then sends a query request to the query node. The query node implements an efficient query algorithm on the blockchain based on the index structure it has built. For specific query algorithms and index structures, see Figure 1 After receiving the corresponding results, the data user can finally decrypt the information.
[0035] The present invention proposes an efficient blockchain data retrieval algorithm based on exponential jump Bloom filter, which enables users to retrieve blockchain data in exponential order. This method can improve query efficiency and resist data leakage under brute force attacks.
[0036] It should be understood that the parts not elaborated in detail in this specification belong to the prior art, and our original technical solutions have been introduced.
[0037] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.
Claims
1. An efficient blockchain query method based on Bloom filter skip list structure, Features: Including establishing query index and blockchain query; The establishment of the query index: Create a corresponding Bloom filter for each block in the blockchain system. Each Bloom filter node BF i Externally link to the i-th block, internally store the i+2-th 0 ,i+2 1 ,i+2 2 ,…,i+2 n The certificate number in the block, n is the certificate number that satisfies i+2 n Less than the maximum number of total blocks; start searching from the -2 BloomFilter node, where BF -2 Only the certificate number of block 0 is stored, BF -1 Store the certificate numbers of blocks 0 and 1; Whenever a new block number i is packaged and put into the blockchain, a corresponding new Bloom filter number i will be generated, and the records in the block will also be written to i-2 logi and i-2 logi-1 Number Bloom filter; The blockchain query: When searching, first start from BF -2 Traverse the search until BF a The first hit indicates that the target block number target may be a+2 x , x∈N, N represents a natural number, and a+2 x The range does not exceed the maximum block number. At this time, it is necessary to find the BF that hits the second time. b , indicating that the target block number target may be b+2 y , y∈N, and b+2 y The range does not exceed the maximum block number; suppose there exist x and y such that a, b, and target satisfy equation (1), and x and y satisfy equation (2). We only need to find a and b, and we can find the target block number through equations (1) and (2); a+2 x =b+2 y =target (1) x=y+1 (2) If the preset range is searched but no hit is found in the first search, no further search is required.
2. According to claim 1, the efficient blockchain query method based on the Bloom filter skip list structure, Features: The blockchain query shows that a and b satisfy the relationship a+2. y = b, that is, after the first search hits Bloom filter a, there is no need to continue linear traversal, but to search a+2 in an exponential jump manner i The content in block a+2 is the content in block a+2 until the second hit. The bloom filter of the second hit is the content in block a+2 y =b Bloom filter; where i∈N (N represents a natural number).
3. According to claim 1, the efficient blockchain query method based on the Bloom filter skip list structure, Features: The blockchain query, from The second search starts from the Bloom Filter node.
4. According to claim 1, the efficient blockchain query method based on the Bloom filter skip list structure, Features: In the first search of the blockchain query, if the max(2 t-1 -1,n-2 t ) BloomFilters are not hit, it means that there is no certificate number on the blockchain and there is no need to continue searching; where n represents the number of blocks in the blockchain system, and t satisfies 2 t ≤n<2 t+1 .
5. An efficient blockchain query system based on Bloom filter skip list structure, It is characterized in that Including establishing a query index module and a blockchain query module; The query index module is established: a corresponding Bloom filter is created for each block in the blockchain system, and each Bloom filter node BF i Externally link to the i-th block, internally store the i+2-th 0 ,i+2 1 ,i+2 2 ,…,i+2 n The certificate number in the block, n is the certificate number that satisfies i+2 n Less than the maximum number of total blocks; start searching from the -2 BloomFilter node, where BF -2 Only the certificate number of block 0 is stored, BF -1 Store the certificate numbers of blocks 0 and 1; Whenever a new block number i is packaged and put into the blockchain, a corresponding new Bloom filter number i will be generated, and the records in the block will also be written to i-2 logi and i-2 logi-1 Number Bloom filter; The blockchain query module: When searching, first start from BF -2 Traverse the search until BF a The first hit indicates that the target block number target may be a+2 x , x∈N, N represents a natural number, and a+2 x The range does not exceed the maximum block number. At this time, it is necessary to find the BF that hits the second time. b , indicating that the target block number target may be b+2 y , y∈N, and b+2 y The range does not exceed the maximum block number; suppose there exist x and y such that a, b, and target satisfy equation (1), and x and y satisfy equation (2). We only need to find a and b, and we can find the target block number through equations (1) and (2); a+2 x =b+2 y =target (1) x=y+1 (2) If the preset range is searched but no hit is found in the first search, no further search is required.
