A method and system for retrieving traffic data files based on blockchain

By dividing traffic data files of different security levels in the blockchain and using a double-chain structure blockchain for storage, the problem of insufficient data security in the existing technology is solved, and secure hierarchical storage and rapid retrieval of data are realized.

CN119719033BActive Publication Date: 2025-06-20JIANGSU ZHICHENG HUINING TRANSPORTATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510230493.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-06-20
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

In the prior art, there is a single encryption method for traffic data file storage based on blockchain that cannot provide targeted security protection for data of different importance, single-chain structure cannot be stored in layers according to the differences in data content, and a fixed structural model is easily mastered by attackers, resulting in insufficient data security.

Method used

By dividing traffic data files into sub-files of different security levels and storing them in a double-chain structure blockchain, the preset index tree is used to store high-security content in high-encryption blockchain chain nodes, and the low-security content is stored in low-encryption blockchain chain nodes, and the hierarchical storage and encryption of data are achieved.

Benefits of technology

It improves the security of traffic data files, reduces the risk of data loss or damage caused by single-chain failure, and realizes secure hierarchical storage and rapid retrieval of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719033B_ABST
    Figure CN119719033B_ABST
Patent Text Reader

Abstract

This application relates to the field of blockchain technology. This application discloses a method and system for retrieving and storing traffic data files based on blockchain, including: dividing the traffic data file to be retrieved and stored into a first content and a second content; based on a preset index tree, storing the first content in a first chain node of a first blockchain and storing the second content in a second chain node of a second blockchain; in response to a retrieval condition input by a user, reading the first content and the second content from the corresponding first chain node and second chain node through the index tree; by combining the index tree containing two chain node addresses and two blockchains with different security levels, this application realizes the split storage of the same traffic data file, on the one hand, improving the security of the traffic data file, and on the other hand, reducing the risk of data loss or damage caused by a single-chain failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and particularly to a method and system for retrieving and storing traffic data files based on blockchain. Background Art

[0002] Traditional methods for retrieving and storing traffic data files based on blockchain usually simply store traffic data in the blockchain and use a single encryption method, which cannot provide targeted security protection for traffic data of different importance levels; traditional blockchain structures use a single-chain structure and cannot perform hierarchical storage according to differences in data content; traditional blockchain structures adopt a fixed structural pattern, making it easy for attackers to master the node positions and stored data in the blockchain and unable to ensure data security.

[0003] For example, the patent application with the publication number CN114265815A discloses a method, server, storage medium, and system for storing traffic media data. The method includes receiving data to be stored sent by a base station, where the data to be stored is collected by a terminal and sent to the base station; encrypting the data to be stored to obtain an electronic ciphertext and sending the electronic ciphertext to a second server, so that the second server generates a corresponding index value according to the electronic ciphertext; receiving the index value returned by the second server, encrypting the index value according to a preset key to obtain an encrypted index value, and storing the encrypted index value in the consortium blockchain.

[0004] The above technical solutions have the problems raised in this background art: using a single encryption method cannot provide targeted security protection for traffic data of different importance levels; using a single-chain structure cannot perform hierarchical storage according to differences in data content; adopting a fixed structural pattern makes it easy for attackers to master the node positions and stored data in the blockchain and unable to ensure data security; to solve at least one of the above problems, this application proposes a method and system for retrieving and storing traffic data files based on blockchain. Summary of the Invention

[0005] Aiming at the deficiencies of the prior art, the main purpose of this application is to provide a method and system for retrieving and storing traffic data files based on blockchain, which can effectively solve the problems in the background art. The specific technical solutions of this application are as follows:

[0006] A method for retrieving and storing traffic data files based on blockchain includes:

[0007] Dividing the traffic data file to be retrieved and stored into a first content and a second content, where the required security level of the first content is higher than that of the second content;

[0008] Based on a preset index tree, store the first content in the first chain node of the first blockchain and store the second content in the second chain node of the second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain;

[0009] In response to a retrieval condition input by a user, read the first content and the second content from the corresponding first chain node and second chain node through the index tree; wherein the index tree includes the first chain node address and the second chain node address of each traffic data file.

[0010] Specifically, the storing the first content in the first chain node of the first blockchain and storing the second content in the second chain node of the second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain, includes:

[0011] Generate corresponding content indexes according to the first content and the second content, and construct an index tree;

[0012] Based on the structure of the index tree, construct the first blockchain and the second blockchain, and the combination of the first blockchain and the second blockchain results in a double-chain structure blockchain;

[0013] Encrypt and store the first content in the first chain node of the first blockchain, and encrypt and store the second content in the second chain node of the second blockchain.

[0014] Specifically, the generating corresponding content indexes according to the first content and the second content and constructing an index tree includes:

[0015] Extract information from the first content and the second content respectively to obtain first key information and second key information;

[0016] Calculate a first key value and a second key value through a hash function according to the first key information and the second key information;

[0017] Determine a first chain node address and a second chain node address according to the first key value and the second key value;

[0018] Generate corresponding content indexes according to the first chain node address and the second chain node address;

[0019] Store the content indexes in leaf nodes to obtain multiple leaf nodes;

[0020] Hierarchically combine the multiple leaf nodes according to the key value size to construct an index tree.

[0021] Specifically, based on the structure of the index tree, a first blockchain and a second blockchain are constructed, and the combination of the first blockchain and the second blockchain results in a double-chain structure blockchain, including:

[0022] Multiple chain nodes are obtained according to the institution to which the traffic data file belongs;

[0023] According to the index tree, an initial first blockchain and an initial second blockchain are respectively configured on each chain node, and a mirror structure exists between the initial first blockchain and the initial second blockchain;

[0024] Within a preset time period, the chain nodes of the initial first blockchain and the initial second blockchain are respectively updated to obtain an updated first blockchain and an updated second blockchain;

[0025] The updated first blockchain and the updated second blockchain are combined to obtain a double-chain structure blockchain.

[0026] Specifically, the step of, within a preset time period, respectively updating the chain nodes of the initial first blockchain and the initial second blockchain to obtain an updated first blockchain and an updated second blockchain includes:

[0027] Within a preset time period, the chain nodes in the initial second blockchain are randomly updated to obtain an updated second blockchain;

[0028] According to the updated second blockchain, the index tree is dynamically updated to obtain an updated index tree;

[0029] According to the updated index tree, the chain nodes in the initial first blockchain are pseudo-randomly updated to obtain an updated first blockchain.

[0030] Specifically, the step of, according to the updated index tree, pseudo-randomly updating the chain nodes in the initial first blockchain to obtain an updated first blockchain includes:

[0031] The chain nodes to be updated in the initial first blockchain are obtained according to the updated index tree;

[0032] According to a preset seed value, the chain nodes to be updated are updated through a pseudo-random algorithm to obtain updated nodes;

[0033] The updated nodes and the non-updated chain nodes in the initial first blockchain are recombined to obtain an updated first blockchain.

[0034] Specifically, the step of encrypting the first content and storing it in the first chain node of the first blockchain, and encrypting the second content and storing it in the second chain node of the second blockchain includes:

[0035] Encrypt the first content using a preset first encryption algorithm to obtain first encrypted data;

[0036] Encrypt the second content using a preset second encryption algorithm to obtain second encrypted data;

[0037] Vote on the non-first chain nodes of the first blockchain and the non-second chain nodes of the second blockchain according to the legality of the stored procedure to obtain a voting result;

[0038] When the number of consent nodes in the voting result is greater than the preset number of nodes, store the first encrypted data in the first chain node and store the second encrypted data in the second chain node.

[0039] Specifically, the step of responding to the retrieval condition input by the user and reading the first content and the second content from the corresponding first chain node and second chain node through the index tree includes:

[0040] Search for a branch tree in the index tree according to the retrieval condition input by the user;

[0041] Determine the downward search path in the branch tree according to the retrieval condition until the target leaf node is retrieved;

[0042] Locate the target first chain node and target second chain node in the double-chain structure blockchain according to the information stored in the target leaf node;

[0043] Obtain the target first encrypted data, target second encrypted data and corresponding encryption keys from the target first chain node and target second chain node to obtain the first content and the second content.

[0044] Specifically, the step of determining the downward search path in the branch tree according to the retrieval condition until the target leaf node is retrieved includes:

[0045] Parse the retrieval condition to obtain a retrieval key value;

[0046] Start from the root node of the branch tree and compare the retrieval key value with the node key value to obtain a comparison result;

[0047] When the comparison result is that the retrieval key value is less than the node key value, continue to search downward according to the sub-node pointer corresponding to the node key value;

[0048] Repeat the key value comparison and search process. When the comparison result is that the retrieval key value is equal to the node key value or the difference between the retrieval key value and the node key value is within the preset key value range, the target leaf node is retrieved.

[0049] A traffic data file storage and retrieval system based on blockchain, which is used to implement the described traffic data file storage and retrieval method based on blockchain, includes:

[0050] A file content division module that divides the traffic data file to be stored and retrieved into a first content and a second content, where the required security level of the first content is higher than that of the second content;

[0051] A traffic data file storage module that, based on a preset index tree, stores the first content in a first chain node of a first blockchain and stores the second content in a second chain node of a second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain;

[0052] A traffic data file retrieval module that, in response to a retrieval condition input by a user, reads the first content and the second content from the corresponding first chain node and second chain node through the index tree; where the index tree includes the first chain node address and the second chain node address of each traffic data file.

[0053] Compared with the prior art, the present application has the following beneficial effects:

[0054] By combining an index tree that includes two chain node addresses and two blockchains with different security levels, the present application splits the traffic data file into two sub-files with different security levels (the first content and the second content) and stores them in two blockchains, thereby realizing the split storage of the same traffic data file. On the one hand, it improves the security of the traffic data file, and on the other hand, it reduces the risk of data loss or damage caused by a single-chain failure. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a working flow chart of a traffic data file storage and retrieval method based on blockchain in Embodiment 1 of the present application;

[0056] Figure 2 It is a schematic diagram of traffic data file classification in Embodiment 1 of the present application;

[0057] Figure 3 It is a schematic diagram of a double-chain structure blockchain in Embodiment 1 of the present application;

[0058] Figure 4 It is a schematic diagram of the update process of a double-chain structure blockchain in Embodiment 1 of the present application;

[0059] Figure 5 It is a schematic diagram of the structure of a traffic data file storage and retrieval system based on blockchain in Embodiment 2 of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0060] To make the above objects, features, and advantages of the present invention more apparent and understandable, the following detailed description of the specific embodiments of the present invention will be provided in conjunction with the accompanying drawings of the specification.

[0061] In the following description, many specific details are set forth in order to provide a thorough understanding of the present invention. However, the present invention may be practiced in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.

[0062] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation manner of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it an individual or alternative embodiment that is mutually exclusive with other embodiments.

[0063] Embodiment 1

[0064] This embodiment provides a method for storing and retrieving traffic data files based on a blockchain. As Figure 1 shown, the method for storing and retrieving traffic data files based on a blockchain includes:

[0065] S101. Divide the traffic data file to be stored and retrieved into a first content and a second content, where the required security level of the first content is higher than that of the second content;

[0066] S102. Based on a preset index tree, store the first content in a first chain node of a first blockchain and store the second content in a second chain node of a second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain;

[0067] S103. In response to a retrieval condition input by a user, read the first content and the second content from the corresponding first chain node and second chain node through the index tree; where the index tree includes the first chain node address and the second chain node address of each traffic data file.

[0068] In this embodiment, traffic data files generally include road data, traffic flow data, traffic facility data, and traffic event data. For example, it records the time, location, or accident type of a traffic accident, etc. Different contents in the traffic data file have different requirements for the encryption level. Classify the contents of the data file according to the encryption requirements. As Figure 2, according to the encryption requirements of different contents, the traffic data file A splits the content into the first content B and the second content C, where the security level requirement of the first content B is higher than that of the second content C. By classifying different contents in the file, it can not only meet the security requirements of different data contents, but also reasonably allocate encryption resources, avoid wasting resources caused by over-encrypting low-sensitive data, and at the same time ensure that high-sensitive data is fully protected.

[0069] Specifically, two corresponding blockchains are configured at each data node. One chain is used to store the content with high encryption requirements, which is encrypted using a high-strength encryption algorithm and uploaded to the corresponding chain node. The other chain is used to store the content with low encryption requirements, which is encrypted using a low-strength encryption algorithm and uploaded to the corresponding chain node. And the two chains are in a mirror structure, constructing a double-chain structure blockchain. By setting the double-chain structure, it can meet the different encryption requirements of different contents of the traffic data file, provide a high level of encryption protection for sensitive data, and at the same time reasonably utilize resources to provide appropriate security protection for ordinary data. At the same time, the double-chain mirror structure enhances the reliability and fault tolerance of the data, reduces the risk of data loss or damage caused by a single-chain failure, and ensures the continuous availability of traffic data.

[0070] Specifically, when retrieving and viewing the file, the user inputs the retrieval conditions according to needs. By parsing the retrieval conditions, continuously searching in the index tree, finding the leaf node that matches the corresponding retrieval conditions, and according to the pointer provided by the leaf node of the index tree, determining which chain in the double-chain structure blockchain the data is stored in, and locating to the corresponding chain node in the double-chain structure blockchain, obtaining the stored encrypted content and the corresponding key, using the key to decrypt the encrypted file, and viewing the original traffic data file. By searching for nodes through the index tree, accurately locating to the corresponding node, ensuring the accuracy of the retrieval result, and realizing the fast retrieval of the traffic data file.

[0071] This application combines an index tree that simultaneously contains two chain node addresses and two blockchains with different security levels, splits the traffic data file into two sub-files with different security levels (the first content and the second content) and stores them in the two blockchains, so as to realize the split storage of the same traffic data file. On the one hand, it improves the security of the traffic data file, and on the other hand, it reduces the risk of data loss or damage caused by a single-chain failure.

[0072] Further, based on the preset index tree, storing the first content in the first chain node of the first blockchain and storing the second content in the second chain node of the second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain, includes:

[0073] S201. Generate a corresponding content index based on the first content and the second content, and construct an index tree;

[0074] S202. Based on the structure of the index tree, construct a first blockchain and a second blockchain, and the combination of the first blockchain and the second blockchain results in a double-chain structure blockchain;

[0075] S203. Encrypt the first content and store it in the first chain node of the first blockchain, and encrypt the second content and store it in the second chain node of the second blockchain.

[0076] In this embodiment, according to the information in the first content and the second content, such as the location, time, etc. information in the traffic data file, different information in the key information is respectively encoded and calculated to generate a corresponding content index. The content index includes information such as the key information of the data file and the storage location pointer, etc. The different information in the content index is respectively stored in the corresponding leaf nodes. According to the relevant relationships between the leaf nodes, corresponding combined associations are constructed between the leaf nodes to construct an index tree. By constructing the index tree, a large number of traffic data files can be organized in an orderly manner, which is convenient for management and maintenance, and can quickly locate the location of the target file, improving the retrieval speed of traffic data files.

[0077] Specifically, the index information stored in each leaf node in the index tree corresponds one-to-one with the chain nodes in the double-chain structure blockchain. Based on the structure of the index tree, the structures of the first blockchain and the second blockchain in the double-chain structure blockchain are configured, where the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain, resulting in a double-chain structure blockchain; the first content B and the second content C are respectively encrypted, and the encryption algorithm strength for encrypting the first content B is higher than the encryption algorithm for encrypting the second content C. After encryption, the first encrypted content is respectively stored in the first chain node of the first blockchain, and the second encrypted content is stored in the second chain node of the second blockchain to achieve split-chain storage.

[0078] Further, the generating a corresponding content index based on the first content and the second content, and constructing an index tree includes:

[0079] S301. Extract information from the first content and the second content respectively to obtain the first key information and the second key information;

[0080] S302. Calculate the first key value and the second key value through a hash function according to the first key information and the second key information;

[0081] S303. Determine the first chain node address and the second chain node address according to the first key value and the second key value;

[0082] S304. Generate a corresponding content index according to the first chain node address and the second chain node address;

[0083] S305. Store the content index in leaf nodes to obtain multiple leaf nodes;

[0084] S306. Hierarchically combine the multiple leaf nodes according to the key value size to construct an index tree.

[0085] In this embodiment, different types of traffic data files contain rich information. By extracting representative key information from them, efficient indexing and retrieval can be achieved. According to the file type, corresponding information extraction methods are adopted. For example, for text files, regular expression technology is used to extract key information. In a text file of a traffic accident report, specific keywords including accident type, occurrence location, and time are matched through regular expressions to extract the corresponding key information; for image or video files, image recognition technology is utilized, and information such as accident scenes, vehicle types, and road signs is recognized through a preset key information extraction model as key information; information extraction is respectively performed on the first content B and the second content C to obtain the first key information and the second key information, which can clearly define the core content and characteristics of different contents, provide representative information for subsequent index construction, enable the index to accurately reflect the content of the data file, and thus improve the quality of the index and the accuracy of retrieval.

[0086] Specifically, preprocess the first key information and the second key information to make them meet the input requirements of the hash function, such as converting text to a byte stream and converting numbers to a specific encoding form. Calculate the preprocessed key information through the hash function to obtain a unique key value, calculate the first key value and the second key value. By calculating the unique key value, it is ensured that different data contents can be accurately distinguished in the index tree, avoiding index conflicts, and improving the search speed and efficiency; according to the size of the key value, determine which node in the index tree the key value should be stored in. For example, in a B+ tree, starting from the root node, compare the key value with the key value of the root node and search downward level by level in the order of the key value until a suitable leaf node is found. Generate a retrieval pointer pointing to the storage chain node position of the traffic data file in the double-chain structure blockchain. The retrieval pointer can be information such as the storage path of the file, the block number and offset in the blockchain. By means of the correspondence between the retrieval index and the storage position of the traffic data file, when retrieving the data file, the corresponding node can be directly found according to the key value, and then the retrieval pointer can be obtained to quickly locate the storage position of the traffic data file, improving the retrieval efficiency.

[0087] Specifically, the calculated key values, retrieval pointers, and pointers to the next leaf node are stored in the corresponding nodes to obtain multiple information nodes containing traffic data file index information. The multiple information nodes are hierarchically combined according to the key values. In the B+ tree, starting from the root node, the information nodes are gradually inserted into the appropriate positions to construct an index tree. By constructing the index tree through the hierarchical structure and key value comparison, the target information node can be quickly located, thereby realizing the fast retrieval of traffic data files.

[0088] Further, based on the structure of the index tree, a first blockchain and a second blockchain are constructed. The combination of the first blockchain and the second blockchain results in a double-chain structure blockchain, including:

[0089] S401. Obtain multiple chain nodes according to the institutions to which the traffic data files belong;

[0090] S402. Configure an initial first blockchain and an initial second blockchain on each chain node according to the index tree. The initial first blockchain and the initial second blockchain are in a mirror structure;

[0091] S403. Update the chain nodes of the initial first blockchain and the initial second blockchain respectively within a preset time period to obtain an updated first blockchain and an updated second blockchain;

[0092] S404. Combine the updated first blockchain and the updated second blockchain to obtain a double-chain structure blockchain.

[0093] In this embodiment, traffic data files are usually generated and managed by multiple different institutions, such as traffic management departments, scientific research institutions, relevant enterprises, etc. Using these institutions as chain nodes to construct a blockchain network can make full use of the resources and data advantages of each institution to achieve distributed storage and management of data; configure an initial first blockchain and an initial second blockchain on each chain node and make them in a mirror structure, and the prefixes of their data upload addresses are the same. For example, the data address uploaded to the initial first blockchain is 1234.1, and the data address uploaded to the initial second blockchain is 1234.2. The first blockchain is used to store highly encrypted data, and a high-strength encryption algorithm is used to ensure data security; the second blockchain is used to store low-encrypted data to meet the basic security requirements of data at a relatively low encryption cost; through the mirror structure, different contents belonging to the same data file are respectively uploaded to the same node in the two chains to ensure node consistency. Through the double-chain structure, different strength encryption algorithms are used on different chains to achieve hierarchical management of data security and meet the security requirements of different data. Such as Figure 3, find the positions of the chain node D corresponding to the data file upload location in the initial first blockchain and the initial second blockchain according to the index tree. After encrypting the first content B and the second content C, store them in the chain node D in the corresponding initial first blockchain and initial second blockchain respectively. Figure 3 In it, E, F, G, and H are different chain nodes respectively.

[0094] Specifically, updating the chain nodes of the initial first blockchain and the initial second blockchain according to a preset time period can effectively avoid problems such as performance degradation, load imbalance, or security vulnerabilities that may occur in the chain nodes of the initial first blockchain and the initial second blockchain over time and with the continuous change of traffic data. Updating the chain nodes can prevent attackers from mastering the system rules, further enhancing the security and flexibility of the system. At the same time, updating the association between the index tree and the double chain ensures the accuracy of data storage and retrieval; combining the updated first blockchain and the second blockchain to form the final double-chain structure blockchain. By combining the two chains together, functions such as secure hierarchical storage, mirror backup, and mutual verification of data can be realized, which can provide reliable support for the storage, retrieval, and management of traffic data.

[0095] Furthermore, within the preset time period, updating the chain nodes of the initial first blockchain and the initial second blockchain respectively to obtain an updated first blockchain and an updated second blockchain includes:

[0096] S501. Randomly update the chain nodes in the initial second blockchain within the preset time period to obtain an updated second blockchain;

[0097] S502. Dynamically update the index tree according to the updated second blockchain to obtain an updated index tree;

[0098] S503. Pseudo-randomly update the chain nodes in the initial first blockchain according to the updated index tree to obtain an updated first blockchain.

[0099] In this embodiment, within a preset time period, randomly update the chain nodes in the initial second blockchain, which can prevent the fixed node connection mode and function allocation from being exploited by attackers to steal data. Determine the update range according to the stability and performance requirements of the system, and decide whether to randomly update all chain nodes or select some nodes for update according to a certain proportion. Set the update method for the nodes. For example, the connection relationship between nodes can be randomly changed or the storage tasks of nodes can be reallocated. The node that originally stored certain data can be changed to store other data. Randomly update the selected nodes according to the update method. For example, when changing the node connection relationship, randomly select other nodes from the node list, establish new connections, and disconnect some original connections to obtain the updated second blockchain. After the update is completed, verify the integrity of the updated second blockchain. By randomly updating the second blockchain, the risk of the blockchain system being attacked can be effectively reduced, and the security and privacy of traffic data can be protected.

[0100] Specifically, after the chain nodes in the second blockchain are updated, the storage location of data, the association relationship between nodes and data, etc. may change. Dynamically adjust the index tree according to the update situation of the second blockchain to ensure that the corresponding data can be accurately found through the index tree and maintain the consistency between the index and the actual data storage state. Specifically, according to the changes in the second blockchain, adjust the corresponding pointers in the index tree. If the storage node of the data file changes, modify the pointer of the blockchain node pointed to by the corresponding key value in the index tree to obtain the updated index tree. By updating the index tree structure, it can be ensured that the index tree can always accurately point to the data storage location in the second blockchain, improving the accuracy of data retrieval.

[0101] Specifically, after the chain nodes of the second blockchain are updated, also update the first blockchain. Adopt different update methods for the update of the chain nodes in the first blockchain, such as Figure 4 , update the node positions and the link relationships between the chain nodes in the initial second blockchain and the initial first blockchain respectively to obtain the updated second blockchain and the updated first blockchain. This can prevent attackers from attacking the first blockchain after mastering the node positions and data information of the second blockchain. The updated first blockchain and the updated second blockchain are no longer in a mirror structure, which can increase the difficulty of attack for attackers, making it difficult for attackers to predict the node update rules and avoid the loss of highly sensitive data, improving the security and flexibility of the system. Specifically, use the pseudo-random update method to perform pseudo-random update on the first blockchain according to the updated index tree.

[0102] Further, the step of performing pseudo-random update on the chain nodes in the initial first blockchain according to the updated index tree to obtain the updated first blockchain includes:

[0103] S601. Obtain the chain nodes to be updated in the initial first blockchain according to the updated index tree;

[0104] S602. Update the chain nodes to be updated through a pseudo-random algorithm according to a preset seed value to obtain updated nodes;

[0105] S603. Recombine the updated nodes with the non-updated chain nodes in the initial first blockchain to obtain an updated first blockchain.

[0106] In this embodiment, since the initial first blockchain and the initial second blockchain are in a mirror structure, the positions corresponding to the leaf node positions in the index tree are consistent with the initial first blockchain and the initial second blockchain. By updating the change situation of the leaf node information in the index tree, the chain nodes in the initial first blockchain that need to be updated due to the update of the second blockchain or the change of their own data storage situation are determined, and the chain nodes to be updated are obtained, avoiding unnecessary update operations on all nodes of the first blockchain, saving system resources and time costs, and at the same time ensuring that the update operation targets the nodes that really need to be adjusted, improving the update efficiency.

[0107] Specifically, use a pseudo-random algorithm, such as the linear congruence method, the Mersenne Twister algorithm, etc., to initialize the pseudo-random algorithm according to a preset seed value, formulate an update strategy for the chain nodes of the first blockchain to be updated according to the performance requirements of the system and the security requirements for the first blockchain, and based on the initialized pseudo-random algorithm and the formulated update strategy, update each chain node to be updated. For example, randomly change the position and name of the node. After the update operation is performed on each chain node to be updated, updated nodes are obtained. Through pseudo-random update, the security of the system can be effectively increased, the risk of attackers attacking by analyzing the node update rules is reduced, and the security and privacy of traffic data are protected. After updating some nodes, these updated nodes need to be re-integrated into the first blockchain, and the updated nodes are recombined with the non-updated chain nodes in the initial first blockchain to ensure that the connection relationship, data transfer mechanism, etc. between the updated nodes and the non-updated nodes remain smooth and maintain the coherence of the system. For example, functions such as block linking and transaction verification between the updated nodes and the non-updated nodes need to work properly after recombination to ensure the normal operation of the entire first blockchain.

[0108] Further, the storing the first content encrypted to the first chain node of the first blockchain and storing the second content encrypted to the second chain node of the second blockchain includes:

[0109] S701. Encrypt the first content using a preset first encryption algorithm to obtain first encrypted data;

[0110] S702. Encrypt the second content using a preset second encryption algorithm to obtain second encrypted data;

[0111] S703. Vote on the non-first chain nodes of the first blockchain and the non-second chain nodes of the second blockchain according to the legality of the stored procedure to obtain a voting result;

[0112] S704. When the number of consenting nodes in the voting result is greater than a preset number of nodes, store the first encrypted data in the first chain node and store the second encrypted data in the second chain node.

[0113] In this embodiment, different encryption algorithms are used to encrypt the first content and the second content respectively. For the first content, due to the sensitivity and importance of its information, a high-strength encryption algorithm is required to ensure the confidentiality, integrity, and anti-attack ability of the data. The preset first encryption algorithm has complex encryption logic and a long key length, which can effectively resist various known encryption cracking methods, making it difficult for attackers to obtain the original data within a reasonable time. For example, the AES-256 encryption algorithm, through its complex round transformation and key expansion mechanism, performs multi-level encryption processing on the data, greatly improving the security of the data; for the second content, although its sensitivity level is relatively low, certain encryption protection is still required to prevent the data from being easily obtained or tampered with. Compared with the first encryption algorithm, the preset second encryption algorithm has relatively simple encryption logic and a shorter key length. For example, the AES-128 encryption algorithm reduces the computational overhead during the encryption process while providing basic security protection, improving the data processing speed.

[0114] After obtaining the first encrypted data and the second encrypted data, determine the leaf node position in the index tree according to the content of the traffic data file, and locate the corresponding chain node in the blockchain according to the leaf node position to obtain the chain node to be stored, ensuring that the data is stored on the most suitable chain node and making full use of the storage capacity of each node; formulate a legality standard according to the data source, data format, and blockchain storage rules of the traffic data file to judge the legality of the data file storage process; broadcast the information to be stored of the traffic data file to all non-chain nodes to be stored in the double-chain structure blockchain, and transmit the formulated legality standard to each non-chain node to be stored together, ensuring that each node makes a judgment based on the same standard during voting.

[0115] Specifically, after each non-storage chain node receives the information to be stored and the legality criteria, it verifies the storage process of the traffic data file. For example, it verifies whether the digital signature of the data file is valid, checks whether the data format complies with the specifications, and determines whether the storage operation violates the storage rules of the blockchain, etc., to obtain the verification result. According to the verification result, each non-storage chain node conducts a vote, and the voting results are divided into consent and dissent. By counting the voting results and through the node voting method, the decentralized feature of the blockchain is fully reflected, ensuring that the data storage decision is made jointly by multiple nodes, improving the fairness and credibility of the system. By strictly verifying the legality of the storage process, illegal data can be effectively prevented from entering the blockchain, safeguarding the security and integrity of the blockchain and the data.

[0116] When the number of consent nodes in the voting result is greater than the preset number of nodes, data storage is allowed. The setting of the preset number of nodes is usually based on the number of nodes in the blockchain network and security requirements. Generally, it is required that more than half or a specific proportion (such as 2 / 3) of the nodes consent to prevent a small number of malicious nodes from manipulating the storage decision. By reaching a consensus through the majority decision method, the rationality and effectiveness of the data storage decision are ensured, and the stability and reliability of the blockchain network are improved.

[0117] Further, the reading of the first content and the second content from the corresponding first chain node and second chain node through the index tree in response to the retrieval condition input by the user includes:

[0118] S801. According to the retrieval condition input by the user, search for a branch tree in the index tree;

[0119] S802. According to the retrieval condition, determine the downward search path in the branch tree until the target leaf node is retrieved;

[0120] S803. According to the information stored in the target leaf node, locate the target first chain node and target second chain node in the double-chain structure blockchain;

[0121] S804. Obtain the target first encrypted data, target second encrypted data and the corresponding encryption keys from the target first chain node and target second chain node to obtain the first content and the second content.

[0122] In this embodiment, the retrieval conditions input by the user are analyzed, and the retrieval conditions are converted into a form that can be compared with the key values in the index tree. Starting from the root node of the index tree, the magnitudes and ranges of the key values are compared, enabling the rapid exclusion of subtrees that do not meet the conditions, gradually narrowing the search scope, and ultimately determining the branch tree containing the key values that may meet the retrieval conditions. This can avoid a comprehensive search of the entire index tree and improve the search efficiency. In the determined branch tree, the key value information of the retrieval conditions is continuously utilized to search downward along the branches of the tree until the target leaf node is reached. The target leaf node stores the target data pointer. By continuously refining the comparison between the retrieval conditions and the node key values, the target leaf node is accurately located, improving the accuracy of the search and avoiding wasting time and resources on irrelevant nodes.

[0123] Specifically, the target leaf node contains pointer information pointing to the chain nodes in the double-chain structure blockchain. Through the pointer information in the leaf node, the target chain node storing the required traffic data file can be found. Through the accurate mapping from the index structure to the storage structure, the efficient positioning of data is achieved. After locating the target chain node, the encrypted data content is read from the target chain node, and the encryption key corresponding to the encrypted data is searched for in the metadata of the chain node. Using the obtained encryption key, the encrypted data is decrypted according to the encryption algorithm used during storage (such as AES-256 or AES-128). The decrypted data is the original target traffic data file, which can be provided to the user in the format required by the user (such as text, image, video, etc.). Through the correct decryption operation, the encrypted data is restored to the original data, providing available data for the user and realizing the complete process of secure storage and on-demand retrieval of traffic data.

[0124] Further, determining the downward search path in the branch tree according to the retrieval conditions until the target leaf node is retrieved includes:

[0125] S901. Analyze the retrieval conditions to obtain the retrieval key value;

[0126] S902. Starting from the root node of the branch tree, compare the retrieval key value with the node key value to obtain a comparison result;

[0127] S903. When the comparison result is that the retrieval key value is less than the node key value, continue to search downward according to the child node pointer corresponding to the node key value;

[0128] S904. Repeat the key value comparison and search process. When the comparison result is that the retrieval key value is equal to the node key value or the difference between the retrieval key value and the node key value is within the preset key value range, the target leaf node is retrieved.

[0129] In this embodiment, the retrieval conditions input by the user are parsed and converted into retrieval key values, converting the diverse retrieval conditions of the user into unified retrieval key values to ensure that they can be compared with the key values in the index tree, providing a unified comparison standard for the search operation; first, the key value list stored in the root node of the branch tree is read, and the retrieval key value is compared with the key value of the root node to obtain a comparison result. By comparing nodes, most nodes that do not meet the conditions can be quickly excluded, greatly narrowing the search scope and accelerating the search process.

[0130] Specifically, in a B+ tree, a node usually stores pointers to child nodes. According to the comparison result, when the retrieval key value is less than the node key value, the pointer to the left child node corresponding to the node key value is obtained, and the current search position is updated to this child node for the next round of comparison and search operations. According to the relationship of key value sizes, by searching downward for child nodes, the search scope is continuously narrowed to a subtree that is more likely to contain the target data, improving the accuracy and efficiency of the search. Searching according to the logical structure of the index tree ensures the logic and coherence of the search process and avoids the chaos and resource waste caused by unordered search; the comparison and search operations are continuously repeated until the retrieval key value is equal to the node key value or within a certain range, indicating that a leaf node that may store the target data has been found. For a range query, a difference within the preset key value range means that a part of the data that meets the conditions has been found, and the leaf node and its adjacent leaf nodes need to be checked; for an exact query, being equal to the node key value means that the exact storage location of the target data has been found; finally, the target leaf node is searched. The target leaf node stores a pointer to the actual data storage location, completing the search process. By continuously narrowing the scope and iterative search, the leaf node that meets the retrieval conditions can be accurately found. Whether it is an exact query or a range query, the required data location can be accurately found.

[0131] Embodiment 2

[0132] In this embodiment, as Figure 5 , a traffic data file indexing and storage system based on a blockchain is provided for implementing the described traffic data file indexing and storage method based on a blockchain, including:

[0133] A file content division module that divides the traffic data file to be indexed and stored into a first content and a second content, where the required security level of the first content is higher than that of the second content;

[0134] A traffic data file storage module that, based on a preset index tree, stores the first content in a first chain node of a first blockchain and stores the second content in a second chain node of a second blockchain, where the data encryption level of the first blockchain is higher than that of the second blockchain;

[0135] The traffic data file retrieval module reads the first content and the second content from the corresponding first chain node and second chain node through the index tree in response to the retrieval condition input by the user; wherein the index tree includes the first chain node address and the second chain node address of each traffic data file.

[0136] The foregoing has shown and described the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and what is described in the above embodiments and the specification is only to illustrate the principle of the present invention. Without departing from the spirit and scope of the present invention, the present invention will also have various changes and improvements, and these changes and improvements fall within the scope of the present invention claimed. The scope of the present invention claimed is defined by the appended claims and their equivalents.

Claims

1. A traffic data file storage method based on blockchain, characterized in that: include: dividing the traffic data file to be stored into a first content and a second content, wherein the required security level of the first content is higher than the required security level of the second content; Based on a preset index tree, the first content is stored in a first chain node of a first blockchain, and the second content is stored in a second chain node of a second blockchain, wherein the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain; Based on the structure of the index tree, a first blockchain and a second blockchain are constructed, and the first blockchain and the second blockchain are combined to obtain a double-chain structure blockchain, including: According to the organization to which the traffic data file belongs, multiple chain nodes are obtained; According to the index tree, an initial first blockchain and an initial second blockchain are respectively configured on each chain node, wherein the initial first blockchain and the initial second blockchain are in a mirror image structure; Within a preset time period, the chain nodes of the initial first blockchain and the initial second blockchain are updated respectively to obtain an updated first blockchain and an updated second blockchain, including: Within a preset time period, randomly updating the chain nodes in the initial second blockchain to obtain an updated second blockchain; According to the updating of the second blockchain, the index tree is dynamically updated to obtain an updated index tree; According to the updated index tree, pseudo-randomly updating the chain nodes in the initial first blockchain to obtain an updated first blockchain includes: According to the update index tree, the chain node to be updated in the initial first blockchain is obtained; According to a preset seed value, the to-be-updated chain node is updated by a pseudo-random algorithm to obtain an updated node; Recombining the update node with the non-updated chain node in the initial first blockchain to obtain an updated first blockchain; Combining the updated first blockchain and the updated second blockchain to obtain a double-chain structure blockchain; In response to a search condition input by a user, the first content and the second content are read from the corresponding first link node and the second link node through the index tree; wherein the index tree includes a first link node address and a second link node address of each traffic data file.

2. A method for storing traffic data files based on blockchain according to claim 1, characterized in that: Based on the preset index tree, the first content is stored in the first chain node of the first blockchain, and the second content is stored in the second chain node of the second blockchain, and the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain, including: Generate a corresponding content index according to the first content and the second content, and construct an index tree; The first content is encrypted and stored in a first chain node of a first blockchain, and the second content is encrypted and stored in a second chain node of a second blockchain.

3. A method for storing traffic data files based on blockchain according to claim 2, characterized in that: The step of generating a corresponding content index and constructing an index tree according to the first content and the second content includes: Extract information from the first content and the second content respectively to obtain first key information and second key information; Obtaining a first key value and a second key value by using a hash function calculation according to the first key information and the second key information; Determine a first chain node address and a second chain node address according to the first key value and the second key value; Generate a corresponding content index according to the first chain node address and the second chain node address; Storing the content index in a leaf node to obtain a plurality of leaf nodes; The multiple leaf nodes are hierarchically combined according to the size of the key values ​​to construct an index tree.

4. According to a method for storing traffic data files based on blockchain in claim 2, it is characterized in that: The step of encrypting the first content and storing it in a first chain node of a first blockchain, and encrypting the second content and storing it in a second chain node of a second blockchain includes: Encrypting the first content using a preset first encryption algorithm to obtain first encrypted data; Encrypting the second content using a preset second encryption algorithm to obtain second encrypted data; According to the legitimacy of the storage process, the non-first chain nodes of the first blockchain and the non-second chain nodes of the second blockchain are voted to obtain the voting results; When the number of nodes that agree in the voting result is greater than the preset number of nodes, the first encrypted data is stored in the first chain node, and the second encrypted data is stored in the second chain node.

5. According to a method for storing traffic data files based on blockchain in claim 1, it is characterized in that: The step of reading the first content and the second content from the corresponding first chain node and the second chain node through the index tree in response to the search condition input by the user includes: According to the search conditions input by the user, a branch tree is searched in the index tree; According to the search condition, determining a downward search path in the branch tree until a target leaf node is retrieved; Locate the target first chain node and the target second chain node in the dual-chain structure blockchain according to the information stored in the target leaf node; The target first encrypted data and the target second encrypted data and the corresponding encryption keys are obtained from the target first chain node and the target second chain node to obtain the first content and the second content.

6. A method for storing traffic data files based on blockchain according to claim 5, characterized in that: Determining a downward search path in the branch tree according to the search condition until a target leaf node is retrieved includes: Parse the search conditions to obtain the search key value; Starting from the root node of the branch tree, the search key value is compared with the node key value to obtain a comparison result; When the comparison result is that the search key value is less than the node key value, continue searching downward according to the child node pointer corresponding to the node key value; The key value comparison and search process is repeated, and when the comparison result is that the retrieval key value is equal to the node key value or the difference between the retrieval key value and the node key value is within the preset key value range, the target leaf node is retrieved.

7. A traffic data file storage system based on blockchain, characterized in that: A method for storing traffic data files based on blockchain according to any one of claims 1 to 6, comprising: a file content division module, dividing the traffic data file to be stored into a first content and a second content, wherein the required security level of the first content is higher than the required security level of the second content; The traffic data file storage module stores the first content in a first chain node of a first blockchain based on a preset index tree, and stores the second content in a second chain node of a second blockchain, wherein the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain; The traffic data file retrieval module reads the first content and the second content from the corresponding first link node and the second link node through the index tree in response to the search conditions input by the user; wherein the index tree includes the first link node address and the second link node address of each traffic data file.

Citation Information

Patent Citations

  • Traffic media data storage method, server, storage medium and system

    CN114265815A

  • Block chain evidence storage method and system based on isomorphic multi-chain architecture

    CN113326317A

  • Railway vehicle on-board network communication data processing method, device, equipment and medium

    CN117792611A