Privacy protection electricity transaction matching method and system based on alliance chain smart contract
By using alliance chain smart contracts and trusted execution environment in the smart grid, data privacy in the power transaction matching process is ensured, and the problems of power transaction data leakage and single point failure in the smart grid are solved, and efficient and reliable power transactions are achieved. match.
Patent Information
- Application Number
- CN202411339180.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
AI Technical Summary
In the smart grid, the openness and transparency of smart contracts lead to data leakage during power transaction matching, which damages the privacy of power users and has a single point of failure problem.
Using smart contracts based on alliance chains, by deploying matched smart contracts in a trusted execution environment, encrypting and decrypting power values using shared keys, ensuring data privacy during the matchmaking process, and verifying matched results through alliance chains to achieve Safe transactions.
It realizes the privacy of users' trading power values while efficient and reliable matching of electricity transactions, avoids single point failure problems, and ensures the safety of electricity transactions.
Smart Images

Figure CN119205339A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart contract technology, and more specifically, to a privacy-preserving electricity transaction matching method and system based on alliance chain smart contracts. Background Art
[0002] The power system is a network that connects power generation companies and power users for the generation, transmission, distribution and use of electricity. In the traditional power system, electricity is transmitted unidirectionally from centralized power generation companies to power users, which results in large power losses during the transmission process. The emergence of smart grids effectively solves this problem. In smart grids, each user can install power generation equipment such as solar panels or wind turbines to achieve autonomous power generation. In addition, smart grids allow two-way power transmission between users, enabling neighboring power users to trade power in a point-to-point manner, thereby reducing power losses caused by long-distance transmission.
[0003] Despite this, the power transmission and transaction information in traditional smart grids is still managed by centralized organizations, which leads to single point failure problems. Once the smart grid management organization is attacked, power transactions may be completely controlled by the adversary. The use of smart contract technology can effectively improve the robustness of smart grids. Smart contracts are a piece of code deployed on the blockchain, which is jointly maintained by all network nodes connected to the blockchain, and no node can tamper with or delete them. Smart grids based on smart contracts can safely complete power transactions in a decentralized network environment, thereby avoiding the single point failure problem in traditional smart grids.
[0004] Transaction matching is one of the important functions of smart grids, which is used to find users with opposite transaction intentions (selling and buying) in the same time period. Transaction matching can ensure the efficient use of electricity and reduce delays in smart grids. In order to match transactions, users need to announce the amount of electricity they want to buy or sell in order to find matching users. However, the public and transparent nature of smart contracts makes the data involved in the transaction matching process visible to all users, which inevitably damages the privacy of electricity users. The leakage of data during the matching process may cause losses to electricity users. Therefore, how to study and design a privacy-preserving electricity transaction matching method and system based on alliance chain smart contracts that can overcome the above-mentioned defects is a problem that we urgently need to solve. Summary of the invention
[0005] In order to solve the deficiencies in the prior art, the purpose of the present invention is to provide a privacy-preserving electricity trading matching method and system based on the alliance chain smart contract. Since the entire matching process is completed in a trusted execution environment, the matching result will only display the successfully matched user relationship without leaking the specific electricity trading value. The present invention ensures the privacy of the user's trading electricity value while achieving efficient and reliable electricity trading matching. .
[0006] The above technical objectives of the present invention are achieved through the following technical solutions:
[0007] First, a privacy-preserving electricity transaction matching method based on a consortium chain smart contract is provided, including the following steps:
[0008] Establish an enclave in the trusted execution environment deployed by the service node to deploy the matching smart contract, and submit the contract deployment result to the alliance chain jointly initialized by a group of service nodes;
[0009] Encrypt the power value list that the user wants to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching;
[0010] Decrypt the ciphertext of the power value with the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result;
[0011] The matching results are submitted to the alliance chain, and after verification by the user, transactions are conducted with the corresponding users according to the matching results.
[0012] Furthermore, the shared key between the user and the trusted execution environment is generated based on the public key of the trusted execution environment and the private key of the user.
[0013] Furthermore, the shared key between the trusted execution environment and the user is generated based on the private key of the trusted execution environment and the public key of the user.
[0014] Furthermore, the user generates a corresponding public-private key pair using a key generation algorithm, and submits the public key to the consortium chain;
[0015] Furthermore, the trusted execution environment generates a corresponding public-private key pair and submits the public key to the consortium chain.
[0016] Furthermore, the method also includes:
[0017] The user signs the encrypted power numerical ciphertext, and sends a matching request containing the power numerical ciphertext to the corresponding service node to request transaction matching.
[0018] Furthermore, after receiving the matching request, the service node first verifies the validity of the signature, and if the verification passes, forwards the matching request to the corresponding trusted execution environment.
[0019] Furthermore, the method also includes:
[0020] The trusted execution environment encrypts the matching result using the user's public key, signs the ciphertext, and returns the ciphertext and signature to the service node.
[0021] Furthermore, the user verifies whether the signature of the ciphertext corresponding to the matching result on the alliance chain is valid; if the signature is valid, the ciphertext is decrypted to obtain the matching result, and the transaction is carried out with the matching user specified in the matching result.
[0022] Furthermore, one of the service nodes corresponds to one microgrid and is responsible for matching power transactions of the microgrid.
[0023] In a second aspect, a privacy-preserving power transaction matching system based on a consortium chain smart contract is provided, and the system is used to implement the privacy-preserving power transaction matching method based on a consortium chain smart contract as described in any one of the first aspects, including:
[0024] The initialization module is used to establish an enclave in the trusted execution environment deployed by the service node for deploying the matching smart contract, and submit the contract deployment result to the alliance chain initialized by a group of service nodes;
[0025] A matching request module is used to encrypt the power value list that the user wants to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching;
[0026] The matching processing module is used to decrypt the ciphertext of the power value with the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result;
[0027] The result announcement module is used to submit the matching results to the alliance chain, and after verification by the user, trade with the corresponding user according to the matching results.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The privacy-preserving electricity transaction matching method based on the alliance chain smart contract provided by the present invention has the following characteristics: since the entire matching process is completed in a trusted execution environment, the matching results will only display the successfully matched user relationships without leaking the specific electricity transaction values. The present invention ensures the privacy of user transaction electricity values while achieving efficient and reliable electricity transaction matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of this application, and do not constitute a limitation of the embodiments of the present invention. In the drawings:
[0031] Figure 1 is a flow chart of Embodiment 1 of the present invention;
[0032] Figure 2 It is a system block diagram in Example 2 of the present invention. DETAILED DESCRIPTION
[0033] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.
[0034] Example 1: A privacy-preserving electricity transaction matching method based on a consortium chain smart contract, such as Figure 1 As shown, the following steps are included:
[0035] S1: Establish an enclave in the trusted execution environment deployed by the service node to deploy the matching smart contract, and submit the contract deployment result to the alliance chain jointly initialized by a group of service nodes;
[0036] S2: Encrypt the power value list that the user wants to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching;
[0037] S3: Decrypt the ciphertext of the power value using the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result;
[0038] S4: Submit the matching results to the alliance chain, and after verification by the user, trade with the corresponding user according to the matching results.
[0039] In step S1, specific steps of the initialization phase include S11-S15.
[0040] S11: The system determines the public parameter pp according to the security parameter λ:
[0041]
[0042] Among them, p is a large prime number, is an integer modulo p remainder class ring, m is the number of service nodes, and n is the number of users. Hash is a collision-resistant hash function; TIni is a trusted execution environment initialization function, TIns and TInv are the corresponding contract deployment algorithm and contract call algorithm respectively; KGen is a key generation algorithm, Sig and Vrfy are signature algorithms and corresponding signature verification algorithms; Enc is a secure symmetric encryption algorithm, and Dec is the corresponding decryption algorithm.
[0043] For example, if the security parameter is 128, then p in the public parameter is a large number of 128 bits.
[0044] S12: A set of service nodes {SN i} i∈[m] Initialize the alliance chain together.
[0045] S13: Each service node {SN i} i∈[m] Initialize its trusted execution environment {T i} i∈[m] , the trusted execution environment generates its own public and private key pair, (tpk i ,tsk i )=TIni(λ), and the public key tpk i Submit to the consortium chain.
[0046] S14: Each trusted execution environment T i Establish an independent storage space as an enclave and deploy smart contracts SC using code deployment algorithms i , eid i =TIns(SC i ). Service Node SN i Generate signature And deploy the results Submit to the consortium chain.
[0047] S15: The user uses the key generation algorithm to generate his public and private key pair (pk j ,sk j )=KGen(λ), and the public key pk j Submit to the consortium chain.
[0048] In step S2, specific steps of the submission phase include S21-S24.
[0049] S21: For the jth user U j , j∈[n], construct a matching request list OL j ={dir j,l ,vol j,l} l∈(0,23) , where transaction requirements dir j,l∈{+,-} indicates that user U j In time period l, do you want to buy electricity + or sell electricity -? j,l Is user U j The amount of electricity you want to buy or sell in time period l, the time period variable l∈(0,23).
[0050] S22: Each user U j Select the corresponding trusted execution environment number eid according to the microgrid number i to which you belong i , calculate the shared key with the trusted execution environment where tpk i Trusted Execution Environment T i The public key of j Is the user's private key.
[0051] S23: User U j Use the shared key to encrypt the power value list and get the power value ciphertext ct j =Enc(key,OL j ).
[0052] S24: User U j The encrypted power value list ct j sign, Then the matching request will be Sent to the corresponding service node SN i Request a trade match.
[0053] In step S3, the specific steps of the matching stage include S31-S34.
[0054] S31: Service Node SN i Receive matching request req j After that, first verify the signature If the verification is successful, Then the matching request req j Forwarded to its trusted execution environment T i .
[0055] S32: Trusted Execution Environment T i Generate a shared key with the user based on the matching request received, where pk j Is user U j The public key of tsk i Trusted Execution Environment T i The private key of the trusted execution environment T i Use the shared key key to cipher the power value ct j Decrypt and get the power value list OLj =Dec(key,ct j ).
[0056] S33: Trusted Execution Environment T i The decrypted power value list OL j (j∈[n]) is sent to the smart contract SC deployed in its enclave i , Smart Contract SC i List the received power values OL j (j∈[n]) is used as input for matching, and the matching result res is obtained. i =TInv(SC i ,OL1,...,OL n ).
[0057] S34: Trusted execution environment uses user U j The public key pk j Encrypt the matching results. And sign the ciphertext, Ciphertext and signature Return to the service node.
[0058] In step S4, specific steps of the publishing stage include S41-S42.
[0059] S41: The service node sends the ciphertext and signature Submit to the consortium chain.
[0060] S42: User U j (j∈[n]) Verify the ciphertext of the matching result on the alliance chain Signature Is it valid? If the signature is valid, Then the ciphertext To decrypt, Get the matching result res i And match with the specified matching user U in the matching result k (k∈[n]\{j}) to conduct transactions.
[0061] Example 2: A privacy-preserving power transaction matching system based on a consortium chain smart contract, the system is used to implement the privacy-preserving power transaction matching method based on a consortium chain smart contract as described in Example 1, such as Figure 2 As shown, it includes an initialization module, a matching request module, a matching processing module and a result publishing module.
[0062] Among them, the initialization module is used to establish an enclave in the trusted execution environment deployed by the service node for deploying the matching smart contract, and submit the contract deployment result to the alliance chain jointly initialized by a group of service nodes; the matching request module is used to encrypt the power value list that the user expects to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching; the matching processing module is used to decrypt the power value ciphertext with the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result; the result announcement module is used to submit the matching result to the alliance chain, and after the user verification, trade with the corresponding user according to the matching result.
[0063] Working principle: The present invention designs a privacy-preserving electricity transaction matching method based on alliance chain smart contracts. A alliance chain is built by a group of service nodes, and a trusted execution environment is deployed to install and run smart contracts. The user first encrypts the electricity value that he wants to trade in each time period, and then sends the electricity value ciphertext and matching request to the smart contract. The smart contract decrypts the electricity value within the trusted execution environment and matches it. After the matching is completed, the matching result will be sent to the alliance chain, and the user will trade according to the matching result.
[0064] Since the entire matching process of the present invention is completed in a trusted execution environment, the matching result will only display the successfully matched user relationships without leaking the specific power transaction values. The present invention ensures the privacy of user transaction power values while achieving efficient and reliable power transaction matching.
[0065] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0066] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0067] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0069] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A privacy-preserving electricity transaction matching method based on alliance chain smart contracts, characterized by: The following steps are involved: Establish an enclave in the trusted execution environment deployed by the service node to deploy the matching smart contract, and submit the contract deployment result to the alliance chain jointly initialized by a group of service nodes; Encrypt the power value list that the user wants to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching; Decrypt the ciphertext of the power value with the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result; The matching results are submitted to the alliance chain, and after verification by the user, transactions are conducted with the corresponding users according to the matching results.
2. According to the privacy protection power transaction matching method based on alliance chain smart contract according to claim 1, it is characterized in that: The shared key between the user and the trusted execution environment is generated based on the public key of the trusted execution environment and the private key of the user.
3. According to the privacy protection power transaction matching method based on alliance chain smart contract according to claim 1, it is characterized in that: The shared key between the trusted execution environment and the user is generated based on the private key of the trusted execution environment and the public key of the user.
4. The privacy-preserving power transaction matching method based on alliance chain smart contract according to claim 2 or 3 is characterized in that: The user generates a corresponding public-private key pair using a key generation algorithm and submits the public key to the consortium chain; Furthermore, the trusted execution environment generates a corresponding public-private key pair and submits the public key to the consortium chain.
5. According to the privacy protection power transaction matching method based on alliance chain smart contract according to claim 1, it is characterized in that: The method further includes: The user signs the encrypted power numerical ciphertext, and sends a matching request containing the power numerical ciphertext to the corresponding service node to request transaction matching.
6. The privacy-preserving power transaction matching method based on alliance chain smart contract according to claim 5 is characterized in that: After receiving the matching request, the service node first verifies the validity of the signature. If the verification passes, the matching request is forwarded to the corresponding trusted execution environment.
7. The privacy-preserving power transaction matching method based on alliance chain smart contract according to claim 1 is characterized in that: The method further includes: The trusted execution environment encrypts the matching result using the user's public key, signs the ciphertext, and returns the ciphertext and signature to the service node.
8. The privacy-preserving power transaction matching method based on alliance chain smart contract according to claim 5 is characterized in that: The user verifies whether the signature of the ciphertext corresponding to the matching result on the alliance chain is valid; if the signature is valid, the ciphertext is decrypted to obtain the matching result, and the transaction is carried out with the matching user specified in the matching result.
9. The privacy-preserving power transaction matching method based on alliance chain smart contract according to claim 1 is characterized in that: One of the service nodes corresponds to one microgrid and is responsible for matching power transactions of the microgrid.
10. The privacy-preserving power transaction matching system based on the alliance chain smart contract is characterized by: The system is used to implement the privacy-preserving power transaction matching method based on the alliance chain smart contract as described in any one of claims 1 to 9, including: The initialization module is used to establish an enclave in the trusted execution environment deployed by the service node for deploying the matching smart contract, and submit the contract deployment result to the alliance chain initialized by a group of service nodes; A matching request module is used to encrypt the power value list that the user wants to trade with the shared key between the user and the trusted execution environment, send the encrypted power value ciphertext to the corresponding service node, and request transaction matching; The matching processing module is used to decrypt the ciphertext of the power value with the shared key between the trusted execution environment and the user, and execute the matching smart contract to match the decrypted power value to obtain the matching result; The result announcement module is used to submit the matching results to the alliance chain, and after verification by the user, trade with the corresponding user according to the matching results.
Citation Information
Patent Citations
Transaction processing method and device based on block chain and electronic equipment
CN111461883A
Private electricity transaction matching method based on block chain
CN118628241A
Method for realizing highly efficient privacy-preserving transaction in blockchain, and device
WO2021103794A1
