Expressway accident rescue data sharing method based on Bloom filtering Merkle tree and related equipment
By adopting a data sharing method based on Blon filtering Merkle tree in highway accident rescue scenarios, the problem of difficulty in balancing efficiency and safety in blockchain data sharing is solved, and efficient, safe and trustworthy sharing of highway accident rescue data is achieved.
Patent Information
- Application Number
- CN202411958423.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
In the scene of highway accident rescue, existing blockchain data sharing methods are difficult to balance efficiency and security, affecting the efficient and trustworthy sharing of data.
The data sharing method based on Blon filtering Merkle tree is adopted, and the highway accident rescue data digest and ciphertext index are stored in the public chain and alliance chain respectively, and data sharing and auditing are performed through the cache-database-public chain hierarchical method.
It realizes efficient and secure sharing of highway accident rescue data, improves response speed and efficiency of multi-department collaboration, and ensures the tamper-proof of data.
Smart Images

Figure CN119884249A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of accident rescue data sharing, and in particular to a highway accident rescue data sharing method based on Bloom filtering Merkle tree and related equipment. Background Art
[0002] As the traffic volume on highways continues to increase, the frequency of traffic accidents has also increased. In order to improve the efficiency and accuracy of accident rescue, departments need to share accident-related data in a timely and reliable manner. However, the traditional centralized data sharing method in highway accident rescue scenarios faces problems such as data silos, information delays, and data tampering, making it difficult to meet the needs of multi-department collaboration. Highway accident rescue data is prone to tampering and loss during transmission, which not only affects rescue efficiency, but also brings challenges to accident investigation and responsibility division.
[0003] The emergence of blockchain technology provides a new solution to the problems faced by highway accident rescue data sharing schemes. In recent years, research on data sharing based on blockchain has made progress. Yang et al. proposed an overall framework for data sharing and transactions based on a single blockchain architecture, which ensures the security of the entire process through the decentralization and transparency of blockchain (Reference 1: Yang J, Wen J, Jiang B, et al. Blockchain-based sharing and tamper-proof framework of big data networking [J]. IEEE Network, 2020, 34 (4): 62-67.). Guo et al. proposed a data sharing scheme that supports blockchain as the underlying platform for complex scenarios of the Internet of Things. The scheme solves the blockchain storage problem through off-chain storage and on-chain search (Reference 2: Guo S, Hu X, Guo S, et al. Blockchain meets edge computing: A distributed and trusted authentication system [J]. IEEE Transactions on Industrial Informatics, 2019, 16 (3): 1972-1983.).
[0004] In the accident rescue scenario, it is difficult for this single blockchain architecture to achieve both efficiency and security, because efficiency usually depends on fewer nodes and lower consensus complexity, which may weaken the network's decentralization and anti-attack capabilities, while security depends on various decentralized and complex consensus mechanisms, which usually reduce processing speed and efficiency. To address the above problems, Zhang et al. proposed a secure data sharing model with supervision and privacy protection, introducing a dual blockchain architecture, one blockchain is used to ensure the integrity and traceability of privacy data, and the other blockchain is used to supervise illegal users (Reference 3: Zhang Y, Ma Z, Luo S, et al. DBSDS: Adual-blockchain security data sharing model with supervision and privacy-protection [J]. Concurrency and computation: practice and experience, 2023, 35 (21): e7706.). Liu et al. proposed a consortium chain medical data sharing mechanism based on a dual-chain structure to achieve secure sharing of medical data between entities such as medical institutions, research institutions, and cloud privacy centers. (Reference 4: Liu L, Liu R, LvZ, et al. Dual blockchain-based data sharing mechanism with privacy protection for medical internet of things [J]. Heliyon, 2024, 10 (1).). However, the efficiency of the public chain in actual application scenarios is difficult to meet the efficiency requirements in highway accident rescue scenarios. In summary, although there have been many works using blockchain technology to solve the problem of data sharing, there are still efficiency and security challenges in applying blockchain technology to solve data sharing in highway accident rescue scenarios, which affects the efficient and reliable sharing of highway accident rescue data. Therefore, it is necessary to propose a highway accident rescue data sharing solution that takes into account both efficiency and security. Summary of the invention
[0005] In view of the problem that existing blockchain data sharing methods are difficult to achieve a balance between efficiency and security in accident rescue scenarios, the present invention proposes a highway accident rescue data sharing method and related equipment based on Bloom filter Merkle tree, which ensures the efficiency and security of highway accident rescue data sharing, provides data users with a verifiable query function, improves the response speed of highway accident rescue, and improves the efficiency of multi-department collaboration.
[0006] In a first aspect, the present invention provides a method for sharing highway accident rescue data based on a Bloom filter Merkle tree, comprising:
[0007] Step 1: Store the highway accident rescue data summary and ciphertext index into the public chain and consortium chain respectively;
[0008] Step 2: When the synchronization mechanism is triggered, the data summaries on the public chain are synchronized to the database in batches and the Bloom filter Merkle tree and index structure of the current batch data summaries are established;
[0009] Step 3: Store the root node information of the Bloom filter Merkle tree into the public chain;
[0010] Step 4: Receive query requests and share and audit highway accident rescue data through a layered approach of cache-database-public chain.
[0011] Furthermore, the triggering condition of the synchronization mechanism is a trigger based on the number of data items or a trigger based on time.
[0012] Furthermore, in step 2, a Bloom filter Merkle tree of the current batch data summary is established, specifically including:
[0013] For each data summary, calculate its corresponding key value; construct a balanced binary search tree based on all data summaries and corresponding key values of the current batch, start from the bottom of the tree, perform hash operations on the left and right leaf nodes respectively, merge the two hash values to obtain new hash values, store them in the upper extension nodes of the left and right leaf nodes, and maintain pointers to the left and right leaf nodes in the extension nodes.
[0014] The pointer of the leaf node repeats the above process until it reaches the root node; when the generated key value has a hash conflict, a corresponding value linked list is generated;
[0015] Correspondingly, the index structure is divided into a root node, an extended node, a leaf node and a meta node; wherein, the information defining the root node includes the key value range of all data summaries of the current batch, the Bloom filter value, the key value of the root node, the value list corresponding to the key value, the hash value and the pointers to the left and right leaf nodes; the information defining the extended node includes the key value of the extended node, the value list corresponding to the key value, the hash value and the pointers to the left and right leaf nodes; the information defining the leaf node includes the key value of the leaf node and the value list corresponding to the key value; the information defining the meta node includes the hash value of the root node, the Bloom filter value and the block height of the meta node in the public chain.
[0016] Furthermore, step 4 specifically includes:
[0017] According to the query request, the query is first performed in the cache layer. If the data is hit, the query data is returned if the trust is met; if there is no hit, the query is then performed in the database layer. The query process includes: first eliminating the interference branches through the Bloom filter value in the meta node, and then querying the remaining branches according to the key value according to the index structure of the Bloom filter Merkle tree. If the data is hit, the query data is returned if the trust is met; if there is still no hit, the query is then performed in the public chain layer. If the data is hit, the query data is returned.
[0018] Furthermore, it also includes:
[0019] If the database query is empty because the database query does not meet the database trust conditions, and the data is hit at the public chain layer, the Bloom filter Merkle tree of the batch data summary is rebuilt according to the batch information corresponding to the query data; if the database query is empty because the data on the public chain has not yet triggered the synchronization mechanism to synchronize to the database, and the data is hit at the public chain layer, the key value and corresponding hash value of the query data are written to the cache layer, and the cache expiration time is set to the trigger time of the synchronization mechanism.
[0020] Furthermore, step 1 also includes: encrypting the highway accident rescue data using a ciphertext policy attribute encryption algorithm to obtain ciphertext, and uploading the ciphertext to the Interstellar File System;
[0021] Correspondingly, the index of the ciphertext in the Interplanetary File System is stored in the consortium chain.
[0022] In a second aspect, the present invention provides a highway accident rescue data sharing system based on a Bloom filter Merkle tree, comprising a public chain, an alliance chain, a database, a synchronization module, and a query module;
[0023] The public chain is used to store highway accident rescue data summary and root node information of the Bloom filter Merkle tree;
[0024] The consortium chain is used to store the ciphertext index of highway accident rescue data;
[0025] The synchronization module is used to synchronize the data summaries on the public chain to the database in batches and establish a Bloom-filtered Merkle tree and index structure of the current batch data summaries when the synchronization mechanism is triggered;
[0026] The query module is used to receive query requests and share and audit highway accident rescue data through a layered approach of cache-database-public chain.
[0027] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0028] In a fourth aspect, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect.
[0029] Beneficial effects of the present invention:
[0030] (1) By integrating the advantages of public chain and alliance chain, efficient and secure data sharing is achieved.
[0031] (2) A Bloom filter Merkle tree index structure is proposed by combining Bloom filter, balanced binary search tree and Merkle tree data structure. On the basis of achieving efficient query, it ensures the tamper-proof nature of off-chain data.
[0032] (3) Establish a connection between the Bloom filter Merkle tree and the public chain to ensure the tamper-proof nature of the index structure. At this time, any data tampering behavior of the off-chain data will be transmitted to the meta node through the Merkle tree structure, and the stored block height can quickly locate the on-chain data.
[0033] (4) Through the cache-off-chain database-public chain on-chain and off-chain hierarchical query solution, the query efficiency and method availability of the public chain are further improved.
[0034] According to the comparison of experimental results, compared with other blockchain-based data sharing methods, the present invention has a smaller time overhead when sharing data and can meet the efficiency requirements in the highway accident rescue data sharing scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of a highway accident rescue data sharing method based on a Bloom filter Merkle tree provided in an embodiment of the present invention;
[0036] Figure 2 An architectural diagram of a highway accident rescue data sharing method based on a Bloom filter Merkle tree provided in an embodiment of the present invention;
[0037] Figure 3 A design diagram of a Bloom filter Merkle tree index structure provided by an embodiment of the present invention;
[0038] Figure 4 A cache-off-chain database-public chain hierarchical query design diagram provided for an embodiment of the present invention;
[0039] Figure 5 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] like Figure 1 As shown, an embodiment of the present invention provides a method for sharing highway accident rescue data based on a Bloom filter Merkle tree, comprising the following steps:
[0042] S101, storing the highway accident rescue data summary and ciphertext index in the public chain and the alliance chain respectively;
[0043] Specifically, the highway accident rescue data summary (hereinafter referred to as the summary) refers to the data formed after the original data is processed using the set summary extraction algorithm. The public chain is an open blockchain network in which anyone can participate and view all data and transaction records on the chain, and all participants can participate in transactions and create blocks anonymously. The alliance chain is a type of blockchain between the public chain and the private chain. Unlike the public chain, the data of the alliance chain is only accessible to institutions and their users in the alliance; in this embodiment, the alliance chain is composed of highway accident rescue departments. The ciphertext index refers to the index of the ciphertext obtained by encrypting the highway accident rescue data on the off-chain storage medium.
[0044] In some embodiments, the owner of the highway accident rescue data calculates the data summary and uploads the summary to the public chain; and encrypts the data using an encryption algorithm, uploads the ciphertext to the Interstellar File System, and stores the index of the ciphertext in the Interstellar File System in the consortium chain.
[0045] S102. When the synchronization mechanism is triggered, the data summaries on the public chain are synchronized to the database in batches and a Bloom-filtered Merkle tree and index structure of the current batch data summaries are established;
[0046] Specifically, the Bloom filter Merkle tree is a new data structure designed in this embodiment that combines a Bloom filter and a Merkle tree, which provides organization and indexing of off-chain data for the public chain, facilitating subsequent efficient query and sharing of data.
[0047] The database is a storage medium off-chain. By storing summary information on the public chain, establishing a Bloom filter Merkle tree and index structure off-chain, the off-chain database and the public chain are connected. The summary information stored on the chain is used to ensure the tamper-proofness of the off-chain data, and the Merkle tree characteristics are used to recover the tampering after the tampering is detected. At the same time, the data tampering behavior of the off-chain data will be transmitted to the meta node through the Bloom filter Merkle tree structure to ensure the tamper-proofness of the index structure.
[0048] In some embodiments, the data summaries on the public chain are continuously synchronized in batches to the off-chain database through the trigger DVT (Data Volume Trigger) based on the number of data items and the time-based trigger mechanism TIT (Time Interval Trigger), and the batch of summary data synchronized to the off-chain is organized into a tree structure according to the Bloom filter Merkle tree insertion algorithm, and persisted in the database. Among them, the trigger based on the number of data items means that if the current number of data items reaches the DVT threshold, the data synchronization operation will be performed to synchronize the data to the off-chain database. If the DVT trigger mechanism is not met, it will check whether the interval between the current time and the last synchronization time reaches the TIT threshold. If the conditions are met, the data synchronization operation will also be performed.
[0049] S103, storing the root node information of the Bloom filter Merkle tree into the public chain;
[0050] Specifically, the root node of the Bloom filter Merkle tree is the top node of the entire tree, which is obtained by continuously hashing the hash values of all leaf nodes; the root node represents the data summary of the entire Bloom filter Merkle tree, and any changes to the data will be reflected in the root node. Therefore, once the root node information is detected to be tampered with, it means that the off-chain data has been tampered with.
[0051] In some embodiments, after a batch of Bloom-filtered Merkle trees of data summaries are established, the hash value and Bloom filter value of the root node are stored in a public chain, and the block height of the root node information in the public chain, the hash value of the root node, and the Bloom filter value are written together into the meta-node of the Bloom-filtered Merkle tree.
[0052] S104, receiving query requests and sharing and auditing highway accident rescue data through a layered approach of cache-database-public chain.
[0053] Specifically, when a user in the consortium chain network wants to query data, he needs to send a query request to the system. The system responds to the request and queries the cache, database and public chain in sequence through a three-level hierarchical query method to achieve data sharing and auditing.
[0054] In some embodiments, in response to a query request, users in the alliance chain network are allowed to retrieve the ciphertext index in the alliance chain, and then obtain the ciphertext in the interplanetary file system and decrypt it to obtain the shared highway accident rescue data. The summary of the shared data is calculated using the same hash function as the data user, and the shared data is judged whether it has been tampered with through cache-external database-public chain hierarchical query to realize highway accident rescue data audit. The present invention can ensure the efficiency and security of the highway accident rescue data sharing process.
[0055] Based on the above embodiments, Figure 3 As shown, for a batch of data summaries, an embodiment of the present invention provides a process for constructing a Bloom filter Merkle tree of the batch of data summaries, which specifically includes the following steps:
[0056] For each data summary, calculate its corresponding key value; construct a balanced binary search tree based on all data summaries of the current batch and the corresponding key values, start from the bottom of the tree, perform hash operations on the left and right leaf nodes respectively, merge the two hash values to obtain new hash values, store them in the upper extension nodes of the left and right leaf nodes, and maintain pointers to the left and right leaf nodes in the extension nodes, repeat the above process until the root node is reached; when the generated key value has a hash conflict, generate the corresponding value linked list;
[0057] Correspondingly, the index structure is divided into root node, extension node, leaf node and meta node; wherein, the information defining the root node includes the key value range of all data summaries of the current batch (expressed by min, max), Bloom filter value, root node key value, value linked list corresponding to the key value, hash value and pointers of left and right leaf nodes (expressed by left, right), that is, defining RootNode=<key,left,right,hash,valueList,min,max,bf> ; The information defining the extension node includes the key value of the extension node, the value list corresponding to the key value, the hash value, and the pointers to the left and right leaf nodes, that is, the definition of ExtensionNode=<key,left,right,hash,valueList> ; The information defining the leaf node includes the key value of the leaf node and the value list corresponding to the key value, that is, LeafNode =<key,valueList> ; The information defining the meta node includes the hash value of the root node, the Bloom filter value, and the block height of the meta node in the public chain.
[0058] In some embodiments, a hash algorithm is used to extract data summaries. For each data summary hash, the corresponding key value calculation formula is key = hash mod k, k is a natural number, and the obtained key and data summary hash constitute a pair of key-value data, and mod represents the modulus operation.
[0059] In some embodiments, the key-value data obtained from the same batch of data summaries are used to construct a balanced binary search tree structure, ensuring that the absolute value of the height difference between the left and right subtrees of each node in the tree does not exceed 1. If a hash conflict occurs in the calculated key value, a linked list is used to sequentially connect the corresponding hash values to form a value linked list. The balanced binary search tree structure can be an AVL tree, a red-black tree, a B tree, a B+ tree, a Treap tree, a Splay tree, etc.
[0060] In some embodiments, the Bloom filter value is stored in the bf field of the root node to establish a Bloom filter Merkle tree index structure, wherein the bf field represents the value of the Bloom filter, which is a hash set or a bit array of the Bloom filter.
[0061] Based on the above embodiments, Figure 4 As shown, in the above step S104, the process of data sharing and auditing through the layered approach of cache-database-public chain specifically includes the following steps:
[0062] According to the query request, the cache layer is queried first. If the data is hit, the query data is returned if the trust is met;
[0063] If there is no hit, then query is performed at the database layer. The query process at the database layer includes: first determine the branch through the Bloom filter value in the meta node, then query according to the index structure of the Bloom filter Merkle tree based on the key value. If the data is hit, the query data is returned if the trust is met;
[0064] Specifically, first, before performing an index query, the Bloom filter value in the meta-node of the Bloom filter Merkle tree constructed by each batch of data is used to exclude interfering branches (i.e., branches where the data to be queried cannot exist) to improve retrieval efficiency. Next, calculate key'=hash'mod k. Among them, hash' is the summary of the data to be queried given in the query request, and k is the natural number used when establishing the Bloom filter Merkle tree. Secondly, according to key', query the remaining branches according to the Bloom filter Merkle tree index structure, starting from the Root node. If key' is equal to the key of Root, directly traverse the ValueList of the node to query whether hash' exists. If key' is not equal to the key of Root, determine whether key' is within the upper and lower limits of the Root record. If key' is not within the upper and lower limits of the record, directly exclude the branch where the Root is located, and go to the next branch to continue querying. Otherwise, decide to recursively search the left subtree Root.left or the right subtree Root.right based on the size relationship between key' and the key of the Root node. The query in the extended node also follows the above rules. The key is used to confirm whether to query the ValueList of the node. Then, based on the size relationship between the key' and the key of the node, it is decided to recursively search the left subtree or the right subtree until a leaf node is found.
[0065] If there is still no hit, then query at the public chain layer, and if the data is hit, the query data is returned.
[0066] In some embodiments, if the database query is empty because the database query does not meet the database trust condition, and the data is hit at the public chain layer, the Bloom filter Merkle tree of the batch data summary is rebuilt according to the batch information corresponding to the query data; if the database query is empty because the data on the public chain has not yet triggered the synchronization mechanism to synchronize to the database, and the data is hit at the public chain layer, the key value and the corresponding hash value of the query data are written in the cache layer, and the cache expiration time is set to the trigger time of the synchronization mechanism
[0067] Furthermore, the embodiment of the present invention also provides a method for sharing highway accident rescue data based on Bloom filter Merkle tree, which can realize efficient and safe sharing of highway accident data among various departments. The overall architecture of the method is shown in FIG. Figure 2 shown.
[0068] (1) Initialization phase;
[0069] Specifically, the Ciphertext-Policy Attribute-Based Encryption (CP-ABE) algorithm is used as the encryption algorithm. This encryption algorithm is an attribute-based encryption technology that allows data owners to specify access policies when encrypting data, and the user's private key is associated with their attributes. Data can only be decrypted when the user's attributes meet the access policy specified during encryption.
[0070] In the initialization phase, system parameters, public and private key pairs, and user attribute keys based on the ciphertext policy attribute encryption algorithm are generated. At the same time, the multi-authorization center will randomly select a random number γi to anonymize and restore the user's identity.
[0071] All users in the system, including data owners and data users, must send a request to the multi-authorization center to register their identity before they can share data securely through the system. i As the real identity, randomly select a random number β i . i , β i}Sent to the multi-authorization center through a secure channel. The multi-authorization center calculates the user's anonymous identity PID i =α i ⊕Hash(β i ||γ i ) and returns it to the user, where ⊕ represents an XOR operation, Hash represents a hash function, and || represents a concatenation operation.
[0072] (2) The data owner uploads the data summary to the public chain and synchronizes it to the external database; the Bloom filter Merkle tree root node information is stored in the public chain;
[0073] Specifically, the data owner uses the SHA-256 hash function to calculate the digest hash of the shared data = Hash {shared data, PID i , β i}, upload the summary hash to the public chain through the contract.
[0074] In this embodiment, a batch of summary data synchronized to the off-chain is organized into a tree structure according to the Bloom filter Merkle tree insertion algorithm and then persisted in the MongoDB database. MongoDB is a document-based NoSQL database suitable for applications that require high throughput and flexible data models, such as big data applications, real-time analysis, content management systems, etc. It can be easily integrated with cloud services and can use the elasticity of the cloud to expand the database.
[0075] After a batch of data is inserted, the hash value and Bloom filter value of the root node of this batch of data are stored in the public chain through the contract, ensuring that the tampering detection of the off-chain data can be realized based on the root node hash recorded on the chain combined with the Bloom filter Merkle tree. Then, the block height of the root node information in the public chain, the hash value of the root node and the Bloom filter value are written together into the meta node of the Bloom filter Merkle tree. Each batch of data will generate a meta node, which corresponds to the root node one by one and is independent of each other.
[0076] (3) Encrypt shared data and upload it to IPFS;
[0077] Specifically, the encryption algorithm based on the ciphertext policy attribute is used to encrypt {shared data, PID i , β i}, and then upload the ciphertext to the Interstellar File System, and receive the index CID of the ciphertext in the Interstellar File System.
[0078] (4) Share the ciphertext index CID in the Interstellar File System to the corresponding channel of the alliance chain network composed of various departments;
[0079] (5) and (6), the data owner obtains the shared data and decrypts it to conduct hierarchical audit queries;
[0080] Specifically, the data user retrieves the index of the required data ciphertext in the alliance chain, and then obtains the ciphertext in the interstellar file system according to the index and decrypts it through the attribute key to obtain {shared data, PID i , β i}. Then use the SHA-256 hash function again to calculate the summary of the shared data hash' = Hash{shared data, PID i , β i To ensure that the data has not been tampered with, a hierarchical query mechanism of cache-external database-public chain is used to query the shared data summary hash of the data owner, compare the summary stored in the public chain by the data owner and the summary hash' calculated by the data user himself to see if they are consistent, and return a verifiable query path to the data user.
[0081] In the Redis cache layer, if the query hits (that is, there is summary information matching the required data in the cache), the query result and the corresponding Merkle Proof verification path will be immediately returned to the data user. The verification path contains the path from the target data node to the root of the Bloom filter Merkle tree, as well as the hash values of all sibling nodes on this path, allowing data users to verify the integrity of the data through hash calculations. If there is no hit in the Redis cache layer, continue to query in the external database.
[0082] At the database layer, queries are performed based on the Bloom filter Merkle tree index structure. First, calculate key'=hash'mod k. Before performing an index query, first eliminate the branches that cannot exist through the bf in the meta node of the Bloom filter Merkle tree constructed by each batch of data. This "pruning" can further improve the retrieval efficiency. Then, in some possible branches, query according to the Bloom filter Merkle tree index structure based on key'. Specifically: start the search from the Root node of the Bloom filter Merkle tree. If key' is equal to the key of the Root, directly traverse the ValueList of the node to query whether hash' exists. If key' is not equal to the key of the Root, determine whether key' is within the upper and lower limits of the Root record. If key' is not within the upper and lower limits of the record, directly exclude the branch where the Root is located. Otherwise, decide whether to recursively search Root.left or Root.right based on the size relationship between key' and the key of the Root node. The query in the extended node also follows the above rules. The key is used to confirm whether to query the ValueList of the node, and then the left subtree or the right subtree is recursively searched according to the size relationship between the key' and the key of the node, until the leaf node is queried.
[0083] If the data corresponding to hash' is found in the Bloom filter Merkle tree, the block height recorded in the meta node information is used to specify the block to retrieve the on-chain data, and the root hash stored in the meta node and the Bloom filter value are compared to see if they are consistent with the on-chain data stored in step (2). If they are consistent, it means that the data in the database has not been tampered with, and the off-chain database data meets the trust condition. The verification path of the Bloom filter Merkle tree and the query result are returned to the user together. The response data received by the user includes both the query result and the corresponding verification path. Since the Bloom filter Merkle tree contains a Merkle structure, the integrity and immutability of the data can be ensured. The verification path provides a reliable Merkle Proof verification path from the off-chain database to the on-chain data. The user can calculate and verify whether the summary is consistent with the on-chain through the path. At the same time, the queried key-value data will be written to the cache layer, and the cache expiration time will be set. If the metadata is inconsistent with the on-chain data stored in step (2), it is considered that the query result of the database does not meet the trust condition, and the query will continue in the public chain.
[0084] If the data corresponding to hash' is not found in the Bloom filter Merkle tree, the query will continue in the public chain. That is to say, the query in the public chain is divided into two cases: one is that the query in the database does not meet the trust condition and needs further confirmation, and the other is that the query result in the database is empty. If the database trust condition is not met and hash' is retrieved in the public chain, it is necessary to reconstruct the Bloom filter Merkle tree of the batch data according to the batch information, quickly locate the tampered node according to the Merkle tree, modify the node information in the database, and then quickly construct the Bloom filter Merkle tree to restore the trust of the database. If the database query result is empty because the on-chain data has not yet triggered the synchronization mechanism, the query result of the public chain is directly returned to the user and the key-value data is written in the cache layer, and the cache expiration time is set to the trigger time of TIT. It should be noted that hash' is still not found in the public chain in the end, indicating that the shared data received by the data owner has been tampered with in the sharing process.
[0085] In the embodiment of the present invention, the proposed Bloom filter Merkle tree index structure and its insertion and search methods can ensure the fast indexing and tamper-proofness of off-chain data. Uploading the root node hash value and Bloom filter value of the Bloom filter Merkle tree to the chain further ensures the tamper-proofness of the off-chain data. The on-chain blockchain height recorded in the meta node can quickly locate the meta node in the public chain, saving retrieval time. In addition, the hierarchical query scheme of cache-external database-public chain proposed in the embodiment of the present invention further improves the audit query time of the method, and can provide data users with verifiable query services, thereby improving the credibility of shared data.
[0086] In order to verify the effectiveness of the solution of the present invention, the present invention also provides relevant comparative experiments.
[0087] (I) The tamper-proof index structure of the Bloom filter Merkle tree proposed in the highway accident rescue data sharing method based on the Bloom filter Merkle tree disclosed in the present invention has the advantage of high efficiency. To verify the effect of the present invention, the following experiment was conducted:
[0088] The experimental comparison schemes are: ExDB-Chain storage architecture (Scheme 1), VeriQuery off-chain query scheme (Scheme 2), off-chain data verifiable query scheme (Scheme 3), blockchain-based secure storage and trusted data sharing (Scheme 4). 50, 100, 200, 500, 1000 and 2000 consecutive queries were executed respectively. No query optimization was done for the query, and all were single-threaded queries.
[0089] The specific experimental results are shown in Table 1. The query efficiency of the Merkle tree based on Bloom filtering proposed in the present invention is better than the above-mentioned schemes. This is mainly because the data is processed in batches, which reduces the height of the index tree and thus reduces the query time overhead, and the data query is pruned through the Bloom filter. Scheme 2 needs to sort the data and calculate the data summary when querying, while this scheme also needs to calculate the summary but does not need to sort the data. Scheme 3 stores data through MPT, which draws on the idea of Ethereum data storage. However, the stored data is a summary or hash value, which is often randomly distributed and lacks a common prefix, which causes the tree structure of MPT to degenerate into a nearly linear linked list, thereby resulting in a decrease in query performance. Scheme 4 uses public chain native query.
[0090] Table 1 Comparison of query time between the Bloom filter Merkle tree index proposed in this invention and the existing method
[0091]
[0092] (II) The cache-external database-public chain hierarchical query proposed in the highway accident rescue data sharing method based on Bloom filter Merkle tree disclosed in the present invention has the advantage of high efficiency. To verify the effect of the present invention, the following experiment was conducted:
[0093] The experimental comparison schemes are: VeriQuery off-chain query scheme (Scheme 2), blockchain-based secure storage and trusted data sharing (Scheme 4). 50, 100, 200, 500 and 1000 consecutive queries were executed for performance testing. This experiment not only includes the query consumption of the external database, but also takes into account the time consumption of querying the public chain (except for Scheme 4, which uses the query time of native Ethereum query).
[0094] The specific experimental results are shown in Table 2. The query time increases with the number of queries. The hierarchical query proposed by the present invention takes the least time, which is 50.32 seconds for 1000 queries, while the query time of scheme 4 reaches 437.1 seconds and the query time of scheme 2 is 57.12 seconds.
[0095] Table 2 Comparison of query time between the hierarchical query proposed by the present invention and the existing method
[0096]
[0097] Corresponding to the above method, an embodiment of the present invention also provides a highway accident rescue data sharing system based on Bloom filter Merkle tree, including: a public chain, an alliance chain, a database, a synchronization module and a query module.
[0098] Among them, the public chain is used to store the summary of highway accident rescue data and the root node information of the Bloom filter Merkle tree; the consortium chain is used to store the ciphertext index of highway accident rescue data; the synchronization module is used to synchronize the data summaries on the public chain to the database in batches when the synchronization mechanism is triggered and to establish the Bloom filter Merkle tree and index structure of the current batch data summary; the query module is used to receive query requests and share and audit highway accident rescue data through a hierarchical manner of cache-database-public chain.
[0099] It should be noted that the data sharing system provided in the embodiment of the present invention is for implementing the above method. The specific functions thereof can be referred to the above method embodiments, which will not be described in detail here.
[0100] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 communicate with each other through the communication bus 504. The processor 501 may call the logic instructions in the memory 503 to execute the data sharing method, which includes: storing the highway accident rescue data summary and the ciphertext index in the public chain and the alliance chain respectively; when the synchronization mechanism is triggered, synchronizing the data summary on the public chain to the database in batches and establishing the Bloom filter Merkle tree and index structure of the current batch data summary; storing the root node information of the Bloom filter Merkle tree in the public chain; receiving the query request and sharing and auditing the highway accident rescue data through the hierarchical mode of cache-database-public chain.
[0101] In addition, when the logic instructions in the above-mentioned memory 503 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0102] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments.
[0103] An embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the methods provided by the above-mentioned method embodiments are implemented.
[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A highway accident rescue data sharing method based on Bloom filter Merkle tree, characterized in that: include: Step 1: Store the highway accident rescue data summary and ciphertext index into the public chain and consortium chain respectively; Step 2: When the synchronization mechanism is triggered, the data summaries on the public chain are synchronized to the database in batches and the Bloom filter Merkle tree and index structure of the current batch data summaries are established; Step 3: Store the root node information of the Bloom filter Merkle tree into the public chain; Step 4: Receive query requests and share and audit highway accident rescue data through a layered approach of cache-database-public chain.
2. A highway accident rescue data sharing method based on Bloom filter Merkle tree according to claim 1, characterized in that: The triggering condition of the synchronization mechanism is a trigger based on the number of data items or a trigger based on time.
3. The highway accident rescue data sharing method based on Bloom filter Merkle tree according to claim 1 is characterized in that: In step 2, a Bloom filter Merkle tree of the current batch data summary is established, including: For each data summary, calculate its corresponding key value; construct a balanced binary search tree based on all data summaries of the current batch and the corresponding key values, start from the bottom of the tree, perform hash operations on the left and right leaf nodes respectively, merge the two hash values to obtain new hash values, store them in the upper extension nodes of the left and right leaf nodes, and maintain pointers to the left and right leaf nodes in the extension nodes, repeat the above process until the root node is reached; when the generated key value has a hash conflict, generate the corresponding value linked list; Correspondingly, the index structure is divided into a root node, an extended node, a leaf node and a meta node; wherein, the information defining the root node includes the key value range of all data summaries of the current batch, the Bloom filter value, the key value of the root node, the value list corresponding to the key value, the hash value and the pointers to the left and right leaf nodes; the information defining the extended node includes the key value of the extended node, the value list corresponding to the key value, the hash value and the pointers to the left and right leaf nodes; the information defining the leaf node includes the key value of the leaf node and the value list corresponding to the key value; the information defining the meta node includes the hash value of the root node, the Bloom filter value and the block height of the meta node in the public chain.
4. The highway accident rescue data sharing method based on Bloom filter Merkle tree according to claim 1 is characterized in that: Step 4 specifically includes: According to the query request, the query is first performed in the cache layer. If the data is hit, the query data is returned if the trust is met; if there is no hit, the query is then performed in the database layer. The query process includes: first eliminating the interference branches through the Bloom filter value in the meta node, and then querying the remaining branches according to the key value according to the index structure of the Bloom filter Merkle tree. If the data is hit, the query data is returned if the trust is met; if there is still no hit, the query is then performed in the public chain layer. If the data is hit, the query data is returned.
5. A highway accident rescue data sharing method based on Bloom filter Merkle tree according to claim 4, characterized in that: Also includes: If the database query is empty because the database query does not meet the database trust condition, and the data is hit at the public chain layer, the Bloom filter Merkle tree of the batch data summary is reconstructed according to the batch information corresponding to the query data; If the database query is empty because the data on the public chain has not yet triggered the synchronization mechanism to be synchronized to the database, and the data is hit at the public chain layer, the key value and corresponding hash value of the query data are written to the cache layer, and the cache expiration time is set to the trigger time of the synchronization mechanism.
6. A highway accident rescue data sharing method based on Bloom filter Merkle tree according to claim 1, characterized in that: Step 1 also includes: encrypting the highway accident rescue data using a ciphertext policy attribute encryption algorithm to obtain ciphertext, and uploading the ciphertext to the Interstellar File System; Correspondingly, the index of the ciphertext in the Interplanetary File System is stored in the consortium chain.
7. A highway accident rescue data sharing system based on Bloom filter Merkle tree, characterized in that: Including public chain, alliance chain, database, synchronization module and query module; The public chain is used to store highway accident rescue data summary and root node information of the Bloom filter Merkle tree; The consortium chain is used to store the ciphertext index of highway accident rescue data; The synchronization module is used to synchronize the data summaries on the public chain to the database in batches and establish a Bloom-filtered Merkle tree and index structure of the current batch data summaries when the synchronization mechanism is triggered; The query module is used to receive query requests and share and audit highway accident rescue data through a layered approach of cache-database-public chain.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Authentication information storage method, system, device and product of edge computing device
CN120281590A