Traffic data file storage method and system based on block chain
By dividing the content of traffic data files of different security levels in the blockchain and adopting a double-chain structure blockchain storage, the problem of insufficient data storage and security in traditional methods is solved, and efficient data hierarchical storage and multi-level encryption are achieved.
Patent Information
- Application Number
- CN202510230493.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-28
AI Technical Summary
The traditional blockchain-based traffic data file storage method cannot be stored in layers according to the differences in data content, and adopts a single encryption method and a fixed structural model, which cannot effectively ensure the security of data.
By dividing the traffic data files to be retrieved into the first content with a high demand security level and the second content with a low demand security level, and storing it in a double-chain structure blockchain based on a preset index tree, the encryption level of the first blockchain is higher than that of the second blockchain.
The hierarchical storage and multi-level encryption of traffic data files are realized, which improves data security and reduces the risk of data loss or damage caused by single-chain failure.
Smart Images

Figure CN119719033A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a method and system for requesting and storing traffic data files based on blockchain. Background Art
[0002] The traditional method of storing traffic data files based on blockchain usually simply stores the traffic data in the blockchain and adopts a single encryption method, which cannot provide targeted security protection for traffic data of different importance; the traditional blockchain structure uses a single chain structure and cannot perform hierarchical storage according to differences in data content; the traditional blockchain structure adopts a fixed structural model, which is easy for attackers to grasp the node location and storage data in the blockchain, and cannot guarantee the security of the data.
[0003] For example, a patent application with publication number CN114265815A discloses a traffic media data storage method, server, storage medium and system, the method comprising receiving data to be stored sent by a base station, wherein 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 alliance blockchain.
[0004] The above technical solutions have the problems raised by this background technology: using a single encryption method, it is impossible to provide targeted security protection for traffic data of different importance; using a single chain structure, it is impossible to perform hierarchical storage according to differences in data content; using a fixed structural mode, it is easy for attackers to grasp the node location and storage data in the blockchain, and the security of the data cannot be guaranteed; in order to solve at least one of the above problems, the present application proposes a traffic data file storage method and system based on blockchain. Summary of the invention
[0005] In view of the shortcomings of the prior art, the main purpose of this application is to provide a traffic data file storage method and system based on blockchain, which can effectively solve the problems in the background technology. The specific technical solutions of this application are as follows: A traffic data file storage method based on blockchain, comprising: 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; 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.
[0006] Specifically, based on a preset index tree, storing the first content in a first chain node of a first blockchain, storing the second content in a second chain node of a second blockchain, and the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain, includes: Generate a corresponding content index according to the first content and the second content, and construct an index tree; 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; 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.
[0007] Specifically, generating corresponding content indexes 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.
[0008] Specifically, the first blockchain and the second blockchain are constructed based on the structure of the index tree, 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; The updated first blockchain and the updated second blockchain are combined to obtain a dual-chain structure blockchain.
[0009] Specifically, 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: 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, the chain nodes in the initial first blockchain are pseudo-randomly updated to obtain an updated first blockchain.
[0010] Specifically, the pseudo-randomly updating the chain nodes in the initial first blockchain according to the updated index tree to obtain the 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; The updated nodes are recombined with the non-updated chain nodes in the initial first blockchain to obtain an updated first blockchain.
[0011] Specifically, 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.
[0012] Specifically, in response to the search condition input by the user, reading the first content and the second content from the corresponding first chain node and the second chain node through the index tree 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.
[0013] Specifically, 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.
[0014] A traffic data file storage system based on blockchain, used to implement a traffic data file storage method based on blockchain, 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.
[0015] Compared with the prior art, this application has the following beneficial effects: This application combines an index tree containing two chain node addresses with two blockchains with different security levels to split the traffic data file into two sub-files (first content and second content) with different security levels and store them on 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 due to single chain failure. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a workflow diagram of a traffic data file storage method based on blockchain in Example 1 of the present application; Figure 2 A schematic diagram of traffic data file classification in Example 1 of the present application; Figure 3 This is a schematic diagram of the double-chain structure blockchain in Example 1 of the present application; Figure 4 This is a schematic diagram of the update process of the double-chain structure blockchain in Example 1 of the present application; Figure 5 This is a structural diagram of a traffic data file storage system based on blockchain in Example 2 of the present application. DETAILED DESCRIPTION
[0017] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0018] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0019] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0020] Example 1 This embodiment provides a traffic data file storage method based on blockchain, such as Figure 1 As shown, the traffic data file storage method based on blockchain includes: S101, 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; S102. 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; S103. In response to a search condition input by a user, read the first content and the second content 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.
[0021] In this embodiment, the traffic data file generally includes road data, traffic flow data, traffic facility data and traffic event data, such as recording the time, location or type of traffic accidents. Different contents in the traffic data file have different requirements for encryption degree. The contents of the data file are classified according to the encryption requirements, such as Figure 2 , the traffic data file A is divided into the first content B and the second content C according to the encryption requirements of different contents. The required security level of the first content B is higher than the required security level of the second content C. By classifying the different contents in the file, it can not only meet the security requirements of different data contents, but also reasonably allocate encryption resources, avoid excessive encryption of low-sensitivity data and cause waste of resources, and ensure that high-sensitivity data is fully protected.
[0022] Specifically, two corresponding blockchains are configured at each data node. One chain is used to store content with high encryption requirements, which is encrypted using a high-intensity encryption algorithm and uploaded to the corresponding chain node. The other chain is used to store content with low encryption requirements, which is encrypted using a low-intensity encryption algorithm and uploaded to the corresponding chain node. The two chains are mirrored to construct a dual-chain blockchain. By setting up a dual-chain structure, different encryption requirements for different contents of traffic data files can be met, and a high level of encryption protection can be provided for sensitive data. At the same time, resources can be reasonably used to provide appropriate security protection for ordinary data. At the same time, the dual-chain mirror structure enhances the reliability and fault tolerance of the data, reduces the risk of data loss or damage due to single-chain failure, and ensures the continuous availability of traffic data.
[0023] Specifically, when searching and viewing files, the user inputs search conditions as needed, parses the search conditions, continuously searches in the index tree, finds leaf nodes that meet the corresponding search conditions, and determines which chain in the double-chain structure blockchain the data is stored in based on the pointer provided by the index tree leaf node. The corresponding chain node is located in the double-chain structure blockchain, the stored encrypted content and the corresponding key are obtained, the encrypted file is decrypted using the key, the original traffic data file is viewed, and the node search is performed through the index tree to accurately locate the corresponding node, thereby ensuring the accuracy of the search results and realizing rapid retrieval of traffic data files.
[0024] This application combines an index tree containing two chain node addresses with two blockchains with different security levels to split the traffic data file into two sub-files (first content and second content) with different security levels and store them on 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 due to single chain failure.
[0025] Furthermore, 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, and the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain, including: S201, generating corresponding content indexes according to first content and second content, and constructing an index tree; S202. Based on the structure of the index tree, construct a first blockchain and a second blockchain, wherein the first blockchain and the second blockchain are combined to obtain a double-chain structure blockchain; S203: Encrypt the first content and store it in a first chain node of a first blockchain, and encrypt the second content and store it in a second chain node of a second blockchain.
[0026] In this embodiment, according to the information in the first content and the second content, such as the location, time and other information in the traffic data file, different information in the key information is encoded and calculated respectively to generate a corresponding content index. The content index contains the key information of the data file, the storage location pointer and other information. The different information in the content index is stored in the corresponding leaf nodes respectively. According to the correlation between the leaf nodes, the corresponding combination association is 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, thereby improving the retrieval speed of the traffic data file.
[0027] Specifically, the index information stored in each leaf node in the index tree corresponds one-to-one to the chain node in the dual-chain structure blockchain. Based on the structure of the index tree, the structures of the first blockchain and the second blockchain in the dual-chain structure blockchain are configured, wherein the data encryption level of the first blockchain is higher than the data encryption level of the second blockchain, thereby obtaining a dual-chain structure blockchain; the first content B and the second content C are encrypted respectively, 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 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, thereby realizing split-chain storage.
[0028] Furthermore, generating corresponding content indexes and constructing an index tree according to the first content and the second content includes: S301, extracting information from the first content and the second content respectively to obtain first key information and second key information; S302: Obtain 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; S303. Determine a first chain node address and a second chain node address according to the first key value and the second key value; S304: Generate a corresponding content index according to the first chain node address and the second chain node address; S305, storing the content index into a leaf node to obtain a plurality of leaf nodes; S306: hierarchically combine the multiple leaf nodes according to the size of the key values to construct an index tree.
[0029] In this embodiment, different types of traffic data files contain rich information. Extracting representative key information therein can achieve efficient indexing and retrieval. According to the file type, a corresponding information extraction method is adopted. For example, for text files, regular expression technology is used to extract key information. In a traffic accident report text file, specific keywords including accident type, location and time are matched by regular expressions to extract corresponding key information; for image or video files, image recognition technology is used to identify accident scenes, vehicle types, road signs and other information as key information through a preset key information extraction model; information is extracted from the first content B and the second content C respectively 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, and enable the index to accurately reflect the content of the data file, thereby improving the quality of the index and the accuracy of retrieval.
[0030] Specifically, the first key information and the second key information are preprocessed to meet the input requirements of the hash function, such as converting text into a byte stream and converting numbers into a specific encoding form. The preprocessed key information is calculated through the hash function to obtain a unique key value, and the first key value and the second key value are calculated. By calculating the unique key value, it is ensured that different data contents can be accurately distinguished in the index tree, index conflicts are avoided, and the search speed and efficiency are improved; according to the size of the key value, it is determined in which node of the index tree the key value should be stored. For example, in a B+ tree, starting from the root node, by comparing the key value with the key value size of the root node, search down step by step in the order of the key value until a suitable leaf node is found, and according to the storage chain node position of the traffic data file in the double-chain structure blockchain, a retrieval pointer pointing to the storage chain node position is generated. The retrieval pointer can be the storage path of the file, the block number and offset in the blockchain, and other information. By searching the corresponding relationship between the index and the storage location of the traffic data file, when searching for the data file, the corresponding node can be found directly according to the key value, and then the retrieval pointer is obtained to quickly locate the storage location of the traffic data file, thereby improving the retrieval efficiency.
[0031] Specifically, the calculated key value and search pointer and the pointer to the next leaf node are stored in the corresponding node to obtain multiple information nodes containing the index information of the data file. The multiple information nodes are hierarchically combined according to the key value. Starting from the root node in the B+ tree, the information nodes are gradually inserted into the appropriate positions to construct an index tree. The index tree is constructed by comparing the hierarchical structure and key values, which can quickly locate the target information node, thereby realizing the rapid retrieval of the traffic data file.
[0032] Furthermore, the first blockchain and the second blockchain are constructed based on the structure of the index tree, and the first blockchain and the second blockchain are combined to obtain a double-chain structure blockchain, including: S401, obtaining multiple chain nodes according to the organization to which the traffic data file belongs; S402. 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; S403. Within a preset time period, respectively update the chain nodes of the initial first blockchain and the initial second blockchain to obtain an updated first blockchain and an updated second blockchain; S404. Combine the updated first blockchain and the updated second blockchain to obtain a dual-chain structure blockchain.
[0033] In this embodiment, traffic data files are usually generated and managed by multiple different institutions, such as traffic management departments, scientific research institutions, related enterprises, etc. These institutions are used as chain nodes to build a blockchain network, which can fully utilize the resources and data advantages of each institution to achieve distributed storage and management of data; configure the initial first blockchain and the 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 uses a high-intensity encryption algorithm to ensure data security; the second blockchain is used to store low-encrypted data and meets 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 uploaded to the same node in the two chains respectively to ensure node consistency. Through the dual-chain structure, encryption algorithms of different strengths are used on different chains to achieve hierarchical management of data security and meet the security requirements of different data. Figure 3 , find the position 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, encrypt the first content B and the second content C, and store them in the corresponding chain node D in the initial first blockchain and the initial second blockchain respectively. Figure 3 In the figure, E, F, G, and H are different chain nodes.
[0034] Specifically, updating the chain nodes of the initial first blockchain and the initial second blockchain according to a preset time period can effectively avoid the problems of performance degradation, load imbalance or security vulnerabilities in the chain nodes of the initial first blockchain and the initial second blockchain as time goes by and traffic data continues to change. Updating the chain nodes can prevent attackers from mastering the system rules and further enhance the security and flexibility of the system. At the same time, the association between the index tree and the double chain is updated to ensure the accuracy of data storage and retrieval; the updated first blockchain and the second blockchain are combined to form a 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.
[0035] Furthermore, 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: S501. Randomly update the chain nodes in the initial second blockchain within a preset time period to obtain an updated second blockchain; S502. Dynamically update the index tree according to the updating of the second blockchain to obtain an updated index tree; S503. According to the updated index tree, pseudo-randomly update the chain nodes in the initial first blockchain to obtain an updated first blockchain.
[0036] In this embodiment, within a preset time period, the chain nodes in the initial second blockchain are randomly updated, which can prevent the fixed node connection mode and function allocation from being stolen by attackers. The update scope is determined according to the stability and performance requirements of the system, and it is determined whether to randomly update all chain nodes or select some nodes for update according to a certain ratio. The node update method is set, such as randomly changing the connection relationship of the nodes or reallocating the storage tasks of the nodes, and changing the nodes that originally stored certain data to store other data; the selected nodes are randomly updated according to the update method, such as when changing the node connection relationship, randomly selecting other nodes from the node list, establishing new connections, and disconnecting some original connections to obtain an updated second blockchain. After the update is completed, the integrity of the updated second blockchain is verified. 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.
[0037] Specifically, after the chain node in the second blockchain is updated, the storage location of the data, the association between the node and the data, etc. may change. The index tree is dynamically adjusted according to the update of the second blockchain to ensure that the corresponding data can be accurately found through the index tree and the consistency of the index and the actual data storage state is maintained. Specifically, according to the changes in the second blockchain, the corresponding pointer in the index tree is adjusted. If the storage node of the data file changes, the blockchain node pointer pointed to by the corresponding key value in the index tree is modified to obtain an 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, thereby improving the accuracy of data retrieval.
[0038] Specifically, after the chain nodes of the second blockchain are updated, the first blockchain is also updated, and different update methods are used for the chain node update methods in the first blockchain, such as Figure 4 , respectively update the node positions and the link relationships between the chain nodes in the initial second blockchain and the initial first blockchain, and obtain the updated second blockchain and the updated first blockchain respectively, so as to prevent the attacker 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 mirror structures, which can increase the difficulty of the attacker's attack and make it difficult for the attacker to predict the update rules of the nodes, thus avoiding the loss of highly sensitive data and improving the security and flexibility of the system. Specifically, the pseudo-random update method is used to pseudo-randomly update the first blockchain according to the update index tree.
[0039] Furthermore, the pseudo-randomly updating the chain nodes in the initial first blockchain according to the updated index tree to obtain the updated first blockchain includes: S601. Obtain the chain node to be updated in the initial first blockchain according to the update index tree; S602: updating the to-be-updated chain node through a pseudo-random algorithm according to a preset seed value to obtain an updated node; S603: Recombine the updated node with the non-updated chain node in the initial first blockchain to obtain an updated first blockchain.
[0040] In this embodiment, since the initial first blockchain and the initial second blockchain are in a mirror structure, the position corresponding to the leaf node position in the index tree is consistent with the initial first blockchain and the initial second blockchain. By updating the leaf node information changes 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 its own data storage are determined, and the chain nodes to be updated are obtained, thereby avoiding unnecessary update operations on all nodes of the first blockchain, saving system resources and time costs, and ensuring that the update operation is targeted at the nodes that really need to be adjusted, thereby improving the update efficiency.
[0041] Specifically, a pseudo-random algorithm, such as a linear congruential method, a Mersenne rotation algorithm, etc., is used to initialize the pseudo-random algorithm according to a preset seed value, and an update strategy for the chain nodes of the first blockchain to be updated is formulated according to the performance requirements of the system and the security requirements for the first blockchain. Based on the initialized pseudo-random algorithm and the formulated update strategy, each chain node to be updated is updated, for example, the position and name of the node are randomly changed. After the update operation is performed on each chain node to be updated, an updated node is obtained. The pseudo-random update can effectively increase the security of the system, reduce the risk of attackers attacking by analyzing the node update rules, and protect the security and privacy of traffic data. After updating some nodes, these updated nodes need to be reintegrated 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 between the updated nodes and the non-updated nodes, the data transmission mechanism, etc. remain smooth, and the continuity of the system is maintained. For example, the block connection between the updated nodes and the non-updated nodes, the transaction verification and other functions need to work normally after the recombination to ensure the normal operation of the entire first blockchain.
[0042] Furthermore, 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: S701, encrypting first content using a preset first encryption algorithm to obtain first encrypted data; S702: Encrypt the second content using a preset second encryption algorithm to obtain second encrypted data; S703. According to the legitimacy of the storage process, voting is performed on the non-first chain nodes of the first blockchain and the non-second chain nodes of the second blockchain to obtain voting results; S704. 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.
[0043] In this embodiment, the first content and the second content are encrypted using different encryption algorithms 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 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 performs multi-level encryption processing on the data through complex round transformation and key expansion mechanism, which greatly improves the security of the data; for the second content, although its sensitivity is relatively low, it still requires certain encryption protection to prevent the data from being easily obtained or tampered with. Compared with the first encryption algorithm, the preset second encryption algorithm has a relatively simple encryption logic and a shorter key length, such as the AES-128 encryption algorithm. While providing basic security protection, it reduces the computational overhead in the encryption process and improves the data processing speed.
[0044] 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, locate the chain node in the corresponding blockchain according to the leaf node position, and obtain the chain node to be stored, so as to ensure that the data is stored on the most suitable chain node and make full use of the storage capacity of each node; formulate a legality standard to judge the legality of the storage process of the data file according to the data source, data format and blockchain storage rules of the traffic data file; broadcast the information to be stored of the traffic data file to all non-to-be-stored chain nodes in the dual-chain structure blockchain, and pass the formulated legality standard to each non-to-be-stored chain node to ensure that each node makes judgments based on the same standard when voting.
[0045] Specifically, after receiving the information to be stored and the legality standards, each non-to-be-stored chain node verifies the storage process of the traffic data file, for example, verifies whether the digital signature of the data file is valid, checks whether the data format complies with the specifications, determines whether the storage operation violates the storage rules of the blockchain, etc., and obtains the verification result. According to the verification result, each non-to-be-stored chain node votes, and the voting results are divided into agreement and disagreement. The voting results are counted. Through node voting, the decentralized nature of the blockchain is fully reflected, ensuring that data storage decisions are made by the participation of multiple nodes, improving the fairness and credibility of the system, and strictly verifying the legality of the storage process. It can effectively prevent illegal data from entering the blockchain and ensure the security of the blockchain and the integrity of the data.
[0046] Data storage is allowed only when the number of nodes that agree in the voting results is greater than the preset number of nodes. The setting of the preset number of nodes is usually based on the number of nodes and security requirements of the blockchain network. Generally, more than half or a certain proportion (such as 2 / 3) of the nodes are required to agree to prevent a small number of malicious nodes from manipulating storage decisions. Consensus is reached through majority voting, which ensures the rationality and effectiveness of data storage decisions and improves the stability and reliability of the blockchain network.
[0047] Furthermore, in response to the search condition input by the user, reading the first content and the second content from the corresponding first chain node and the second chain node through the index tree includes: S801, searching the index tree to obtain a branch tree according to the search condition input by the user; S802: Determine a downward search path in the branch tree according to the search condition until a target leaf node is retrieved; S803. 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; S804: Obtain target first encrypted data and target second encrypted data and corresponding encryption keys from the target first chain node and the target second chain node to obtain the first content and the second content.
[0048] In this embodiment, the search conditions input by the user are analyzed, and the search 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 size and range of the key values are compared, so that subtrees that do not meet the conditions can be quickly excluded, and the search range is gradually narrowed. Finally, a branch tree containing key values that may meet the search conditions is determined, which can avoid a comprehensive search of the entire index tree and improve search efficiency; in the determined branch tree, the key value information of the search conditions is continued to be used 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, and the target leaf node is accurately located by continuously refining the comparison between the search conditions and the node key values, thereby improving the accuracy of the search and avoiding wasting time and resources on irrelevant nodes.
[0049] Specifically, the target leaf node contains pointer information pointing to the chain node in the dual-chain structure blockchain. Through the pointer information in the leaf node, the target chain node storing the required traffic data file can be found, and the efficient positioning of the data is achieved through accurate mapping from the index structure to the storage structure; 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 found from the metadata of the chain node, and the encrypted data is decrypted using the obtained encryption key according to the encryption algorithm used when storing (such as AES-256 or AES-128), and 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 the user with available data, and realizing the complete process of secure storage and on-demand retrieval of traffic data.
[0050] Further, determining a downward search path in the branch tree according to the search condition until a target leaf node is retrieved includes: S901, parsing the search conditions to obtain a search key value; S902, starting from the root node of the branch tree, comparing the search key value with the node key value to obtain a comparison result; S903, 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; S904, repeating 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 a preset key value range, the target leaf node is retrieved.
[0051] In this embodiment, the search conditions input by the user are parsed and converted into search key values, and the user's diverse search conditions are converted into a unified search key value 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 search key value is compared with the key value of the root node to obtain a comparison result. Through node comparison, most of the nodes that do not meet the conditions can be quickly eliminated, which greatly narrows the search scope and speeds up the search process.
[0052] Specifically, in a B+ tree, a node usually stores a pointer to a child node. According to the comparison result, when the search 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 the child node for the next round of comparison and search operations. According to the key value size relationship, the search scope is continuously narrowed to the subtree that is more likely to contain the target data by searching downward. This improves the accuracy and efficiency of the search. The search is performed according to the logical structure of the index tree, which ensures the logic and coherence of the search process and avoids the confusion and waste of resources caused by disordered search. The comparison and search operations are repeated until the search result is found. If the search key value is equal to the node key value or is within a certain range, it indicates that a leaf node that may store the target data has been found. For range queries, a difference value 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 precise queries, being equal to the node key value means that the precise target data storage location has been found. Finally, the target leaf node is searched, and the target leaf node stores a pointer to the actual data storage location, completing the search process. By continuously narrowing the scope and iterative searching, the leaf nodes that meet the retrieval conditions can be accurately found. Whether it is a precise query or a range query, the required data location can be accurately found.
[0053] Example 2 In this embodiment, if Figure 5 , a traffic data file request and storage system based on blockchain is provided, which is used to implement the traffic data file request and storage method based on blockchain, including: 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.
[0054] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached 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; In response to a search condition input by a user, reading the first content and the second content from the corresponding first chain node and the second chain node through the index tree; 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; 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; 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 method of constructing a first blockchain and a second blockchain based on the structure of the index tree, wherein the first blockchain and the second blockchain are combined to obtain a double-chain structure blockchain, includes: 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; The updated first blockchain and the updated second blockchain are combined to obtain a dual-chain structure blockchain.
5. A method for storing traffic data files based on blockchain according to claim 4, characterized in that: The updating of the chain nodes of the initial first blockchain and the initial second blockchain within the preset time period to obtain the updated first blockchain and the updated second blockchain includes: 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, the chain nodes in the initial first blockchain are pseudo-randomly updated to obtain an updated first blockchain.
6. A method for storing traffic data files based on blockchain according to claim 5, characterized in that: The pseudo-randomly updating the chain nodes in the initial first blockchain according to the updated index tree 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; The updated nodes are recombined with the non-updated chain nodes in the initial first blockchain to obtain an updated first blockchain.
7. A method for storing traffic data files based on blockchain according to claim 2, 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.
8. A method for storing traffic data files based on blockchain according to claim 2, 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.
9. A method for storing traffic data files based on blockchain according to claim 8, 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.
10. A traffic data file storage system based on blockchain, characterized in that: The method for storing a traffic data file based on blockchain according to claims 1 to 9 comprises: 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
Dynamic searchable encryption method and device based on block chain
CN114048448A
User behavior data auditing method and system based on block chain
CN114372296A
Grain supply chain data privacy protection method based on multi-chain block chain
CN116432213A
Cited By
Block chain-based traffic data secure transmission method and system
CN120915575A