Green electricity transaction and settlement data accounting method and system

By simulating power measurement at power gateway nodes and storing evidence on blockchain, the problem of insufficient transparency of link loss in power transactions is solved, and fair settlement and efficient data management in power transactions are achieved.

CN120875869APending Publication Date: 2025-10-31STATE GRID DIGITAL TECHNOLOGY HOLDING CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510935509.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

The existing electricity settlement system lacks a unified mechanism for transparent link loss, which leads to discrepancies between the electricity traded and the electricity received by the power generator and the power consumer, affecting the fairness and efficiency of the transaction, especially in large-scale electricity interaction scenarios.

Method used

The cumulative loss coefficient of the entire network is determined by simulating power measurement based on the internal software function of the power gateway node. The transaction data packet is generated by combining the encrypted data packet of the power generation party and the power consumption party with the actual power consumption, and uploaded to the blockchain for storage. By utilizing the immutability of the blockchain, the centralized management and automatic accounting of power transaction data can be realized.

Benefits of technology

It has enabled fair settlement between the two parties in electricity transactions, improved transaction efficiency, enhanced transaction transparency and trust, and reduced data errors and dispute rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120875869A_ABST
    Figure CN120875869A_ABST
Patent Text Reader

Abstract

The invention provides a green electricity transaction and settlement data accounting method and system. According to the implementation scheme, a power gateway node determines a whole-network accumulated loss coefficient based on input electric energy and output electric energy; the power gateway node packages the accumulated loss coefficient of the whole network, the received encrypted data packet of each power generation party in the first bookkeeping period and the actual power consumption of each power utilization party in the first bookkeeping period to obtain a transaction data packet and uploads the transaction data packet to a block chain; the electricity utilization party obtains and analyzes the transaction data packet from the block chain to obtain an actual received electric quantity ratio; and the power gateway node receives the actual received electric quantity ratio, and uploads the corresponding transaction data packet to the block chain under the condition that the whole network accumulated loss coefficient is matched with the actual received electric quantity ratio, so that the to-be-accounted amount in the corresponding transaction data packet on the block chain is automatically accounted through the smart contract in the second accounting period. The embodiment of the invention can promote the two parties of power transaction to fairly settle the transaction amount and improve the transaction efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power trading technology, and in particular to a method and system for calculating green electricity trading and settlement data. Background Technology

[0002] In response to the energy transition, green power systems are widely used as a key pathway to achieving carbon neutrality. However, in green power systems, resistance and line losses are unavoidable during power transmission. While these power losses are physically measurable, most current electricity settlement systems rely on centralized platforms. Because centralized platforms lack a unified mechanism for transparent link losses, discrepancies between the electricity traded and received by the generator and consumer can easily lead to settlement results that deviate from actual supply and demand, thus undermining the fairness of the transaction.

[0003] Especially in large-scale power interaction scenarios, unequal information structures are more likely to cause disputes and efficiency bottlenecks for multi-party interactions. Summary of the Invention

[0004] This invention provides a method and system for calculating green electricity trading and settlement data, which can solve at least one of the above-mentioned technical problems.

[0005] In a first aspect, embodiments of the present invention provide a method for calculating green electricity transaction and settlement data, including:

[0006] The power gateway node uses internal software functions to simulate power measurement to obtain the input and output power in the first accounting period, and determines the cumulative loss coefficient of the entire network.

[0007] The power gateway node packages the total network cumulative loss coefficient, the encrypted data packets of each power generator in the first accounting period, and the actual electricity consumption of each power consumer in the first accounting period to obtain a transaction data packet, and uploads the transaction data packet to the blockchain.

[0008] During the first accounting period, each electricity user obtains and parses the transaction data packet from the blockchain to obtain decrypted data, and calculates the ratio of the decrypted data to the actual electricity consumption to obtain the ratio of the actual received electricity and sends it to the power gateway node.

[0009] The power gateway node receives the actual received power ratio and uploads the corresponding transaction data packet to the blockchain when the total network loss coefficient matches the actual received power ratio, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through a smart contract during the second accounting period.

[0010] Secondly, embodiments of the present invention provide a calculation device for green electricity transaction and settlement data, comprising:

[0011] The determination module is used by the power gateway node to determine the total network loss coefficient based on the encrypted data packets of each power generator received in the first accounting period and the actual electricity consumption of each power consumer in the first accounting period.

[0012] The first packaging module is used by the power gateway node to package the encrypted data packet, the actual electricity consumption, and the total network loss coefficient to obtain a transaction data packet, and upload the transaction data packet to the blockchain;

[0013] The parsing and calculation module is used to obtain and parse the transaction data packet from the blockchain during the first accounting period, obtain decrypted data, calculate the decrypted data and the actual electricity consumption, obtain the actual received electricity ratio, and send it to the power gateway node.

[0014] The accounting module is used by the power gateway node to receive the actual received power ratio and upload the corresponding transaction data packet to the blockchain when the total network loss coefficient matches the actual received power ratio, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through smart contracts during the second accounting period.

[0015] Thirdly, embodiments of the present invention also provide a green electricity transaction and settlement data accounting system, comprising: at least one processor; and a memory communicatively connected to the at least one processor;

[0016] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in any one of the embodiments of the present invention.

[0017] Fourthly, embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method described in any one of the embodiments of the present invention.

[0018] Using the technical solution of this invention, the power gateway node simulates power measurement through its internal software functions, collecting input and output electrical energy in real time during the first accounting period, and calculating the cumulative loss coefficient of the entire network. Simultaneously, the power gateway node receives encrypted data packets sent by each power generator and the actual electricity consumption sent by each power consumer during the first accounting period. The power gateway node packages the cumulative loss coefficient, encrypted data packets, and actual electricity consumption into a transaction data packet and uploads it to the blockchain. Thus, centralized management and on-chain storage of relevant power transaction data are achieved at the power gateway node, utilizing the immutability of blockchain to provide a reliable data source for subsequent transaction accounting. During the first accounting period, each power consumer obtains the transaction data packet from the blockchain, parses it to obtain decrypted data, calculates the actual received electricity ratio based on the decrypted data and actual electricity consumption, and then sends it to the power gateway node. Subsequently, the power gateway node receives the ratio of actual received electricity from each electricity user during the first accounting period and compares it with the cumulative loss coefficient of the entire network. If the two match, the corresponding transaction data packet is uploaded to the blockchain, allowing the smart contract to automatically calculate the amount to be calculated in the corresponding transaction data packet on the blockchain during the second accounting period. This promotes fair settlement of transaction amounts between the two parties in the power transaction while improving transaction efficiency.

[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0020] The accompanying drawings are provided for a better understanding of this solution and do not constitute a limitation of the invention. Wherein:

[0021] Figure 1 This is a flowchart of a method for calculating green electricity trading and settlement data according to an embodiment of the present invention;

[0022] Figure 2 This is a structural block diagram of a green electricity transaction and settlement data accounting device according to an embodiment of the present invention;

[0023] Figure 3 This is a structural block diagram of the determination module in the green electricity transaction and settlement data accounting device according to an embodiment of the present invention;

[0024] Figure 4 This is a structural block diagram of the parsing and calculation module in the green electricity transaction and settlement data accounting device according to an embodiment of the present invention;

[0025] Figure 5 This is a structural block diagram of the accounting module in a green electricity transaction and settlement data accounting device according to an embodiment of the present invention;

[0026] Figure 6 This is another structural block diagram of the accounting module in the green electricity transaction and settlement data accounting device according to an embodiment of the present invention;

[0027] Figure 7 This is a block diagram of an electronic device used to implement the methods of embodiments of the present invention. Detailed Implementation

[0028] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0029] Figure 1 This is a flowchart of a method for calculating green electricity trading and settlement data according to an embodiment of the present invention.

[0030] like Figure 1 As shown, the accounting method for green electricity trading and settlement data may include:

[0031] S110, the power gateway node uses internal software functions to simulate power measurement to obtain the input and output power in the first accounting period, and determines the cumulative loss coefficient of the entire network.

[0032] S120: The power gateway node packages the total network loss coefficient, the encrypted data packets of each power generator in the first accounting period, and the actual electricity consumption of each power consumer in the first accounting period into a transaction data packet, and uploads the transaction data packet to the blockchain.

[0033] S130, During the first accounting period, each electricity user obtains and parses the transaction data packet from the blockchain to obtain the decrypted data, calculates the ratio of the decrypted data to the actual electricity consumption, and sends it to the power gateway node.

[0034] S140, the power gateway node receives the ratio of actual received electricity and uploads the corresponding transaction data packet to the blockchain when the cumulative loss coefficient of the whole network matches the ratio of actual received electricity, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through smart contract in the second accounting cycle.

[0035] In this embodiment of the invention, regarding power data transmission, the power gateway node uses internal software to simulate power measurement to obtain input and output power data for the first accounting period. Based on the measured input and output power data, the cumulative loss coefficient of the entire network is calculated. It is evident that through precise measurement and calculation, the loss of power during transmission can be accurately quantified, providing reliable data support for power system operation analysis. Regarding electricity data transmission, the electricity user obtains the transaction data packet uploaded by the power gateway node from the blockchain and parses it to obtain decrypted data. Based on the decrypted data and actual electricity consumption data, the actual electricity received ratio of the electricity user in the first accounting period can be calculated. The electricity user has the initiative to verify the data, ensuring the accuracy of their own electricity consumption data and improving the openness and transparency of transactions. After the electricity user uploads the calculated actual electricity received ratio to the power gateway node, the power gateway node compares the losses incurred in power data transmission (cumulative loss coefficient of the entire network) with the losses in electricity data transmission (actual electricity received ratio) to see if they match. Matching the two parties can avoid risks such as falsification of data provided by the power generator or the power consumer, thereby promoting fair settlement of transaction amounts between the two parties in the power transaction and improving transaction efficiency.

[0036] For example, the internal software function simulates power measurement, which refers to a software module pre-installed in the power gateway node for virtually calculating power and energy changes. It does not require additional hardware acquisition devices and can estimate the power change process through system logs, meter data, and power consumption event simulation.

[0037] For example, the transaction data packet is uploaded to all blockchain nodes in the network via a secure software interface, with the power gateway node acting as the blockchain front end. The uploaded transaction data packet must maintain its complete structure and ensure it contains all necessary information (e.g., generator identification, consumer identification, timestamp, actual electricity consumption, cumulative losses, token payment data, etc.). The secure software interface uploads the data to all blockchain nodes in the network, for example, using a peer-to-peer (P2P) network protocol with Transport Layer Security (TLS) encryption.

[0038] For example, since the packaged object of the transaction data packet includes the encrypted data packet transmitted by the power generator, and the encrypted data packet includes original data such as the power generator identifier, the power generation corresponding to the power generator identifier, and power generation equipment information, the decrypted data obtained after decrypting the transaction data packet will necessarily contain the original data such as the power generation of the power generator. In this way, on the one hand, the power consumer independently completes the decryption and ratio calculation based on the transaction data packet obtained from the blockchain, ensuring that it has visibility and verifiability in the entire process of participating in power trading and settlement, thus strengthening the foundation of trust in the transaction; on the other hand, this step gives the power consumer the ability to independently decrypt and calculate, avoiding one-way reliance on the calculation results of the central platform, changing from "passive acceptance" to "active verification," and improving the user's (power consumer's) trust and satisfaction with the system.

[0039] According to the above implementation method, in the power transaction data processing, the power gateway node first collects the input and output electrical energy within the first accounting period through its internal software and calculates the cumulative loss coefficient of the entire network. Then, it integrates this loss coefficient with the encrypted data packet from the power generator and the actual electricity consumption of the power consumer to generate a transaction data packet, which is then uploaded to the blockchain for notarization. The power consumer obtains the transaction data packet from the blockchain, decrypts it, calculates the actual received electricity ratio based on its own actual electricity consumption, and feeds it back to the power gateway node. The gateway node compares this ratio with the cumulative loss coefficient of the entire network for verification. If they match, the transaction data packet is confirmed and uploaded to the blockchain. In the second accounting period, the smart contract automatically calculates the amounts receivable and payable based on this, completing the power transaction settlement. By using blockchain to achieve trusted notarization of data across the entire power generation-transmission-consumption chain, the data reconciliation problem in traditional power transactions is solved. This forms a fully automated power transaction system encompassing "data collection-blockchain notarization-smart contract settlement," providing a reusable technological paradigm for the digital transformation of new power systems.

[0040] In one implementation, the method further includes: each power generator preprocessing its original power data during the first accounting period to obtain first power data corresponding to each power generator during the first accounting period, wherein the first power data includes power generation; each power generator encrypting the first power data using a built-in encryption algorithm to generate a digital signature during the first accounting period; each power generator packaging the digital signature and the first power data during the first accounting period to obtain a standardized transaction data packet; each power generator modulating the standardized transaction data packet using a power line carrier communication protocol during the first accounting period to obtain a power line transmission signal carrying the encrypted data packet; and each power generator transmitting the power line transmission signal to the power gateway node using time division multiple access and code division multiple access technologies during the first accounting period.

[0041] For example, raw power data may include the power generation of the power generator, the time of data collection, the power generation equipment, or the identity information of the power generator.

[0042] For example, the raw power data can be collected from the power generators of various distributed energy systems (such as solar and wind power). Simultaneously, high-precision sensors (such as Rogowski coil current sensors and capacitive voltage sensors) can be used to collect the raw power data from the power generators in real time.

[0043] For example, preprocessing includes data cleaning, outlier filtering, and format standardization. For data cleaning, for example, a median filtering algorithm is used to remove impulse noise from the raw power data. For outlier filtering, for example, a sliding window algorithm is used to smooth out abnormal data (such as instantaneous exceedances), thereby ensuring data validity. For format standardization, for example, the raw power data (such as power generation and other related data) is encapsulated in a uniform data format (such as JSON or XML) to form the first power data.

[0044] For example, digital signatures can be generated using the RSA algorithm, the Digital Signature Algorithm (DSA) algorithm, or the elliptic curve algorithm.

[0045] In this example, at least one power generator transmits data to the power gateway node during the first accounting period. We will use one power generator as an example. The power generator encrypts the first power data using a built-in encryption algorithm (e.g., AES-256), which offers high encryption efficiency and security, effectively protecting data privacy. The encryption key is randomly generated by the power generator's key management system and changed periodically. Subsequently, the symmetric encryption key can be encrypted using the RSA-2048 algorithm to ensure key security. The power generator uses its own RSA private key to sign the encrypted first power data, generating a digital signature. The digital signature not only verifies data integrity but also prevents data tampering and repudiation.

[0046] For example, the power generator encapsulates the digital signature, encrypted first power data, and related metadata (such as generator identifier, data generation time, data type, etc.) according to a predefined data packet format. The data packet format can be JSON or XML, facilitating data parsing and processing. Each power generator standardizes its data packets according to power industry data exchange standards (such as IEC61850 or DL / T 634.5104) to ensure that data packets generated by different power generators have a unified format and specifications, facilitating reception and processing by power gateway nodes. In cross-regional power transactions, power generators in different regions package their data according to a unified standardized transaction data packet format, enabling rapid data connection and sharing, and improving transaction efficiency.

[0047] For example, the process of the power generator modulating standardized transaction data packets can be achieved by encoding the standardized transaction data packets using orthogonal frequency division multiplexing (OFDM) technology, and then selecting a suitable carrier frequency to modulate the encoded signal onto the power line. Depending on the characteristics of the power line, modulation methods such as direct sequence spread spectrum (DSS) or frequency shift keying (FSK) can be used to improve the signal's anti-interference capability and transmission stability. Furthermore, the signal transmission power can be automatically adjusted based on factors such as the power line length and load conditions to ensure that the signal covers the target power gateway node during transmission without causing electromagnetic interference to other equipment.

[0048] For example, each power generator uses Time Division Multiple Access (TDMA) and Code Division Multiple Access (CDMA) technologies to transmit power line transmission signals to the power gateway node, as specifically implemented below:

[0049] Time Division Multiple Access (TDMA): This method divides time into multiple time slots, with each power generator allocated a specific time slot for data transmission. Within its own time slot, the power generator transmits the modulated power line transmission signal to the power line. A precise clock synchronization mechanism ensures that each power generator transmits data in different time slots, avoiding signal collisions.

[0050] Code Division Multiple Access (CDMA): Before transmitting data, the power generator spreads the signal using a unique spreading code. At the receiving end, the power gateway node despreads the received signal using the corresponding spreading code to recover the original data. CDMA technology enables data transmission from multiple power generators simultaneously on the same time and frequency, improving channel utilization.

[0051] It is understood that the steps in this example can be executed before step S110 or between step S110 and step S120. This application does not limit the execution order of this example, as long as the power gateway node in step S120 can receive the encrypted data packets sent to it by each power generator in the first billing period, as well as the actual electricity consumption sent to it by each power consumer in the first billing period.

[0052] In one implementation, the power gateway node simulates power measurement based on internal software functions to obtain the input and output electrical energy within a first billing cycle, and determines the total network cumulative loss coefficient. This includes: the power gateway node simulating the ratio of input and output electrical energy within the first billing cycle based on internal software functions to determine a first calculation result; the power gateway node determining a single-level loss coefficient based on the difference between a preset unit energy threshold and the first calculation result; the power gateway node performing a multiplication operation on the difference between the preset unit energy threshold and the first calculation result to obtain a second calculation result; and the power gateway node determining the total network cumulative loss coefficient based on the difference between the preset unit energy threshold and the second calculation result.

[0053] For example, a gateway node has multiple child nodes. The power gateway node can send data acquisition commands to the sub-measuring devices deployed at various branch nodes of the power grid via the Modbus TCP protocol. During the first billing cycle, each child node independently collects the input and output power data of its local line by simulating power measurement through its internal software functions, and uploads the input and output power data to the gateway node through an encrypted channel. The gateway node sums the input and output power data transmitted by each child node to obtain the input and output power for the first billing cycle.

[0054] In this example, the encrypted channel is, for example, the Secure Sockets Layer (SSL) protocol or the Transport Layer Security (TLS) protocol.

[0055] For example, the preset unit energy threshold is set to 1. The calculation method of the single-stage loss coefficient is expressed mathematically as follows:

[0056]

[0057] Among them, L i P represents the single-stage loss coefficient of the power gateway node numbered i; out To output electrical energy; P in To input electrical energy.

[0058] For example, the calculation method of the total network loss coefficient can be expressed mathematically as follows:

[0059]

[0060] Among them, L total is the total network loss coefficient; n is the number of power gateway nodes participating in power transmission.

[0061] According to the above implementation method, the power gateway node simulates power measurement through internal software to obtain real-time data on input and output electrical energy within the first accounting period. First, the ratio of input to output electrical energy is calculated as an initial parameter. Next, the difference between a preset theoretical threshold per unit of electrical energy and this ratio is used to determine the single-stage loss coefficient of each transmission link. Subsequently, the loss coefficients of each link are multiplied together to obtain an intermediate result reflecting the cumulative effect of losses across the entire network. Finally, the difference between the preset threshold per unit of electrical energy and the intermediate result is calculated to obtain the cumulative loss coefficient of the entire network. By multiplying and accumulating the single-stage loss coefficients of the power gateway nodes at each link, a refined model of complex power grid losses is achieved, significantly improving the accuracy of calculating the cumulative loss coefficient of the entire network.

[0062] In one implementation, during the first accounting period, each electricity user obtains and parses transaction data packets from the blockchain to obtain decrypted data, and calculates the ratio of the decrypted data to the actual electricity consumption to obtain the ratio of the actual received electricity. This includes: during the first accounting period, each electricity user obtains and parses transaction data packets from the blockchain to obtain decrypted data; during the first accounting period, each electricity user determines the ratio of the actual received electricity based on the ratio of the actual electricity consumption to the decrypted data.

[0063] For example, the decrypted data includes raw data such as the power generation of the power generator, the power generator identifier, the power consumer identifier, the transaction number, the timestamp, and other auxiliary information.

[0064] For example, during the first accounting period, at least one power generator and at least one power consumer in the power trading system simultaneously engage in power interaction with the power gateway node, thereby forming at least one power transaction. This example illustrates the situation by having a power generator send power generation data to the power gateway node and a power consumer send actual power consumption data to the power gateway node.

[0065] For example, in the first accounting period, user Li's local smart meter recorded an actual electricity consumption of 100 kWh. Li connects to the community's electricity trading (electricity gateway node) blockchain network via a blockchain client installed on his mobile phone. After identity verification, Li queries and downloads the transaction data packets related to himself for the first accounting period. The client parses and decrypts the data packets, revealing on the blockchain that Li's electricity consumption for that period was 98 kWh. Then, the server on Li's mobile client calculates the ratio of his actual received electricity consumption using the formula 100 ÷ 98 ≈ 1.02. Through this ratio, Li can intuitively understand the difference between the electricity consumption recorded on the blockchain and his actual consumption. If a significant discrepancy is found, he can promptly report it to the electricity gateway node for further verification.

[0066] According to the above implementation method, in the first accounting cycle, the electricity consumer uses a blockchain client to retrieve the corresponding transaction data packet. After data format parsing and encryption decryption, readable original information (i.e., decrypted data) is obtained. Subsequently, the electricity consumer quantitatively compares the actual electricity consumption recorded by the local smart meter with the power generation in the decrypted data to obtain the ratio of the electricity received by the consumer, intuitively presenting the data matching degree. It can be seen that this process constructs a closed-loop mechanism of "self-verification - data calibration." On the one hand, it utilizes the tamper-proof characteristics of blockchain to ensure the credibility of the data source; on the other hand, it grants the electricity consumer direct verification rights, making data errors visible. Compared with the traditional one-way data transmission mode, this can greatly reduce the dispute rate in electricity billing, thereby improving the fairness of electricity transactions.

[0067] In one implementation, the power gateway node receives the ratio of actual received electricity and uploads the corresponding transaction data packet to the blockchain when the cumulative loss coefficient of the entire network matches the ratio of actual received electricity. This enables the smart contract to automatically calculate the amount to be calculated in the corresponding transaction data packet on the blockchain during the second accounting cycle. The calculation includes: the power gateway node determining the electricity loss ratio based on the difference between a preset unit electricity threshold and the ratio of actual received electricity; the power gateway node determining a third calculation result based on the difference between the electricity loss ratio and the cumulative loss coefficient of the entire network; if the third calculation result is less than a preset first threshold, it indicates that the cumulative loss coefficient of the entire network matches the ratio of actual received electricity; and the power gateway node uploading the corresponding transaction data packet to the blockchain when the cumulative loss coefficient of the entire network matches the ratio of actual received electricity.

[0068] For example, the power gateway node determines the power loss ratio based on the difference between a preset unit power threshold and the actual received power ratio, representing the power loss ratio for a single transaction between the power generator and the power consumer. The difference between this single power loss ratio and the cumulative network loss coefficient is compared to a preset first threshold. If the former is less than the latter, it means the cumulative network loss coefficient matches the actual received power ratio. At this point, the power gateway node can upload its corresponding transaction data packet to the blockchain.

[0069] For example, a low-carbon industrial park has integrated a distributed photovoltaic and energy storage system. The park deploys power gateway nodes and uses blockchain for electricity trading and settlement to achieve transparent management and reliable accounting of power generation and consumption data. The park uses a 15-minute accounting cycle for electricity settlement. At 9:15, electricity user A retrieves transaction data packet 'a' from the blockchain and decrypts it, obtaining the power generation (decrypted data) of power generator B during the accounting cycle from 9:00 to 9:15 as 125.00 kWh. At 9:15, electricity user A's local smart meter records show an actual electricity consumption of 118.50 kWh. Based on the ratio of these two data points, the actual received electricity ratio for electricity user A is 0.948. With a preset unit electricity threshold of 1, the electricity loss ratio is 0.052 (1-0.948=0.525). Setting the total network cumulative loss coefficient to 0.034, the third calculation result is 0.018 (0.052-0.034=0.018). The preset first threshold is set to 0.02. Since 0.018 is less than 0.02, the cumulative loss coefficient of the entire network matches the ratio of the actual received electricity. The power gateway node uploads the transaction data packets of electricity user A and power generator B to the blockchain during the accounting period from 9:00 to 9:15.

[0070] For example, the power gateway node determines the power loss ratio based on the difference between a preset unit power threshold and the actual received power ratio, which is the power loss ratio for a single transaction between the power generator and the power consumer. The power loss ratios for all transactions between all power generators and power consumers on the blockchain are calculated using the same method, and then summed to obtain the total power loss ratio on the blockchain. In this example, the requirement for uploading transaction data packets to the blockchain is that the difference between the total power loss ratio and the cumulative loss coefficient across the entire network is less than a preset first threshold.

[0071] For example, the preset first threshold can be flexibly set according to the actual power grid operation conditions (such as a floating tolerance of 1%-3%) to improve the power trading system's ability to adapt to different deployment scenarios.

[0072] According to the above implementation method, the power loss ratio is obtained by the power gateway node based on the difference between a preset unit power threshold and the actual received power ratio. This achieves fine-grained evaluation of power transmission accuracy, relying not only on overall system statistics but also accurately analyzing the energy consumption performance of individual power generators and consumers. It also provides a fairer data basis for subsequent monetary settlement. Introducing local judgment logic (i.e., calculating the difference between the power loss ratio and the cumulative network loss coefficient) under a unified standard (network-wide loss coefficient) improves the robustness and flexibility of the matching mechanism. Then, the calculated third result is compared with a preset first threshold. Under the premise that the preset rule (the power gateway node's difference between the power loss ratio and the cumulative network loss coefficient is less than the preset first threshold) is met, the corresponding transaction data packet is uploaded to the blockchain. This alleviates blockchain resource pressure by uploading only valid and highly consistent transaction packets, improving on-chain efficiency.

[0073] In one implementation, the method further includes: the smart contract determining the theoretical receivable amount for each power generator in the first accounting period based on the product of the target electricity price per unit and the power generation in the corresponding transaction data; the smart contract determining the loss amount for each power generator in the first accounting period based on the product of the target electricity price per unit, the power generation in the corresponding transaction data, and the cumulative loss coefficient of the entire network; the smart contract determining the target receivable amount for each power generator in the first accounting period based on the difference between the theoretical receivable amount and the loss amount; the smart contract determining the target payable amount for each electricity consumer in the first accounting period based on the product of the actual electricity consumption and the target electricity price per unit; and automatically deducting the target payable amount from the electricity consumer's account and transferring the target receivable amount to the power generator's account through the smart contract in the second accounting period.

[0074] For example, a smart contract reads the power generation data of each power generator within the first accounting period from the transaction data packets stored on the blockchain, and simultaneously obtains the pre-set target electricity price stored on the blockchain. For instance, in an Ethereum-based electricity trading platform, the smart contract obtains the relevant data by calling the getPowerGeneration() and getTargetPrice() functions.

[0075] For example, the smart contract performs a multiplication operation on each power generator, i.e., theoretical receivable amount = target electricity price × power generation. By traversing the list of power generators, the theoretical receivable amount for each power generator in the current accounting period is calculated sequentially, and the result is temporarily stored in an internal variable of the contract.

[0076] For example, the smart contract retrieves the total network loss coefficient for the first accounting period from the blockchain. This coefficient is calculated and stored on the blockchain by the power gateway node. For each power generator, the smart contract executes the formula: Loss Amount = Target Electricity Price × Power Generation × Total Network Loss Coefficient. Similarly, by traversing the list of power generators, the loss amount for each generator is calculated, and the calculation results are stored. Subsequently, based on the theoretical receivable amount and the loss amount, the target receivable amount is calculated, and the final calculated target receivable amount is updated in the account record corresponding to the power generator in the contract.

[0077] For example, the smart contract reads the actual electricity consumption data of each electricity user within the first accounting period from the blockchain transaction data packet. For each electricity user, it performs the calculation: Target Payable Amount = Actual Electricity Consumption × Target Electricity Price, and records the result in the electricity user's account information within the contract.

[0078] For example, at the start of the second accounting cycle, the smart contract is automatically triggered. The corresponding target amount payable is deducted from each electricity consumer's account, and the corresponding amount is transferred to each power generator's account. Taking an Ethereum smart contract as an example, the transfer() function is used to transfer Ether (or tokens representing the value of electricity) between accounts, completing the automated settlement process. The smart contract automatically executes the entire process from data acquisition and amount calculation to transfer settlement, without human intervention. Compared to traditional manual settlement, this significantly improves efficiency, shortens the settlement cycle, and reduces labor costs.

[0079] For example, suppose in a regional green electricity trading network, the target electricity price is 0.5 tokens / kWh in the first accounting period. Power generator A generates 10,000 kWh, power generator B generates 8,000 kWh, and the total network loss coefficient is 0.05; power consumer C consumes 6,000 kWh, and power consumer D consumes 4,000 kWh.

[0080] Based on the calculation method described above, the transaction amounts for each party are calculated as follows:

[0081] The theoretical amount receivable by power generator A = 0.5 × 10000 = 5000 tokens, the loss amount = 0.5 × 10000 × 0.05 = 250 tokens, and the target amount receivable = 5000 - 250 = 4750 tokens.

[0082] The theoretical amount receivable by power generator B = 0.5 × 8000 = 4000 tokens, the loss amount = 0.5 × 8000 × 0.05 = 200 tokens, and the target amount receivable = 4000 - 200 = 3800 tokens.

[0083] The target amount payable by electricity user C = 0.5 × 6000 = 3000 tokens.

[0084] The target amount payable by electricity user D = 0.5 × 4000 = 2000 tokens.

[0085] In the second accounting cycle, the smart contract automatically deducted 3,000 tokens from electricity consumer C's account, 2,000 tokens from electricity consumer D's account, and transferred 4,750 tokens to power generator A's account and 3,800 tokens to power generator B's account, completing the transaction settlement.

[0086] According to the above implementation method, in the electricity transaction settlement process, smart contracts undertake the core calculation and execution functions. First, the smart contract retrieves the pre-set target electricity price for the first accounting period, combines it with the power generation data stored on the blockchain, and calculates the theoretical amount due for each power generator through multiplication. Then, the smart contract multiplies the target electricity price, power generation, and the cumulative loss coefficient of the entire network to accurately calculate the amount of loss incurred by the power generator due to power transmission losses. Based on this, the loss amount is subtracted from the theoretical amount due to determine the final target amount due to the power generator. Simultaneously, the smart contract calculates the target amount payable by each power user based on their actual electricity consumption and the target electricity price. When the second accounting period begins, the smart contract automatically triggers the transfer procedure, deducting the corresponding amount from the power user's account and transferring the funds to the power generator's account, completing the entire transaction settlement process. Calculating the power generator's loss amount based on the cumulative loss coefficient of the entire network ensures that the power generator's revenue takes into account actual transmission losses, while the power user pays according to actual electricity consumption, thus ensuring fair protection of the rights and interests of both parties and making the settlement process transparent and traceable.

[0087] In one implementation, when the ratio of the cumulative network loss coefficient to the actual received electricity matches, the power gateway node uploads the corresponding transaction data packet to the blockchain. This includes: transferring the transaction data packet matching the ratio of the cumulative network loss coefficient to the actual received electricity to the software memory pool, and simultaneously automatically verifying the transaction data in the transaction data packet (format, signature, data range, etc.). Only transaction data packets that pass verification are retained in the memory pool. Subsequently, the power gateway node broadcasts the transaction data of the transaction data packet to the entire network via a P2P network, ensuring that all power gateway nodes maintain data synchronization.

[0088] For example, the block-producing node responsible for producing blocks selects a batch of transaction data from the software memory pool and packages it. The transaction data is sorted according to preset rules (such as transaction time and priority), then a Merkle tree is constructed, and a unique Merkle root is calculated to verify the integrity of all transaction data within the block.

[0089] The block-producing node constructs the block header of a new block, which includes: the hash of the previous block (to ensure the chain structure); the current timestamp; a nonce (used for the consensus mechanism); Merkle root; and other auxiliary information (such as the current accounting cycle identifier, the current electricity price, etc.).

[0090] Subsequently, a consensus algorithm is used to determine the ledger keeper, who then generates a new block and broadcasts it across the entire network via a P2P network. Upon receiving a new block, each power gateway node first verifies the block header and all transaction data within it to ensure that each record (including power generation, actual electricity consumption, total network losses, token payment information, etc.) conforms to preset rules. After successful verification, the power gateway node appends the new block to its local blockchain and updates the overall network ledger status.

[0091] For example, the entire blockchain incorporates a multi-layered verification mechanism to ensure the authenticity and validity of each transaction and settlement result. Verification primarily includes:

[0092] First-level verification: After statistically analyzing all transactions across the network, check whether the power generation (after loss compensation) is strictly equal to the power consumption.

[0093] The second layer of verification involves aggregating all transaction data across the entire network to ensure that the total amount of tokens paid by the electricity user matches the total amount of tokens received by the power generator.

[0094] The third layer of verification involves checking the transaction records of each individual participant to ensure that their token expenditures or income match the actual electricity data.

[0095] These verifications are all automatically completed by blockchain nodes through a consensus mechanism and are verified in real time by software, ensuring that the ledger data is tamper-proof and completely open and transparent.

[0096] According to the above implementation method, after verification and settlement, the newly generated blocks and smart contract execution results will be synchronously updated by all power gateway nodes across the network. Power gateway nodes maintain ledger data consistency through a P2P network, allowing any power gateway node to query the latest transaction records and token settlement status in real time, achieving network-wide data sharing and transparent management. All on-chain transaction records, settlement information, and verification results are permanently stored in the blockchain, and any participant or regulatory agency can view and verify transaction and settlement details through the system's query interface. This not only enhances the transparency of the green electricity trading system but also provides data evidence for potential future disputes.

[0097] Figure 2 This is a structural block diagram of a green electricity transaction and settlement data accounting device according to an embodiment of the present invention.

[0098] like Figure 2As shown, the calculation device for green electricity trading and settlement data may include:

[0099] The determination module 510 is used by the power gateway node to determine the total network loss coefficient based on the encrypted data packets of each power generator received in the first accounting period and the actual electricity consumption of each power consumer in the first accounting period.

[0100] The first packaging module 520 is used by the power gateway node to package the encrypted data packet, the actual power consumption, and the total network loss coefficient to obtain a transaction data packet, and upload the transaction data packet to the blockchain;

[0101] The parsing and calculation module 530 is used to obtain and parse the transaction data packet from the blockchain during the first accounting period, obtain decrypted data, calculate the decrypted data and the actual electricity consumption, obtain the actual received electricity ratio, and send it to the power gateway node.

[0102] The accounting module 540 is used by the power gateway node to receive the actual received power ratio and upload the corresponding transaction data packet to the blockchain when the total network loss coefficient matches the actual received power ratio, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through smart contract during the second accounting period.

[0103] In some embodiments, the green electricity transaction and settlement data processing device further includes:

[0104] The preprocessing module is used to preprocess the original power data of each power generator in the first accounting period to obtain the first power data corresponding to each power generator in the first accounting period, wherein the first power data includes the amount of power generated.

[0105] The encryption module is used by each power generator to encrypt the first power data using a built-in encryption algorithm during the first accounting period, and generate a digital signature.

[0106] The standardized transaction data packet module is used to package the digital signature and the first power data by each power generator in the first accounting period to obtain a standardized transaction data packet.

[0107] The modulation module is used to modulate the standardized transaction data packets by each power generator through the power line carrier communication protocol during the first accounting period to obtain a power line transmission signal carrying the encrypted data packets.

[0108] The transmission module is used by each power generator to transmit the power line transmission signal to the power gateway node using time division multiple access and code division multiple access technologies during the first accounting period.

[0109] In some embodiments, such as Figure 3 As shown, the determining module 510 includes:

[0110] The first determining unit 511 is used to determine the first calculation result based on the ratio of input power to output power obtained by the power gateway node from the power measurement simulation based on the internal software function within the first accounting period.

[0111] The second determining unit 512 is used to determine the single-level loss coefficient of the power gateway node based on the difference between the preset unit energy threshold and the first calculation result;

[0112] The multiplication unit 513 is used by the power gateway node to perform a multiplication operation on the difference between the preset unit energy threshold and the first calculation result to obtain a second calculation result;

[0113] The third determining unit 514 is used by the power gateway node to determine the total network cumulative loss coefficient based on the difference between the preset unit energy threshold and the second calculation result.

[0114] In some embodiments, such as Figure 4 As shown, the analytical calculation module 530 includes:

[0115] The parsing unit 531 is used to obtain and parse the transaction data packet from the blockchain during the first accounting period to obtain decrypted data.

[0116] The fourth determining unit 532 is used to determine the actual received electricity ratio based on the ratio of the actual electricity consumption to the decrypted data for each electricity user during the first accounting period.

[0117] In some embodiments, such as Figure 5 As shown, the accounting module 540 includes:

[0118] The power loss ratio determination unit 541 is used by the power gateway node to determine the power loss ratio based on the difference between a preset unit power threshold and the actual received power ratio.

[0119] The third calculation result determination unit 542 is used by the power gateway node to determine the third calculation result based on the difference between the power loss ratio and the total network cumulative loss coefficient;

[0120] The matching unit 543 is used to indicate that the total network cumulative loss coefficient matches the ratio of the actual received power if the third calculation result is less than a preset first threshold.

[0121] Upload unit 544 is used by the power gateway node to upload the corresponding transaction data packet to the blockchain when the cumulative loss coefficient of the entire network matches the ratio of the actual received electricity.

[0122] In some embodiments, such as Figure 6 As shown, the accounting module 540 further includes:

[0123] The theoretical receivable amount determination unit 545 is used by the smart contract to determine the theoretical receivable amount of each power generator in the first accounting period based on the product of the target electricity unit price in the first accounting period and the power generation in the corresponding transaction data.

[0124] The loss amount determination unit 546 is used by the smart contract to determine the loss amount of each power generator in the first accounting period based on the product of the target electricity unit price in the first accounting period, the power generation in the corresponding transaction data, and the cumulative loss coefficient of the entire network.

[0125] The target receivable amount determination unit 547 is used by the smart contract to determine the target receivable amount for each power generator in the first accounting period based on the difference between the theoretical receivable amount and the loss amount.

[0126] The target payable amount determination unit 548 is used by the smart contract to determine the target payable amount for each electricity user in the first accounting period based on the product of the actual electricity consumption and the target electricity unit price.

[0127] The deduction transfer unit 549 is used to automatically deduct the target payable amount from the electricity consumer's account through the smart contract during the second accounting cycle, and to transfer the target receivable amount to the power generator's account.

[0128] The specific functions and examples of each module and submodule of the system in this embodiment of the invention can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.

[0129] The acquisition, storage, and application of user personal information involved in the technical solution of this invention all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0130] This invention also provides an accounting system for green electricity trading and settlement data, comprising:

[0131] At least one processor; and a memory communicatively connected to said at least one processor;

[0132] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in any one of the embodiments of the present invention.

[0133] The beneficial effects of the green electricity transaction and settlement data accounting system of this invention are equivalent to the beneficial effects of the green electricity transaction and settlement data accounting method described above, and will not be repeated here.

[0134] This invention also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method described in any one of the embodiments of this invention.

[0135] The beneficial effects of the storage medium of the present invention are equivalent to the beneficial effects of the above-mentioned green electricity transaction and settlement data accounting method, and will not be repeated here.

[0136] According to embodiments of the present invention, the present invention also provides a system and a readable storage medium.

[0137] Figure 7 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments 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 may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0138] like Figure 7 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0139] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0140] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the method for calculating green electricity transaction and settlement data. For example, in some embodiments, the method for calculating green electricity transaction and settlement data can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the method for calculating green electricity transaction and settlement data described above can be performed. Alternatively, in other embodiments, the computing unit 801 may be configured in any other suitable manner (e.g., by means of firmware) to perform a method for calculating green electricity transaction and settlement data.

[0141] Various embodiments 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0142] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0143] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0144] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).

[0145] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0146] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0147] 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 this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.

[0148] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for calculating green electricity trading and settlement data, characterized in that, include: The power gateway node uses internal software functions to simulate power measurement to obtain the input and output power in the first accounting period, and determines the cumulative loss coefficient of the entire network. The power gateway node packages the total network cumulative loss coefficient, the encrypted data packets of each power generator in the first accounting period, and the actual electricity consumption of each power consumer in the first accounting period to obtain a transaction data packet, and uploads the transaction data packet to the blockchain. During the first accounting period, each electricity user obtains and parses the transaction data packet from the blockchain to obtain decrypted data, and calculates the ratio of the decrypted data to the actual electricity consumption to obtain the ratio of the actual received electricity and sends it to the power gateway node. The power gateway node receives the actual received power ratio and uploads the corresponding transaction data packet to the blockchain when the total network loss coefficient matches the actual received power ratio, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through a smart contract during the second accounting period.

2. The method according to claim 1, characterized in that, Also includes: During the first accounting period, each power generator preprocesses its original power data to obtain the first power data corresponding to each power generator during the first accounting period, wherein the first power data includes the amount of power generated. During the first accounting period, each power generator encrypts the first power data using a built-in encryption algorithm to generate a digital signature; During the first accounting period, each power generator packages the digital signature and the first power data to obtain a standardized transaction data package. During the first accounting period, each power generator modulates the standardized transaction data packet through the power line carrier communication protocol to obtain a power line transmission signal carrying the encrypted data packet; During the first accounting period, each power generator uses Time Division Multiple Access (TDMA) and Code Division Multiple Access (CDMA) technologies to transmit the power line transmission signal to the power gateway node.

3. The method according to claim 1, characterized in that, The power gateway node uses internal software to simulate power measurement to obtain the input and output power during the first accounting period, and determines the cumulative loss coefficient of the entire network, including: The power gateway node determines the first calculation result based on the ratio of input power to output power obtained from power measurement in the first accounting period using the internal software function. The power gateway node determines the single-level loss coefficient based on the difference between a preset unit energy threshold and the first calculation result; The power gateway node performs a multiplication operation on the difference between the preset unit energy threshold and the first calculation result to obtain a second calculation result; The power gateway node determines the total network loss coefficient based on the difference between the preset unit energy threshold and the second calculation result.

4. The method according to claim 1, characterized in that, During the first accounting period, each electricity user obtains and parses the transaction data packet from the blockchain to obtain decrypted data. The decrypted data and the actual electricity consumption are then used to calculate the ratio of actual received electricity, including: During the first accounting period, each electricity consumer obtains and parses the transaction data packet from the blockchain to obtain decrypted data; During the first accounting period, each electricity user determines the actual received electricity ratio based on the ratio of the actual electricity consumption to the decrypted data.

5. The method according to claim 1, characterized in that, The power gateway node receives the actual received power ratio and, if the total network loss coefficient matches the actual received power ratio, uploads the corresponding transaction data packet to the blockchain. This enables the smart contract to automatically calculate the amount to be calculated in the corresponding transaction data packet on the blockchain during the second accounting cycle, including: The power gateway node determines the power loss ratio based on the difference between a preset unit power threshold and the actual received power ratio. The power gateway node determines the third calculation result based on the difference between the power loss ratio and the total network loss coefficient; If the third calculation result is less than the preset first threshold, it means that the total network loss coefficient matches the ratio of the actual received power. When the cumulative loss coefficient of the entire network matches the ratio of the actual received electricity, the power gateway node uploads the corresponding transaction data packet to the blockchain.

6. The method according to claim 5, characterized in that, Also includes: The smart contract determines the theoretical amount receivable by each power generator in the first accounting period based on the product of the target electricity price per unit and the power generation in the corresponding transaction data. The smart contract determines the loss amount for each power generator in the first accounting period based on the product of the target electricity price per unit in the first accounting period, the power generation in the corresponding transaction data, and the cumulative loss coefficient of the entire network. The smart contract determines the target receivable amount for each power generator in the first accounting period based on the difference between the theoretical receivable amount and the loss amount. The smart contract determines the target payable amount for each electricity user within the first accounting period based on the product of the actual electricity consumption and the target electricity price per unit. During the second accounting cycle, the smart contract automatically deducts the target amount due from the electricity consumer's account and transfers the target amount receivable to the power generator's account.

7. A device for calculating green electricity trading and settlement data, characterized in that, include: The determination module is used by the power gateway node to determine the total network loss coefficient based on the encrypted data packets of each power generator received in the first accounting period and the actual electricity consumption of each power consumer in the first accounting period. The first packaging module is used by the power gateway node to package the encrypted data packet, the actual electricity consumption, and the total network loss coefficient to obtain a transaction data packet, and upload the transaction data packet to the blockchain; The parsing and calculation module is used to obtain and parse the transaction data packet from the blockchain during the first accounting period, obtain decrypted data, calculate the decrypted data and the actual electricity consumption, obtain the actual received electricity ratio, and send it to the power gateway node. The accounting module is used by the power gateway node to receive the actual received power ratio and upload the corresponding transaction data packet to the blockchain when the total network loss coefficient matches the actual received power ratio, so that the amount to be calculated in the corresponding transaction data packet on the blockchain can be automatically calculated through smart contracts during the second accounting period.

8. The apparatus according to claim 7, characterized in that, Also includes: The preprocessing module is used to preprocess the original power data of each power generator in the first accounting period to obtain the first power data corresponding to each power generator in the first accounting period, wherein the first power data includes the amount of power generated. The encryption module is used by each power generator to encrypt the first power data using a built-in encryption algorithm during the first accounting period, and generate a digital signature. The standardized transaction data packet module is used to package the digital signature and the first power data by each power generator in the first accounting period to obtain a standardized transaction data packet. The modulation module is used to modulate the standardized transaction data packets by each power generator through the power line carrier communication protocol during the first accounting period to obtain a power line transmission signal carrying the encrypted data packets. The transmission module is used by each power generator to transmit the power line transmission signal to the power gateway node using time division multiple access and code division multiple access technologies during the first accounting period.

9. A system for calculating green electricity trading and settlement data, comprising: At least one processor, and a memory communicatively connected to said at least one processor; The memory stores instructions that can be executed by the at least one processor. The processor retrieves the instructions from the memory and executes the instructions so that the at least one processor can execute the accounting method for green electricity transaction and settlement data according to any one of claims 1-6.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.