Electric power data credibility verification method and system based on Merkel tree
By signing and storing power data on an off-chain TEE device and comparing it with data on the blockchain, the consistency problem between on-chain and off-chain power data is solved, and the accuracy of power data credibility judgment is improved.
Patent Information
- Application Number
- CN202511577443.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-02-06
AI Technical Summary
Existing technologies have failed to effectively address the consistency issue of power data on and off the blockchain, leading to a decrease in the accuracy of power data credibility assessment results.
A Merkle tree-based approach is used to sign and store power operation status data groups through off-chain TEE devices, and compare them with data on the blockchain to ensure consistency between on-chain and off-chain data.
It improves the accuracy of power data credibility assessment by comparing off-chain and on-chain Merkel data on user node devices, ensuring the integrity and credibility of power data.
Smart Images

Figure CN121485941A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data verification technology, and in particular to a method and system for verifying the credibility of power data based on Merkle trees. Background Technology
[0002] In the process of energy digital transformation, power data assets have become the core basis for grid dispatching, power trading, and equipment operation and maintenance. Their authenticity and integrity are directly related to the safe and stable operation of the power system and the optimal allocation of energy resources. However, power data faces multi-dimensional tampering risks throughout its entire lifecycle, from collection and transmission to storage and use. Therefore, verifying the credibility of power data is crucial.
[0003] In existing technologies, the main considerations are to ensure the security of electricity data and the accuracy of the tamper-proof judgment results of electricity data through blockchain technology, encryption algorithms, and digital signature algorithms. However, if an attacker tampers with the original data before it is uploaded from off-chain to on-chain, and then uploads the tampered data to the chain, the on-chain data will completely match the tampered off-chain data, and the blockchain will still consider the data to be legitimate. Therefore, existing technologies do not take into account the need to verify the consistency of the original electricity data, which leads to a decrease in the accuracy of the trustworthiness judgment results of the electricity data. Summary of the Invention
[0004] This invention provides a method and system for verifying the credibility of power data based on Merkle trees, which can solve the problem that the existing technology does not consider the on-chain and off-chain consistency of power data, resulting in a decrease in the accuracy of the credibility judgment results of power data.
[0005] One embodiment of the present invention provides a method for verifying the credibility of power data based on Merkle trees, applicable to off-chain TEE devices, including:
[0006] The system acquires several power operation status data sets uploaded by the data acquisition device within a preset time period. When acquiring each power operation status data set, the system signs the power operation status data set with its own first private key to obtain first signature data, and stores the power operation status data set. Each power operation status data set corresponds to a time point within the preset time period.
[0007] The system uploads its first public key, the aforementioned first signature data, and the power operation status data set to the blockchain. After obtaining these data from the blockchain, user node devices perform tamper-proof verification on the power operation status data set using the first public key and the first signature data. If the tamper-proof verification passes, the on-chain Merkel data is compared with the off-chain Merkel data. If the on-chain and off-chain Merkel data are identical, all power operation status data sets within the aforementioned preset time period are deemed trustworthy; otherwise, all power operation status data sets within the aforementioned preset time period are deemed untrustworthy.
[0008] Specifically, the on-chain Merkel data is calculated by the blockchain based on all received power operation status data sets and sent to the user node device; the off-chain Merkel data is calculated by the off-chain TEE device itself based on all power operation status data sets and sent to the user node device.
[0009] Furthermore, before acquiring several sets of power operation status data uploaded by the data acquisition equipment within a preset time period, the process also includes:
[0010] Obtain its own binding status, and determine whether it is bound to the data acquisition device based on the binding status.
[0011] If the above binding status is true, it is determined that it is bound to the above data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate.
[0012] Otherwise, it will be determined that it is not bound to the aforementioned data acquisition device, and the device will be rebound.
[0013] Furthermore, after generating the enclave proof, it also includes:
[0014] The aforementioned enclave proof, its own first public key, the aforementioned first signature data, and the power operation status data group are uploaded to the blockchain so that the aforementioned user node devices can perform enclave integrity verification based on the aforementioned enclave proof.
[0015] If the above enclave proof is true, the above enclave integrity verification is passed, and the above user node equipment performs anti-tampering verification on the above power data.
[0016] Furthermore, after acquiring each set of power operation status data, the process also includes:
[0017] Based on the preset hash algorithm and the aforementioned power operation status data group, a status data hash value is generated and transmitted to the aforementioned blockchain.
[0018] Furthermore, the aforementioned tamper-proof verification of the power operation status data group based on the first public key and the first signature data includes:
[0019] The first signature is decrypted using the first public key to obtain the decrypted value;
[0020] A decryption hash value is generated based on the above decryption value, and the above decryption hash value is compared with the corresponding status data hash value. If the above decryption hash value is the same as the above status data hash value, the above anti-tampering verification is deemed to have passed; otherwise, the above anti-tampering verification is deemed to have failed.
[0021] Furthermore, after uploading its first public key, the aforementioned first signature data, and the power operation status data set to the blockchain, it also includes:
[0022] The blockchain obtains the first public key, the first signature data, and the data upload time of the power operation status data group, and extracts the data acquisition time of the data acquisition device from the power operation status data group.
[0023] Calculate the difference between the above data upload time and the above data acquisition time, and compare the above difference with a preset time difference threshold;
[0024] If the difference is not greater than the preset time difference threshold, the corresponding power operation status data group will be marked as risk data.
[0025] Furthermore, before comparing the on-chain Merkel data with the off-chain Merkel data as described above, the following steps are also included:
[0026] The aforementioned user node device sends an authentication request signal to the aforementioned off-chain TEE device, so that the aforementioned off-chain TEE device will return its own device ID to the aforementioned user node device;
[0027] On the aforementioned blockchain, the binding status of the corresponding off-chain TEE device is obtained by querying the device ID. If the binding status is true, the on-chain Merkel data is compared with the off-chain Merkel data.
[0028] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments;
[0029] This invention provides a power data credibility verification system based on Merkle trees, comprising:
[0030] Off-chain TEE devices, data acquisition devices, blockchain, and user node devices;
[0031] The aforementioned data acquisition equipment is used to collect several power operation status data sets within a preset time period and upload these data sets to the aforementioned off-chain TEE equipment.
[0032] The aforementioned off-chain TEE device is used to sign the power operation status data group with its own first private key when it acquires a power operation status data group, obtain the first signature data, and store the power operation status data group; wherein, each power operation status data group corresponds to a point in time within the aforementioned preset time period; and uploads its own first public key, the aforementioned first signature data, and the power operation status data group to the blockchain.
[0033] The aforementioned blockchain is used to upload the aforementioned first public key, the aforementioned first signature data, and the power operation status data set to the blockchain and send them to the aforementioned user node device;
[0034] The aforementioned user node device is used to obtain the first public key, the first signature data, and the power operation status data group from the aforementioned blockchain, and then perform anti-tampering verification on the power operation status data group based on the first public key and the first signature data. If the anti-tampering verification is successful, it sends Merkel data request signals to the aforementioned blockchain and the aforementioned off-chain TEE device respectively.
[0035] The aforementioned off-chain TEE device is also used to calculate the off-chain Merkel data through all the power operation status data groups stored in its own storage after receiving the aforementioned Merkel data request signal, and send it to the aforementioned user node device.
[0036] The aforementioned blockchain is also used to calculate on-chain Merkel data based on all received power operation status data sets after receiving the aforementioned Merkel data request signal, and send it to the aforementioned user node device.
[0037] The aforementioned user node device is also used to compare on-chain Merkel data with off-chain Merkel data. If the on-chain Merkel data and the off-chain Merkel data are the same, then all power operation status data groups within the aforementioned preset time period are determined to be trustworthy; otherwise, all power operation status data groups within the aforementioned preset time period are determined to be untrustworthy.
[0038] Furthermore, the aforementioned off-chain TEE devices are also used for:
[0039] Before acquiring several power operation status data sets uploaded by the data acquisition device within a preset time period, the system acquires its own binding status and determines whether it is bound to the data acquisition device based on the binding status.
[0040] If the above binding status is true, it is determined that it is bound to the above data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate.
[0041] Otherwise, it will be determined that it is not bound to the aforementioned data acquisition device, and the device will be rebound.
[0042] Furthermore, the aforementioned off-chain TEE devices are also used for:
[0043] After generating the enclave proof, the enclave proof, its own first public key, the first signature data, and the power operation status data group are uploaded to the blockchain so that the user node device can perform enclave integrity verification based on the enclave proof.
[0044] If the above enclave proof is true, the above enclave integrity verification is passed, and the above user node equipment performs anti-tampering verification on the above power data.
[0045] The embodiments of the present invention have the following beneficial effects:
[0046] This invention provides a method and system for verifying the trustworthiness of power data based on Merkle trees, applicable to off-chain TEE devices. The method includes: acquiring several power operation status data groups uploaded by a data acquisition device within a preset time period; and upon acquiring each power operation status data group, signing the power operation status data group using its own first private key to obtain first signature data, and storing the power operation status data group; wherein each power operation status data group corresponds to a time point within the preset time period; subsequently, uploading its own first public key, the first signature data, and the power operation status data group to the blockchain, so that user node devices can obtain the first public key, the first signature data, and the power operation status data group from the blockchain. Subsequently, the power operation status data group is tamper-proof verified based on the first public key and the first signature data. If the tamper-proof verification passes, the on-chain Merkel data is compared with the off-chain Merkel data. If the on-chain Merkel data and the off-chain Merkel data are the same, all power operation status data groups within the preset time period are deemed trustworthy; otherwise, all power operation status data groups within the preset time period are deemed untrustworthy. The on-chain Merkel data is calculated by the blockchain based on all received power operation status data groups and sent to the user node device. The off-chain Merkel data is calculated by the off-chain TEE device itself based on all power operation status data groups and sent to the user node device. Therefore, this invention calculates the corresponding Merkle root for the power operation status data stored locally on the off-chain TEE device and the power operation status data that has been uploaded to the blockchain on the user node device, and compares the two Merkle data. By judging whether the two Merkle data are consistent, the on-chain and off-chain consistency of the original power data is verified, which improves the accuracy of the credibility judgment result. Attached Figure Description
[0047] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating a method for verifying the credibility of power data based on Merkle trees, provided in an embodiment of the present invention.
[0049] Figure 2 This is a schematic diagram of the structure of a power data credibility verification system based on Merkle tree according to an embodiment of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0052] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0053] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0054] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0055] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0056] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0057] See Figure 1 To address the problem in existing technologies that fail to consider the consistency between on-chain and off-chain power data, leading to reduced accuracy in power data reliability assessments, this invention provides a Merkle tree-based power data reliability verification method applicable to off-chain TEE devices, comprising:
[0058] Step S101: Obtain several power operation status data groups uploaded by the data acquisition device within a preset time period, and when each power operation status data group is obtained, sign the power operation status data group with its own first private key to obtain the first signature data, and store the power operation status data group; wherein, each power operation status data group corresponds to a time point within the preset time period.
[0059] Specifically, the off-chain TEE (Trusted Execution Environment) device is used to monitor and collect power operation status data uploaded from the data acquisition device. When each power operation status data group is received, the off-chain TEE device will sign and store it separately. Therefore, for several power operation status data groups within a preset time period, there will also be several first signature data.
[0060] Specifically, the aforementioned power operation status data group includes multi-dimensional data such as real-time power consumption, real-time voltage, real-time current, and the timestamp of the data acquisition (referred to as the data acquisition time) collected by the sensors of the data acquisition equipment. Its mathematical representation is as follows:
[0061] Data state ={E t V t ,I t ,...,t1}=sensor_get()
[0062] In the formula, Data state E represents the power operation status data group. t V represents the electricity consumption at time t. tI represents the voltage at time t. t t represents the current at time t, t1 represents the data acquisition time, and sensor_get() represents the sensor data reading interface in the data acquisition device.
[0063] Specifically, after receiving the power operation status data set, the off-chain TEE device signs the data using its own first private key. The signing process is shown in the following formula:
[0064] S data1 =sign(Data) state SK TEE )
[0065] In the formula, S data1 Indicates the first signature data, SK TEE This represents the first private key, and sign represents the signature algorithm. The first private key of the off-chain TEE is used to perform a signature operation on the power operation status data to generate the corresponding digital signature S. data1 .
[0066] In a preferred embodiment, before acquiring several power operation status data sets uploaded by the data acquisition device within a preset time period, the method further includes:
[0067] Obtain its own binding status, and determine whether it is bound to the data acquisition device based on the binding status.
[0068] Specifically, before data collection, the data asset owner needs to bind the device ID of the off-chain TEE device to the corresponding data collection device, and store the identity information of the data collection device in the storage area of the off-chain TEE device to ensure the data trustworthiness of the subsequent data collection device. After successful binding, the binding status will be set to TEE. ID =true.
[0069] If the above binding status is true, it is determined that it is bound to the above data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate.
[0070] Otherwise, it will be determined that it is not bound to the aforementioned data acquisition device, and the device will be rebound.
[0071] Specifically, first check your own binding status (TEE). ID , if TEE ID =true indicates successful binding; the off-chain TEE device runs the enclave integrity check procedure and generates an enclave certificate; if the TEE... ID =false indicates that the off-chain TEE device has not been successfully bound to the corresponding data acquisition device and needs to be rebound.
[0072] In this preferred embodiment, an enclave proof is generated if the binding status of the off-chain TEE device is true.
[0073] Step S102: Upload the user node device's first public key, the first signature data, and the power operation status data set to the blockchain. After obtaining the first public key, the first signature data, and the power operation status data set from the blockchain, the user node device performs anti-tampering verification on the power operation status data set based on the first public key and the first signature data. If the anti-tampering verification passes, the on-chain Merkel data is compared with the off-chain Merkel data. If the on-chain Merkel data and the off-chain Merkel data are the same, all power operation status data sets within the preset time period are deemed trustworthy; otherwise, all power operation status data sets within the preset time period are deemed untrustworthy.
[0074] Specifically, the on-chain Merkel data is calculated by the blockchain based on all received power operation status data sets and sent to the user node device; the off-chain Merkel data is calculated by the off-chain TEE device itself based on all power operation status data sets and sent to the user node device.
[0075] Specifically, the goal of putting data assets on the blockchain is to ensure the security of both the data acquisition process and the data upload process. This invention utilizes hardware-level security features of TEE technology to continuously monitor power data, ensuring the trustworthiness of the power data asset source. First, off-chain TEE devices acquire power operation status data sets in real time, including basic status attributes and continuous dynamic status (associated with timestamps). Then, relying on the TEE secure execution domain, key management and encryption / decryption operations are isolated, ensuring the confidentiality, integrity, and non-repudiation of off-chain data assets. Next, when off-chain data is uploaded to the blockchain, a time window defense is built using the continuity of data acquisition. A time verification mechanism sets an effective upload threshold; exceeding the timeout indicates a risk, improving the security of the data asset upload and transmission process. Finally, the data user (i.e., user node device) verifies data integrity and traces the entire process through a signature verification mechanism combined with the immutability of blockchain, achieving trusted circulation of power data assets from acquisition to storage.
[0076] Specifically, the goal of data asset verification is to verify the integrity and security of data assets before they are received by upper-layer power data applications, ensuring consistency between on-chain and off-chain data and preventing malicious verification failures. Each time an off-chain TEE device performs a data upload operation, it simultaneously stores a copy of that batch of data in a local secure area. When a user node device needs to verify data credibility, it can quickly verify the credibility and security of on-chain data according to the Merkle tree generation mechanism. First, the user node device requests the Merkle value of the off-chain data. After receiving the request, the off-chain TEE device calculates the Merkle value of the off-chain data. Then, the user requests the Merkle value of the on-chain data. When storing each piece of data uploaded to the blockchain, the blockchain automatically calculates the data hash and aggregates it to generate a Merkle root, which is written into the block header as a trusted identifier for the on-chain data. Finally, the node user device completes the consistency verification of on-chain and off-chain data by comparing the Merkle value calculated off-chain (i.e., off-chain Merkle data) with the Merkle root of the on-chain data (i.e., on-chain Merkle data). Due to the lightweight nature of Merkle trees, the above solution can significantly reduce the verification overhead of user nodes while ensuring data credibility verification.
[0077] Specifically, before data is uploaded to the blockchain, the off-chain TEE device stores a copy of the power operation status data set to be uploaded locally before finally uploading it to the blockchain. When a user needs to use this data, verification is required to ensure its availability, authenticity, and reliability. Therefore, the user node device requests the Merkle root of the local data (i.e., off-chain Merkle data) from the off-chain TEE device and compares it with the on-chain Merkle data. If the on-chain and off-chain Merkle roots match, the consistency between the on-chain and off-chain data is confirmed, thus verifying the integrity and security of the data assets. On-chain Merkle data is obtained by hashing all power operation status data sets located on the blockchain, while off-chain Merkle data is obtained directly by hashing all power operation status data sets pre-stored in the off-chain TEE device. Both can be expressed mathematically using the following formula:
[0078] MerkelRoot = hash(hash(Data) n-1 ),Data n )
[0079] In the formula, Data n This represents the nth power operation status data group, where `hash` represents the cryptographic hash function used to perform hash calculations on the power operation status data group. `Data` n-1 This indicates the previous power operation status data group.
[0080] In a preferred embodiment, after generating the enclave certificate, the method further includes:
[0081] The aforementioned enclave proof, its own first public key, the aforementioned first signature data, and the power operation status data group are uploaded to the blockchain so that the aforementioned user node devices can perform enclave integrity verification based on the aforementioned enclave proof.
[0082] If the above enclave proof is true, the above enclave integrity verification is passed, and the above user node equipment performs anti-tampering verification on the above power data.
[0083] Specifically, user node devices use smart contracts to check if the enclave proof is true. If it is true, the enclave integrity verification passes; otherwise, the message "TEE security enclave module is untrusted" is displayed, indicating that the off-chain environment is untrusted and there may be a physical security threat.
[0084] In this preferred embodiment, the trustworthiness of the off-chain environment can be determined by detecting whether the enclave proof is genuine.
[0085] In another preferred embodiment, after each set of power operation status data is acquired, the method further includes:
[0086] Based on the preset hash algorithm and the aforementioned power operation status data group, a status data hash value is generated and transmitted to the aforementioned blockchain.
[0087] Specifically, a state data hash value corresponding to the power operation status data group is generated through a preset hash algorithm. Then, the state data hash value, along with the enclave proof, the first public key, the aforementioned first signature data, and the power operation status data group, is uploaded to the blockchain for use in subsequent data asset verification processes.
[0088] In this preferred embodiment, the status data hash value is obtained by using a preset hash algorithm and a power operation status data set.
[0089] In another preferred embodiment, the above-mentioned tamper-proof verification of the power operation status data group based on the first public key and the first signature data includes:
[0090] The first signature is decrypted using the first public key to obtain the decrypted value;
[0091] A decryption hash value is generated based on the above decryption value, and the above decryption hash value is compared with the corresponding status data hash value. If the above decryption hash value is the same as the above status data hash value, the above anti-tampering verification is deemed to have passed; otherwise, the above anti-tampering verification is deemed to have failed.
[0092] Specifically, the first public key of the off-chain TEE device is used to verify the legitimacy of the first signature. The core of the verification process is to verify whether the first signature was indeed signed by the private key corresponding to the first public key, and whether the original data has been tampered with. The first public key, the power operation status data set, and the first signature are all input into the verification algorithm, which returns a result indicating whether the verification passed. The first signature is decrypted using the first public key. If the decrypted data matches the hash value of the status data (i.e., the verification algorithm returns a true result), it means that the signature was indeed generated by the corresponding private key. The verification process of the first signature is represented by the following formula:
[0093] {true,false}=verify(S data1 Data state PK TEE )
[0094] In the formula, true indicates that the verification result of the anti-tampering verification is true, false indicates that the verification result of the anti-tampering verification is false, verify represents the signature verification algorithm, and PK... TEE This represents the first public key.
[0095] Specifically, when S data1 It is indeed a PK between the first public key and the third public key. TEE The corresponding private key to the power operation status data group Data state When a signature is generated, the signature algorithm will return true if the power operation status data group has not been tampered with; otherwise, it will return false.
[0096] Preferably, after the tamper-proof verification is passed, the user node device can use its own private key to sign the first signature data to obtain the second signature data. Then, the second signature data and the user node device's public key are submitted to the blockchain ledger. The signing process is expressed by the following formula:
[0097] S data2 =sign(S) data1 SK DIST )
[0098] In the formula, S data2 Indicates the second signature data, SK DIST This represents the public key of the user node device.
[0099] In this preferred embodiment, the power operation status data group is tamper-proof verified based on the first public key and the first signature data.
[0100] In another preferred embodiment, after uploading its first public key, the aforementioned first signature data, and the power operation status data set to the blockchain, the method further includes:
[0101] The blockchain obtains the first public key, the first signature data, and the data upload time of the power operation status data group, and extracts the data acquisition time of the data acquisition device from the power operation status data group.
[0102] Calculate the difference between the above data upload time and the above data acquisition time, and compare the above difference with a preset time difference threshold;
[0103] If the difference is not greater than the preset time difference threshold, the corresponding power operation status data group will be marked as risk data.
[0104] Specifically, after receiving data, the blockchain verifies whether the time interval between the data collection time and the data upload time exceeds a threshold. If it exceeds the predetermined threshold, the authenticity of the data is deemed to be at risk and marked as risky data, requiring close monitoring in the future. The mathematical representation is as follows:
[0105] Δt=(t2-t1)≤τ
[0106] In the formula, Δt represents the difference, t2 represents the data upload time, t1 represents the data acquisition time, and τ represents the preset time difference threshold.
[0107] In this preferred embodiment, the difference between the data upload time and the data acquisition time is calculated, and the difference is compared with a preset time difference threshold. Based on the comparison result, the risk of the uploaded power operation status data group is determined.
[0108] In another preferred embodiment, prior to the comparison of on-chain Merkel data with off-chain Merkel data described above, the method further includes:
[0109] The aforementioned user node device sends an authentication request signal to the aforementioned off-chain TEE device, so that the aforementioned off-chain TEE device will return its own device ID to the aforementioned user node device;
[0110] On the aforementioned blockchain, the binding status of the corresponding off-chain TEE device is obtained by querying the device ID. If the binding status is true, the on-chain Merkel data is compared with the off-chain Merkel data.
[0111] Specifically, when other users use on-chain data assets, they need to verify that the on-chain electricity data assets are genuine and trustworthy. However, there is a risk that attackers may maliciously attack the verification service during the verification process, leading to verification failure. Therefore, it is necessary to verify the consistency of on-chain and off-chain data before using electricity data assets. First, the user node device requests identity verification from the off-chain TEE device, and the off-chain TEE device sends its device ID to the user node device. The user node device uses a smart contract to query the binding status of the off-chain TEE device on the blockchain. If the verification result is successful binding, a "identity verification passed" result is returned, followed by a comparison operation between the on-chain Merkel data and the off-chain Merkel data. Otherwise, a "off-chain TEE device identity not verified" result is returned.
[0112] In this preferred embodiment, if the binding status of the off-chain TEE device is determined to be true, a comparison operation between the on-chain Merkel data and the off-chain Merkel data is performed.
[0113] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments;
[0114] like Figure 2 As shown, one embodiment of the present invention provides a power data credibility verification system based on Merkle trees, comprising:
[0115] Off-chain TEE devices, data acquisition devices, blockchain, and user node devices;
[0116] The aforementioned data acquisition equipment is used to collect several power operation status data sets within a preset time period and upload these data sets to the aforementioned off-chain TEE equipment.
[0117] The aforementioned off-chain TEE device is used to sign the power operation status data group with its own first private key when it acquires a power operation status data group, obtain the first signature data, and store the power operation status data group; wherein, each power operation status data group corresponds to a point in time within the aforementioned preset time period; and uploads its own first public key, the aforementioned first signature data, and the power operation status data group to the blockchain.
[0118] The aforementioned blockchain is used to upload the aforementioned first public key, the aforementioned first signature data, and the power operation status data set to the blockchain and send them to the aforementioned user node device;
[0119] The aforementioned user node device is used to obtain the first public key, the first signature data, and the power operation status data group from the aforementioned blockchain, and then perform anti-tampering verification on the power operation status data group based on the first public key and the first signature data. If the anti-tampering verification is successful, it sends Merkel data request signals to the aforementioned blockchain and the aforementioned off-chain TEE device respectively.
[0120] The aforementioned off-chain TEE device is also used to calculate the off-chain Merkel data through all the power operation status data groups stored in its own storage after receiving the aforementioned Merkel data request signal, and send it to the aforementioned user node device.
[0121] The aforementioned blockchain is also used to calculate on-chain Merkel data based on all received power operation status data sets after receiving the aforementioned Merkel data request signal, and send it to the aforementioned user node device.
[0122] The aforementioned user node device is also used to compare on-chain Merkel data with off-chain Merkel data. If the on-chain Merkel data and the off-chain Merkel data are the same, then all power operation status data groups within the aforementioned preset time period are determined to be trustworthy; otherwise, all power operation status data groups within the aforementioned preset time period are determined to be untrustworthy.
[0123] Furthermore, the aforementioned off-chain TEE devices are also used for:
[0124] Before acquiring several power operation status data sets uploaded by the data acquisition device within a preset time period, the system acquires its own binding status and determines whether it is bound to the data acquisition device based on the binding status.
[0125] If the above binding status is true, it is determined that it is bound to the above data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate.
[0126] Otherwise, it will be determined that it is not bound to the aforementioned data acquisition device, and the device will be rebound.
[0127] Furthermore, the aforementioned off-chain TEE devices are also used for:
[0128] After generating the enclave proof, the enclave proof, its own first public key, the first signature data, and the power operation status data group are uploaded to the blockchain so that the user node device can perform enclave integrity verification based on the enclave proof.
[0129] If the above enclave proof is true, the above enclave integrity verification is passed, and the above user node equipment performs anti-tampering verification on the above power data.
[0130] It should be noted that the device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without creative effort. The above schematic diagram is merely an example of a Merkle tree-based power data credibility verification system and does not constitute a limitation on a Merkle tree-based power data credibility verification system. It may include more or fewer components than illustrated, or combine certain components, or use different components.
[0131] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for verifying the credibility of power data based on Merkle trees, characterized in that, Suitable for off-chain TEE devices, including: A number of power operation status data groups uploaded by data acquisition devices within a preset time period are acquired. When a power operation status data group is acquired, the power operation status data group is signed with its own first private key to obtain first signature data. At the same time, the power operation status data group is stored. Each power operation status data group corresponds to a time point within the preset time period. The system uploads its first public key, first signature data, and power operation status data set to the blockchain. After obtaining these data from the blockchain, user node devices perform tamper-proof verification on the power operation status data set using the first public key and first signature data. If the tamper-proof verification passes, the on-chain Merkel data is compared with the off-chain Merkel data. If the on-chain and off-chain Merkel data are identical, all power operation status data sets within the preset time period are deemed trustworthy; otherwise, all power operation status data sets within the preset time period are deemed untrustworthy. The on-chain Merkel data is calculated by the blockchain based on all received power operation status data sets and sent to the user node device; the off-chain Merkel data is calculated by the off-chain TEE device itself based on all power operation status data sets and sent to the user node device.
2. The method for verifying the credibility of power data based on Merkle trees according to claim 1, characterized in that, Before acquiring several sets of power operation status data uploaded by the data acquisition equipment within a preset time period, the process also includes: Obtain its own binding status, and determine whether it is bound to the data acquisition device based on the binding status; If the binding status is true, it is determined that it is bound to the data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate; Otherwise, it is determined that it is not bound to the data acquisition device, and the device is rebound.
3. The method for verifying the credibility of power data based on Merkle trees according to claim 2, characterized in that, After generating the enclave proof, the following is also included: The enclave proof, its own first public key, the first signature data, and the power operation status data group are uploaded to the blockchain so that the user node device can perform enclave integrity verification based on the enclave proof. If the enclave proof is true, the enclave integrity verification is passed, and the user node device performs anti-tampering verification on the power data.
4. The method for verifying the credibility of power data based on Merkle trees according to claim 3, characterized in that, After acquiring each set of power operation status data, the process further includes: Based on a preset hash algorithm and the power operation status data group, a status data hash value is generated and transmitted to the blockchain.
5. The method for verifying the credibility of power data based on Merkle trees according to claim 4, characterized in that, The step of performing tamper-proof verification on the power operation status data group based on the first public key and the first signature data includes: The first signature is decrypted using the first public key to obtain the decrypted value; A decryption hash value is generated based on the decryption value, and the decryption hash value is compared with the corresponding status data hash value. If the decryption hash value is the same as the status data hash value, the anti-tampering verification is determined to be successful; otherwise, the anti-tampering verification is determined to be unsuccessful.
6. The method for verifying the credibility of power data based on Merkle trees according to claim 5, characterized in that, After uploading its first public key, first signature data, and power operation status data set to the blockchain, it also includes: The blockchain obtains the data upload time of the first public key, the first signature data, and the power operation status data group, and extracts the data acquisition time of the data acquisition device from the power operation status data group. Calculate the difference between the data upload time and the data acquisition time, and compare the difference with a preset time difference threshold; If the difference is not greater than the preset time difference threshold, the corresponding power operation status data group is marked as risk data.
7. The method for verifying the credibility of power data based on Merkle trees according to claim 6, characterized in that, Before comparing the on-chain Merkel data with the off-chain Merkel data, the following is also included: The user node device sends an authentication request signal to the off-chain TEE device, so that the off-chain TEE device returns its own device ID to the user node device. The binding status of the corresponding off-chain TEE device is obtained by querying the device ID on the blockchain. If the binding status is true, the on-chain Merkel data is compared with the off-chain Merkel data.
8. A power data credibility verification system based on Merkle trees, characterized in that, include: Off-chain TEE devices, data acquisition devices, blockchain, and user node devices; The data acquisition device is used to collect several power operation status data sets within a preset time period and upload the several power operation status data sets to the off-chain TEE device. The off-chain TEE device is used to sign the power operation status data group with its own first private key to obtain first signature data each time a power operation status data group is acquired, and to store the power operation status data group; wherein, each power operation status data group corresponds to a point in time within the preset time period; and to upload its own first public key, the first signature data and the power operation status data group to the blockchain. The blockchain is used to upload the first public key, the first signature data, and the power operation status data group to the blockchain and send them to the user node device. The user node device is used to obtain the first public key, the first signature data, and the power operation status data group from the blockchain, and then perform anti-tampering verification on the power operation status data group according to the first public key and the first signature data. If the anti-tampering verification is successful, it sends Merkel data request signals to the blockchain and the off-chain TEE device respectively. The off-chain TEE device is also used to calculate the off-chain Merkel data by using all the power operation status data groups stored in itself after receiving the Merkel data request signal, and send it to the user node device. The blockchain is also used to calculate on-chain Merkel data based on all received power operation status data groups after receiving the Merkel data request signal, and send it to the user node device. The user node device is also used to compare the on-chain Merkel data with the off-chain Merkel data. If the on-chain Merkel data and the off-chain Merkel data are the same, then all power operation status data groups within the preset time period are determined to be trustworthy; otherwise, all power operation status data groups within the preset time period are determined to be untrustworthy.
9. The power data credibility verification system based on Merkle tree according to claim 8, characterized in that, The off-chain TEE device is also used for: Before acquiring several power operation status data groups uploaded by the data acquisition device within a preset time period, the system acquires its own binding status and determines whether it is bound to the data acquisition device based on the binding status. If the binding status is true, it is determined that it is bound to the data acquisition device, and an enclave integrity check is performed on the enclave in itself to generate an enclave certificate; Otherwise, it is determined that it is not bound to the data acquisition device, and the device is rebound.
10. A power data credibility verification system based on Merkle trees according to claim 9, characterized in that, The off-chain TEE device is also used for: After generating the enclave proof, the enclave proof, its own first public key, the first signature data, and the power operation status data group are uploaded to the blockchain so that the user node device can perform enclave integrity verification based on the enclave proof. If the enclave proof is true, the enclave integrity verification is passed, and the user node device performs anti-tampering verification on the power data.