Energy trading method, electronic device and storage medium
By using commitment mechanism and two-layer encryption mechanism in distributed energy transactions to protect the privacy of transaction data, and using graph neural network to detect abnormal transaction behaviors, the problems of privacy leakage and data security in distributed energy transactions are solved, and efficient A safe transaction process.
Patent Information
- Application Number
- CN202411747527.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In distributed energy transactions, privacy leakage and data security issues are prominent, and traditional blockchain technology is difficult to effectively protect transaction privacy, and how to efficiently process transaction data, ensure security and detect abnormal transaction behaviors in a timely manner has become a technical challenge.
The commitment mechanism is used to encrypt the input amount, and the transaction output amount is protected through the two-layer encryption mechanism to ensure the security of the transaction data during the transmission process. At the same time, graph neural network technology was introduced to detect abnormal transaction behavior.
It realizes the privacy protection and security of transaction data in distributed energy transactions, ensures the security of data during the transaction process, and can promptly detect and deal with abnormal transaction behaviors, improving the overall efficiency and security of the system.
Smart Images

Figure CN119205110B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power technology, and in particular to an energy trading method, electronic equipment and storage medium. Background Art
[0002] With the rapid development of distributed energy trading, the diversification of trading entities and the complexity of data have made privacy protection and data security key issues.
[0003] Distributed energy transactions involve multiple different participants, including energy producers, consumers, trading institutions, and regulators. These trading entities face the risk of privacy leakage when conducting energy transactions, especially in the process of end-side data processing and storage, where data security issues are particularly prominent. Due to the decentralized nature of distributed energy transactions, data interactions between participants are frequent and sensitive information is easily leaked.
[0004] Although traditional blockchain technology can provide data immutability and transparency, it still has shortcomings in protecting transaction privacy. In addition, with the expansion of transaction scale and the increase in complexity, how to efficiently process transaction data, ensure transaction security, and timely detect and respond to abnormal transaction behavior have become urgent technical challenges. Therefore, how to achieve a balance between privacy protection, data security and system efficiency in distributed energy transactions has become a key direction of current technological development. Summary of the invention
[0005] The present invention provides an energy trading method, an electronic device and a storage medium, which can solve at least one of the above problems.
[0006] The present invention provides an energy trading method, comprising:
[0007] The transaction institution receives a first encrypted input amount and a second encrypted input amount for the first energy source from the transaction sender, wherein the first encrypted input amount and the second encrypted input amount are obtained by the transaction sender through a commitment mechanism to encrypt the first input amount and the second input amount;
[0008] The transaction institution decrypts the first encrypted input amount and the second encrypted input amount to obtain the first input amount and the second input amount, and performs transaction processing on the first input amount and the second input amount to obtain a first output amount for transaction to the transaction recipient and a second output amount for change to the transaction sender;
[0009] Based on the commitment mechanism, the transaction institution encrypts the first output amount and the second output amount to obtain a first encrypted output amount and a second encrypted output amount;
[0010] The transaction institution encrypts the first encrypted output amount based on the anonymous identity of the transaction recipient to obtain a third encrypted output amount;
[0011] The transaction institution encrypts the second encrypted output amount based on the anonymous identity of the transaction sender to obtain a fourth encrypted output amount;
[0012] The transaction institution sends the third encrypted output amount to the transaction recipient and sends the fourth encrypted output amount to the transaction sender to complete the transaction for the first energy.
[0013] According to another aspect of the present invention, there is provided an electronic device, comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any energy trading method in the embodiments of the present invention.
[0017] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute any energy trading method in the embodiments of the present invention.
[0018] By adopting the technical solution of the present invention, when trading for the first energy source, the transaction sender first uses the commitment mechanism to encrypt the input amount and then sends it to the transaction agency. The transaction agency decrypts it and then conducts the transaction, obtaining the first output amount for trading to the transaction receiver and the second output amount for change to the transaction sender. Then, the transaction agency first encrypts the two output amounts, and then uses the anonymous identity of the transaction receiver to encrypt the first output amount, and uses the anonymous identity of the transaction sender to encrypt the second output amount. In this way, after two layers of encryption, it is sent to the transaction receiver and the transaction sender, ensuring the data security of the transaction and successfully completing the transaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flow chart of an energy trading method according to an embodiment of the present invention;
[0020] Figure 2 is a flow chart of an energy trading method according to another embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a transaction process according to an embodiment of the present invention;
[0022] Figure 4 is a block diagram of an electronic device for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] Explanation of relevant terms
[0025] Blockchain: Blockchain is a distributed ledger technology that records data in a series of interconnected blocks and arranges these blocks in a chronological chain to form an immutable record chain. Each block contains the encrypted hash value of the previous block, new transaction data, and timestamp information. Since data is distributed and stored on multiple nodes and consensus algorithms are used to ensure data consistency between nodes, blockchain has a high degree of security and transparency and is difficult to be tampered with or attacked.
[0026] Probabilistic Public Key Encryption: Probabilistic Public Key Encryption is an encryption method that generates different ciphertexts when the same plaintext is encrypted multiple times. This randomization feature is achieved by introducing random numbers or random parameters, thereby improving the security of encryption. Even if an attacker obtains multiple ciphertexts of the same plaintext, he cannot infer the original plaintext information by comparing these ciphertexts.
[0027] This encryption method effectively prevents common attacks such as chosen plaintext attacks, making the encryption scheme more secure and reliable. Probabilistic public key encryption is often used in scenarios that require high security, such as protecting sensitive data and identity authentication.
[0028] IBC: IBC (Identity-Based Cryptography) is an encryption technology that directly generates public keys through user identity information (such as email address, phone number, etc.) without the need for a certificate management system in a traditional public key infrastructure (PKI). This method simplifies the key management process and makes the distribution of public keys more convenient.
[0029] In IBC, the trust center or key generation center (KGC) is responsible for generating and distributing the user's private key, while the public key is derived from the user's identity information. This mechanism reduces the complex management of public key certificates and is particularly suitable for resource-constrained environments and scenarios where encrypted communications need to be deployed quickly. IBC technology is widely used in systems that require simplified key management, such as mobile communications, email encryption, and identity authentication for IoT devices.
[0030] Zero-knowledge proof: Zero-knowledge proof is a cryptographic technique that allows the prover to prove the authenticity of a statement to the verifier without revealing any additional information. In other words, the prover can convince the verifier that he has certain information or meets certain conditions without disclosing the information itself.
[0031] The core features of zero-knowledge proof are:
[0032] 1. Completeness: If the statement is true, an honest verifier will trust the prover’s proof.
[0033] 2. Zero-knowledge: The verifier cannot obtain any additional information about the content of the proof except that the statement is true.
[0034] 3. Reliability: If the statement is false, it is almost impossible for an honest verifier to be convinced that it is true.
[0035] This technology is very useful in scenarios where privacy and security are protected, especially in applications that need to verify the legitimacy of an identity or transaction but do not want to disclose specific details, such as blockchain, cryptographic protocols, and secure authentication systems.
[0036] Graph Neural Network: Graph Neural Network (GNN) is a deep learning model specifically designed to process graph structure data. The graph structure consists of nodes (vertices) and edges (edges). Nodes represent entities, and edges represent the relationship or connection between entities. GNN captures information in the graph structure by representing and learning the features of nodes and edges in the graph, and is applied to various tasks such as node classification, edge prediction, and graph classification.
[0037] The core idea of GNN is to update and learn the feature representation of nodes through the connection relationship between nodes (i.e. the topological structure of the graph). Specifically, the features of each node are not only determined by its own features, but also affected by the features of its neighboring nodes. In GNN, information is transmitted through the edges of the graph, and nodes aggregate information from their neighboring nodes and perform feature updates through multi-layer neural networks, thereby gradually learning the global representation of the entire graph.
[0038] Figure 1 is a flow chart of an energy trading method according to an embodiment of the present invention.
[0039] like Figure 1 As shown, the energy trading method may include:
[0040] S110, the transaction institution receives a first encrypted input amount and a second encrypted input amount for the first energy source from the transaction sender, wherein the first encrypted input amount and the second encrypted input amount are obtained by the transaction sender through a commitment mechanism to encrypt the first input amount and the second input amount;
[0041] S120, the transaction institution decrypts the first encrypted input amount and the second encrypted input amount to obtain the first input amount and the second input amount, and performs transaction processing on the first input amount and the second input amount to obtain a first output amount for transaction to the transaction recipient and a second output amount for change to the transaction sender;
[0042] S130, the transaction institution encrypts the first output amount and the second output amount based on the commitment mechanism to obtain the first encrypted output amount and the second encrypted output amount;
[0043] S140, the transaction institution encrypts the first encrypted output amount based on the anonymous identity of the transaction recipient to obtain a third encrypted output amount;
[0044] S150, the transaction institution encrypts the second encrypted output amount based on the anonymous identity of the transaction sender to obtain a fourth encrypted output amount;
[0045] S160, the transaction institution sends the third encrypted output amount to the transaction recipient, and sends the fourth encrypted output amount to the transaction sender to complete the transaction for the first energy.
[0046] For example, Figure 2 and 3 As shown, the transaction institution can use the UTXO transaction structure to conduct transactions between the two parties.
[0047] like Figure 2As shown in the figure, the participants of the scheme include the following categories: (1) The main entities of the transaction - the sender and the receiver, who hope to protect their anonymity and the confidentiality of the transaction amount through secure transactions. In basic transaction activities, the sender transfers a certain amount of money to the receiver. (2) Validators, who are responsible for verifying the legitimacy of the transaction and ensuring that there is no double payment or fraud; after the transaction is verified, the validator packages it into a new block through a consensus mechanism and stores it on the blockchain to ensure that the transaction record cannot be tampered with. (3) Regulators, who are responsible for supervising and regulating the blockchain network. When necessary, they track relevant participants and financial transactions to combat illegal financial activities. (4) Third parties, who may be malicious actors who steal transaction-related information through technical means to obtain improper benefits.
[0048] like Figure 3 As shown, when the transaction sender With the transaction sender When conducting a transaction, the transaction sender enters two input amounts into the input port (Input) of the transaction institution (Transaction), namely the first input amount and the second input amount , and the output port (Output) of the transaction institution after the transaction outputs two output amounts, one for the transaction to the transaction recipient The first output amount , and the other is the second output amount for the transaction sender In addition, the transaction fee output port (Fee) of the transaction institution (Transaction) outputs the transaction fee , the fee given to the verifier (Miner) for packaging transactions.
[0049] It can be understood that the first input amount can be the total transaction amount, and the second input amount can be the unit price of the first energy.
[0050] For example, the above commitment mechanism can adopt the Pedersen commitment mechanism. In this way, the privacy protection of the transaction amount can be ensured, and the transaction input and output amounts ( , , , ) will not be disclosed during the transaction broadcast process, while retaining the ability of the verifier to verify the legitimacy of the transaction. Specifically, the transaction sender expresses the transaction input amount through commitment as and At this time, when the transaction output amount is obtained after the transaction, the transaction institution will set and To calculate the commitment value of the output amount and , to ensure the privacy of the output amount, as follows:
[0051]
[0052]
[0053]
[0054] Among them, G and H are mathematical elements used to generate commitment values. Mathematically, G is an element on a group. As the basis for calculating the commitment value, it ensures that the generated commitment has strong security; H is an element on another group, which is independent of G and is derived from G through a hash function to ensure the randomness of the commitment.
[0055] Among them, in terms of the handling of transaction fees, the transaction fees Publicly stated as , so that the verifier can calculate the fee when packaging the transaction. This design simplifies the verification process of the verifier, while ensuring that the privacy of the entire transaction will not be affected by the disclosure of transaction fees. At the same time, in order to further ensure the privacy and security of the transaction, the scheme introduces identity-based encryption, in which and Encrypted as and . Using Receiver Public key encryption ensures that only the recipient can decrypt and view the transaction amount . Use Sender The public key encryption is used by the sender to obtain the change amount This double encryption mechanism ensures the privacy of both parties in the transaction, and the specific amount of the transaction will not be disclosed even in a public blockchain environment. The details are as follows:
[0056]
[0057]
[0058] For example, in order to verify the legitimacy of a transaction, the public key of the transaction can also be calculated. To verify the equivalence of input amounts and output amounts. and The difference between and The difference between these two values determines the transaction public key , so that the verifier can be based on To verify the transaction signature The effectiveness of the transaction ensures the authenticity and legality of the transaction.
[0059] Exemplarily, the above embodiment can also introduce Bulletproofs zero-knowledge proof, which is an efficient privacy protection technology used to verify the range of transaction amounts and prevent the occurrence of negative transactions. Compared with other zero-knowledge proof technologies (such as zk-SNARKs), Bulletproofs is more efficient, does not require trusted settings, and has low computational complexity, making it suitable for high-frequency transaction scenarios in blockchain. By using Bulletproofs, the verifier can verify the validity of the transaction amount without exposing the specific amount.
[0060] Finally, the transaction record It will be broadcast on the blockchain network, and after verification by the validator, it will be included in the block through the consensus protocol to form an unalterable ledger record. The transaction recipient can use his anonymous identity The corresponding private key right Decrypt and get the transaction amount At the same time, the sender of the transaction can use the private key corresponding to his anonymous identity right Decrypt and get the transaction amount . Thus completing the transaction.
[0061] When trading the first energy source, the transaction sender first uses the commitment mechanism to encrypt the input amount and then sends it to the transaction institution. The transaction institution decrypts it and then conducts the transaction, obtaining the first output amount for the transaction to the transaction recipient and the second output amount for the change to the transaction sender. Then, the transaction institution first encrypts the two output amounts, and then uses the anonymous identity of the transaction recipient to encrypt the first output amount, and uses the anonymous identity of the transaction sender to encrypt the second output amount. In this way, after two layers of encryption, it is sent to the transaction recipient and the transaction sender, ensuring the data security of the transaction and successfully completing the transaction.
[0062] In one embodiment, the above method further includes: the transaction institution obtains the anonymous identity of the transaction recipient from the regulatory agency, and the anonymous identity of the transaction recipient is generated by the regulatory agency using the first step.
[0063] Among them, the first step includes: the regulatory agency generates three corresponding key pairs for the transaction recipient, wherein the first key pair of the three key pairs includes a first private key and a first public key, the second key pair includes a second private key and a second public key, and the third key pair includes a third public key and a third private key encrypted by the second private key and the third public key; the regulatory agency encrypts the real identity of the transaction recipient based on the first public key to obtain a first part of the anonymous identity; the regulatory agency encrypts the first part of the anonymous identity based on the third private key to obtain a second part of the anonymous identity; the regulatory agency combines the first part of the anonymous identity and the second part of the anonymous identity to obtain the anonymous identity of the transaction recipient.
[0064] Exemplarily, the first key pair can be generated using the BG algorithm. For example, the first private key is generated using the BG algorithm. and the first public key , which makes the subsequent user identity encryption probabilistic and random, ensuring the security and anti-inference of the ciphertext.
[0065] For example, the second key pair can be generated by the key generation center (KGC) of the IBC framework. The regulator creates a master public key (second public key MPKr) and a corresponding master private key (second private key MSKr), laying the foundation for identity-based encryption.
[0066] Exemplarily, the third key pair may be generated using an IBC algorithm.
[0067] Define the identity of the transaction recipient in IBC as , use it as the third public key, and then use the second private key MSKr to create the signature private key (third private key) through the IBC algorithm, that is .
[0068] For example, during the initialization of the user identity and the generation of the anonymous identity, the user (transaction recipient) uses the unique identifiable information (Self-certification is required, such as email address, ID number or phone number) Apply to the regulator for key distribution. During this process, the regulator verifies the user's identity and uses the public key of the BG algorithm Encrypt user identity information to generate the first partially anonymous identity .
[0069] For example, since the BG algorithm has strong randomness and unpredictability, It has a high degree of privacy protection. The authenticity and legitimacy of the Anonymize the first part Sign and generate the second part of anonymous identity .
[0070] For example, the final anonymous identity , which is generated by the BG algorithm Generated with IBC signature The combination retains randomness while ensuring the verifiability of identity.
[0071] According to the above implementation, a mechanism for generating multiple anonymous identities using the BG algorithm is implemented. Through the probability and repeatability of the BG algorithm, multiple anonymous identities can be generated from the same real identity. Generate multiple different anonymous identities This one-to-many identity association mechanism not only breaks the limitation of traditional single identity and key binding, but also provides users with great anonymity and flexibility. Users can generate different anonymous identities according to different transaction scenarios to avoid being tracked. This dynamic anonymous identity update design not only enhances privacy protection, but also effectively disperses the risk of identity leakage.
[0072] In one implementation, the above method may further include: the transaction institution obtains the anonymous identity of the transaction sender from the regulatory agency, and the anonymous identity of the transaction sender is generated by the regulatory agency using the second step.
[0073] Among them, the second step includes: the regulatory agency generates three corresponding key pairs for the transaction sender, among which the fourth key pair of the three key pairs includes a fourth private key and a fourth public key, the fifth key pair includes a fifth private key and a fifth public key, and the sixth key pair includes a sixth public key and a sixth private key encrypted by the fifth private key and the sixth public key; the regulatory agency encrypts the real identity of the transaction sender based on the fourth public key to obtain a third anonymous identity; the regulatory agency encrypts the third anonymous identity based on the sixth private key to obtain a fourth anonymous identity; the regulatory agency combines the third anonymous identity with the fourth anonymous identity to obtain the anonymous identity of the transaction sender.
[0074] Exemplarily, the fourth key pair uses the BG algorithm to generate a fourth private key and the fourth public key This makes the subsequent user identity encryption probabilistic and random, ensuring the security and anti-inference of the ciphertext.
[0075] Exemplarily, the fifth key pair is generated by a key generation center (KGC) within the IBC framework. The regulator creates a fifth public key MPKs and a corresponding fifth private key MSKs, laying the foundation for identity-based encryption.
[0076] Exemplarily, the sixth key pair may be generated using an IBC algorithm.
[0077] Define the identity of the transaction sender in IBC as , and use it as the sixth public key.
[0078] Use the fifth private key MSKs to create a signature private key through the IBC algorithm to obtain the sixth private key This structural design of multiple key generation ensures the organic combination of different encryption mechanisms within the system and lays the foundation for subsequent identity authentication and key distribution.
[0079] For example, during the initialization of the user identity and the generation of the anonymous identity, the user (transaction sender) uses the unique identifiable information Apply to the regulatory authority for key distribution (self-identification is required, such as email address, ID number or phone number).
[0080] During this process, the regulator verifies the user's identity and uses the fourth public key of the BG algorithm Encrypt user identity information to generate a third anonymous identity Since the BG algorithm has strong randomness and unpredictability, It has a high degree of privacy protection. The authenticity and legitimacy of the regulatory agency using the sixth private key right Sign and generate the fourth part of anonymous identity Finally, the anonymous identity of the transaction sender is obtained , which is generated by the BG algorithm Generated with IBC signature It is generated by a combination of , which not only retains randomness but also ensures the verifiability of identity.
[0081] According to the above implementation, a mechanism for generating multiple anonymous identities using the BG algorithm is implemented. Through the probability and repeatability of the BG algorithm, multiple anonymous identities can be generated from the same real identity. Generate multiple different anonymous identities This one-to-many identity association mechanism not only breaks the limitation of traditional single identity and key binding, but also provides users with great anonymity and flexibility. Users can generate different anonymous identities according to different transaction scenarios to avoid being tracked. This dynamic anonymous identity update design not only enhances privacy protection, but also effectively disperses the risk of identity leakage.
[0082] In one embodiment, the above method may also include: the transaction recipient obtains the corresponding seventh private key from the regulatory agency based on the anonymous identity of the transaction recipient, wherein the seventh private key is a key generated by the regulatory agency based on the anonymous identity of the transaction recipient and the second private key; the transaction recipient decrypts the received third encrypted output amount based on the seventh private key to obtain the first encrypted output amount; the transaction recipient decrypts the first encrypted output amount based on the commitment mechanism to obtain the first output amount.
[0083] In this example, the in-depth integration of anonymous identity and transaction process is proposed. As a public key identity, at the same time, the IBC algorithm is used to generate the corresponding seventh private key for it . And, establish the user's real identity With anonymous identity Through the flexibility of the BG algorithm, users can continuously update their anonymous identities and participate in transactions without revealing their true identities.
[0084] In specific transaction scenarios, the transaction recipient can use the seventh private key Decrypt the transaction amount and the recipient’s anonymous identity As the receiving address. This mechanism ensures that the identities of both parties remain anonymous during the transaction, enhancing the privacy and security of the transaction.
[0085] In one embodiment, the above method may also include: the transaction sender obtains the corresponding eighth private key from the regulatory agency based on the anonymous identity of the transaction sender, wherein the eighth private key is a key generated by the regulatory agency based on the anonymous identity of the transaction sender and the fifth private key; the transaction sender decrypts the received fourth encrypted output amount based on the eighth private key to obtain the second encrypted output amount; the transaction sender decrypts the second encrypted output amount based on the commitment mechanism to obtain the second output amount.
[0086] In this example, a deep integration of anonymous identity and transaction process is proposed. As a public key identity, at the same time, the IBC algorithm is used to generate the corresponding eighth private key . And, establish the user's real identity With anonymous identity Through the flexibility of the BG algorithm, users can continuously update their anonymous identities and participate in transactions without revealing their true identities.
[0087] In specific transaction scenarios, the transaction sender can use the eighth private key Decrypt the transaction output amount and the anonymous identity of the transaction sender As the receiving address. This mechanism ensures that the identities of both parties remain anonymous during the transaction, enhancing the privacy and security of the transaction.
[0088] In some implementations, legitimacy verification is an important part of the system to ensure the legitimacy of blockchain transactions. In blockchain, transaction records are recorded through a consensus mechanism. In this process, the verifier is mainly responsible for verifying the legitimacy of the identity of the participants and the transaction amount. Identity legitimacy verification mainly involves the legitimacy of the identity of the sender and the receiver. In the UTXO model, the sender uses a private key to verify the legitimacy of the transaction. Unlocking the UTXO input, the validator uses the sender’s anonymous identity public key Verify the legitimacy of the unlocking script signature. Verifying the recipient's address is crucial to preventing fraudulent transactions and potential asset losses. In this scheme, the recipient's anonymous identity public key As the recipient address. is generated by the BG encryption algorithm, and The regulator uses its private key right Therefore, the verifier only needs to use the anonymous public key identity of the recipient The legitimacy of the signature of the unlocking script can be verified.
[0089] The legitimacy verification of the transaction amount includes two aspects: the equivalence of the input and output amounts, and the validity of the output amount range. For each transaction, the verifier first calculates the transaction public key , use this public key to verify the transaction signature The legitimacy of the transaction is ensured to ensure the equivalence of the input and output amounts. At the same time, Bulletproofs zero-knowledge proof technology is used to verify the range of the output amount to ensure that it is within the legal range.
[0090] In some implementations, the micro-monitoring mechanism for transaction data not only ensures the anonymity of the participants, but also facilitates supervision. or , but its true identity or is effectively hidden.
[0091] In specific applications, taking the transaction participant as the transaction recipient as an example, the regulator first uses Verify the legitimacy of identity authentication, and then use the private key of the BG algorithm Decryption , thereby obtaining the true identity of the transaction participants In addition, in order to obtain information on its transaction amount, the regulator uses the IBC algorithm for the receiver. Generate a private key , and use the private key to decrypt To obtain amount information , so that transactions can be reviewed and tracked when necessary.
[0092] In an embodiment of the present invention, a solution for detecting anomalies in transaction data may also be included. In this solution, a model based on a graph neural network (GNN) is used to effectively identify complex transaction behavior patterns and anomalies. The entire process starts with the organization of transaction data. We first convert all transaction information into a graph structure, in which each node represents a transaction entity and the edge describes the transaction relationship between these entities. Both nodes and edges carry attribute information, reflecting specific transaction characteristics, such as the amount, time, frequency and type of the transaction. The core of the model is to use an improved graph neural network to analyze and learn these transaction data. GNN is good at processing data containing structural information. It generates a simplified low-dimensional vector representation by utilizing the attributes of nodes and edges and the relationships between them to capture key patterns and associations in transaction behavior.
[0093] In an embodiment of the present invention, the detailed design of constructing a GNN for anomaly detection model includes the following contents:
[0094] In one embodiment, the above method may also include: the anomaly detection module obtains transaction data from the transaction institution, wherein the transaction data includes the transaction sender and transaction receiver involved in each transaction, the transaction amount and the transaction time; the anomaly detection module constructs a transaction relationship graph based on the transaction data, wherein each node in the transaction relationship graph represents a transaction entity, and the edge between two nodes is used to describe the transaction relationship between two transaction entities corresponding to the two nodes; the anomaly detection module uses a graph neural network to perform feature representation on the transaction relationship graph to obtain feature representations of each node in the transaction relationship graph; the anomaly detection module uses an anomaly scoring function to calculate the feature representation of each node to obtain an anomaly score for each node; the anomaly detection module determines the target abnormal node in each node in the transaction relationship graph based on the anomaly score of each node.
[0095] Exemplarily, the transaction relationship graph can also be called an attribute graph G=(V,E,X). Node V represents the transaction entity, and edge E describes the relationship between them. X is a node attribute matrix representing transaction characteristics (such as amount, time, frequency, type, etc.). The transaction entity can be the transaction receiver or transaction sender mentioned above.
[0096] For example, the anomaly score of each node is , indicating the degree of abnormality. The higher the score, the greater the possibility of abnormality.
[0097] Exemplarily, the formula in the graph neural network is as follows:
[0098]
[0099] in, It is The node feature matrix of the layer, It is The characteristic dimension of the layer, It is The trainable weight matrix of the layer, is an adjacency matrix with self-loops, yes The degree matrix of is an activation function such as ReLU. By adopting the graph neural grid, the model's ability to capture node features and structural information can be enhanced. After the layer, the final node feature representation is obtained .
[0100] After obtaining the feature representation of transaction entities and relationships, the embodiment of the present invention can also introduce an improved anomaly scoring function. Different from the traditional method based on reconstruction error, the scoring function of the embodiment of the present invention comprehensively considers the distance and density information of node embedding.
[0101] In one embodiment, the anomaly scoring function is:
[0102]
[0103] in, Representation Node The abnormal score of Representation Node The neighbor set of Is a node The characteristic representation of Representation Node The feature representation of .
[0104] In this example, the function measures the similarity between a node and its neighbors in the embedding space, where lower scores indicate that the node is The embedding representation of is quite different from its neighboring nodes, which means that the node may be an outlier. In this way, it is possible to more accurately identify abnormal nodes that have large feature differences from surrounding nodes.
[0105] In one embodiment, the loss function used in the training of the graph neural network is:
[0106]
[0107] in, Is a node The abnormal score of is a parameter that controls the scaling of the anomaly score, and V is the set of all nodes in the transaction relationship graph.
[0108] Understandably, the loss function is responsible for optimizing the model parameters to better distinguish between normal and abnormal nodes.
[0109] In this example, the purpose of the loss function is to maximize the score of abnormal nodes while minimizing the score of normal nodes, thereby increasing the score difference between nodes. By directly optimizing the anomaly score, the model can more effectively learn the features that distinguish normal and abnormal nodes.
[0110] According to the above implementation, the embodiments of the present invention have the following beneficial effects:
[0111] 1. The embodiment of the present invention proposes an energy trading solution that can simultaneously protect user privacy and meet regulatory requirements, which not only protects user privacy but also meets regulatory requirements for transactions. While ensuring the privacy of transaction amounts and identities, it enhances the regulatory and compliance capabilities of the system.
[0112] 2. The UTXO transaction model is adopted to reasonably divide the roles of transaction participants, validators and regulators to ensure that transaction data on the blockchain cannot be tampered with. This design further improves the security and transparency of blockchain transactions.
[0113] 3. Introduce graph neural network (GNN) technology into blockchain transaction data, and detect abnormal transaction behaviors by modeling blockchain transaction data. This technology can not only effectively identify potential risky transactions, but also improve the security and compliance of overall transaction activities.
[0114] For the description of specific functions and examples of each module and submodule of the system in the embodiment of the present invention, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0115] According to an embodiment of the present invention, the above method of the present invention can be applied to an electronic device and a readable storage medium.
[0116] Figure 4A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0117] like Figure 4 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0118] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0119] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as an energy trading method. For example, in some embodiments, an energy trading method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of an energy trading method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform an energy trading method in any other appropriate manner (e.g., by means of firmware).
[0120] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0122] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0125] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0126] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An energy trading method, characterized in that: include: The transaction institution receives a first encrypted input amount and a second encrypted input amount for the first energy source from the transaction sender, wherein the first encrypted input amount and the second encrypted input amount are obtained by the transaction sender through a commitment mechanism to encrypt the first input amount and the second input amount; The transaction institution decrypts the first encrypted input amount and the second encrypted input amount to obtain the first input amount and the second input amount, and performs transaction processing on the first input amount and the second input amount to obtain a first output amount for transaction to the transaction recipient and a second output amount for change to the transaction sender; Based on the commitment mechanism, the transaction institution encrypts the first output amount and the second output amount to obtain a first encrypted output amount and a second encrypted output amount; The transaction institution obtains the anonymous identity of the transaction recipient from the regulatory agency, and encrypts the first encrypted output amount based on the anonymous identity of the transaction recipient to obtain a third encrypted output amount; The transaction institution obtains the anonymous identity of the transaction sender from the regulatory agency, and encrypts the second encrypted output amount based on the anonymous identity of the transaction sender to obtain a fourth encrypted output amount; The transaction institution sends the third encrypted output amount to the transaction recipient, and sends the fourth encrypted output amount to the transaction sender, so as to complete the transaction for the first energy source; The anonymous identity of the transaction recipient is generated by the regulatory agency in a first step, wherein the first step includes: The regulatory agency generates three corresponding key pairs for the transaction recipient, wherein a first key pair of the three key pairs includes a first private key and a first public key, a second key pair includes a second private key and a second public key, and a third key pair includes a third public key and a third private key encrypted by the second private key and the third public key; The regulatory agency encrypts the real identity of the transaction recipient based on the first public key to obtain a first partial anonymous identity; The regulatory agency encrypts the first part of the anonymous identity based on the third private key to obtain the second part of the anonymous identity; The regulatory agency combines the first part of the anonymous identity with the second part of the anonymous identity to obtain the anonymous identity of the transaction recipient; The anonymous identity of the transaction sender is generated by the regulatory agency in a second step, wherein the second step includes: The regulatory agency generates three corresponding key pairs for the transaction sender, wherein a fourth key pair of the three key pairs includes a fourth private key and a fourth public key, a fifth key pair includes a fifth private key and a fifth public key, and a sixth key pair includes a sixth public key and a sixth private key encrypted by the fifth private key and the sixth public key; The regulatory agency encrypts the real identity of the transaction sender based on the fourth public key to obtain a third part of the anonymous identity; The regulatory agency encrypts the third part of the anonymous identity based on the sixth private key to obtain a fourth part of the anonymous identity; The regulatory agency combines the third part of the anonymous identity with the fourth part of the anonymous identity to obtain the anonymous identity of the transaction sender.
2. The method according to claim 1, characterized in that Also includes: The transaction recipient obtains the corresponding seventh private key from the regulatory agency based on the anonymous identity of the transaction recipient, wherein the seventh private key is a key generated by the regulatory agency based on the anonymous identity of the transaction recipient and the second private key; The transaction recipient decrypts the received third encrypted output amount based on the seventh private key to obtain the first encrypted output amount; The transaction recipient decrypts the first encrypted output amount based on the commitment mechanism to obtain the first output amount.
3. The method according to claim 1, characterized in that Also includes: The transaction sender obtains the corresponding eighth private key from the regulatory agency based on the anonymous identity of the transaction sender, wherein the eighth private key is a key generated by the regulatory agency based on the anonymous identity of the transaction sender and the fifth private key; The transaction sender decrypts the received fourth encrypted output amount based on the eighth private key to obtain the second encrypted output amount; The transaction sender decrypts the second encrypted output amount based on the commitment mechanism to obtain the second output amount.
4. The method according to any one of claims 1 to 3, characterized in that: Also includes: The anomaly detection module obtains transaction data from the transaction institution, wherein the transaction data includes a transaction sender and a transaction receiver involved in each transaction, a transaction amount, and a transaction time; The anomaly detection module constructs a transaction relationship graph based on the transaction data, wherein each node in the transaction relationship graph represents a transaction entity, and an edge between two nodes is used to describe a transaction relationship between two transaction entities corresponding to the two nodes; The anomaly detection module uses a graph neural network to perform feature representation on the transaction relationship graph to obtain feature representation of each node in the transaction relationship graph; The anomaly detection module uses an anomaly scoring function to calculate the feature representation of each node and obtain the anomaly score of each node; The anomaly detection module determines a target abnormal node at each node in the transaction relationship graph based on the anomaly score of each node.
5. The method according to claim 4, characterized in that The anomaly scoring function is: in, Representation Node The abnormal score of Representation Node The neighbor set of Is a node The characteristic representation of Representation Node The feature representation of .
6. The method according to claim 5, characterized in that The loss function used in the training of the graph neural network is: in, Is a node The abnormal score of is a parameter that controls the scaling of the anomaly score, and V is the set of all nodes in the transaction relationship graph.
7. An electronic device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods of claims 1-6.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are for causing a computer to execute a method according to any one of claims 1-6.
Citation Information
Patent Citations
System and method for information protection
CN110089069A
Business interaction method and device based on block chain network, equipment and storage medium
CN110809000A