Data processing method, system and device, medium and program product
By building a tree-shaped data structure and generating a target data tree, the problem of inefficient winding of terminal equipment data is solved, and efficient winding of multiple terminal equipment data within a time interval is achieved.
Patent Information
- Application Number
- CN202411513888.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, during the data rolling process of terminal devices, the blockchain needs to handle a large number of transaction transactions simultaneously, resulting in inefficient data rolling.
After obtaining and verifying the leaf data sent by multiple terminal devices, a tree-shaped data structure is constructed, a target data tree is generated, and the data to be stored is generated based on the target data tree and time information. Finally, the blockchain is carried out according to the preset smart contract. On-chain processing.
Within a time interval, data records of multiple terminal devices only need to be chained once, which reduces the number of on-chain transaction transactions processed by the blockchain within a unit time and improves the efficiency of data chaining.
Smart Images

Figure CN119474042A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a data processing method, system, device, medium and program product. Background Art
[0002] With the development of the Internet of Things and artificial intelligence technologies, the credibility of data from various terminals on the Internet of Things has become a key factor in measuring the value of data. To ensure data credibility, terminal devices in various places usually store the collected data on the blockchain to ensure that the data is credible, verifiable, and not tampered with, so as to facilitate the data application in subsequent artificial intelligence scenarios. However, during the current data chaining process of terminal devices, the blockchain may need to process a large number of chained transactions at the same time, affecting the normal operation of the blockchain and resulting in low efficiency of data chaining. Summary of the invention
[0003] The present invention provides a data processing method, system, device, medium and program product to solve the problem that in the process of data uploading to the chain of existing terminal devices, the blockchain may need to process a large number of uploading transaction affairs at the same time, resulting in low efficiency of data uploading.
[0004] In a first aspect, an embodiment of the present application provides a data processing method, including:
[0005] After acquiring and verifying the leaf data sent by multiple terminal devices, the leaf data sent by multiple terminal devices within the first time interval are constructed into tree data to obtain a target data tree. The terminal devices sign the collected data records to obtain leaf data. The leaf nodes of the target data tree are node data generated based on the leaf data of multiple terminal devices.
[0006] Generate data to be stored according to the target data tree and time information of the target data tree;
[0007] According to the preset smart contract, the stored data is uploaded to the blockchain to obtain the data upload result.
[0008] Optionally, after obtaining and verifying the leaf data sent by the multiple terminal devices, the leaf data sent by the multiple terminal devices within the first time interval are constructed into tree data to obtain a target data tree, including:
[0009] After obtaining and verifying the leaf data sent by multiple terminal devices, the leaf data of multiple terminal devices in the same network segment are obtained to generate the node data of the corresponding network segment; the node data is data including the network segment subtree generated after the leaf data of multiple terminal devices in the same network segment within the second time interval are constructed into a network segment subtree;
[0010] The node data is taken as a leaf node, and a target data tree is constructed according to a plurality of node data of different network segments within a first time interval.
[0011] Optionally, after the leaf data sent by the multiple terminal devices pass the signature verification, the leaf data of the multiple terminal devices in the same network segment are obtained to generate the node data of the corresponding network segment, including:
[0012] Receive leaf data sent by each terminal device, where the leaf data includes a data record collected by the corresponding terminal device and leaf verification information obtained by signing;
[0013] Perform security verification on data records in leaf data according to verification information of each leaf;
[0014] Multiple leaf data from the same network segment and passed verification within a second time interval are constructed into a network segment subtree, and node data of the network segment is generated according to the network segment subtree and time information of the network segment subtree, and the second time interval is less than or equal to the first time interval.
[0015] Optionally, after the leaf data sent by the multiple terminal devices pass the signature verification, the leaf data of the multiple terminal devices in the same network segment are obtained to generate the node data of the corresponding network segment, including:
[0016] The gateway receives leaf data of multiple terminal devices in the corresponding network segment, so that the gateway generates node data according to the received multiple leaf data, and receives the node data of the network segment sent by the gateway;
[0017] Among them, after verifying the received leaf data, the gateway performs a security check on each leaf data received, and constructs multiple leaf data received and verified within the second time interval into a network segment subtree, and generates and signs the node data of the network segment based on the network segment subtree and the time information of the network segment subtree. The second time interval is less than the first time interval.
[0018] Optionally, taking the node data as a leaf node, a plurality of node data of different network segments within the first time interval are aggregated and packaged to obtain a target data tree, including:
[0019] When the node data is data sent by the gateway and the node data includes subtree verification information, a security verification is performed on the node data based on the subtree verification information in the node data;
[0020] The node data that has passed the verification is taken as a leaf node, and multiple node data that have passed the verification in different network segments within the first time interval are aggregated and packaged to obtain a target data tree.
[0021] Optionally, the data to be stored is processed on the blockchain according to a preset smart contract, and the data on-chain result is obtained and stored, including:
[0022] Perform hash operation on the data to be stored, use the hash value of the data to be stored as the on-chain data, and sign and encapsulate the on-chain data based on the preset smart contract to obtain the on-chain transaction including the on-chain data;
[0023] Send the transaction to the blockchain for signature verification and data uploading, and obtain the data uploading result fed back by the blockchain;
[0024] The data to be stored and the data on-chain results are stored together in a distributed storage cluster mapped to the blockchain.
[0025] In a second aspect, an embodiment of the present application provides a data processing system, including multiple terminal devices and a server, wherein the server is used to:
[0026] After acquiring and verifying the leaf data sent by multiple terminal devices, the leaf data sent by multiple terminal devices within the first time interval are constructed into tree data to obtain a target data tree. The terminal devices sign the collected data records to obtain leaf data. The leaf nodes of the target data tree are node data generated based on the leaf data of multiple terminal devices.
[0027] Generate data to be stored according to the target data tree and time information of the target data tree;
[0028] According to the preset smart contract, the stored data is uploaded to the blockchain to obtain the data upload result.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the steps of the above-mentioned data processing method.
[0030] In a fourth aspect, an embodiment of the present application provides a readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0031] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which enables the above-mentioned data processing method to be executed when the computer program is run.
[0032] In a scheme provided by the above-mentioned data processing method, system, device, medium and program product, the terminal device obtains leaf data after signing the collected data record. After obtaining and verifying the leaf data sent by multiple terminal devices, the server constructs tree data of the leaf data sent by multiple terminal devices within a first time interval to obtain a target data tree. The leaf nodes of the target data tree are node data generated according to the leaf data of multiple terminal devices. Then, according to the target data tree and the time information of the target data tree, the data to be stored is generated, and the data to be stored is processed on the blockchain according to the preset smart contract to obtain the data on-chain result; the terminal device obtains leaf data after signing the collected data record. The server aggregates the leaf data sent by multiple terminal devices within a time interval into a target data tree, and then performs blockchain on-chain storage based on the target data tree and its time information. The data records of multiple terminal devices within a time interval only need to be on-chain once, which reduces the number of on-chain transaction transactions processed by the blockchain per unit time and improves the data on-chain efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0034] Figure 1 is a structural schematic diagram of a data processing system in one embodiment of the present invention;
[0035] Figure 2 This is a schematic diagram of a block chain structure in one embodiment of the present invention;
[0036] Figure 3 is a flow chart of a data processing method in one embodiment of the present invention;
[0037] Figure 4 yes Figure 3 A schematic diagram of an implementation process of step S30;
[0038] Figure 5 yes Figure 3 A schematic diagram of an implementation process of step S10;
[0039] Figure 6 is a schematic diagram of the structure of a network segment subtree in one embodiment of the present invention;
[0040] Figure 7 is a schematic diagram of a structure of a target data tree in one embodiment of the present invention;
[0041] Figure 8 is a schematic diagram of a data processing process of a data processing method in one embodiment of the present invention;
[0042] Fig. 9 yes Figure 1 A structural diagram of a server in FIG.
[0043] Fig.10 It is a schematic diagram of the structure of an electronic device in one embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or their collections. It should also be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0046] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0047] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0048] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0049] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0050] It should be understood that in the traditional terminal data chain process, the terminal device sends a data record to the server after collecting it. After receiving the data record sent by the terminal device, the server encapsulates and signs the data record in accordance with the requirements of the smart contract, and then sends the transaction and signature information including the data record to the blockchain, so that the blockchain can verify it according to the signature information, and after the verification is passed, the data record is chained according to the transaction, and then the chain processing result is returned to the server. In this process, due to the large number of terminal devices and the large number of data records collected by the terminal devices, the blockchain needs to frequently process transactions of different terminals; for example, the number of terminal devices is M, and the number of data records that each terminal device needs to chain within a certain period of time is L, and the total chain data is M*L transaction records. When the server and blockchain chain the L data records of M terminal devices, the amount of data processing calculation is M*L, and the amount of communication required to transmit the chain data is also M*L. This chaining method reduces the processing speed of the blockchain, and may even cause the blockchain to fail to operate normally, resulting in low efficiency of data chaining.
[0051] In view of the above problems, the data processing method provided by the embodiment of the present invention can be applied in Figure 1 In the data processing shown, the data processing system includes a blockchain, a server and multiple terminal devices (terminal device 1...terminal device n, n is greater than 1), wherein each terminal device communicates with the server through a network, and the server communicates with the blockchain through the network.
[0052] Among them, the terminal device is used to sign the collected data records to obtain leaf data and send it, and the leaf data includes at least one data record collected by the terminal device and leaf verification information obtained by signing. After obtaining and verifying the leaf data sent by multiple terminal devices, the server constructs the leaf data sent by multiple terminal devices within the first time interval into a tree-shaped data structure to obtain a target data tree, wherein the leaf nodes of the target data tree are node data generated based on the leaf data of multiple terminal devices; then, the server generates the data to be stored based on the target data tree and the time information of the target data tree, and performs blockchain on-chain processing on the data to be stored according to the preset smart contract to obtain the data on-chain result.
[0053] In this embodiment, the terminal device signs the collected data records to obtain leaf data. After obtaining and verifying the leaf data sent by multiple terminal devices, the server constructs a target data tree by aggregating the leaf data sent by multiple terminal devices within a time interval, and then stores the data on the blockchain based on the target data tree and its time information. In a time interval, the data records of multiple terminal devices only need to be uploaded to the chain once, which reduces the number of on-chain transaction transactions processed by the blockchain in unit time, which not only ensures the security and integrity of the terminal device data, but also improves the efficiency of data on-chain.
[0054] The blockchain is a chain data structure that is pre-built and deployed with preset smart contracts using decentralized distributed ledger technology. Figure 2 As shown, the blockchain of the data processing system includes multiple blocks (such as block 1, block 2 and block 3), and the data processing system also includes multiple servers (such as platform 1... platform n, where n is an integer greater than 1). Each server generates a target data tree at the same time, and each target data tree includes multiple data records sent by multiple terminal devices within a period of time. Corresponding to the blockchain itself, the blockchain only needs to process the on-chain transaction transactions of the target data tree of each server at the same time. n servers are n on-chain transaction transactions, that is, the transaction transaction list of the blockchain includes n on-chain transaction transactions respectively composed of platform 1 data tree (i.e. target data tree)... platform n data tree; compared with the traditional on-chain of each data record of each terminal device, this embodiment provides an on-chain method that greatly reduces the amount of transaction transactions, increases the on-chain processing amount of the blockchain, and improves the on-chain efficiency of the blockchain.
[0055] The terminal devices include but are not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be a server of a service platform, which can be implemented as an independent server or a server cluster composed of multiple servers.
[0056] In one embodiment, if Figure 3 As shown, a data processing method is provided, which is applied in Figure 1 The data processing system in is taken as an example to illustrate, which includes the following steps:
[0057] S10: After acquiring and verifying the leaf data sent by the multiple terminal devices, the server constructs tree data for the leaf data sent by the multiple terminal devices within the first time interval to obtain a target data tree.
[0058] During the operation of the data processing system, the terminal device signs the collected data records to obtain leaf data, and then the terminal device can send the leaf data directly (or through a gateway) to the server in real time. The leaf data includes the data records collected by the corresponding terminal device and the verification data of the data records (i.e., leaf verification information). The data records include the data content collected by the corresponding terminal device and the data generation time.
[0059] For example, the leaf verification information can be signature data obtained by signing a data record using a signature algorithm; the terminal device periodically collects data, and combines the data collection time and the collected data content into a data record, and then the terminal device uses the signature algorithm to sign at least one data record to obtain leaf verification information, and then uses the leaf verification information and at least one data record as leaf data.
[0060] In one embodiment, the leaf verification information includes the hash value of the data record collected by the terminal device and the signature data of the hash value of the data record. The terminal device collects data regularly and combines the data collection time and the collected data content into a data record; then, the terminal device performs a hash operation on the data record to obtain the hash value of the data record, and uses the terminal private key to sign the hash value of the data record based on a preset signature algorithm (such as an elliptic curve digital algorithm) to obtain signature data; finally, the terminal device uses the hash value and signature data of the data record as leaf verification information, and aggregates the data record and the leaf verification information into leaf data. Signing the hash value of the data record can reduce the amount of calculation required for the signature and improve the efficiency of data generation and transmission while ensuring data integrity and security.
[0061] The server receives the leaf data sent by multiple terminal devices in real time, and performs signature verification on each leaf data received. After the leaf data passes the verification, the server constructs a tree data of the leaf data sent by multiple terminal devices within the first time interval to obtain the target data tree.
[0062] Among them, the leaf nodes of the target data tree are node data generated based on the leaf data of multiple terminal devices. For example, each node data can be a leaf data, and each node data can also include multiple leaf data with the same time information (such as similar generation time). The child nodes in the target data tree (nodes other than leaf nodes and root nodes) are hash values generated based on multiple nodes (such as node data) with the same time information in the upper layer. The root node of the target data tree is the hash value of multiple child nodes, that is, the root node of the target data tree is obtained by hash calculation based on multiple node data.
[0063] Among them, the first time interval is a time interval, and the first time interval can be a time interval set according to the nature of the data collected by the data processing system, such as the first time interval can be 30 minutes, 1 hour, 2 hours, 1 day or 1 week. According to the monitoring requirements of data of different natures and the amount of generated data, the first time interval set is different. For example, the data collected by the terminal device can be sensor data in the power system, such as voltage, current, power, temperature, power consumption, power generation and other data. In order to ensure the monitoring accuracy of the power system and reduce the amount of system cache data, a shorter first time interval can be set, for example, the first time interval can be 30 minutes.
[0064] S20: The server generates data to be stored according to the target data tree and the time information of the target data tree.
[0065] After constructing the target data tree with the leaf data sent by the plurality of terminal devices within the first time interval, the server generates the data to be stored according to the target data tree and the time information of the target data tree.
[0066] The time information of the target data tree is the time range of data generation in the target data tree. The time information of the target data tree may be a specific time range determined after summarizing the data generation time of all data records in the target data tree, so as to facilitate subsequent data indexing according to the time information. The time information of the target data tree may also be a time range obtained by back-calculating the first time interval based on the time when the server generates the target data tree, so as to reduce the amount of data processing required to summarize all data records. In other embodiments, the time information of the target data tree may be the time when the server generates the target data tree.
[0067] S30: The server processes the data to be stored on the blockchain according to the preset smart contract and obtains the result of data on-chain.
[0068] After generating the data to be stored according to the target data tree and the time information of the target data tree, the server processes the data to be stored on the blockchain according to the preset smart contract, obtains the data on-chain result and stores it. Among them, a smart contract is a computer protocol that propagates, verifies or executes a contract in an information-based manner. Smart contracts allow trusted transactions without a third party, and these transactions are traceable and irreversible; the purpose of smart contracts is to provide a security method that is superior to traditional contracts and reduce other transaction costs associated with contracts. Different blockchains can use different smart contracts, which are determined according to actual needs. The preset smart contract in this embodiment is a smart contract deployed by the blockchain that needs to store data on the chain.
[0069] For example, the server uses the target data tree as the on-chain data, encapsulates the target data tree for the transaction based on the preset smart contract, obtains the on-chain transaction including the target data tree, and signs the target data tree to obtain the signature information; then, the server initiates the on-chain transaction request to the blockchain based on the on-chain transaction and the signature information. After receiving the on-chain transaction request, the blockchain performs signature verification on the on-chain transaction based on the signature information in the on-chain transaction request, and performs on-chain transaction processing according to the on-chain transaction after the verification passes, that is, the target data tree in the on-chain transaction request is encrypted and stored in the public network side chain of the InterPlanetary File System IPFS (InterPlanetary File System), and a data index is formed in the public trust chain, and the data on-chain result is obtained and returned to the server. The data on-chain result includes the data index information formed after the data is on-chain. After the server obtains the data on-chain result fed back by the blockchain, it stores the on-chain data (i.e., the target data tree) and the data on-chain result together in the distributed storage cluster mapped to the blockchain, so as to facilitate the subsequent data indexing of the target data tree.
[0070] In this embodiment, the terminal device signs the collected data records to obtain leaf data. After obtaining and verifying the leaf data sent by multiple terminal devices, the server constructs a target data tree by aggregating the leaf data sent by multiple terminal devices within a time interval, and then stores the data on the blockchain based on the target data tree and its time information. In a time interval, the data records of multiple terminal devices only need to be uploaded to the chain once, which reduces the number of on-chain transaction transactions processed by the blockchain in unit time, which not only ensures the security and integrity of the terminal device data, but also improves the efficiency of data on-chain.
[0071] In one embodiment, if Figure 4 As shown, in step S30, the data to be stored is processed on the blockchain according to the preset smart contract to obtain the data on-chain result, which specifically includes the following steps:
[0072] S31: The server performs a hash operation on the data to be stored, uses the hash value of the data to be stored as the on-chain data, and signs and encapsulates the on-chain data based on the preset smart contract to obtain an on-chain transaction transaction including the on-chain data.
[0073] The server performs a hash operation on the data to be stored, uses the hash value of the data to be stored as the on-chain data, and signs and encapsulates the on-chain data based on the preset smart contract to obtain an on-chain transaction including the on-chain data. The on-chain transaction includes the on-chain data (i.e., the hash value of the data to be stored) and the signature information of the on-chain data.
[0074] Among them, the preset smart contract includes a signature algorithm (such as elliptic curve digital algorithm) for signing the on-chain data. After the on-chain data is signed based on the signature algorithm in the preset smart contract to obtain the signature information, the on-chain data and its signature information are packaged as an on-chain transaction transaction according to the relevant requirements in the preset smart contract, so as to facilitate the server to interact with the blockchain and upload to the chain based on the on-chain transaction transaction.
[0075] S32: The server sends the on-chain transaction to the blockchain for signature verification and data on-chain, and obtains the data on-chain result fed back by the blockchain.
[0076] After the server obtains the on-chain transaction, it sends the on-chain transaction to the blockchain for signature verification and data on-chain, and obtains the data on-chain result fed back by the blockchain. That is, the server sends an on-chain transaction request including the on-chain data and its signature information. After receiving the on-chain transaction request, the blockchain calls the preset smart contract to respond to the on-chain transaction request, so as to perform signature verification on the on-chain data through the signature information of the on-chain data. After the verification is passed, the on-chain process is executed to store the on-chain data in the corresponding block, and the index information of the on-chain data is generated, and the on-chain result (success or failure of on-chain) and the index information of the on-chain data are fed back to the server as the data on-chain result. After sending the on-chain transaction to the blockchain, the server will check the processing result of the on-chain transaction in real time and obtain the data on-chain result fed back by the blockchain.
[0077] S33: The server stores the data to be stored together with the data on-chain result in a distributed storage cluster mapped to the blockchain.
[0078] After the server obtains the data on-chain result fed back by the blockchain, the server stores the data to be stored (i.e., the target data tree and its time information) together with the data on-chain result in the distributed storage cluster mapped to the blockchain, so that the data to be stored in the distributed storage cluster can be indexed according to the on-chain data in the blockchain.
[0079] In this embodiment, the server performs a hash operation on the data to be stored, uses the obtained hash value of the data to be stored as the on-chain data, and signs and encapsulates the on-chain data based on the preset smart contract to obtain an on-chain transaction transaction including the on-chain data; sends the on-chain transaction transaction to the blockchain for signature verification and data on-chain, and obtains the data on-chain result fed back by the blockchain; stores the data to be stored and the data on-chain result together in a distributed storage cluster mapped to the blockchain. The specific process of on-chain processing of the data to be stored on the blockchain according to the preset smart contract is clarified. By on-chaining the hash value of the data to be stored including the target data tree as the on-chain data, rather than on-chaining the data to be stored as the on-chain data, the amount of data on the blockchain can be reduced, thereby improving the efficiency of on-chaining.
[0080] In one embodiment, if Figure 5 As shown, in step S10, that is, after obtaining and verifying the leaf data sent by multiple terminal devices, the leaf data sent by multiple terminal devices within the first time interval are constructed into tree data to obtain the target data tree, which specifically includes the following steps:
[0081] S11: After acquiring and verifying the leaf data sent by multiple terminal devices, the server acquires the leaf data of multiple terminal devices in the same network segment and generates node data of the corresponding network segment.
[0082] After obtaining and verifying the leaf data sent by multiple terminal devices, the server needs to obtain the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment. Among them, the node data is the data including the network segment subtree generated after the leaf data of multiple terminal devices in the same network segment are constructed into a network segment subtree.
[0083] For example, the server can directly receive the leaf data sent by each terminal device within the first time interval, and perform a signature-based security check on each received leaf data. After the check is passed, the server constructs the leaf data of multiple terminal devices in the same network segment into a network segment subtree of the network segment, and then generates the node data of the network segment including the network segment subtree, that is, obtains the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment.
[0084] In other embodiments, the server can receive leaf data sent by multiple terminal devices in the same network segment through a gateway, so that the gateway constructs a data tree for the multiple leaf data received to obtain a network segment subtree, and after signing the network segment subtree, generates node data and sends it to the server. The server receives the node data sent by the gateway, and can obtain the leaf data of multiple terminal devices in the same network segment to generate node data of the corresponding network segment.
[0085] S12: The server uses the node data as leaf nodes and constructs a target data tree according to multiple node data in different network segments within the first time interval.
[0086] After the server obtains the node data, the server will use the node data as a leaf node and construct a target data tree according to multiple node data of different network segments within the first time interval.
[0087] In one embodiment, when the node data is data sent by the gateway and the node data includes subtree verification information, the server needs to perform a security verification on the node data based on the subtree verification information in the node data, and then use the node data that has passed the verification as a leaf node, aggregate and package multiple node data that have passed the verification in different network segments within the first time interval to obtain the target data tree.
[0088] Among them, the node data includes subtree data and subtree verification information. The subtree data includes the network segment subtree and the time information of the network segment subtree (such as the generation time); the subtree verification information may include the hash value and signature information of the network segment subtree. The signature information is the information obtained by signing the hash value of the network segment subtree using a preset signature algorithm. Among them, the server can use the elliptic curve digital algorithm to perform security verification on the data records in the node data based on the subtree verification information in the node data sent by the gateway and the public key corresponding to the gateway private key of the gateway, and determine whether the node data has passed the verification. When the signature regenerated during the verification process is consistent with the information signed in the node verification information, the verification passes; if not, the verification fails.
[0089] In this embodiment, when the node data is data sent by the gateway and the node data includes subtree verification information, the server needs to perform a security check on the node data and use the node data to build the target data tree only after the check is passed, thereby ensuring the integrity and authenticity of the node data, thereby improving the credibility of the target data tree and subsequent on-chain data. In other embodiments, if the node data is data generated by the server, no security check is required.
[0090] The leaf nodes of the target data tree are multiple node data; the child nodes of the target data tree are hash values generated based on multiple node data (i.e., leaf nodes); the root node of the target data tree is the total hash value of the connected nodes, which is the unique identifier of the target data tree, i.e., the root node of the network segment subtree is obtained by performing one or more hash calculations based on multiple node data. The child nodes of the target data tree can be calculated using multiple node data with similar time information (such as similar generation time).
[0091] Specifically, the construction process of the target data tree is as follows: the server takes each node data as a leaf node, determines the time information (i.e., generation time) of each node data, and merges at least two nodes (including leaf nodes and child nodes) with similar time information and performs hash calculation to obtain multiple child nodes; merges at least two child nodes with similar time information and performs hash calculation to obtain a root node, and generates a network segment subtree consisting of a root node, multiple child nodes, and multiple leaf nodes. By performing hash calculation on nodes with similar time information to construct a data tree, it is convenient to quickly determine the corresponding node data and the leaf data of the network segment subtree in the node data according to the time information, which can improve the efficiency of subsequent data transmission and the speed of data search.
[0092] like Figure 6As shown, the data processing system includes three gateways: gateway 1, gateway 2 and gateway 3. The server receives 7 node data of three gateway devices in the first time interval: gateway 1 node data 1, gateway 1 node data 2, gateway 1 node data 3, gateway 2 node data 1, gateway 2 node data 2, gateway 3 node data 1 and gateway 3 node data 2. Among them, the generation time of gateway 1 node data 1 and gateway 2 node data 1 is similar (that is, the generation time is in the same time period, that is, the time information of the two is similar), and the gateway 1 node data 1 and the gateway 2 node data 1 can be merged and hashed to obtain hash value 1; the generation time of gateway 3 node data 1 and gateway 1 node data 2 is similar, and the gateway 3 node data 1 and the gateway 1 node data 2 can be merged and hashed to obtain hash value 2; the generation time of gateway 2 node data 2 and gateway 3 node data 2 is similar, and the gateway 2 node data 2 and the gateway 3 node data 2 can be merged and hashed to obtain hash value 3. If the time information of hash value 2 and hash value 1 (which can be the time when the hash value was generated) is similar and the time information of both are in the same time period, then hash value 2 and hash value 1 are merged to generate hash value 4. If the time information of hash value 3 and gateway 1 node data 3 is similar and the time information of both are in the same time period, then gateway 1 node data 3 is merged with hash value 3 to generate hash value 5. Finally, hash value 4 and hash value 5 are merged to generate hash value 6, and a target data tree with hash value 6 as the root node is obtained. Figure 6 It can be clearly seen that hash values 1 to 5 are child nodes of the target data tree, and each node data is a child node of the target data tree.
[0093] Among them, the data processing system includes 3 gateways, the server receives 7 node data from 3 gateway devices within the first time interval, and the time information and hash value generation process of each node data are only for exemplary explanation. In other embodiments, the number of gateways in the data processing system can also be other, the number of node data received by the server within the first time interval can also be other, the time information of each node data and the corresponding hash value generation process can also be other, which will not be repeated here.
[0094] In this embodiment, after obtaining and verifying the leaf data sent by multiple terminal devices, the server obtains the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment, and uses the node data as the leaf node, and constructs a target data tree according to the multiple node data of different network segments within the first time interval, wherein the node data is generated according to the network segment subtree and the second time interval after the leaf data of multiple terminal devices in the same network segment within the second time interval are constructed as a network segment subtree, and the second time interval is less than or equal to the first time interval. This process refines the construction process of the target data tree, uses the node data of different network segments as leaves to construct the target data tree, increases the amount of data contained in the target data tree, uses longer and more data for chaining, reduces the transaction transactions of subsequent chained data, and increases the processing volume of chained transaction transactions per unit time of the server and blockchain, thereby improving the efficiency of chaining.
[0095] In one embodiment, the data processing system includes multiple gateways, each gateway is responsible for the data transmission and reception of multiple terminal devices in a network segment (such as a local area network). In step S11, after obtaining and verifying the leaf data sent by multiple terminal devices, the server obtains the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment, which specifically includes: the server can receive the leaf data of multiple terminal devices in the corresponding network segment through the gateway, so that the gateway generates node data according to the received multiple leaf data, and receives the node data of the network segment sent by the gateway. Among them, after verifying the received leaf data, the gateway performs a security check on each received leaf data, and constructs the multiple leaf data received and verified within the second time interval into a network segment subtree, and generates and signs the node data of the network segment according to the network segment subtree and the time information of the network segment subtree; wherein, the second time interval is less than the first time interval.
[0096] Specifically, the server can receive leaf data of multiple terminal devices in the corresponding network segment through the gateway, so that the gateway generates node data according to the received multiple leaf data, and receives the node data of the network segment sent by the gateway, which specifically includes the following steps:
[0097] S011: The gateway receives leaf data sent by the terminal device of the network segment corresponding to the gateway, performs security verification on the received leaf data, and determines whether the leaf data passes the verification.
[0098] After generating leaf data, the terminal device sends the leaf data to the gateway of the network segment where it is located, and the gateway receives the leaf data sent by the terminal device of the network segment corresponding to the gateway. The leaf data includes the data record collected by the corresponding terminal device and the verification data of the data record, that is, the leaf verification information. The data record includes the data content and data collection time collected by the corresponding terminal device. The leaf verification information includes the hash value of the data record and the signature of the hash value of the data record.
[0099] After the gateway receives the leaf data sent by the terminal device, the gateway needs to perform a security check on the received leaf data to determine whether the leaf data has passed the verification. Among them, the gateway can use a preset signature algorithm to perform a security check on the data records in the leaf data based on the leaf verification information in the leaf data and the public key corresponding to the terminal private key of the terminal device, and determine whether the leaf data has passed the verification. When the signature regenerated during the verification process is consistent with the signature information in the leaf verification information, the leaf data verification passes; if the signature regenerated during the verification process is consistent with the signature information in the leaf verification information, the leaf data verification fails. When the leaf data verification fails, the leaf data is deleted, and the terminal device that sent the leaf data is notified that the leaf data has failed the verification and needs to be resent.
[0100] Among them, the preset signature algorithm can be an elliptic curve digital algorithm. By adopting the elliptic curve digital algorithm, a shorter key length can be used to achieve the same security strength as other signature algorithms. It has higher security, faster signing and verification speed, improved data processing efficiency, and lower algorithm storage space requirements.
[0101] S02: After determining that the leaf data has passed verification, the gateway constructs a plurality of leaf data received and verified within a second time interval into a network segment subtree.
[0102] After the gateway determines that the leaf data has passed the verification, the gateway caches the leaf data that has passed the verification, and then constructs a plurality of leaf data that have passed the verification and are received within a second time interval into a network segment subtree, wherein the second time interval is smaller than the first time interval.
[0103] The leaf nodes of the network segment subtree are multiple leaf data that have passed verification, the child nodes of the network segment subtree are hash values generated based on multiple leaf data (i.e., leaf nodes), and the root node of the network segment subtree is the total hash value of the connected nodes, which is the unique identifier of the network segment subtree, i.e., the root node of the network segment subtree is obtained by performing one or more hash calculations based on multiple leaf data. The child nodes of the network segment subtree can be calculated using multiple leaf data with similar time information (such as similar generation time).
[0104] Among them, the gateway constructs multiple leaf data received and verified within the second time interval into a network segment subtree, including: taking each leaf data that has passed the verification as a leaf node, determining the time information (i.e., generation time) of each leaf data that has passed the verification, and merging at least two nodes (including leaf nodes and child nodes) with similar time information and performing hash calculation to obtain multiple child nodes; merging at least two child nodes with similar time information and performing hash calculation to obtain a root node, and generating a network segment subtree consisting of a root node, multiple child nodes, and multiple leaf nodes. By performing hash calculation on nodes with similar time information to construct a data tree, it is convenient to quickly determine the corresponding leaf data according to the time information later, which can improve the efficiency of subsequent data transmission and the speed of data search.
[0105] like Figure 7 As shown, the network segment where the gateway is located includes three terminal devices: terminal 1, terminal 2 and terminal 3. The gateway receives seven leaf data from the three terminal devices in the second time interval: terminal 1 leaf data 1, terminal 1 leaf data 2, terminal 1 leaf data 3, terminal 2 leaf data 1, terminal 2 leaf data 2, terminal 3 leaf data 1 and terminal 3 leaf data 2. Among them, the generation time of terminal 1 leaf data 1 and terminal 2 leaf data 1 is similar (that is, the generation time is in the same time period, that is, the time information of the two is similar), terminal 1 leaf data 1 and terminal 2 leaf data 1 can be merged and hashed to obtain hash value 1; terminal 3 leaf data 1 and terminal 1 leaf data 2 are generated at similar times, terminal 3 leaf data 1 and terminal 1 leaf data 2 can be merged and hashed to obtain hash value 2; terminal 2 leaf data 2 and terminal 3 leaf data 2 are generated at similar times, terminal 2 leaf data 2 and terminal 3 leaf data 2 can be merged and hashed to obtain hash value 3. If the time information of hash value 2 and hash value 1 (which can be the time when the hash value was generated) is similar and the time information of both are in the same time period, then hash value 2 and hash value 1 are merged to generate hash value 4. If the time information of hash value 3 and terminal 1 leaf data 3 is similar and the time information of both are in the same time period, then terminal 1 leaf data 3 is merged with hash value 3 to generate hash value 5. Finally, hash value 4 and hash value 5 are merged to generate hash value 6, and a network segment subtree with hash value 6 as the root node is obtained. Figure 7 It can be clearly seen that hash values 1 to 5 are child nodes of the network segment subtree, and each leaf data is a child node of the network segment subtree.
[0106] Among them, the network segment where the gateway is located includes 3 terminal devices, the gateway receives 7 leaf data within the second time interval, and the time information and hash value generation process of each leaf data are only for exemplary explanation. In other embodiments, the number of terminal devices in the network segment where the gateway is located can also be other, the number of leaf data received by the gateway within the second time interval can also be other, the time information of each leaf data and the corresponding hash value generation process can also be other, which will not be repeated here.
[0107] S03: The gateway generates and signs node data of the network segment according to the network segment subtree and the time information of the network segment subtree, and sends the node data to the server.
[0108] The gateway generates and signs the node data of the network segment based on the network segment subtree and the time information of the network segment subtree, and sends the node data to the server. Specifically, the gateway packages the time information of the network segment subtree and the network segment subtree into subtree data; the gateway performs a hash operation on the subtree data to obtain the hash value of the subtree data, and uses a preset signature algorithm (such as an elliptic curve digital algorithm) to sign the hash value of the subtree data using the gateway private key to obtain the signature information of the subtree data; the gateway aggregates the hash value and signature information of the subtree data into subtree verification information, and merges the subtree data and the subtree verification information into node data, and finally sends the node data to the server so that the server can process the mechanical energy data and upload it to the chain.
[0109] Among them, the time information of the network segment subtree can be the generation time of the network segment subtree; in other embodiments, the time information of the network segment subtree can also be the time range formed by the generation time of all leaf data in the network segment subtree, which is convenient for subsequent data indexing.
[0110] S04: The server receives the node data sent by the gateway.
[0111] The server receives the node data sent by the gateway, and can obtain the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment.
[0112] After verifying the received leaf data, the gateway constructs multiple leaf data received and verified within the second time interval into a network segment subtree, and generates and signs the node data of the network segment according to the network segment subtree and the time information of the network segment subtree.
[0113] In this embodiment, the server receives leaf data from multiple terminal devices in the corresponding network segment through the gateway, so that the gateway verifies the received leaf data, and constructs multiple leaf data received and verified within the second time interval into a network segment subtree, generates and signs the node data of the network segment according to the network segment subtree and the time information of the network segment subtree, and finally receives the node data sent by the gateway. By receiving the leaf data of the terminal device and generating node data through the gateway, part of the data processing tasks of the server are allocated to multiple gateways, which can reduce the data processing volume of the server, improve the server's chain efficiency, and improve the normal operation of the entire system and improve system reliability. In addition, data verification is also performed during the process of sending and receiving data at the gateway, which can improve the integrity and authenticity of the data transmission process and ensure the credibility of the transmitted data.
[0114] In one embodiment, in step S11, that is, after obtaining and verifying the leaf data sent by multiple terminal devices, obtaining the leaf data of multiple terminal devices in the same network segment to generate the node data of the corresponding network segment specifically includes the following steps:
[0115] S111: The server receives leaf data sent by each terminal device, where the leaf data includes a data record collected by the corresponding terminal device and leaf verification information obtained by signing.
[0116] The server needs to receive leaf data sent by each terminal device, where the leaf data includes a data record collected by the corresponding terminal device and leaf verification information obtained by signing.
[0117] S112: The server performs security verification on the data records in the leaf data according to the verification information of each leaf.
[0118] The server performs security verification on the data records in the leaf data based on the verification information of each leaf. Among them, the leaf data includes the data record collected by the corresponding terminal device and the verification data of the data record, that is, the leaf verification information. The data record includes the data content and data collection time collected by the corresponding terminal device. The leaf verification information includes the hash value of the data record and the signature of the hash value of the data record. The server's verification process for leaf data is the same as the aforementioned gateway's verification process for leaf data, which will not be repeated here.
[0119] When the node data fails to pass the verification, the server deletes the node data and notifies the gateway that sent the node data that the node data fails the verification and needs to be resent.
[0120] S113: The server constructs a plurality of leaf data from the same network segment and passed verification within the second time interval into a network segment subtree, and generates node data of the network segment according to the network segment subtree and time information of the network segment subtree.
[0121] After the node data is verified, that is, after all the leaf data of the node data are verified, the server caches the node data, and then the server constructs multiple leaf data from the same network segment and verified within the second time interval into a network segment subtree, and generates node data of the network segment according to the network segment subtree and the time information of the network segment subtree. The second time interval is less than or equal to the first time interval.
[0122] Among them, the process of the server constructing the network segment subtree is the same as the process of the gateway constructing the network segment subtree, which will not be repeated here. After the server constructs the network segment subtree, it aggregates the network segment subtree and the time information of the network segment subtree into node data without the need for data signing. Among them, the time information of the network segment subtree can be the generation time of the network segment subtree; in other embodiments, the time information of the network segment subtree can also be the time range formed by the generation time of all leaf data in the network segment subtree, which is convenient for subsequent data indexing.
[0123] In this embodiment, the server receives leaf data sent by each terminal device. The leaf data includes a data record collected by the corresponding terminal device and leaf verification information obtained by the signature. Then, the data record in the leaf data is security verified according to each leaf verification information, and multiple leaf data from the same network segment and passed the verification within the second time interval are constructed into a network segment subtree, and the node data of the network segment is generated according to the network segment subtree and the time information of the network segment subtree. This process clarifies the process of the server obtaining leaf data and constructing node data after verification, ensuring the integrity and authenticity of the data. The server directly generates node data and then constructs it into a target data tree, reducing the risk of data tampering caused by multi-segment data transmission through the gateway.
[0124] In a complete embodiment, the data processing system includes a blockchain, a server, multiple terminal devices, and multiple gateways; the data processing method provided in this embodiment specifically includes the following steps:
[0125] S1: Each terminal device collects data through a collection device, and combines the data collection time and the collected data into a data record;
[0126] S2: Each terminal device performs a hash operation on the data record to obtain a hash value of the data record, uses a preset signature algorithm to sign the hash value of the data record to obtain signature information, and forms leaf data with the data record, the hash value of the data record and its signature information and sends it to the gateway, wherein the hash value of the data record and its signature information are combined into leaf verification information;
[0127] S3: The gateway performs security verification on the received leaf data and caches the leaf data after the verification passes;
[0128] S4: The gateway periodically (such as within the second time interval) constructs the leaf data sent by the multiple terminal devices and passed the verification into a data subtree, and composes the data subtree and the time information of the data subtree into subtree data;
[0129] S5: After obtaining the subtree data, the gateway performs a hash operation on the subtree data to obtain a hash value of the data record, uses a preset signature algorithm to sign the hash value of the data record to obtain signature information, and forms node data with the subtree data, the hash value of the subtree data and its signature information, and sends the node data to the server, wherein the hash value of the subtree data and its signature information are combined into leaf verification information;
[0130] S6: The server performs security verification on the received node data and caches the node data after the verification passes;
[0131] S7: The server periodically (such as within the first time interval) constructs the node data sent by the multiple gateways and passed the verification into a target data tree, and composes the target data tree and the time information of the target data tree into data to be stored;
[0132] S5: After obtaining the data to be stored, the server performs a hash operation on the data to be stored to obtain a hash value of the data to be stored, uses the hash value of the data to be stored as the on-chain data, and signs and encapsulates the on-chain data according to the preset smart contract to obtain an on-chain transaction transaction;
[0133] S6: The server sends the on-chain transaction to the blockchain, so that the blockchain calls the preset smart contract to execute the on-chain transaction, so as to realize the signature verification and on-chain processing of the on-chain data and obtain the on-chain processing result;
[0134] S7: The server periodically checks the results of the on-chain transaction, obtains the on-chain processing results, and stores the data to be stored and the on-chain processing results in a distributed storage cluster mapped to the blockchain.
[0135] According to the above steps, the data processing system includes m gateways, each of which is responsible for managing n terminal devices, where n is an integer greater than 1; Figure 8As shown, the data chain process provided in this embodiment can be: the terminal device collects data through the collection device, summarizes the collected data and the collection time into a data record, and generates leaf data after hashing the data record and signing it with the terminal device private key, and sends the leaf data to the corresponding gateway; the gateway receives and verifies the leaf data sent by n terminal devices in the corresponding network segment, constructs multiple leaf data that have passed the verification into a data subtree, and hashes the data subtree and generates node data after signing it with the gateway private key, and sends the node data to the server; the server receives and verifies the node data of m gateways, constructs multiple node data that have passed the verification into a target data tree, and signs and encapsulates the transaction transaction using the server private key (i.e., the platform private key) according to the preset smart contract, obtains the chain transaction transaction and sends it to the blockchain for signature verification and chain processing, and obtains the chain processing result fed back by the blockchain. The target data tree is constructed by using the node data of different network segments in different time periods as leaves, which increases the amount of data contained in the target data tree, uses longer and more data for chain-up, reduces the transaction volume of chain-up data, and increases the processing volume of chain-up transaction transactions per unit time of the server and blockchain, thereby improving the efficiency of chain-up.
[0136] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0137] In one embodiment, a server is provided, which corresponds one-to-one to the data processing method in the above embodiment. Fig. 9 As shown, the server includes a construction module 901, a generation module 902 and a processing module 903. The detailed description of each functional module is as follows:
[0138] Construction module 901 is used to construct tree data of leaf data sent by multiple terminal devices within a first time interval after acquiring and verifying leaf data sent by multiple terminal devices to obtain a target data tree. The terminal device signs the collected data records to obtain leaf data. Leaf nodes of the target data tree are node data generated according to leaf data of multiple terminal devices.
[0139] A generating module 902, used to generate data to be stored according to the target data tree and the time information of the target data tree;
[0140] The processing module 903 is used to perform blockchain on-chain processing on the data to be stored according to the preset smart contract to obtain the data on-chain result.
[0141] Optionally, the construction module 901 is specifically used for:
[0142] After obtaining and verifying the leaf data sent by multiple terminal devices, the leaf data of multiple terminal devices in the same network segment are obtained to generate the node data of the corresponding network segment; the node data is data including the network segment subtree generated after the leaf data of multiple terminal devices in the same network segment within the second time interval are constructed into a network segment subtree;
[0143] The node data is taken as a leaf node, and a target data tree is constructed according to a plurality of node data of different network segments within a first time interval.
[0144] Optionally, the construction module 901 is further configured to:
[0145] Receive leaf data sent by each terminal device, where the leaf data includes a data record collected by the corresponding terminal device and leaf verification information obtained by signing;
[0146] Perform security verification on data records in leaf data according to verification information of each leaf;
[0147] Multiple leaf data from the same network segment and passed verification within a second time interval are constructed into a network segment subtree, and node data of the network segment is generated according to the network segment subtree and time information of the network segment subtree, and the second time interval is less than or equal to the first time interval.
[0148] Optionally, the construction module 901 is further configured to:
[0149] The gateway receives leaf data of multiple terminal devices in the corresponding network segment, so that the gateway generates node data according to the received multiple leaf data, and receives the node data of the network segment sent by the gateway;
[0150] Among them, after verifying the received leaf data, the gateway performs a security check on each leaf data received, and constructs multiple leaf data received and verified within the second time interval into a network segment subtree, and generates and signs the node data of the network segment based on the network segment subtree and the time information of the network segment subtree. The second time interval is less than the first time interval.
[0151] Optionally, the construction module 901 is further used to
[0152] When the node data is data sent by the gateway and the node data includes subtree verification information, security verification is performed on the node data based on the subtree verification information in the node data;
[0153] The node data that has passed the verification is taken as a leaf node, and multiple node data that have passed the verification in different network segments within the first time interval are aggregated and packaged to obtain a target data tree.
[0154] Optionally, the processing module 903 is specifically configured to:
[0155] Perform hash operation on the data to be stored, use the hash value of the data to be stored as the on-chain data, and sign and encapsulate the on-chain data based on the preset smart contract to obtain the on-chain transaction including the on-chain data;
[0156] Send the transaction to the blockchain for signature verification and data uploading, and obtain the data uploading result fed back by the blockchain;
[0157] The data to be stored and the data on-chain results are stored together in a distributed storage cluster mapped to the blockchain.
[0158] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0159] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0160] The present application also provides an electronic device, such as Fig.10 As shown, the electronic device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program, or implements the functions of the modules / units in the above-mentioned device embodiments when executing the computer program.
[0161] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the computer device.
[0162] Those skilled in the art will understand that Fig.10 These are merely examples of the computer device and do not constitute a limitation of the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0163] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0164] The memory may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc. equipped on the computer device. Furthermore, the memory may include both an internal storage unit of the computer device and an external storage device.
[0165] An embodiment of the present application further provides a readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps in the above-mentioned method embodiments or the functions of each device.
[0166] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments or the functions of each device when the computer program product is executed.
[0167] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0168] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0169] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0170] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0171] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0172] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: include: After acquiring and verifying the leaf data sent by multiple terminal devices, the leaf data sent by the multiple terminal devices within the first time interval are constructed into tree data to obtain a target data tree, and the terminal devices sign the collected data records to obtain the leaf data, and the leaf nodes of the target data tree are node data generated according to the leaf data of the multiple terminal devices; Generate data to be stored according to the target data tree and time information of the target data tree; The data to be stored is processed on the blockchain according to the preset smart contract to obtain the data on-chain result.
2. The data processing method according to claim 1, characterized in that: After acquiring and verifying the leaf data sent by the plurality of terminal devices, constructing the leaf data sent by the plurality of terminal devices within the first time interval into tree data to obtain the target data tree, including: After obtaining and verifying the leaf data sent by multiple terminal devices, the leaf data of multiple terminal devices in the same network segment are obtained to generate node data corresponding to the network segment; the node data is data including the network segment subtree generated after the leaf data of multiple terminal devices in the same network segment are constructed into the network segment subtree; The node data is used as a leaf node, and the target data tree is constructed according to a plurality of the node data in different network segments within the first time interval.
3. The data processing method according to claim 2, characterized in that: After obtaining and verifying the leaf data sent by the plurality of terminal devices, obtaining the leaf data of the plurality of terminal devices in the same network segment to generate the node data corresponding to the network segment includes: Receiving the leaf data sent by each of the terminal devices, the leaf data including a data record collected by the corresponding terminal device and leaf verification information obtained by signing; Performing security verification on the data records in the leaf data according to the leaf verification information; The multiple leaf data from the same network segment and passed verification within a second time interval are constructed into the network segment subtree, and the node data of the network segment is generated according to the network segment subtree and the time information of the network segment subtree, and the second time interval is less than or equal to the first time interval.
4. The data processing method according to claim 2, characterized in that: After obtaining and verifying the leaf data sent by the plurality of terminal devices, obtaining the leaf data of the plurality of terminal devices in the same network segment to generate the node data corresponding to the network segment includes: Receiving leaf data of a plurality of terminal devices in a corresponding network segment through a gateway, so that the gateway generates the node data according to the received plurality of leaf data, and receives the node data of the network segment sent by the gateway; Among them, after verifying the received leaf data, the gateway performs a security check on each leaf data received, and constructs multiple leaf data received and verified within a second time interval into the network segment subtree, and generates and signs the node data of the network segment based on the network segment subtree and the time information of the network segment subtree, and the second time interval is less than the first time interval.
5. The data processing method according to claim 2, characterized in that: The step of taking the node data as a leaf node and aggregating and packaging a plurality of the node data in different network segments within the first time interval to obtain the target data tree includes: When the node data is data sent by a gateway and the node data includes subtree verification information, performing security verification on the node data based on the subtree verification information in the node data; The node data that has passed the verification is taken as a leaf node, and multiple node data that have passed the verification in different network segments within the first time interval are aggregated and packaged to obtain the target data tree.
6. The data processing method according to any one of claims 1 to 5, characterized in that: The processing of uploading the data to be stored to the blockchain according to the preset smart contract to obtain the data uploading result includes: Performing a hash operation on the data to be stored, using the obtained hash value of the data to be stored as the on-chain data, and signing and encapsulating the on-chain data based on the preset smart contract to obtain an on-chain transaction transaction including the on-chain data; Send the on-chain transaction to the blockchain for signature verification and data on-chain, and obtain the data on-chain result fed back by the blockchain; The data to be stored and the data on-chain result are stored together in a distributed storage cluster mapped to the blockchain.
7. A data processing system, characterized in that: It includes multiple terminal devices and a server, wherein the server is used for: After acquiring and verifying the leaf data sent by multiple terminal devices, the leaf data sent by the multiple terminal devices within the first time interval are constructed into tree data to obtain a target data tree, and the terminal devices sign the collected data records to obtain the leaf data, and the leaf nodes of the target data tree are node data generated according to the leaf data of the multiple terminal devices; Generate data to be stored according to the target data tree and time information of the target data tree; The data to be stored is processed on the blockchain according to the preset smart contract to obtain the data on-chain result.
8. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the electronic device implements the steps of the data processing method according to any one of claims 1 to 6.
9. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed, the data processing method according to any one of claims 1 to 6 is executed.