A method, device, equipment and storage medium for generating a Merkle tree

By adjusting the importance coefficient and data combination of industrial data, a target Merkle tree is generated, which solves the problem of slow Merkle tree construction in Taichung in industrial big data, and achieves real-time monitoring and rapid anomaly positioning.

CN118331967BActive Publication Date: 2024-10-18THREE GORGES GROUP IND DEVELOPMENT (BEIJING) CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410758948.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-10-18
Estimated Expiration
2044-06-13

Smart Images

  • Figure CN118331967B_ABST
    Figure CN118331967B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, equipment and storage medium for generating a Merkle tree. A first data set is generated by acquiring monitoring data at multiple points. The data contained in the first data set is compressed to obtain a second data set. Based on the importance coefficient of the monitoring data at each point, the importance coefficient of the data in the second data set whose importance coefficient is less than a first threshold is adjusted to a second threshold. The data in the second data set with the same importance coefficient is divided into a group. A Merkle tree is generated for each group of data. The original data of each group of data in the second data set is replaced by a hash value corresponding to a root node of the Merkle tree corresponding to each group of data to obtain a third data set. A target Merkle tree is generated based on the data in the third data set and the importance coefficient corresponding to the data in the third data set, thereby improving the construction speed of the Merkle tree and realizing real-time monitoring alarm and rapid abnormality positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of industrial informatization, and in particular to a method, device, equipment and storage medium for generating a Merkle tree. Background Art

[0002] As an important data structure in blockchain technology, Merkle tree technology can quickly perform data verification and error location due to its unique structure and the characteristics of the hash algorithm used to construct the Merkle tree. Therefore, it is widely used in blockchain, big data, cloud computing, database migration, log auditing and other fields.

[0003] In the industrial big data platform monitoring scenario, Merkle trees are usually used to compare the collected real-time data with standard data to judge and locate industrial anomalies.

[0004] However, in actual application, due to the periodicity and large amount of industrial data, the Merkle tree construction is usually slow, and the constructed Merkle tree has many nodes and levels, which affects the efficiency of abnormal data verification. As a result, it is difficult for the current industrial anomaly monitoring under the big data platform to achieve real-time monitoring and alarm and rapid anomaly location, which in turn affects the rapid location and processing of fault points by industrial field operation and maintenance personnel. Summary of the invention

[0005] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and storage medium for generating a Merkle tree.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for generating a Merkle tree, comprising:

[0007] Acquire monitoring data at multiple points to generate a first data set, compress the data contained in the first data set to obtain a second data set, adjust the importance coefficient of the data in the second data set whose importance coefficient is less than the first threshold to the second threshold based on the importance coefficient of the monitoring data at each point obtained in advance, divide the data in the second data set with the same importance coefficient into a group, generate a Merkle tree for each group of data, obtain the root node of the Merkle tree corresponding to each group of data, replace the original data of each group of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each group of data to obtain a third data set, generate a target Merkle tree based on the data in the third data set and the importance coefficient corresponding to the data in the third data set, so that the importance coefficient of the target Merkle tree starting from the root node is gradually reduced.

[0008] In a second aspect, an embodiment of the present disclosure provides a hash operation device, including:

[0009] A first data set generating module, used to obtain monitoring data at multiple points and generate a first data set;

[0010] A second data set generating module, used for compressing the data contained in the first data set to obtain a second data set;

[0011] An importance coefficient adjustment module, for adjusting the importance coefficient of data in the second data set whose importance coefficient is less than the first threshold to a second threshold based on the importance coefficient of the monitoring data at each point obtained in advance;

[0012] A first Merkle tree generating module divides the data with the same importance coefficient in the second data set into a group, generates a Merkle tree for each group of data, and obtains a root node of the Merkle tree corresponding to each group of data;

[0013] A third data set generating module, used to replace the original data of each set of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each set of data, to obtain a third data set;

[0014] The second Merkle tree generation module is used to generate a target Merkle tree based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, so that the importance coefficient of the target Merkle tree starting from the root node decreases step by step.

[0015] In a third aspect, an embodiment of the present disclosure provides a computer device, including:

[0016] Memory;

[0017] Processor; and

[0018] Computer programs;

[0019] The computer program is stored in the memory and is configured to be executed by the processor to implement the method of the first aspect.

[0020] In a fourth aspect, an embodiment of the present disclosure provides a storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the method of the first aspect.

[0021] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method of the first aspect is implemented.

[0022] The Merkle tree generation method, device, equipment and storage medium provided by the embodiments of the present disclosure generate a first data set by acquiring monitoring data at multiple points, compress the data contained in the first data set to obtain a second data set, adjust the importance coefficient of the data in the second data set whose importance coefficient is less than the first threshold to the second threshold based on the importance coefficient of the monitoring data at each point, divide the data in the second data set with the same importance coefficient into a group, generate a Merkle tree for each group of data, replace the original data of each group of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each group of data to obtain a third data set, generate a target Merkle tree based on the data in the third data set and the importance coefficient corresponding to the data in the third data set, reduce the amount of data for generating the target Merkle tree, thereby improving the Merkle tree construction speed, reducing the number of nodes of the target Merkle tree, and improving the retrieval efficiency of abnormal data, thereby realizing real-time monitoring alarm and rapid abnormality location. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0025] Figure 1 A flow chart of a method for generating a Merkle tree provided in an embodiment of the present disclosure;

[0026] Figure 2 An example diagram of a data set provided for an embodiment of the present disclosure;

[0027] Figure 3 An example diagram of a target Merkle tree provided in an embodiment of the present disclosure;

[0028] Figure 4 A flow chart of an abnormality detection method provided by another embodiment of the present disclosure;

[0029] Figure 5 A schematic diagram of the structure of a Merkle tree generation device provided in an embodiment of the present disclosure;

[0030] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0032] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0033] Figure 1 A flow chart of a method for generating a Merkle tree provided in an embodiment of the present disclosure. The method can be exemplarily performed by a Merkle tree generating device, which can be implemented in software and / or hardware, and can be configured in a computer device, such as a server or a terminal, wherein the terminal can be, for example, a mobile phone, a computer, or a tablet computer.

[0034] like Figure 1 As shown, the method for generating a Merkle tree provided in the embodiment of the present disclosure may include the following steps:

[0035] S101. Acquire monitoring data at multiple points to generate a first data set.

[0036] Specifically, the points referred to in the embodiments of the present disclosure may be, for example, monitoring points preset in an industrial site, and the monitoring data may be exemplarily understood as data collected by sensors preset at the monitoring points. Taking the oil tank industrial site as an example, the monitoring data includes information data such as the temperature, pressure, valve switch status, and whether the limit is exceeded for multiple oil tanks. It should be noted that the corresponding monitoring data in different scenarios may be different, and this is only for example.

[0037] Specifically, data from the industrial site is collected by sensors preset at monitoring points to obtain monitoring data at multiple monitoring points.

[0038] Optionally, after the monitoring data at each point is collected, the collected monitoring data can be cleaned and integrated. Optionally, after the monitoring data is cleaned and integrated, the monitoring data with an importance coefficient lower than a third threshold value can be screened out based on the importance coefficient of the monitoring data at each monitoring point obtained in advance.

[0039] The remaining monitoring data are sorted according to the importance coefficient to obtain a first data set, wherein the first data set may also include the importance coefficient of each monitoring point.

[0040] For example, Figure 2 is an example diagram of a data set provided by an embodiment of the present disclosure, such as Figure 2 As shown, there are seven monitoring points a, b, c, d, e, f, and g, wherein the importance data of the seven monitoring points are 30, 40, 50, 60, 70, 70, and 80, respectively. The first data set includes the monitoring data collected at each monitoring point and the importance coefficient corresponding to the monitoring point.

[0041] Specifically, the importance coefficient referred to in the embodiment of the present disclosure is obtained by the confidence of the association rule where the monitoring point is located and the importance level score of the fault in the association rule. The specific formula is:

[0042]

[0043] Where n represents the number of faults related to monitoring point A, M(A) represents the importance coefficient of monitoring point A, C(A->B) represents the confidence of the association rule between monitoring point A and fault B, and I(B) represents the pre-set importance level score of fault B.

[0044] Among them, the confidence of the association rules between monitoring points and faults is obtained by the association rule mining algorithm (apriori).

[0045] Specifically, for all monitoring points, the association between each monitoring point and all possible faults in current industrial production is analyzed. The confidence of the association rules between each monitoring point and fault is calculated using the prior knowledge of the operation and maintenance personnel and previous operation logs as the basic data set.

[0046] Optionally, when calculating the importance coefficient, a minimum confidence threshold can be set, and for the association rules between monitoring points and faults whose confidence is less than the minimum confidence threshold, the confidence is adjusted to 0. By adjusting the confidence of the association rules between monitoring points and faults whose confidence is less than the minimum confidence threshold to 0, the interference of the monitoring points and faults with less correlation on the calculation of the importance coefficient of the monitoring points can be reduced. The minimum confidence threshold can be set according to the experience of the operation and maintenance personnel.

[0047] S102: compress the data contained in the first data set to obtain a second data set.

[0048] Specifically, in the embodiment of the present disclosure, the data contained in the first data set is compressed by performing a hash operation on the data in the first data set to obtain a hash value of each data in the first data set, sorting the calculated hash values ​​based on the importance coefficient of the corresponding data, generating a second data set, and obtaining the second data set. The hash operation in the compression process can be any pre-set hash operation.

[0049] Specifically, in the embodiment of the present disclosure, the data contained in the first data set is compressed, and based on the importance coefficient of the monitoring data at each point obtained in advance, the data in the first data set whose importance coefficient is less than the fourth threshold and the data whose importance coefficient is greater than or equal to the fourth threshold are compressed to obtain the second data set. Among them, the compression method for the data whose importance coefficient is less than the fourth threshold is different from the compression method for the data whose importance coefficient is greater than or equal to the fourth threshold. For example, the data in the first data set whose importance coefficient is less than the fourth threshold can be sliced ​​to obtain at least one data slice, and each data slice is hashed to obtain the hash value of each data slice. Specifically, the number of data slices can be determined based on the number of data in the first data set whose importance coefficient is less than the fourth threshold, so that the number of data in each data slice whose importance coefficient is less than the fourth threshold is consistent. For the compression of data whose importance coefficient is greater than or equal to the fourth threshold, the data whose importance coefficient is greater than or equal to the fourth threshold can be directly hashed to obtain the hash value of the data in the first data set whose importance coefficient is greater than or equal to the fourth threshold. Based on the importance coefficient of the corresponding data slice or data, the calculated hash values ​​are sorted to generate the second data set. By performing different compression methods on data with different importance coefficients, the number of data less than the fourth threshold when constructing the Merkle tree is reduced, the speed of constructing the Merkle tree is improved, the nodes of the constructed Merkle tree are reduced, and the retrieval efficiency of abnormal data is further improved.

[0050] For example Figure 2 As shown, the fourth threshold is set to 65, and the data with importance coefficient less than the fourth threshold is sliced ​​to obtain data slice A and data slice B, and H(X) refers to the hash value calculated based on data X.

[0051] S103: Based on the importance coefficients of the monitoring data at each point obtained in advance, the importance coefficients of the data in the second data set whose importance coefficients are less than the first threshold are adjusted to the second threshold.

[0052] Specifically, in the embodiment of the present disclosure, the first threshold and the fourth threshold may be the same or different, and the second threshold is a preset threshold that is smaller than the first threshold.

[0053] For example Figure 2 As shown, the first threshold is set to 65, the second threshold is set to 0, and the importance coefficients of H(A) and H(B) in the second data set are adjusted to 0.

[0054] S104, dividing the data with the same importance coefficient in the second data set into one group, generating a Merkle tree for each group of data, and obtaining a root node of the Merkle tree corresponding to each group of data.

[0055] Specifically, the method for generating a Merkle tree in the embodiment of the present disclosure is a commonly used method in the art and will not be described in detail here.

[0056] Specifically, data with the same importance in the second data set are extracted into the same group to obtain multiple data groups with the same importance coefficient, and a corresponding Merkle tree is generated for each data group.

[0057] Specifically, in the embodiment of the present disclosure, after extracting the data with the same importance in the second data set into the same group, the data with the same importance coefficient in the second data set are merged.

[0058] For example, Figure 2 H(A) and H(B) whose importance coefficients are both 0 are extracted into the same group to generate the corresponding Merkle tree. H(e) and H(f) whose importance coefficients are both 70 are extracted into the same group to generate the corresponding Merkle tree, thereby obtaining the root node of the Merkle tree of the data group composed of H(e) and H(f). By dividing the data with the same importance coefficient into the same group and obtaining the root node of the group of data, the amount of data when constructing the Merkle tree is further reduced, the speed of constructing the Merkle tree is improved, the number of nodes of the constructed Merkle tree is reduced, and the retrieval efficiency of abnormal data is further improved.

[0059] S105 . Replace the original data of each set of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each set of data to obtain a third data set.

[0060] For example Figure 2 As shown, H(A) and H(B) whose importance coefficients are both 0 in the second data set are merged and replaced with the hash value H(AB) corresponding to the root node of the corresponding Merkle tree; H(e) and H(f) whose importance coefficients are both 70 in the second data set are merged and replaced with the hash value H(ef) corresponding to the root node of the corresponding Merkle tree to obtain the third data set.

[0061] S106: Generate a target Merkle tree based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, so that the importance coefficient of the target Merkle tree starting from the root node decreases step by step.

[0062] Specifically, in the disclosed embodiment, according to the importance coefficients corresponding to the data in the third data set, two data are sequentially taken out in order from small to large for splicing, a hash operation is performed on the spliced ​​data, and the obtained hash value is used as the root node of the two data and filled into the target Merkel tree, and the two data in the third data set are merged, and the hash value is replaced into the third data set to form a new data set, wherein the importance coefficient of the hash value is the maximum value of the importance coefficients of the two data corresponding to the hash value, and it is iterated layer by layer until only one hash value remains in the entire data set, and the hash value is filled into the target Merkel tree as the root node of the target Merkel tree to generate the target Merkel tree. Since, when generating the target Merkel tree, the data in the data set and the hash value obtained according to the data are filled into the target Merkel tree in order from small to large according to the importance coefficients corresponding to the data in the data set, the importance coefficient of the target Merkel tree starting from the root node decreases step by step.

[0063] Optionally, after the target Merkle tree is generated, the Merkle tree generated in step S104 can be spliced ​​to the corresponding node of the target Merkle tree to generate the target Merkle tree. Since the importance of each node on the Merkle tree generated in S104 is the same, the importance coefficient of the target Merkle tree is gradually reduced starting from the root node.

[0064] For example Figure 2 As shown, according to the importance coefficient of the data in the third data set, data H(AB) and H(ef) are taken out and concatenated, and a hash operation is performed to obtain a hash value H(ABef). After H(ABef) is filled into the third data set, a fourth data set is obtained. In the fourth data set, data H(ABef) and H(g) are taken out and concatenated, and a hash operation is performed to obtain a hash value H(ABefg). After H(ABefg) is filled into the fourth data set, a fifth data set is obtained.

[0065] Figure 3 Based on Figure 2 A schematic diagram of a target Merkle tree generated by the third dataset in . Figure 3 As shown, the root node of the target Merkle tree is H(ABefg), and the importance coefficient of the target Merkle tree decreases step by step starting from the root node.

[0066] The disclosed embodiment acquires monitoring data at a plurality of points to generate a first data set, compresses the data contained in the first data set to obtain a second data set, adjusts the importance coefficient of the data in the second data set whose importance coefficient is less than the first threshold value to the second threshold value based on the importance coefficient of the monitoring data at each point, divides the data in the second data set with the same importance coefficient into a group, generates a Merkle tree for each group of data, replaces the original data of each group of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each group of data to obtain a third data set, generates a target Merkle tree based on the data in the third data set and the importance coefficient corresponding to the data in the third data set, reduces the amount of data for generating the target Merkle tree, thereby improving the target Merkle tree construction speed, reducing the number of nodes in the target Merkle tree, and further realizing real-time monitoring alarm and rapid abnormality location.

[0067] Furthermore, on the basis of the above embodiments, after generating a target Merkle tree based on the data in the third data set and the importance coefficient corresponding to the data in the third data set, the hash values ​​of the nodes on the target Merkle tree and the preset standard Merkle tree are compared, and the abnormal location is determined based on the comparison result, wherein the standard Merkle tree and the target Merkle tree are produced in the same way, and the data used to generate the standard Merkle tree are data collected by the monitoring node indicating that industrial production is in a safe state.

[0068] Figure 4 A flowchart of an abnormality detection method provided by another embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the anomaly detection method includes the following steps:

[0069] S401, comparing the hash value of the root node of the target Merkle tree with the hash value of the root node of the standard Merkle tree.

[0070] S402: In response to the hash values ​​of the root node of the target Merkle tree and the root node of the standard Merkle tree being inconsistent, determining that an abnormality occurs.

[0071] Specifically, since the root node of the Merkle tree is generated by a hash algorithm, when any leaf node of the target Merkle tree is different from that of the standard Merkle tree, the root node of the Merkle tree will be different. When any leaf node of the target Merkle tree is different from that of the standard Merkle tree, it means that there is an abnormality in industrial production. Therefore, by only comparing the root node, it is possible to quickly determine whether an abnormality has occurred, thereby improving the efficiency of abnormality detection and achieving real-time monitoring and alarming.

[0072] S403, starting from the root node, compare the nodes at the same position on the target Merkle tree and the standard Merkle tree step by step until the nodes with different hash values ​​on the target Merkle tree and the standard Merkle tree are determined to obtain the abnormal position.

[0073] Specifically, when a node on the target Merkle tree and a node on the standard Merkle tree with the same hash value is determined, the child nodes of the node are no longer detected.

[0074] Specifically, when a node with a different hash value on the target Merkle tree and the standard Merkle tree is found, it is determined whether the node has a child node. If the node does not have a child node, the monitoring point where the data corresponding to the node is collected is an abnormal position. If the node has a child node, the child nodes of the node at the same position on the target Merkle tree and the standard Merkle tree are continued to be compared.

[0075] The disclosed embodiment compares the hash values ​​of the root node of the target Merkle tree with the root node of the standard Merkle tree. In response to the inconsistency between the hash values ​​of the root node of the target Merkle tree and the root node of the standard Merkle tree, it is determined that an abnormality has occurred, and the nodes at the same position on the target Merkle tree and the standard Merkle tree are compared step by step starting from the root node until the nodes on the target Merkle tree and the standard Merkle tree with different hash values ​​are determined, and the abnormal position is obtained. Since the number of nodes of the target Merkle tree is reduced, real-time monitoring and alarming and rapid abnormality location are achieved.

[0076] Figure 5 The schematic diagram of the structure of the Merkle tree generation device provided in the embodiment of the present disclosure. The Merkle tree generation device may be a computer device as in the above embodiment, or the Merkle tree generation device may be a component or assembly in the computer device. The Merkle tree generation device provided in the embodiment of the present disclosure may execute the processing flow provided in the Merkle tree generation method embodiment, such as Figure 5 As shown, the Merkle tree generation device 500 includes:

[0077] The first data set generation module 510 may be used to obtain monitoring data at multiple points to generate a first data set;

[0078] The second data set generation module 520 may be used to compress the data contained in the first data set to obtain a second data set;

[0079] The importance coefficient adjustment module 530 may be used to adjust the importance coefficient of the data in the second data set whose importance coefficient is less than the first threshold to a second threshold based on the importance coefficient of the monitoring data at each point obtained in advance;

[0080] The first Merkle tree generating module 540 may be used to group the data with the same importance coefficient in the second data set into one group, generate a Merkle tree for each group of data, and obtain a root node of the Merkle tree corresponding to each group of data;

[0081] The third data set generation module 550 may be used to replace the original data of each set of data in the second data set with the hash value corresponding to the root node of the Merkle tree corresponding to each set of data to obtain a third data set;

[0082] The second Merkle tree generation module 560 can be used to generate a target Merkle tree based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, so that the importance coefficient of the target Merkle tree starting from the root node decreases step by step.

[0083] The second data set generation module 520 can also be specifically used to compress the data in the first data set whose importance coefficient is less than the fourth threshold and the data whose importance coefficient is greater than or equal to the fourth threshold based on the importance coefficient of the monitoring data at each point obtained in advance, to obtain the second data set.

[0084] Optionally, the second data set generating module 520 may further include:

[0085] A slicing unit 521, configured to slice the data in the first data set whose importance coefficient is less than a fourth threshold value to obtain at least one data slice;

[0086] A hash value calculation unit 522, configured to calculate a hash value of each data slice and a hash value of data in the first data set whose importance coefficient is greater than or equal to a fourth threshold;

[0087] The sorting unit 523 is used to sort the calculated hash values ​​based on the corresponding data slices or the importance coefficients of the data to generate a second data set.

[0088] Optionally, the Merkle tree generating device 500 may further include:

[0089] The anomaly detection module 570 can be used to compare the hash values ​​of the nodes on the target Merkle tree and the preset standard Merkle tree, and determine the anomaly location based on the comparison result, wherein the standard Merkle tree and the target Merkle tree are produced in the same way.

[0090] The anomaly detection module 570 may further include:

[0091] A comparison unit 571 may be used to compare the hash value of the root node of the target Merkle tree with the hash value of the root node of the standard Merkle tree;

[0092] The abnormality determination unit 572 may be configured to determine that an abnormality occurs in response to a difference in hash values ​​between the root node of the target Merkle tree and the root node of the standard Merkle tree;

[0093] The abnormal query unit 573 can be used to compare the nodes at the same position on the target Merkle tree and the standard Merkle tree step by step starting from the root node, until the nodes with different hash values ​​on the target Merkle tree and the standard Merkle tree are determined to obtain the abnormal position.

[0094] Figure 5 The Merkle tree generation device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0095] Figure 6 The computer device provided in the embodiment of the present disclosure can execute the processing flow provided in the embodiment of the method for generating a Merkle tree, such as Figure 6 As shown, the computer device 60 includes: a memory 61, a processor 62, a computer program and a communication interface 63; wherein the computer program is stored in the memory 61 and is configured so that the processor 62 executes the above Merkle tree generation method.

[0096] In addition, an embodiment of the present disclosure further provides a storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method for generating a Merkle tree of the above embodiment.

[0097] In addition, an embodiment of the present disclosure also provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method for generating a Merkle tree as described above is implemented.

[0098] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0099] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating a Merkle tree, It is characterized in that The method comprises: Acquire monitoring data collected by sensors at multiple points on the industrial site to generate a first data set; compressing the data contained in the first data set to obtain a second data set; Based on the importance coefficients of the monitoring data at each point obtained in advance, adjusting the importance coefficients of the data in the second data set whose importance coefficients are less than the first threshold to a second threshold; Divide the data with the same importance coefficient in the second data set into a group, generate a Merkle tree for each group of data, and obtain the root node of the Merkle tree corresponding to each group of data; Merge the data with the same importance coefficient in the second data set, and replace them with the hash value corresponding to the root node of the corresponding Merkle tree to obtain a third data set; Based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, generating a target Merkle tree so that the importance coefficient of the target Merkle tree starting from the root node decreases step by step; The compressing the data contained in the first data set to obtain the second data set includes: Based on the importance coefficients of the monitoring data at each point obtained in advance, respectively compressing the data whose importance coefficients are less than a fourth threshold and the data whose importance coefficients are greater than or equal to the fourth threshold in the first data set to obtain a second data set; The method of compressing the data in the first data set whose importance coefficient is less than a fourth threshold value and the data in the first data set whose importance coefficient is greater than or equal to the fourth threshold value based on the importance coefficient of the monitoring data at each point obtained in advance to obtain a second data set includes: Slice the data in the first data set whose importance coefficient is less than a fourth threshold to obtain at least one data slice; Calculating a hash value of each data slice and a hash value of data in the first data set whose importance coefficient is greater than or equal to the fourth threshold; The calculated hash values ​​are sorted based on the corresponding data slices or the importance coefficients of the data to generate a second data set.

2. The method according to claim 1, It is characterized in that The monitoring data at the plurality of points are obtained based on the importance coefficients of the monitoring data at the respective points obtained in advance, and are obtained by screening out the monitoring data with importance coefficients lower than a third threshold.

3. The method according to any one of claims 1 to 2, It is characterized in that After generating the target Merkle tree based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, the method includes: Compare the hash values ​​of the nodes on the target Merkle tree and the preset standard Merkle tree, and determine the abnormal position based on the comparison result, wherein the standard Merkle tree and the target Merkle tree are produced in the same way.

4. The method according to claim 3, It is characterized in that The comparing the hash values ​​of the nodes on the target Merkle tree and the preset standard Merkle tree, and determining the abnormal position based on the comparison result, includes: Compare the hash values ​​of the root node of the target Merkle tree and the root node of the standard Merkle tree; In response to the hash values ​​of the root node of the target Merkle tree and the root node of the standard Merkle tree being inconsistent, determining that an exception occurs; Starting from the root node, nodes at the same position on the target Merkle tree and the standard Merkle tree are compared step by step until nodes with different hash values ​​on the target Merkle tree and the standard Merkle tree are determined to obtain abnormal positions.

5. A device for generating a Merkle tree, It is characterized in that The device comprises: A first data set generation module, used to obtain monitoring data collected by sensors at multiple points on the industrial site to generate a first data set; A second data set generating module, configured to compress the data contained in the first data set to obtain a second data set; An importance coefficient adjustment module, configured to adjust the importance coefficient of the data in the second data set whose importance coefficient is less than the first threshold to a second threshold based on the importance coefficient of the monitoring data at each point obtained in advance; A first Merkle tree generating module, which divides the data with the same importance coefficient in the second data set into a group, generates a Merkle tree for each group of data, and obtains a root node of the Merkle tree corresponding to each group of data; A third data set generating module, configured to merge the data with the same importance coefficient in the second data set, and replace the data with the hash value corresponding to the root node of the corresponding Merkle tree, to obtain a third data set; A second Merkle tree generating module, configured to generate a target Merkle tree based on the data in the third data set and the importance coefficients corresponding to the data in the third data set, so that the importance coefficients of the target Merkle tree starting from the root node are gradually reduced; The second data set generating module is specifically used to compress the data whose importance coefficient is less than the fourth threshold value and the data whose importance coefficient is greater than or equal to the fourth threshold value in the first data set respectively based on the importance coefficient of the monitoring data at each point obtained in advance, so as to obtain the second data set; The second data set generating module comprises: A slicing unit, configured to slice the data in the first data set whose importance coefficient is less than a fourth threshold value to obtain at least one data slice; A hash value calculation unit, used to calculate the hash value of each data slice, and the hash value of the data in the first data set whose importance coefficient is greater than or equal to the fourth threshold; The sorting unit is used to sort the calculated hash values ​​based on the corresponding data slices or the importance coefficients of the data to generate a second data set.

6. The device according to claim 5, It is characterized in that The monitoring data at the plurality of points are obtained by screening out the monitoring data with an importance coefficient lower than a third threshold value based on the confidence of the monitoring data at each point obtained in advance.

7. The device according to any one of claims 5 to 6, It is characterized in that The device also includes: An anomaly detection module is used to compare the hash values ​​of the nodes on the target Merkle tree and the preset standard Merkle tree, and determine the anomaly location based on the comparison result, wherein the standard Merkle tree and the target Merkle tree are produced in the same way.

8. The device according to claim 7, It is characterized in that The anomaly detection module comprises: A comparison unit, used for comparing the hash value of the root node of the target Merkle tree with the hash value of the root node of the standard Merkle tree; an abnormality determination unit, configured to determine that an abnormality occurs in response to a difference in hash values ​​between the root node of the target Merkle tree and the root node of the standard Merkle tree; The abnormal query unit is used to compare the nodes at the same position on the target Merkle tree and the standard Merkle tree step by step starting from the root node until the nodes with different hash values ​​on the target Merkle tree and the standard Merkle tree are determined to obtain the abnormal position.

9. A computer device, It is characterized in that include: Memory; processor; and a computer program; wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 4.

10. A storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating a Merkle tree according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Storage method and verification method of transaction data in block chain, and block chain system

    CN112561700A