Search

CN-122022793-A - Peer-to-peer power transaction settlement method and system based on alliance chain

CN122022793ACN 122022793 ACN122022793 ACN 122022793ACN-122022793-A

Abstract

The invention belongs to the technical field of settlement, and particularly relates to a peer-to-peer power transaction settlement method and system based on a alliance chain, comprising the following steps of S1, acquiring power transaction data to be settled, wherein the power transaction data at least comprises key grades, transaction electric quantity, transaction price and transaction time of both transaction parties; and S2, verifying the reliability and the power grid role identity according to the historical transaction of each consensus node, calculating to obtain the consensus weight of each consensus node, calculating to obtain the whole-network consensus health according to the whole-network distribution of the consensus weights, and taking the whole-network consensus health as an adjusting factor. According to the invention, false or error transactions which do not accord with rules can be filtered before the data is linked, the authenticity and reliability of the linked power transaction data are ensured from the source, and the potential operation risk of a power grid is avoided.

Inventors

  • PAN XIN
  • WANG JING
  • Jiao Haiyun
  • MA YAN

Assignees

  • 腾奥(宁夏)新能源科技有限公司

Dates

Publication Date
20260512
Application Date
20260128

Claims (10)

  1. 1. A peer-to-peer power transaction settlement method based on a alliance chain is characterized by comprising the following steps: s1, acquiring to-be-settled power transaction data at least comprising transaction parties, key grades of the transaction parties, transaction electric quantity, transaction price and transaction time; s2, calculating the consensus weight of each consensus node according to the historical transaction verification reliability of each consensus node and the identity of the power grid role, calculating the whole network consensus health according to the whole network distribution of the consensus weight, and calculating a voting threshold value required by generating the round of consensus by taking the whole network consensus health as an adjusting factor and combining the transaction amount determined by the transaction electric quantity and the transaction price and the key grade of the two transaction parties; S3, selecting a master node from a set of candidate master nodes by adopting a verifiable random function in combination with the recent transaction initiation amount of the node, packaging the power transaction data to be settled into a pre-preparation message by the master node and broadcasting the pre-preparation message to the whole network; And S4, broadcasting preparation messages to the whole network through consensus nodes of the first-stage grammar verification and the second-stage physical rationality verification, and when any consensus node receives a group of preparation messages and the consensus weight accumulated value corresponding to a message sender is greater than or equal to a voting threshold value, generating a block containing to-be-settled power transaction data and recording the block to a alliance chain.
  2. 2. The federation-chain-based peer-to-peer power transaction settlement method according to claim 1, wherein the calculating the consensus weight of each consensus node according to the historical transaction verification reliability and the grid role identity of each consensus node comprises: according to the transaction verification success rate of each consensus node in a preset history period, calculating to obtain the history transaction verification reliability; Based on consensus nodes Setting a corresponding identity reference value for the consensus node; Obtaining consensus nodes through weighting historical transaction verification reliability and identity reference value Is a common weight of (a) 。
  3. 3. The peer-to-peer power transaction settlement method based on a coalition chain according to claim 2, wherein the calculating the overall network consensus health according to the overall network distribution of the consensus weights, and calculating the voting threshold required for generating the round of consensus by using the overall network consensus health as an adjusting factor and combining the transaction amount determined by the transaction electric quantity and the transaction price and the key grades of the two transaction parties, comprises: Standard deviation of consensus weights As a quantization index of distribution dispersion and according to Calculating to obtain the total network consensus health degree Wherein Is the average value of the consensus weights of the whole network; calculating a transaction amount influence factor according to the transaction amount determined by the transaction electric quantity and the transaction price ; Setting a security factor for a transaction based on the highest key level of both parties to the transaction ; Total weight of knowledge combined with whole network Is set in a preset basic proportion of (2) Transaction amount influencing factor Safety factor Full network consensus health The voting threshold T is calculated and generated by the following formula: 。
  4. 4. The federation-chain-based peer-to-peer power transaction settlement method according to claim 1, wherein the electing of a master node from a set of candidate master nodes using a verifiable random function in combination with a node recent transaction initiation amount comprises: determining election weight according to transaction initiation amount of each candidate master node in recent time window ; Each alternative master node j runs a verifiable random function to generate random numbers And (5) proving; According to Calculating a ranking value And selecting the consensus node with the smallest ranking value as the master node.
  5. 5. The federation-chain-based peer-to-peer power transaction settlement method according to claim 1, wherein performing a first stage syntax verification including transaction signature and data format compliance verification comprises: Verifying the digital signature of the transaction data by using an asymmetric encryption algorithm, so as to ensure the source and the integrity; and verifying that the transaction data structure accords with a preset format, and ensuring the integrity and the correctness of the key field.
  6. 6. The alliance chain-based peer-to-peer power transaction settlement method according to claim 1, wherein the second stage of physical rationality verification for verifying the transaction electric quantity by using a preset power grid topology constraint and a power generation and power consumption curve model comprises the following steps: Based on a preset power grid topology, checking that a power transmission path communicated between two transaction parties exists and the line power flow after the transaction electric quantity is counted does not exceed a preset safety limit value; And verifying that the current transaction electric quantity is within the available margin of each party at the transaction moment according to the planned power generation curve of the power selling party and the planned power consumption curve of the power buying party.
  7. 7. The peer-to-peer power transaction settlement method based on a federation chain according to claim 1, wherein when any one of the consensus nodes receives a set of preparation messages and a consensus weight accumulated value corresponding to a message sender is greater than or equal to a voting threshold, generating a block containing power transaction data to be settled and recording the block to the federation chain, comprising: Any consensus node collects the preparation messages which are for the same preparation message and pass the two-stage verification; And accumulating the consensus weights of the message senders in real time, and when the accumulated weights reach or exceed the voting threshold value for the first time, the consensus node confirms that the consensus is achieved, generates a new block containing the power transaction data to be settled and records the new block in the alliance chain.
  8. 8. A peer-to-peer power transaction settlement system based on a coalition chain, comprising the following modules: The acquisition module is used for acquiring to-be-settled power transaction data at least comprising transaction parties, key grades of the transaction parties, transaction electric quantity, transaction price and transaction time; The calculation module is used for calculating the consensus weight of each consensus node according to the historical transaction verification reliability of each consensus node and the identity of the power grid role, calculating the whole network consensus health according to the whole network distribution of the consensus weight, and calculating the voting threshold value required by generating the round of consensus by taking the whole network consensus health as an adjusting factor and combining the transaction amount determined by the transaction electric quantity and the transaction price and the key grade of the two transaction parties; The system comprises an execution module, a first-stage grammar verification module, a second-stage physical rationality verification module, a power generation and utilization curve model, a power generation module and a power generation module, wherein the execution module is used for selecting a master node from an alternative master node set by adopting a verifiable random function in combination with the recent transaction initiation quantity of nodes, and the master node packages power transaction data to be settled into a pre-preparation message and broadcasts the pre-preparation message to the whole network; The generation module is used for broadcasting the preparation message to the whole network through the consensus nodes of the first-stage grammar verification and the second-stage physical rationality verification, and when any consensus node receives a group of preparation messages and the consensus weight accumulated value corresponding to the message sender is greater than or equal to the voting threshold value, a block containing the electric power transaction data to be settled is generated and recorded to the alliance chain.
  9. 9. The system of claim 8, wherein calculating the consensus weight for each consensus node based on the historical transaction verification reliability and the grid role identity for each consensus node comprises: according to the transaction verification success rate of each consensus node in a preset history period, calculating to obtain the history transaction verification reliability; Based on consensus nodes Setting a corresponding identity reference value for the consensus node; Obtaining consensus nodes through weighting historical transaction verification reliability and identity reference value Is a common weight of (a) 。
  10. 10. The system of claim 8, wherein the calculating the overall network consensus health from the overall network distribution of consensus weights and using the overall network consensus health as an adjustment factor, in combination with the transaction amount determined by the transaction electricity and the transaction price, and the key level of the transaction parties, calculates a voting threshold required to generate the current round of consensus, comprises: Standard deviation of consensus weights As a quantization index of distribution dispersion and according to Calculating to obtain the total network consensus health degree Wherein Is the average value of the consensus weights of the whole network; calculating a transaction amount influence factor according to the transaction amount determined by the transaction electric quantity and the transaction price ; Setting a security factor for a transaction based on the highest key level of both parties to the transaction ; Total weight of knowledge combined with whole network Is set in a preset basic proportion of (2) Transaction amount influencing factor Safety factor Full network consensus health The voting threshold T is calculated and generated by the following formula: 。

Description

Peer-to-peer power transaction settlement method and system based on alliance chain Technical Field The invention belongs to the technical field of settlement, and particularly relates to a peer-to-peer power transaction settlement method and system based on a alliance chain. Background Peer-to-peer P2P power trading modes are emerging allowing power trading between producers and consumers. The mode can promote the in-situ digestion of renewable energy sources and improve the energy utilization efficiency. By constructing the decentralized ledger, the blockchain can record and settle the transaction in a trusted way, so that the dependence on the traditional centralized mechanism is reduced, the transaction cost and trust risk are reduced, and the blockchain technology can be used as a bottom technology support for guaranteeing the decentralized, transparent, traceable and safe of the P2P power transaction. Consensus algorithms such as the bayer fault tolerant BFT or the practical variants PBFT are employed to ensure consistency and non-tamper ability of transaction data. The existing blockchain consensus mechanism applied to electric power transaction often regards all participating nodes as homogeneous entities, for example, although patent CN202511156655.2 adopts blockchains to conduct transaction guarantee according to identity information, more identity abnormal information is adopted, however, roles, importance and historical reputation differences of different market subjects in a power grid make it difficult to optimize the security and efficiency of the system, and even there may be a risk that a few key nodes are attacked by a large number of non-key nodes in a combined way. The decision condition for consensus achievement typically employs a voting threshold, e.g., more than two-thirds of node agreements, that do not permit more stringent consensus checks for transactions involving critical users or large amounts of electricity. The existing verification flow is mainly focused on grammar verification of digital layers such as transaction signature, account balance and the like, and generally lacks verification links for transaction data rationality, namely, the feasibility of the transaction cannot be verified by combining with rules such as topological structure of a power grid, line tide constraint, power generation power characteristics and the like, so that the stable operation of an electric power market is affected. Disclosure of Invention The invention provides a peer-to-peer power transaction settlement method and system based on a alliance chain, which are used for solving the technical problems that a P2P power transaction block chain consensus mechanism is homogeneous, key nodes are easy to attack and the transaction is not combined with the power grid physical constraint verification in the prior art. In a first aspect, the present invention provides a peer-to-peer power transaction settlement method based on a coalition chain, comprising the steps of: s1, acquiring to-be-settled power transaction data at least comprising transaction parties, key grades of the transaction parties, transaction electric quantity, transaction price and transaction time; s2, calculating the consensus weight of each consensus node according to the historical transaction verification reliability of each consensus node and the identity of the power grid role, calculating the whole network consensus health according to the whole network distribution of the consensus weight, and calculating a voting threshold value required by generating the round of consensus by taking the whole network consensus health as an adjusting factor and combining the transaction amount determined by the transaction electric quantity and the transaction price and the key grade of the two transaction parties; S3, selecting a master node from a set of candidate master nodes by adopting a verifiable random function in combination with the recent transaction initiation amount of the node, packaging the power transaction data to be settled into a pre-preparation message by the master node and broadcasting the pre-preparation message to the whole network; And S4, broadcasting preparation messages to the whole network through consensus nodes of the first-stage grammar verification and the second-stage physical rationality verification, and when any consensus node receives a group of preparation messages and the consensus weight accumulated value corresponding to a message sender is greater than or equal to a voting threshold value, generating a block containing to-be-settled power transaction data and recording the block to a alliance chain. The method has the advantages that a multi-dimensional dynamic defense system is built, firstly, the limitation of traditional one-ticket one-weight is broken through by introducing a weight computing mechanism based on historical reputation and power grid role identities, the expertise of key nodes suc