A transaction method of a blockchain energy transaction system
By combining on-chain encrypted storage and homomorphic secure computation with attribute-based encryption algorithms, the problem of insufficient user privacy protection in blockchain transaction systems is solved, achieving privacy protection of user data and transaction security, and improving transaction efficiency and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2026-04-07
AI Technical Summary
Blockchain transaction systems lack adequate user privacy protection, posing risks of data leakage and tampering, and the plaintext storage of transaction information leads to the leakage of sensitive information.
We employ on-chain encrypted storage and homomorphic secure computation schemes, combined with attribute-based encryption algorithms, to achieve privacy protection and secure computation of user data through Node.js SDK and Java SDK. We design the SDK layer as the chaincode management layer to isolate the encryption and decryption process.
It achieves privacy protection for user data, improves the security and efficiency of transactions, optimizes the chaincode management of the blockchain system, and ensures the security and reliability of user privacy during the transaction process.
Smart Images

Figure CN115720146B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchain, and particularly relates to a transaction method of a blockchain energy transaction system. BACKGROUND
[0002] Blockchain is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. Its characteristics of decentralization, security and reliability, tamper resistance and traceability make it widely concerned and applied in various fields. For example, at present, blockchain can be applied to energy transactions.
[0003] However, as a distributed ledger technology, blockchain is open and transparent in order to quickly reach consensus among all nodes. This will pose a serious threat to user privacy. On the one hand, most existing works do not support privacy protection security computing schemes applied to blockchain. Many existing privacy protection security computing schemes rely on one or more central servers in cloud computing to constitute a cloud computing system model, which is vulnerable to data leakage, data tampering, denial of service attacks and other security problems. On the other hand, most blockchain-based schemes store plaintext information in blockchain, and the data transmitted to the server is usually unencrypted, or the server (or computing node) can decrypt the transmitted data, which will lead to the risk of releasing sensitive information. SUMMARY
[0004] To solve the above technical problems, the present application proposes a transaction method of a blockchain energy transaction system.
[0005] The technical scheme adopted by the present application is as follows:
[0006] This invention proposes a trading method for a blockchain energy trading system. The system includes a node network layer, an SDK (Software Development Kit) layer, and an application layer. The node network layer includes endorsement nodes, confirmation nodes, ordering nodes, certificate nodes, and underlying chaincode responsible for inter-node communication. The SDK layer includes a Node.js SDK (a JavaScript interpreter running on the server side) and a Java SDK (Java Software Development Kit). The application layer includes a Web (Global Wide Area Network) frontend and a Web backend. The method includes the following steps: After receiving a transaction request, the application layer sends a transaction endorsement proposal to the Node.js SDK according to the transaction request; the Node.js SDK sends the transaction endorsement proposal to the endorsement node; the endorsement node endorses the transaction endorsement proposal, and during the endorsement process, sends a secure computation request to the Java SDK, the secure computation request including transaction information [m i The Java SDK performs homomorphic secure computation based on the secure computation request and returns the corresponding computation result to the endorsing node. The computation result includes ciphertext and key. The endorsing node verifies the correctness of the computation result and, after verification, replies to the Node.js SDK with a proposal response. The proposal response includes the endorsing node signature and the current endorsement status. After the Node.js SDK receives a set number of proposal responses, it constructs a valid transaction based on the proposal response and sends it to the sorting node. The sorting node receives the transaction, sorts it, and sends a block to the confirmation node. The confirmation node submits the block information corresponding to the block to the application layer. The application layer executes the transaction action and displays the block information.
[0007] The trading method of the blockchain energy trading system proposed above in this invention may also have the following additional technical features:
[0008] According to one embodiment of the present invention, when the transaction request is initiated by an administrator, the administrator registers and logs in through a certificate node; the administrator initiates the transaction request through a web frontend; the web frontend sends a WebSocket (a protocol for full-duplex communication over a single TCP connection) message to the web backend based on the transaction request, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the WebSocket message; when the transaction request is initiated by a user, the client submits the transaction request to the web backend, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the transaction request.
[0009] According to one embodiment of the present invention, the transaction endorsement proposal includes: data packet ID, chaincode, and a signature uniformly issued by certificate nodes.
[0010] According to one embodiment of the present invention, the transaction information [m] i The data includes: transaction amount; the security calculation function parameter f includes: 0, 1 and 2; when the security calculation function parameter f is 0, no calculation is performed; when the security calculation function parameter f is 1, addition security calculation is performed; when the security calculation function parameter f is 2, subtraction security calculation is performed.
[0011] According to one embodiment of the present invention, the Java SDK performs homomorphic secure computation based on the secure computation request, specifically for: calling the KeyGen algorithm (key generation algorithm) to complete system initialization; and calling the EncTK algorithm (encryption algorithm) to encrypt the transaction information to obtain encrypted data [m]. i ]; DSP (Digital Signal Processing) processes encrypted data [m i The encrypted transaction information [m] is obtained through homomorphic computation using the secure computation function parameter f; the DSP selects a random number r1 and the first part of the key ck1 for encryption and partial decryption to generate the first part of encrypted data. And send it to the CP (Central Processor); the CP encrypts the first part of the data. Decryption is performed to obtain the first part of the ciphertext c1(m+r1). The CP then selects the second part of the key ck2 and a random number r to encrypt a portion of the ciphertext c1(m+r1) to obtain the second part of the encrypted data. The CP encrypts the first part of the ciphertext c1(m+r1) using the second part of the key ck2 and a random number r to obtain the second part of the encrypted data. And encrypt the second part of the key ck2 to obtain the encrypted second part of the key CK2, and then encrypt the second part of the data. The encrypted second part of the key CK2 is passed back to the DSP; the DSP decrypts the encrypted second part of the key CK2 to obtain the second part of the key ck2, and the DSP calculates the ciphertext based on r1 and ck1. The key CK is obtained by using the ABE (Attribute-Based Encryption) algorithm based on the first key ck1 and the second key ck2.
[0012] The beneficial effects of this invention are:
[0013] This invention achieves user data privacy protection in a blockchain energy trading system through on-chain encrypted storage and uses a homomorphic encryption security computation scheme to ensure users can conduct normal transfer transactions. While protecting user privacy, it allows users to complete normal transaction operations, improving transaction efficiency and security. Simultaneously, it uses a key-policy-based attribute encryption algorithm to ensure access control between endorsing nodes. The design employs an SDK as the chaincode management layer to isolate the encryption / decryption process from the chaincode interaction, optimizing chaincode management in the blockchain system and improving encryption / decryption efficiency. Attached Figure Description
[0014] Figure 1 This is a block diagram of a blockchain energy trading system according to an embodiment of the present invention;
[0015] Figure 2 This is a flowchart of a transaction method for a blockchain energy trading system according to an embodiment of the present invention. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] According to one embodiment of the present invention, such as Figure 1 As shown, the blockchain energy trading system includes a node network layer, an SDK layer, and an application layer. The node network layer includes endorsement nodes, confirmation nodes, sorting nodes, certificate nodes, and the underlying chaincode responsible for communication between nodes (not specifically shown in the figure). The SDK layer includes Node.js SDK and Java SDK. The application layer includes a web frontend and a web backend.
[0018] Specifically, the node network layer mainly includes four types of nodes in the Fabric blockchain network: endorsers, confirmers, orderers, and certifiers, as well as the underlying chaincode responsible for inter-node communication. The chaincode's functions primarily include adding, deleting, modifying, and querying transaction information. Simultaneously, the node network layer handles secure computation requests for encrypted information on the blockchain. The SDK layer mainly includes the Node.js SDK used in the Marbles (a blockchain project) project and the Java SDK used for secure homomorphic addition computation requests. The Node.js SDK is primarily used for interaction between the blockchain transaction network and users. The Java SDK primarily uses a defined secure computation scheme to perform secure computations on the secure computation requests submitted by the node network layer, ultimately returning the encrypted result of the secure computation on the blockchain, which is then securely stored by the Fabric network.
[0019] The application layer primarily comprises the user-interactive web interface for energy trading and the web backend code responsible for calling the SDK layer code. Its main functions include user authentication and user interaction with the system. To achieve user authentication and access control, it integrates the Marbles asset management project from Hyperledger Fabric and attribute-based cryptographic ABE. ABE provides access control for each endorsing node, while the authentication component of the Marbles project performs user authentication. The web backend acts as an intermediary between the administrator and the blockchain, primarily responsible for message forwarding. It provides web services using WebSockets for efficient message synchronization and performs chaincode operations via the SDK to control Fabric's operation. The web frontend serves as the user trading interface, implemented using JavaScript. By calling the backend's return values through API calls, it enables the functions required by the user, making the trading system more user-friendly.
[0020] Specifically, a blockchain energy trading system can be Fabric's energy trading platform.
[0021] According to one embodiment of the present invention, such as Figure 2 As shown, the trading method of the blockchain energy trading system specifically includes the following steps:
[0022] S1. After receiving the transaction request, the application layer sends a transaction endorsement proposal to the Node.js SDK according to the transaction request.
[0023] Transaction requests include: asset creation requests, asset transfer requests, and asset deletion requests.
[0024] Specifically, transaction requests can be initiated by users or administrators, such as... Figure 1As shown, when a transaction request is submitted by an administrator, the administrator registers and logs in through the certificate node; the administrator submits the transaction request through the web frontend; the web frontend sends a WebSocket message to the web backend based on the transaction request, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the WebSocket message; when a transaction request is submitted by a user, the client submits the transaction request to the web backend, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the transaction request.
[0025] Transaction endorsement proposals may include: data packet ID (identity information), chaincode, and signatures uniformly issued by certificate nodes.
[0026] S2, the Node.js SDK sends the transaction endorsement proposal to the endorsing node.
[0027] S3, the endorsing node endorses the transaction endorsement proposal, and during the endorsement process, sends a secure computation request to the Java SDK. The secure computation request includes transaction information [m i ] and the parameter f of the security computation function to be executed.
[0028] In an embodiment of the present invention, transaction information [m] i The parameters include: transaction amount, and the security calculation function parameter f, which can be 0, 1, or 2. When the security calculation function parameter f is 0, no calculation is performed; when the security calculation function parameter f is 1, an addition security calculation is performed; when the security calculation function parameter f is 2, a subtraction security calculation is performed.
[0029] S4, the Java SDK performs homomorphic secure computation based on the secure computation request and returns the corresponding computation result to the endorsement node. The computation result includes: ciphertext and key.
[0030] Furthermore, endorsement nodes with the same attribute will decrypt the corresponding attribute's ciphertext and return it to the user. The ciphertext contains the user's asset information and needs to be decrypted before being returned to the user. The specific endorsement node sends the information to the Node.js SDK, which then interacts with the user and returns the information to them.
[0031] S5, the endorsing node verifies the correctness of the calculation result, and after verification, replies to the Node.js SDK with a proposal response, which includes the endorsing node signature and the current endorsement status (endorsement successful or endorsement failed).
[0032] S6: Once the number of proposal responses received by the Node.js SDK reaches a set value, a valid transaction is constructed based on the proposal responses and sent to the sorting node.
[0033] S7: The sorting node receives the transactions, sorts them, and then sends a block to the confirmation node.
[0034] S8, confirming that the node submits the block information corresponding to the block to the application layer.
[0035] S9 is the application layer that executes transaction actions and displays block information.
[0036] Specifically, the sorting node receives a transaction and sends a block to the confirmation node, which then commits the block. After committing the block, the confirmation node submits the block information corresponding to this transaction to the web backend. The backend code then sends a WebSocket message to the web frontend or client code, and the client code performs one of the following three operations: adding an asset (corresponding to the operation of creating an energy asset) and displaying the block information; removing the corresponding asset (corresponding to the operation of deleting an energy asset) and displaying the block information; or removing the corresponding asset from a user and adding it to another user (corresponding to the operation of transferring an energy asset) and displaying the block information.
[0037] In this invention, chaincode responds to transactions sent by the blockchain network, executes code logic, and interacts with the ledger. Users, as members of the blockchain network, can write the business logic into the chaincode after agreeing on it. The solution uses the three most basic transaction ledger creation, transfer, and deletion logics. The Node.js SDK at the SDK layer calls the chaincode and forwards the function request to the application layer, ultimately presenting it to the user through a web interface.
[0038] This invention specifies a homomorphic secure computation scheme adopted by the Java SDK, which performs secure computation on secure computation requests submitted by the node network layer according to the homomorphic secure computation scheme. This scheme can be applied to a system composed of four types of entities: Data Service Providers (DSPs), Computing Providers (CPs), Fabric-based energy trading platforms, and users. Data Service Providers (DSPs) are responsible for storing user data, providing some computing services, and acting as cloud servers. Computing Providers (CPs) are primarily responsible for secure data computation on data requesters. They can be private cloud service providers, or the management departments of companies or research institutions. The Fabric-based energy trading platform is a complete blockchain architecture that includes the aforementioned node network layer, SDK layer, and application layer. It provides users with functions such as identity authentication, transaction information transmission, and homomorphic secure computation. Simultaneously, endorsing nodes implement access control between nodes through attribute encryption algorithms based on ciphertext policies, ensuring access control between nodes. Users are users of the energy trading platform. Users send transaction requests to the Fabric-based energy trading platform, which is responsible for storing and sharing transaction data.
[0039] In one embodiment of the present invention, the Java SDK performs homomorphic secure computation based on the secure computation request, specifically including:
[0040] S41, call the KeyGen algorithm to complete system initialization.
[0041] Specifically, the system calls the KeyGen algorithm to initialize HRES (Homomorphic Re-encryption Algorithm). Let k be the security parameter, and p and q be two large prime numbers, where L(p) = L(q) = k, and L(.) represents the bit length of the returned input data. Due to the properties of secure prime numbers, there exist two prime numbers p' and q that satisfy p = 2p' + 1 and q = 2q' + 1. Calculate n = p * q, and select a generator of order λ = 2p'q'. The selector selects a random number. And calculate g = -z 2n The value λ can be used to decrypt encrypted data, but the choice is to hide it and protect it from all relevant parties. In HRES, only the key pair (sk, g) is used. sk Data encryption and decryption are performed. DSP and CP generate their key pairs: (sk DSP =a,pk DSP =g a ) and (sk CP =b,pk CP =g b Then they negotiate their Diffie-Hellman keys. To support encrypted data processing, the key PK is publicly available to all relevant parties. The cloud user i generates the key pair upon system startup. The common system parameters include {g, n, PK}.
[0042] In addition, users should invoke Setup through the certificate authority. ABE (λ, U) generates the public parameters PK′ and master key MSK′ of the ABE algorithm (attribute encryption algorithm). Here, λ is the security parameter, and U = {1, 2, ..., ω} is the attribute Universe description. It is then published to each endorsing node in the Fabric network.
[0043] S42, invoke the EncTK algorithm to encrypt the transaction information to obtain encrypted data [m] i ].
[0044] Specifically, users encrypt their personal data before uploading it to the Fabric platform, directly using the EncTK algorithm to encrypt transaction information. i (unless otherwise stated, |m i|<L(n) / 4). Given transaction information m i ∈Z n Provided by user i, first select a random number r. i ∈[1, n / 4], and then encrypted using a PK generated from the keys of the two servers. Assuming there are N encrypted data items under the same key PK, this can be represented as [m i ] pk (i = 1, 2, ..., N). For ease of representation, [m i ] indicates m encrypted with PK i The ciphertext can only be decrypted through the collaboration of DSP and CP. The ciphertext is generated as follows:
[0045]
[0046] in,
[0047] By utilizing encrypted data uploaded by users to the Fabric network, some computations can be performed for potential application needs.
[0048] S43, DSP based on encrypted data [m] i The encrypted transaction information [m] is obtained through homomorphic computation using the parameter f of the secure computation function.
[0049] Specifically, when performing secure addition, addition obtains the sum of all the original data by copying all the ciphertext. The number of data points used for addition also affects the length of the provided data. To obtain the result of N data points, then m... i <n / N. Due to the existence of additive homomorphism, the DSP can directly multiply the encrypted data one by one in the following way:
[0050] When performing a secure subtraction calculation, it is necessary to calculate the difference between the first W terms and the last NW terms of the encrypted data. This is done by encrypting the data [m...] i (i = 1, ..., N) obtains the differences of some data. It can be achieved by subtracting the negative value (by raising it to the (n-1)th power) and then following the addition procedure.
[0051] When performing subtraction-safe calculations, the DSP first calculates... and Then further calculations Multiply them to get Then, following the addition procedure, the next calculation is performed on [m].
[0052] S44, the DSP selects a random number r1 and the first part of the key ck1 for encryption and partial decryption, generating the first part of the encrypted data. And send it to CP.
[0053] Specifically, after obtaining [m], the following calculations are performed to implement group access control: a random number r1 and the first partial key ck1 are selected, and the following calculations are executed:
[0054] 1) Calculate c1 = ck1 -1 mod n 2 ;
[0055] 2) Hidden ciphertext: in,
[0056] 3) Partial decryption using the PDec1 partial decryption algorithm yields:
[0057] Then the DSP sends For CP.
[0058] S45, the CP encrypts the first part of the data. Decryption is performed to obtain the first part of the ciphertext c1(m+r1). The CP then selects the second part of the key ck2 and a random number r to encrypt a portion of the ciphertext c1(m+r1) to obtain the second part of the encrypted data.
[0059] Specifically, CP uses the PDec2 algorithm to decrypt the encrypted data and obtain c1(m+r1). Then, CP selects the second part of the key ck2 and a random number r to encrypt the data as follows:
[0060] here
[0061] S46, the CP encrypts the first part of the ciphertext c1(m+r1) using the second part of the key ck2 and a random number r to obtain the second part of the encrypted data. And encrypt the second part of the key ck2 to obtain the encrypted second part of the key CK′2, and then encrypt the second part of the data. The encrypted second part of the key, CK′2, is passed back to the DSP.
[0062] Specifically, CP uses the key pair generated during initialization to encrypt ck2 to obtain CK′2, and then... CK′2 is passed back to the DSP.
[0063] S47, the DSP decrypts the encrypted second part key CK′2 to obtain the second part key ck2, and the DSP calculates the ciphertext based on r1 and ck1. The key CK′ is obtained by using the ABE algorithm based on the first part key ck1 and the second part key ck2.
[0064] Specifically, the DSP obtains the ciphertext using the following formula.
[0065] The above Substituting the formula into the calculation yields the final result. ck = ck1 * ck2.
[0066] Using the ABE encryption algorithm, combined with attributes γ and PK′, the ciphertext CK′ is output according to the following formula: CK′=CK′1*CK′2=Enc ABE (ck1*ck2, γ, PK′).
[0067] In summary, the transaction method of the blockchain energy trading system according to embodiments of the present invention achieves privacy protection of user data through on-chain encrypted storage and uses a homomorphic encryption security computation scheme to ensure that users can conduct normal transfer transactions. While protecting user privacy, it allows users to complete normal transaction operations, improving transaction efficiency and security. Simultaneously, it uses a key-policy-based attribute encryption algorithm to ensure access control between endorsing nodes, and designs an SDK as the chaincode management layer to isolate the encryption / decryption process from the chaincode interaction, optimizing chaincode management in the blockchain system and improving encryption / decryption efficiency.
[0068] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. "A plurality of" means two or more, unless otherwise explicitly specified.
[0069] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples and features of different embodiments or examples described in this specification without contradiction. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described herein, as well as the features of the different embodiments or examples, without contradiction.
[0070] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.
[0071] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0072] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0073] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0074] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0075] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
[0076] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A trading method for a blockchain energy trading system, characterized in that, The system comprises a node network layer, an SDK layer, and an application layer. The node network layer includes endorsement nodes, confirmation nodes, ordering nodes, and certificate nodes, as well as underlying chaincode responsible for inter-node communication. The SDK layer includes the Node.js SDK and the Java SDK. The application layer includes a web frontend and a web backend. The method includes the following steps: After receiving the transaction request, the application layer sends a transaction endorsement proposal to the Node.js SDK according to the transaction request; The Node.js SDK sends the transaction endorsement proposal to the endorsing node; The endorsing node endorses the transaction endorsement proposal, and during the endorsement process, sends a secure computation request to the Java SDK. The secure computation request includes transaction information. And the parameter f of the security computation function to be executed; The Java SDK performs homomorphic secure computation based on the secure computation request and returns the corresponding computation result to the endorsement node. The computation result includes: ciphertext and key. The endorsing node verifies the correctness of the calculation result and, after verifying its correctness, replies to the Node.js SDK with a proposal response, which includes the endorsing node signature and the current endorsement status. Once the number of proposal responses received by the Node.js SDK reaches a set value, a valid transaction is constructed based on the proposal responses and sent to the sorting node. The sorting node receives and sorts the transactions, then sends a block to the confirmation node. The confirmation node submits the block information corresponding to the block to the application layer; The application layer executes transaction actions and displays the block information; Specifically, the Java SDK performs homomorphic secure computation based on the secure computation request, including: Calling Algorithm Complete system initialization; Call The algorithm encrypts the transaction information to obtain encrypted data. ; Data service provider DSP based on encrypted data The encrypted transaction information is obtained through homomorphic computation using the parameter f of the secure computation function. ; DSP selects random numbers and the first part of the key Encryption and partial decryption are performed to generate the first part of encrypted data. And send it to the computing party CP, where, , where n is a common system parameter; The CP encrypts the first part of the data. Decrypt to obtain the first part of the ciphertext. The CP selects the second part of the key. and random numbers To encrypt the first part of the ciphertext To obtain the second part of encrypted data , g is a common system parameter; The second part of the CP encryption key Obtain the second part of the encryption key The second part of encrypted data and the second part of the encrypted key Passed back to DSP; The DSP uses the second part of the encrypted key. Decrypt to obtain the second part of the key. The DSP is based on and Calculate to obtain ciphertext and according to the first part of the key Second part key Use the ABE algorithm to obtain the key , , m is the sum of all the original data, , This is the encryption function for the ABE algorithm. These are the public parameters for the ABE algorithm. These are properties of the ABE algorithm.
2. The trading method of the blockchain energy trading system according to claim 1, characterized in that, When the transaction request is initiated by an administrator, the administrator registers and logs in through a certificate node; the administrator initiates the transaction request through the web frontend; the web frontend sends a WebSocket message to the web backend based on the transaction request, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the WebSocket message; when the transaction request is initiated by a user, the client submits the transaction request to the web backend, and the web backend sends a transaction endorsement proposal to the Node.js SDK based on the transaction request.
3. The trading method of the blockchain energy trading system according to claim 2, characterized in that, The transaction endorsement proposal includes: data packet ID, chaincode, and a signature uniformly issued by certificate nodes.
4. The trading method of the blockchain energy trading system according to claim 1, characterized in that, The transaction information This includes: the transaction amount; the security calculation function parameter f includes: 0, 1, and 2; when the security calculation function parameter f is 0, no calculation is performed; when the security calculation function parameter f is 1, addition security calculation is performed; when the security calculation function parameter f is 2, subtraction security calculation is performed.
Citation Information
Patent Citations
Professional title evaluation method and system based on blockchain
CN111476548A
Secure multi-party computing method and system based on block chain
CN114124347A