CN115641210A - Electric power transaction storage method, device, equipment and storage medium - Google Patents

Electric power transaction storage method, device, equipment and storage medium Download PDF

Info

Publication number
CN115641210A
CN115641210A CN202211352041.8A CN202211352041A CN115641210A CN 115641210 A CN115641210 A CN 115641210A CN 202211352041 A CN202211352041 A CN 202211352041A CN 115641210 A CN115641210 A CN 115641210A
Authority
CN
China
Prior art keywords
transaction
power transaction
electric power
user
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211352041.8A
Other languages
Chinese (zh)
Inventor
龙玉江
吴飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Information Center of Guizhou Power Grid Co Ltd
Original Assignee
Information Center of Guizhou Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Information Center of Guizhou Power Grid Co Ltd filed Critical Information Center of Guizhou Power Grid Co Ltd
Priority to CN202211352041.8A priority Critical patent/CN115641210A/en
Publication of CN115641210A publication Critical patent/CN115641210A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention belongs to the field of data storage, and particularly relates to a power transaction storage method, a device, equipment and a storage medium, wherein the method comprises the following steps: searching and sending the corresponding intelligent contract address to the user equipment so as to enable the user equipment to call the corresponding intelligent contract; according to the intelligent contract code logic, when the conditions required by transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after managing and signing to the user equipment, and after verification is correct, carrying out user signing and feedback on the electric power transaction after managing and signing; the power transaction signed by the user is received and verified, and the power transaction signed by the user is submitted to the block chain for confirmation of the transaction pool for temporary storage after verification is error-free, so that power transaction data is stored and processed through the block chain and an intelligent contract technology, and the power transaction data is more confident.

Description

Electric power transaction storage method, device, equipment and storage medium
Technical Field
The present invention relates to power transaction storage, and more particularly, to a method, an apparatus, a device and a storage medium for power transaction storage.
Background
With the rapid development of economic society, the demands of people on low-carbon, clean and renewable energy sources are continuously increased, and higher requirements are also put on the efficient utilization of the energy sources. With the advancement of the innovation of the power system, the market body on the electricity selling side is more diversified. Therefore, how to store and process the electric power transaction data and make the electric power transaction data have more public confidence becomes a technical problem to be solved urgently at present, and a traditional power grid electric power transaction system is generally a centralized database storage system, so that inconsistency of transaction data and potential manual operation space easily exist, and risks of data repetition, information inconsistency, information leakage, random change, hacking and the like are caused.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a power transaction storage method, a device, equipment and a storage medium, and aims to solve the technical problems that in the prior art, a traditional power grid power transaction system is a centralized database storage system, so that transaction data are inconsistent and potential manual operation space is easy to exist.
In order to achieve the above object, the present invention provides an electric power transaction storage method, applied to a terminal device, where the terminal device is located in a management node in a block chain, and the electric power transaction storage method includes the following steps:
when an electric power transaction request is received, searching and sending a corresponding intelligent contract address to user equipment so that the user equipment calls a corresponding intelligent contract according to the address of the intelligent contract;
judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction according to a preset intelligent contract code logic;
when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction;
and receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after the verification is error-free.
Optionally, the receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after verification is error-free, includes:
encrypting the power transaction signed by the user by a preset encryption method based on system parameters and public and private keys to obtain a power transaction amount ciphertext, a power account original amount ciphertext, a post-power transaction account balance ciphertext and a post-power transaction power balance ciphertext;
constructing a Pedersen commitment, and calling a sigma protocol to construct an equality evidence for the Pedersen commitment, an electric power transaction amount ciphertext, an electric power account original amount ciphertext, an account balance ciphertext after electric power transaction and the commitment in the electric power balance ciphertext after electric power transaction;
constructing a Pedersen commitment for the account balance ciphertext after the power transaction and the power balance ciphertext after the power transaction, and constructing an equal evidence for the commitment in the account balance ciphertext after the power transaction and the power balance ciphertext after the power transaction by calling a sigma protocol;
and verifying the validity of the transaction by the equal evidence, and after the verification is passed, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage.
Optionally, the receiving the power transaction signed by the user, verifying the power transaction signed by the user, submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after verification is not incorrect, and further comprising:
monitoring and confirming the electric power transaction quantity in the transaction pool in real time;
and when the transactions in the transaction pool are confirmed to exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage.
Optionally, writing the packaged power transaction into a block chain for saving includes:
carrying out re-encryption on the packaged electric power transaction, transmitting the electric power transaction to any block link point, and carrying out hash processing on the re-encrypted packaged electric power transaction through the block link point to generate a hash code;
broadcasting the re-encrypted and packaged electric power transaction and the generated hash code to nodes of the whole network so that the consensus node performs consensus verification on data in the network and the hash code generated by the re-encrypted and packaged electric power transaction, performs fragmentation storage on the re-encrypted data and allocates storage nodes, and generates a storage address table corresponding to the hash code;
and respectively storing the re-encrypted and packaged electric power transactions on each storage node according to the storage address table corresponding to the generated hash code.
Optionally, when it is determined that the transactions in the transaction pool exceed the preset electric power transaction amount, after packaging all transactions in the current transaction pool and writing the packaged electric power transactions into the block chain for storage, the method further includes:
after receiving a transaction query request, judging whether the user equipment has a query quota for checking the transaction according to the real information of the user equipment sending the transaction query;
and if the user equipment has the query quota for viewing the transaction, reading the target power transaction data into a trusted execution environment of a block chain node for decryption under the condition that a data query condition is met, transmitting the decrypted target power transaction data to the user equipment, and performing decrement update on the query quota of the user equipment.
Optionally, when it is determined that the transactions in the transaction pool exceed the preset electric power transaction quantity, the method further includes, after packaging all transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage:
when an electric power transaction reliability query request is received, a block where the electric power transaction is located is searched, and relevant information of the transaction is sent to user equipment, so that a user can confirm the authenticity of the transaction according to digital signatures of both transaction parties, and the transaction content is confirmed to be unmodified according to a hash value of a transaction tree calculated through layer-by-layer splitting.
Optionally, before searching and sending the corresponding intelligent contract address to the user equipment when receiving the power transaction request, so that the user equipment invokes the corresponding intelligent contract according to the address of the intelligent contract, the method further includes:
when receiving a creating request for creating an intelligent contract, responding to the creating request for creating the intelligent contract and acquiring contract attribute information in the creating request;
acquiring a power transaction service account corresponding to the creation request;
and generating an intelligent contract in the electric power transaction business account according to the attribute information of the electric power transaction contract.
Further, to achieve the above object, the present invention also provides an electric power transaction storage device including:
the receiving module is used for searching and sending a corresponding intelligent contract address to the user equipment when receiving the power transaction request so as to enable the user equipment to call a corresponding intelligent contract according to the address of the intelligent contract;
the judging module is used for judging whether the electric power transaction meets the preset conditions required for handling the electric power transaction according to the preset intelligent contract code logic;
the response module is used for responding to the power transaction request when preset conditions required by transacting the power transaction are met, managing and signing the power transaction, sending the power transaction after the management signature to the user equipment so that the user equipment verifies the power transaction after the management signature, and performing user signature and feedback on the power transaction after the management signature after no error is verified;
and the storage module is used for receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after no error exists in verification.
In addition, to achieve the above object, the present invention also provides an electric power transaction storage apparatus, including: a memory, a processor and a power transaction storage program stored on the memory and run on the processor, the power transaction storage program configured to implement the power transaction storage method as described above.
Further, to achieve the above object, the present invention also proposes a storage medium having stored thereon a power transaction storage program which, when executed by a processor, implements the power transaction storage method as described above.
The invention discloses a power transaction storage method, a device, equipment and a storage medium, wherein the method comprises the following steps: when receiving a power transaction request, searching and sending a corresponding intelligent contract address to user equipment so that the user equipment calls a corresponding intelligent contract according to the address of the intelligent contract; judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction according to a preset intelligent contract code logic; when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction; the method comprises the steps of receiving power transaction signed by a user, verifying the power transaction signed by the user, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage after verification is error-free, and accordingly storing and processing power transaction data through the block chain and an intelligent contract technology, and enabling the power transaction data to have more public trust.
Drawings
FIG. 1 is a schematic diagram of a power transaction storage device structure of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a power transaction storage method according to a first embodiment of the present invention;
FIG. 3 is a flow chart illustrating a power transaction storage method according to a second embodiment of the present invention;
FIG. 4 is a flow chart illustrating a power transaction storage method according to a third embodiment of the present invention;
fig. 5 is a functional block diagram of a power transaction storage device according to a first embodiment of the invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a power transaction storage device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the power transaction storage device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), and the optional user interface 1003 may further include a standard wired interface and a wireless interface, and the wired interface for the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory or a Non-volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001 described previously.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the power trade storage device and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, identified as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a power distribution network fault diagnostic program.
In the power transaction storage device shown in fig. 1, the network interface 1004 is mainly used for connecting a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting user equipment; the power transaction storage device calls the power distribution network fault diagnosis program stored in the memory 1005 through the processor 1001 and executes the power transaction storage method provided by the embodiment of the invention.
Based on the hardware structure, the embodiment of the electric power transaction storage method is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of the power transaction storage method according to the present invention, and the first embodiment of the power transaction storage method according to the present invention is provided.
In a first embodiment, the electricity transaction storage method includes the steps of:
step S10: and when the power transaction request is received, searching and sending the corresponding intelligent contract address to the user equipment so that the user equipment calls the corresponding intelligent contract according to the address of the intelligent contract.
It should be understood that the main execution body of the present embodiment is an electric power transaction storage device, and the power distribution network fault diagnosis device has functions of data processing, data communication, program operation, and the like.
It should be clear that the main execution body of this embodiment is a terminal device, the terminal device is located in a management node in a block chain, and the service storage device has functions of data processing, data communication, program operation, and the like. The system management node is composed of a server cluster arranged in a power grid information center, and the nodes for storing the complete information of all block chains of the system through hot backup operate in a full-node operating mode for 24 hours, so that the all-weather normal operation of the service storage system is ensured. The service management node can complete the operations of making intelligent contracts, initiating transactions, packaging transactions to block chains and the like. The service management node generally operates in a full node mode, is used by a manager of power grid transaction, and can be shut down and offline when not used. The common node operates in a light node mode, only the block head information of the block chain data is downloaded for creating, releasing and verifying transactions, so that the information privacy of the transactions can be ensured, and the data storage and calculation pressure of the common node can be relieved.
Step S20: and judging whether the electric power transaction meets the preset conditions required for transacting the electric power transaction according to the preset intelligent contract code logic.
In specific implementation, when an electricity user needs to initiate a certain service, a corresponding request is sent to a management node, and the management node finds a corresponding intelligent contract address and sends the intelligent contract address to the user. The electricity user calls the intelligent contract according to the address of the intelligent contract, the intelligent contract checks whether the current electricity user meets various conditions required by the service according to the code logic, if so, the corresponding service operation is executed, and if not, an error prompt is returned, thereby reducing the artificial judgment in the service response and ensuring the safety of the transaction. It should be noted that, in response to receiving a creation request for instructing to create an intelligent contract, acquiring contract attribute information in the creation request, acquiring a target service account corresponding to the creation request, and generating the intelligent contract in the target service account based on the contract attribute information, so that a user can acquire the intelligent contract on a chain deployed on a block chain without needing to understand the underlying operation principle/operation logic of different block chains and without needing to know the compiling principle of the intelligent contract, and the efficiency of creating the intelligent contract can be improved.
Step S30: and when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the verification is not wrong, performing user signature and feedback on the electric power transaction after the management signature.
In specific implementation, after the services in the intelligent contract are successfully executed, the execution result forms transaction data and signatures, then the transaction information and the signature data are sent to the electricity users, and the electricity users check the transaction information and the signature data to send to the management node for storage.
Step S40: and receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after the verification is error-free.
In specific implementation, a power utilization user inquires own power utilization record and transaction conditions on a system and calls an intelligent contract to conduct power purchase transaction and inquiry operation. The intelligent contract date approves or rejects the electricity purchasing application of the user according to the current user state of electricity utilization. All the electricity purchasing records of the users are generated in a transaction mode, and power grid workers input the electricity purchasing records, historical electricity consumption and the like of the electricity utilization users in the system and call a preset intelligent contract to evaluate the electricity utilization conditions of the users. All evaluation records of the power grid staff to the electricity utilization users are generated in a transaction mode.
In the specific implementation, the electricity transaction quantity in the transaction pool is monitored and confirmed in real time; and when the transactions in the transaction pool are confirmed to exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage. Carrying out re-encryption on the packaged electric power transaction, transmitting the electric power transaction to any block chain link point, and carrying out hash processing on the re-encrypted packaged electric power transaction through the block chain link point to generate a hash code; broadcasting the re-encrypted and packaged electric power transaction and the generated hash code to nodes of the whole network so that the consensus node performs consensus verification on data in the network and the hash code generated by the re-encrypted and packaged electric power transaction, performs fragmentation storage on the re-encrypted data and allocates storage nodes, and generates a storage address table corresponding to the hash code; and respectively storing the re-encrypted and packaged electric power transactions on each storage node according to the storage address table corresponding to the generated hash code, so that the electric power transactions can be stored in the block chain.
In this embodiment, when receiving a power transaction request, searching and sending a corresponding intelligent contract address to user equipment, so that the user equipment invokes a corresponding intelligent contract according to the address of the intelligent contract; judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction according to a preset intelligent contract code logic; when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction; the method comprises the steps of receiving power transaction signed by a user, verifying the power transaction signed by the user, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage after verification is error-free, and accordingly storing and processing power transaction data through the block chain and an intelligent contract technology, and enabling the power transaction data to have more public trust.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of the power transaction storage method according to the present invention, and the second embodiment of the power transaction storage method according to the present invention is proposed based on the first embodiment shown in fig. 2.
In the second embodiment, the step S40 includes:
step S401: and encrypting the power transaction signed by the user by a preset encryption method based on the system parameters and the public and private keys to obtain a power transaction amount ciphertext, a power account original amount ciphertext, a power transaction account balance ciphertext and a power transaction post-power balance ciphertext.
It should be noted that, through Paillier and game theory methods, the method of generating the public key y1 of the transaction sender is as shown in formula 1:
Figure BDA0003919270360000091
wherein the generated power transaction system parameter sysPrm = (h, k, n) 2 ) (ii) a Resulting Pedersen commitment parameter pedPrm = (G, p, G1, h 1) where pedPrm denotes Pedersen commitment parameter, G1 and h1 are two generators of group G of prime order p, sysPrm denotes system parameter, h = G λ modn 2 ,k=g λ modn 2 N = pq, p and q are both randomly selected security prime numbers, mod represents the remainder calculation, r is a random number, r < n2, g is a random number, and n is the sum of the r and the n 2 Is relatively prime and less than n 2 A multiplicative group formed by the natural numbers of (1), and satisfies (L (g) λ modn 2 ) -1modn exists and satisfies gcd (L (h) λ modn 2 ) N) = =1 present, where λ = lcm (p-1, q-1), lcm representing the power transaction least common multiple calculation, L (g) λ modn 2 )=(g λ modn 2 -1)/n, gcd represents the calculation of the greatest common divisor of the power transaction, L (h) λ modn2)=(h λ modn2 -1)/n。
Step S402: and constructing a Pedersen commitment, and calling a sigma protocol to construct an equality evidence for the Pedersen commitment, the power transaction amount ciphertext, the power account original amount ciphertext, the power transaction post-account balance ciphertext and the commitment in the power transaction post-power balance ciphertext.
It should be noted that: calling a sigma protocol, constructing an equality evidence for Pedersen and Ea0, and marking the evidence as EquaProofT; the method comprises the following steps that an account balance after the trade of the electricity user and a clear text random number of the account balance after the trade of a trade sending party construct a Pedersen commitment, and a sigma protocol is called to construct an equality evidence for the commitment of the electricity and the commitment in an account balance secret text after the trade of the electricity user, and specifically comprises the following steps: constructing a commitment for the account balance after the electricity consumption transaction and the account balance plaintext random number after the electricity consumption user transaction, and marking the commitment as Pedersen; and calling the sigma protocol to construct an equality evidence for PedersenC2 and Ed0, wherein the evidence is marked as EquaProofB. On the basis of the scheme, an evidence that the transaction amount is in a specific range is constructed for the transaction amount ciphertext of the transaction sender based on the function for generating the zero knowledge range proof, an evidence that the transaction amount is in the specific range is constructed for the account balance ciphertext of the transaction sender after transaction, and the constructed two evidences are generated in an aggregation mode.
Step S403: and constructing a Pedersen commitment for the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext, and constructing an equal evidence for the commitment in the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext by calling a sigma protocol.
It should be noted that whether the transaction is legal or not is judged, if and only if the first verification, the second verification and the third verification are all established, the transaction is legal, the original account amount ciphertext and the transaction amount of the electricity consumer are obtained, the account balance ciphertext after the electricity consumer transaction is obtained, the account balance after the electricity consumer transaction sender side conducts the transaction, the account balance ciphertext after the transaction receiver side conducts the transaction and other transaction data are written into an account book, otherwise, the transaction is illegal, and the transaction is failed.
Step S404: and verifying the validity of the transaction by the equal evidence, and after the verification is passed, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage.
It should be noted that all transactions confirmed by the grid transaction manager are temporarily stored in the confirmation transaction pool and wait for writing into the block chain, and when the number of transactions in the transaction pool reaches a certain number, all transactions in the current transaction pool are packaged and written into the block chain by the system management node. After the block is successfully distributed, the system management node broadcasts the latest block chain information to all other nodes.
In specific implementation, when a transaction query request is received, whether the user equipment has a query quota for checking the transaction is judged according to the real information of the user equipment sending the transaction query; if the user equipment has the query quota for checking the transaction, reading the target power transaction data into a trusted execution environment of a block chain node for decryption under the condition that a data query condition is met, sending the decrypted target power transaction data to the user equipment, and performing decrement updating on the query quota of the user equipment; when an electric power transaction reliability query request is received, a block where the electric power transaction is located is searched, and relevant information of the transaction is sent to user equipment, so that a user can confirm the authenticity of the transaction according to digital signatures of both transaction parties, and the transaction content is confirmed to be unmodified according to a hash value of a transaction tree calculated through layer-by-layer splitting.
It should be noted that, for the authenticity of the power transaction, the current leaf nodes are respectively divided by a plurality of different feature thresholds, and a corresponding kini coefficient after each division is obtained; wherein the feature threshold value takes any value within a range of feature values of the elements corresponding to the attribute; splitting the current leaf node by the partition corresponding to the smallest of the kini coefficients to form a next leaf node of the decision tree; and setting the next-layer leaf node as the current leaf node, and repeating the steps until a decision tree stop splitting condition is met. The formula for calculating the kini coefficient is shown in formula 2,
Figure BDA0003919270360000101
where k is an arbitrary constant, c is a feature threshold for any one of the attributes, xi is the ith attribute of an element in the sample data set, gini (TXi = c) is a kini coefficient corresponding to the current leaf node divided by c as the feature threshold, T (Xi ≦ c) is a subset composed of elements whose feature values of the divided attributes Xi are less than or equal to c, T (Xi > c) is a subset composed of elements whose feature values of the divided attributes Xi are greater than c, num (T (Xi ≦ c)) is the number of elements in the subset T (Xi ≦ c), num (T (X > c)) is the number of elements in the subset T (Xi > c), gini (T (Xi ≦ c)) is a kini coefficient of the subset T (Xi ≦ c), and Gini (T (Xi > c)) is a kini coefficient of the subset T (Xi > c).
In this embodiment, when a power transaction request is received, a corresponding intelligent contract address is searched and sent to user equipment, so that the user equipment calls a corresponding intelligent contract according to the address of the intelligent contract; judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction according to a preset intelligent contract code logic; when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction; encrypting the power transaction signed by the user through a preset encryption method based on system parameters and a public and private key to obtain a power transaction amount ciphertext, a power account original amount ciphertext, a post-power transaction account balance ciphertext and a post-power transaction power balance ciphertext; constructing a Pedersen commitment, and calling a sigma protocol to construct an equality evidence for the Pedersen commitment, a power transaction amount ciphertext, a power account original amount ciphertext, an account balance ciphertext after power transaction and the commitment in the power balance ciphertext after power transaction; constructing a Pedersen commitment for the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext, and constructing an equal evidence for the commitment in the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext by calling a sigma protocol; and verifying the legality of the transaction by the equal evidence, submitting the power transaction signed by the user to a block chain for confirming a transaction pool for temporary storage after the verification is passed, and storing and processing power transaction data by the block chain and an intelligent contract technology by combining a Pedersen commitment, a preset encryption method and calling a sigma protocol so that the power transaction data has more public credibility.
Referring to fig. 4, fig. 4 is a flowchart illustrating a third embodiment of the power transaction storage method according to the present invention, and the third embodiment of the power transaction storage method according to the present invention is proposed based on the first embodiment shown in fig. 2.
In the third embodiment, after the step S40, the method further includes:
step S50: and monitoring and confirming the electric power transaction quantity in the transaction pool in real time.
In the specific implementation, the system management node monitors and confirms the transaction quantity in the transaction pool in real time, and packs all current transactions into a block chain and issues the block chain when the transactions reach a preset number. The system periodically increases or decreases the number of transactions contained in a single block based on the generation speed of the current block. Since this blockchain is a private chain used inside the grid trade.
Step S60: and when the transactions in the transaction pool exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage.
In specific implementation, the packaged electric power transaction is re-encrypted and is transmitted to any block link point, and the re-encrypted packaged electric power transaction is subjected to hash processing through the block link point to generate a hash code; broadcasting the re-encrypted and packaged electric power transaction and the generated hash code to nodes of the whole network so that the consensus node performs consensus verification on data in the network and the hash code generated by the re-encrypted and packaged electric power transaction, performs fragmentation storage on the re-encrypted data and allocates storage nodes, and generates a storage address table corresponding to the hash code; and respectively storing the re-encrypted and packaged electric power transactions on each storage node according to the storage address table corresponding to the generated hash code.
It should be noted that, the data hash code is used for retrieval, the data of each node is checked through the calling interface of the block chain client, the system retrieves the address of the storage node according to the hash code, if the address of the storage node corresponding to the hash code does not exist, the query is finished, if the address of the storage node corresponding to the hash code exists, the data are obtained from the n nodes closest to the node, the query success is fed back, the data value is returned, and the query record is broadcasted to the block chain network.
In this embodiment, when receiving a power transaction request, searching and sending a corresponding intelligent contract address to user equipment, so that the user equipment invokes a corresponding intelligent contract according to the address of the intelligent contract; judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction or not according to preset intelligent contract code logic; when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction; receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage and monitoring the power transaction quantity in the confirmation transaction pool in real time after the verification is error-free; when the transactions in the transaction pool are confirmed to exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, writing the packaged electric power transactions into the block chain for storage, and storing the re-encrypted packaged electric power transactions on each storage node by using the data hash code, so that the public trust of the transactions is guaranteed.
Furthermore, an embodiment of the present invention further provides a storage medium, where the storage medium stores thereon a power transaction storage program, and the power transaction storage program, when executed by a processor, implements the steps of the power transaction storage method as described above.
Since the storage medium may adopt the technical solutions of all the embodiments, beneficial effects brought by the technical solutions of the embodiments are at least achieved, and are not described in detail herein.
Referring to fig. 5, fig. 5 is a functional block diagram of a power transaction storage device according to a first embodiment of the invention.
In a first embodiment of the electric power transaction storage apparatus of the present invention, the electric power transaction storage apparatus includes:
the receiving module 10 is configured to, when receiving the power transaction request, search and send a corresponding intelligent contract address to the user equipment, so that the user equipment invokes a corresponding intelligent contract according to the address of the intelligent contract;
the judging module 20 is used for judging whether the electric power transaction meets the preset conditions required for transacting the electric power transaction according to the preset intelligent contract code logic;
the response module 30 is configured to, when a preset condition required for transacting the power transaction is met, respond to the power transaction request, perform management signature on the power transaction, send the power transaction after the management signature to the user equipment, so that the user equipment verifies the power transaction after the management signature, and perform user signature and feedback on the power transaction after the management signature after no error is verified;
the storage module 40 is configured to receive the power transaction signed by the user, verify the power transaction signed by the user, and submit the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after verification is performed without error.
In this embodiment, when receiving a power transaction request, searching and sending a corresponding intelligent contract address to user equipment, so that the user equipment invokes a corresponding intelligent contract according to the address of the intelligent contract; judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction or not according to preset intelligent contract code logic; when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after managing and signing to the user equipment so that the user equipment can verify the electric power transaction after managing and signing, and after verification is not wrong, performing user signature on the electric power transaction after managing and signing and feeding back; the method comprises the steps of receiving the power transaction signed by a user, verifying the power transaction signed by the user, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage after the power transaction signed by the user is verified to be error-free, and accordingly storing and processing power transaction data through the block chain and an intelligent contract technology to enable the power transaction data to be more credible.
In an embodiment, the storage module 40 is further configured to receive the power transaction signed by the user, verify the power transaction signed by the user, and submit the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after verification is not wrong, and the method includes:
encrypting the power transaction signed by the user by a preset encryption method based on system parameters and public and private keys to obtain a power transaction amount ciphertext, a power account original amount ciphertext, a power transaction account balance ciphertext and a power transaction post-power balance ciphertext;
constructing a Pedersen commitment, and calling a sigma protocol to construct an equality evidence for the Pedersen commitment, an electric power transaction amount ciphertext, an electric power account original amount ciphertext, an account balance ciphertext after electric power transaction and the commitment in the electric power balance ciphertext after electric power transaction;
constructing a Pedersen commitment for the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext, and constructing an equal evidence for the commitment in the post-power-transaction account balance ciphertext and the post-power-transaction power balance ciphertext by calling a sigma protocol;
and verifying the validity of the transaction by the equal evidence, and after the verification is passed, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage.
In an embodiment, the storage module 40 is further configured to receive the power transaction signed by the user, verify the power transaction signed by the user, and after the power transaction signed by the user is submitted to a confirmation transaction pool in a block chain for temporary storage after verification is not wrong, the method further includes:
monitoring and confirming the electric power transaction quantity in the transaction pool in real time;
and when the transactions in the transaction pool exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage.
In an embodiment, the storage module 40 is further configured to write the packaged power transaction into a block chain for saving, and includes:
carrying out re-encryption on the packaged electric power transaction, transmitting the electric power transaction to any block chain link point, and carrying out hash processing on the re-encrypted packaged electric power transaction through the block chain link point to generate a hash code;
broadcasting the re-encrypted and packaged electric power transaction and the generated hash code to nodes of the whole network, so that a consensus node performs consensus verification on data in the network and the hash code generated by the re-encrypted and packaged electric power transaction, performs fragmentation storage on the re-encrypted data and allocates storage nodes, and generates a storage address table corresponding to the hash code;
and respectively storing the re-encrypted and packaged electric power transactions on each storage node according to the storage address table corresponding to the generated hash code.
In an embodiment, the response module 30 is further configured to, when it is determined that the transactions in the transaction pool exceed the preset electric power transaction quantity, package all transactions in the current transaction pool, and write the packaged electric power transactions into the block chain for storage, further including:
after receiving a transaction query request, judging whether the user equipment has a query quota for checking the transaction according to the real information of the user equipment sending the transaction query;
and if the user equipment has the inquiry quota for checking the transaction, reading the target electric power transaction data into a trusted execution environment of a block chain node for decryption under the condition that a data inquiry condition is met, sending the decrypted target electric power transaction data to the user equipment, and performing decrement updating on the inquiry quota of the user equipment.
In an embodiment, the determining module 20 is further configured to, when it is determined that the transactions in the transaction pool exceed the preset electric power transaction quantity, package all transactions in the current transaction pool, and write the packaged electric power transactions into the block chain for storage, further including:
when an electric power transaction reliability query request is received, a block where the electric power transaction is located is searched, and relevant information of the transaction is sent to user equipment, so that a user can confirm the authenticity of the transaction according to digital signatures of both transaction parties, and the transaction content is confirmed to be unmodified according to a hash value of a transaction tree calculated through layer-by-layer splitting.
In an embodiment, the determining module 20 is further configured to, when receiving the power transaction request, search and send a corresponding intelligent contract address to the user equipment, so that before the user equipment invokes the corresponding intelligent contract according to the address of the intelligent contract, the method further includes:
when receiving a creating request for creating an intelligent contract, responding to the creating request for creating the intelligent contract and acquiring contract attribute information in the creating request;
acquiring a power transaction service account corresponding to the creation request;
and generating an intelligent contract in the electric power transaction business account according to the attribute information of the electric power transaction contract.
Other embodiments or specific implementations of the electric power transaction storage apparatus according to the present invention may refer to the above-mentioned method embodiments, so that at least all the advantages brought by the technical solutions of the above-mentioned embodiments are provided, and no further description is provided herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or system comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering and these words may be interpreted as names.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (such as a Read Only Memory image (ROM)/Random Access Memory (RAM), a magnetic disk, and an optical disk), and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. The electric power transaction storage method is characterized by being applied to terminal equipment, wherein the terminal equipment is positioned at a management node in a block chain;
the method comprises the following steps:
when receiving a power transaction request, searching and sending a corresponding intelligent contract address to user equipment so that the user equipment calls a corresponding intelligent contract according to the address of the intelligent contract;
judging whether the electric power transaction meets a preset condition required for transacting the electric power transaction according to a preset intelligent contract code logic;
when preset conditions required for transacting the electric power transaction are met, responding to the electric power transaction request, managing and signing the electric power transaction, sending the electric power transaction after the management signature to the user equipment so that the user equipment verifies the electric power transaction after the management signature, and after the electric power transaction after the management signature is verified to be error-free, performing user signature on the electric power transaction after the management signature and feeding back the electric power transaction;
and receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after no error exists in verification.
2. The method of claim 1, wherein the receiving and verifying the user-signed power transaction, and after the verifying is correct, submitting the user-signed power transaction to a confirmation transaction pool in a blockchain for temporary storage comprises:
encrypting the power transaction signed by the user by a preset encryption method based on system parameters and public and private keys to obtain a power transaction amount ciphertext, a power account original amount ciphertext, a post-power transaction account balance ciphertext and a post-power transaction power balance ciphertext;
constructing a Pedersen commitment, and calling a sigma protocol to construct an equality evidence for the Pedersen commitment, an electric power transaction amount ciphertext, an electric power account original amount ciphertext, an account balance ciphertext after electric power transaction and the commitment in the electric power balance ciphertext after electric power transaction;
constructing a Pedersen commitment for the account balance ciphertext after the power transaction and the power balance ciphertext after the power transaction, and constructing an equal evidence for the commitment in the account balance ciphertext after the power transaction and the power balance ciphertext after the power transaction by calling a sigma protocol;
and verifying the validity of the transaction by the equal evidence, and after the verification is passed, submitting the power transaction signed by the user to a block chain to confirm a transaction pool for temporary storage.
3. The method of claim 1, wherein the receiving and verifying the user-signed power transaction, and after submitting the user-signed power transaction to a confirmation transaction pool in a blockchain for temporary storage after no error in verification, further comprises:
monitoring and confirming the electric power transaction quantity in the transaction pool in real time;
and when the transactions in the transaction pool are confirmed to exceed the preset electric power transaction quantity, packaging all the transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for storage.
4. The method of claim 3, wherein writing the packed power transaction to a blockchain for saving comprises:
carrying out re-encryption on the packaged electric power transaction, transmitting the electric power transaction to any block chain link point, and carrying out hash processing on the re-encrypted packaged electric power transaction through the block chain link point to generate a hash code;
broadcasting the re-encrypted and packaged electric power transaction and the generated hash code to nodes of the whole network so that the consensus node performs consensus verification on data in the network and the hash code generated by the re-encrypted and packaged electric power transaction, performs fragmentation storage on the re-encrypted data and allocates storage nodes, and generates a storage address table corresponding to the hash code;
and respectively storing the re-encrypted and packaged electric power transaction on each storage node according to the storage address table corresponding to the generated hash code.
5. The method of claim 3, wherein after the confirming that the transactions in the transaction pool exceed the preset electric power transaction amount, packaging all transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for saving, the method further comprises:
after receiving a transaction query request, judging whether the user equipment has a query quota for checking the transaction according to the real information of the user equipment sending the transaction query;
and if the user equipment has the inquiry quota for checking the transaction, reading the target electric power transaction data into a trusted execution environment of a block chain node for decryption under the condition that a data inquiry condition is met, sending the decrypted target electric power transaction data to the user equipment, and performing decrement updating on the inquiry quota of the user equipment.
6. The method of claim 3, wherein after the confirming that the transactions in the transaction pool exceed the preset electric power transaction amount, packaging all transactions in the current transaction pool, and writing the packaged electric power transactions into a block chain for saving, further comprising:
when an electric power transaction reliability query request is received, a block where the electric power transaction is located is searched, and relevant information of the transaction is sent to user equipment, so that a user can confirm the authenticity of the transaction according to digital signatures of both transaction parties, and the transaction content is confirmed to be unmodified according to a hash value of a transaction tree calculated through layer-by-layer splitting.
7. The method of claim 1, wherein prior to searching for and sending a corresponding intelligent contract address to the user device upon receiving the power transaction request to cause the user device to invoke the corresponding intelligent contract according to the address of the intelligent contract, further comprising:
when receiving a creating request for creating an intelligent contract, responding to the creating request for creating the intelligent contract and acquiring contract attribute information in the creating request;
acquiring a power transaction service account corresponding to the creation request;
and generating an intelligent contract in the electric power transaction business account according to the attribute information of the electric power transaction contract.
8. An electric power transaction storage device, comprising:
the receiving module is used for searching and sending a corresponding intelligent contract address to the user equipment when receiving the power transaction request so as to enable the user equipment to call a corresponding intelligent contract according to the address of the intelligent contract;
the judging module is used for judging whether the electric power transaction meets the preset condition required for transacting the electric power transaction according to the preset intelligent contract code logic;
the response module is used for responding to the power transaction request when preset conditions required by transacting the power transaction are met, managing and signing the power transaction, sending the power transaction after the management signature to the user equipment so that the user equipment verifies the power transaction after the management signature, and performing user signature and feedback on the power transaction after the management signature after no error is verified;
and the storage module is used for receiving the power transaction signed by the user, verifying the power transaction signed by the user, and submitting the power transaction signed by the user to a confirmation transaction pool in a block chain for temporary storage after no error exists in verification.
9. An electric power transaction storage device, characterized in that the electric power transaction storage device comprises a memory, a processor and an electric power transaction storage program stored on the memory and executable on the processor, the electric power transaction storage program realizing the electric power transaction storage method according to any one of claims 1 to 7 when executed by the processor.
10. A storage medium, wherein a power transaction storage program is stored thereon, and when executed by a processor, the power transaction storage program implements the power transaction storage method according to any one of claims 1 to 7.
CN202211352041.8A 2022-10-31 2022-10-31 Electric power transaction storage method, device, equipment and storage medium Pending CN115641210A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211352041.8A CN115641210A (en) 2022-10-31 2022-10-31 Electric power transaction storage method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211352041.8A CN115641210A (en) 2022-10-31 2022-10-31 Electric power transaction storage method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115641210A true CN115641210A (en) 2023-01-24

Family

ID=84946346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211352041.8A Pending CN115641210A (en) 2022-10-31 2022-10-31 Electric power transaction storage method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115641210A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107392767A (en) * 2017-07-28 2017-11-24 广州亦云信息技术股份有限公司 Method of commerce, electronic equipment and the storage medium of electricity market based on block chain
CN107578243A (en) * 2017-07-27 2018-01-12 远光软件股份有限公司 Electricity transaction method and device based on block chain technology
CN109327512A (en) * 2018-09-19 2019-02-12 广东微链科技有限公司 Game data subregion storage method based on block chain hash addressing and re-encryption
CN111260450A (en) * 2020-02-18 2020-06-09 暨南大学 Electric power bilateral transaction system based on block chain technology
WO2021082664A1 (en) * 2019-10-30 2021-05-06 支付宝(杭州)信息技术有限公司 Blockchain privacy data query method and apparatus
CN113159762A (en) * 2021-01-28 2021-07-23 武汉天喻信息产业股份有限公司 Block chain transaction method based on Paillier and game theory

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107578243A (en) * 2017-07-27 2018-01-12 远光软件股份有限公司 Electricity transaction method and device based on block chain technology
CN107392767A (en) * 2017-07-28 2017-11-24 广州亦云信息技术股份有限公司 Method of commerce, electronic equipment and the storage medium of electricity market based on block chain
CN109327512A (en) * 2018-09-19 2019-02-12 广东微链科技有限公司 Game data subregion storage method based on block chain hash addressing and re-encryption
WO2021082664A1 (en) * 2019-10-30 2021-05-06 支付宝(杭州)信息技术有限公司 Blockchain privacy data query method and apparatus
CN111260450A (en) * 2020-02-18 2020-06-09 暨南大学 Electric power bilateral transaction system based on block chain technology
CN113159762A (en) * 2021-01-28 2021-07-23 武汉天喻信息产业股份有限公司 Block chain transaction method based on Paillier and game theory

Similar Documents

Publication Publication Date Title
EP3688634B1 (en) System and method for implementing a resolver service for decentralized identifiers
US11159526B2 (en) System and method for decentralized-identifier authentication
JP2023106528A (en) System and method for authenticating off-chain data based on proof verification
CN112446785A (en) Cross-chain transaction method, system, device, equipment and storage medium
CN113569294B (en) Zero knowledge proving method and device, electronic equipment and storage medium
US9641340B2 (en) Certificateless multi-proxy signature method and apparatus
CN111464315B (en) Digital signature processing method, device, computer equipment and storage medium
CN109460966A (en) Contract signing method, apparatus and terminal device based on requesting party&#39;s classification
CN111080295A (en) Block chain-based electronic contract processing method and equipment
CN109635572A (en) A kind of contract signing method, apparatus and terminal device based on block chain
CN113159762A (en) Block chain transaction method based on Paillier and game theory
CN115396115A (en) Block chain data privacy protection method, device, equipment and readable storage medium
CN103309973B (en) Can verify that the method and system of outsourcing data query
CN113205378A (en) Electric energy transaction system based on block chain
CN116506134B (en) Digital certificate management method, device, equipment, system and readable storage medium
CN115641210A (en) Electric power transaction storage method, device, equipment and storage medium
CN115065465A (en) Personal data processing method and device based on zero-knowledge proof
CN114092240A (en) Transaction method and device based on block chain, electronic equipment and storage medium
CN114418769A (en) Block chain transaction charging method and device and readable storage medium
CN114329610A (en) Block chain privacy identity protection method, device, storage medium and system
CN113706261A (en) Block chain-based power transaction method, device and system
CN111552950A (en) Software authorization method and device and computer readable storage medium
US20230010339A1 (en) Methods and systems for device-specific event handler generation
US11263063B1 (en) Methods and systems for device-specific event handler generation
CN117040930B (en) Resource processing method, device, product, equipment and medium of block chain network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination