Energy resource transfer method and device based on smart contract and computer device

By optimizing the transfer of energy resources in microgrids through smart contracts and distributed gradient descent, the problem of imbalance between resource supply and demand is solved, the security, fairness and timeliness of microgrids are improved, and dynamic equilibrium of resource interaction is achieved.

CN123180551APending Publication Date: 2026-11-27FOSHAN POWER SUPPLY BUREAU GUANGDONG POWER GRID
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611127969.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, the imbalance between the supply and demand attributes of energy resources transferred through microgrids leads to problems with security, fairness, and timeliness.

Method used

By constructing an energy resource transfer method based on smart contracts, and utilizing blockchain smart contracts and distributed gradient descent, the supply and demand balance of energy resources is optimized, achieving dynamic equilibrium of resource supply and demand attributes.

Benefits of technology

It achieves dynamic balance of resource supply and demand attributes, improves the security, fairness and timeliness of microgrid resource interaction, and avoids global paralysis caused by the failure of the central node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180551A_ABST
    Figure CN123180551A_ABST
Patent Text Reader

Abstract

The application relates to an energy resource transfer method and device based on a smart contract and a computer device. The method comprises the following steps: obtaining resource supply attribute parameters submitted by a resource providing node to a blockchain for energy resources to be transferred, and resource demand attribute parameters submitted by a resource demand node to the blockchain; inputting the resource supply attribute parameters and the resource demand attribute parameters into a pre-constructed initial overall benefit evaluation model through a smart contract of the blockchain to form a target overall benefit evaluation model, wherein the initial overall benefit evaluation model comprises a balance constraint term; iteratively optimizing the target overall benefit evaluation model by using a preset target model optimization algorithm to obtain a target balanced attribute value of the energy resources; and executing, through the smart contract, energy resource transfer processing from the resource providing node to the resource demand node based on the target balanced attribute value. In this way, the balance of the supply and demand attribute values can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of energy resource interaction processing technology, and in particular to an energy resource transfer method, apparatus and computer equipment based on smart contracts. Background Technology

[0002] Microgrid energy resource interaction technology, as a crucial support for distributed energy systems, currently generally adopts a centralized matching mechanism, completing supply and demand matching and resource interaction execution through power resource interaction platforms or third-party intermediaries. While this model achieves energy resource scheduling and allocation to a certain extent, its architectural design has significant flaws, severely restricting the security, fairness, and timeliness of microgrid resource interaction.

[0003] With the emergence of decentralized markets, issues such as security, fairness, and timeliness in microgrid resource interaction can be effectively addressed. Decentralized energy resource interaction, through methods such as blockchain, improves the trust and satisfaction of both parties in the resource interaction platform.

[0004] However, during the implementation of traditional technologies, the applicant discovered that at least the resource transfer attribute values ​​of energy resource transfer are difficult to adapt to the fluctuating resource interaction environment, which means that at least there is an imbalance between resource supply attributes and resource demand attributes. Summary of the Invention

[0005] Based on this, the purpose of this application is to at least solve one of the above-mentioned technical defects, especially the technical defect of uneven resource attribute values ​​in the prior art. This application provides an energy resource transfer method, apparatus and computer equipment based on smart contracts.

[0006] Firstly, this application provides a method for energy resource transfer based on smart contracts, the method comprising: The resource supply attribute parameters submitted to the blockchain by the resource providing nodes for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand nodes; Through blockchain smart contracts, resource supply attribute parameters and resource demand attribute parameters are input into a pre-built initial overall benefit assessment model to form a target overall benefit assessment model, wherein the initial overall benefit assessment model includes balance constraint terms. Using a pre-defined target model optimization algorithm, the overall benefit evaluation model of the target is iteratively optimized to obtain the target equilibrium attribute value of energy resources. Through smart contracts, based on the target equilibrium attribute value, the energy resource transfer process is executed from the resource providing node to the resource demanding node.

[0007] In one embodiment, a preset target model optimization algorithm is used to iteratively optimize the overall benefit evaluation model of the target to obtain the target equilibrium attribute value of energy resources, including: The resource supply interaction volume updated by the resource provider node and the resource demand interaction volume updated by the resource demand node are obtained. The resource supply interaction volume is obtained by the resource provider node using the distributed gradient descent algorithm locally, and the resource demand interaction volume is obtained by the resource demand node using the distributed gradient descent algorithm locally. If the interaction between resource supply and resource demand satisfies the preset equilibrium conditions, then the target equilibrium attribute value is determined based on the interaction between resource supply and resource demand.

[0008] In one embodiment, the initial overall benefit assessment model is constructed in the following ways: Obtain a supply benefit quantification model based on multiple resource supply nodes, and obtain a demand benefit quantification model based on multiple resource demand nodes; Determine the balance attribute value parameters; An initial overall benefit assessment model is constructed based on the supply benefit quantification model, the demand benefit quantification model, and the equilibrium attribute value parameters.

[0009] In one embodiment, obtaining a supply efficiency quantification model based on multiple resource providing nodes includes: Determine the amount of resource transfer revenue for the resource-providing node; Based on the pre-set resource cost function and the amount of resource transfer revenue, a quantitative model of supply efficiency is obtained.

[0010] In one embodiment, obtaining a demand-benefit quantification model based on a set of multiple resource demand nodes includes: Determine the amount of resource transfer expenditure at resource demand nodes; A demand benefit quantification model is obtained by using a pre-set energy value function and resource transfer expenditure.

[0011] In one embodiment, the method further includes: Record information on energy resource transfer; Among them, energy resource transfer information includes the amount of resources transferred from resource-providing nodes to resource-demanding nodes, the resource transfer attribute value of energy, and the resource transfer time.

[0012] Secondly, this application provides an energy resource transfer device based on smart contracts, the device comprising: The attribute parameter acquisition module is used to acquire the resource supply attribute parameters submitted to the blockchain by the resource providing node for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand node. The evaluation model determination module is used to input resource supply attribute parameters and resource demand attribute parameters into a pre-built initial overall benefit evaluation model through a blockchain smart contract to form a target overall benefit evaluation model. The initial overall benefit evaluation model includes balance constraint terms. The model iterative optimization module is used to iteratively optimize the overall benefit evaluation model of the target using a preset target model optimization algorithm, so as to obtain the target equilibrium attribute value of energy resources. The energy resource transfer module is used to execute energy resource transfer processes from resource-providing nodes to resource-demanding nodes through smart contracts, based on target equilibrium attribute values.

[0013] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0014] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0015] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0016] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: The energy resource transfer method, apparatus, and computer equipment based on smart contracts provided in this application achieve data submission through a distributed node network of blockchain, avoiding global paralysis caused by the failure of a central node. An initial overall benefit assessment model including balance constraints reflects the supply and demand relationship in real time, adapting to fluctuating resource interaction environments and achieving a balance in resource supply and demand attributes. For example, Lagrange constraints can be introduced to enforce total balance, improving equilibrium. Furthermore, a pre-defined target model optimization algorithm, such as distributed gradient descent iterative solution, enables decentralized solutions, allowing resource exchange attribute values ​​to dynamically change with supply and demand, thereby improving the equilibrium of supply and demand attribute values. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1A flowchart illustrating the energy resource transfer method based on smart contracts provided in this application embodiment; Figure 2 A flowchart illustrating an iterative optimization target overall benefit evaluation model provided in this application embodiment; Figure 3 A flowchart illustrating the steps for constructing an initial overall benefit assessment model, as provided in this application embodiment; Figure 4 A schematic diagram of the structure of an energy resource transfer device based on a smart contract, provided for an embodiment of this application; Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] Currently, a centralized matching mechanism is commonly used, which completes the matching of supply and demand and the execution of resource interaction through power resource interaction platforms or third-party intermediaries. While this model has achieved energy resource scheduling and allocation to a certain extent, its architectural design has significant flaws, which seriously restrict the security, fairness, and timeliness of microgrid resource interaction.

[0021] With the emergence of decentralized markets, issues such as security, fairness, and timeliness in microgrid resource interaction can be effectively addressed. Decentralized energy resource interaction, through methods such as blockchain, improves the trust and satisfaction of both parties in the resource interaction platform.

[0022] However, during the implementation of traditional technologies, the applicant discovered that at least the resource transfer attribute values ​​of energy resource transfer are difficult to adapt to the fluctuating resource interaction environment, which means that at least there is an imbalance between resource supply attributes and resource demand attributes.

[0023] Based on this, this application provides a method, apparatus, and computer equipment for energy resource transfer based on smart contracts. By constructing a decentralized market equilibrium optimization problem and combining Lagrange optimization and distributed gradient descent methods, it is possible to realize automatic energy trading matching based on smart contracts and ensure dynamic adjustment of trading prices and market equilibrium.

[0024] In one exemplary embodiment, Figure 1A flowchart illustrating the energy resource transfer method based on smart contracts provided in this application embodiment is shown below. Figure 1 As shown, a smart contract-based energy resource transfer method is provided. This method is illustrated using a server as an example. It is understood that this method can also be applied to terminals, and to systems including terminals and servers, and is implemented through interaction between the terminal and the server. Terminals can be, but are not limited to, various personal computers, laptops, smartphones, and tablets. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing cloud computing services. In this embodiment, the method includes the following steps S101 to S104. Wherein: S101, Obtain the resource supply attribute parameters submitted to the blockchain by the resource providing node for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand node.

[0025] In this context, "resource-providing nodes" refer to nodes in the blockchain that are energy suppliers with energy production capabilities (such as photovoltaic power generation users, energy storage users, etc.) within the microgrid, capable of providing energy resources, such as electricity, that can be exchanged with the blockchain. "Resource-demanding nodes" refer to users in the microgrid who have energy consumption needs (such as electricity users, enterprises, etc.) and require energy resources through resource exchange.

[0026] Resource supply attribute parameters can include the resource transfer attribute value and the amount of energy transferred by the resource supply node. Resource demand attribute parameters can be a set of technical parameters for the energy required by the resource demand node, including but not limited to energy demand, acceptable range of transfer attribute values, demand period, and geographical location. The transfer attribute value can refer to the energy price.

[0027] Blockchain refers to a distributed ledger technology that stores transaction data through a decentralized node consensus mechanism. It has the technical characteristics of being immutable and traceable, and in this invention, it serves as the deployment and execution environment for smart contracts.

[0028] For example, the server can collect energy supply information (resource supply attribute parameters) uploaded by resource-providing nodes and energy demand information (resource demand attribute parameters) published by resource-demanding nodes in real time through the blockchain network, and can record the two types of parameters in the form of structured data to the blockchain distributed ledger.

[0029] Resource-providing nodes and resource-demanding nodes can broadcast transaction requests to the blockchain network through encrypted communication protocols. The parameter data is written to the blockchain after being verified by digital signatures.

[0030] Optionally, suppose there are N energy suppliers (such as photovoltaic users) in the microgrid, denoted as set S = {s1, s2, ..., sN}, and M energy consumers (such as residents and businesses), denoted as set D = {d1, d2, ..., dM}. The electricity supplied by each supplier si at time t is... Its quotation function is , indicating willingness to The price sold is q units of electricity. And each consumer... The required power is Its bid function is , indicating willingness to The price is used to purchase q units of electricity. Based on the above data, the resource supply attribute parameters and resource demand attribute parameters submitted to the blockchain can be obtained.

[0031] S102. Through the smart contract of the blockchain, the resource supply attribute parameters and resource demand attribute parameters are input into the pre-built initial overall benefit assessment model to form the target overall benefit assessment model, wherein the initial overall benefit assessment model includes balance constraint terms.

[0032] The initial overall benefit assessment model can be a pre-designed mathematical model used to quantitatively evaluate the comprehensive benefits of energy trading in a microgrid system. It can include multiple evaluation indicators such as energy supply and demand balance, economic benefits, and network losses. This model can ensure that the assessment results conform to the physical laws of the power grid and the trading rules through mathematical constraints (balance constraints).

[0033] The overall benefit assessment model can be an instantiated model formed by dynamically adjusting the initial model based on the actual supply and demand parameters of the current transaction cycle, such as resource supply attribute parameters and demand attribute parameters. It can reflect the optimal benefit target of transaction matching under specific time period conditions.

[0034] Balance constraints can be constraints in a model used to ensure that energy resource interactions achieve a dynamic balance in resource transfer attribute values ​​between supply and demand sides. For example, they can be function terms constructed from Lagrange multipliers included in the model.

[0035] For example, the server can input the resource supply attribute parameters and resource demand attribute parameters obtained in step S101 into the initial overall benefit assessment model called by the smart contract. Through dynamic parameter injection and constraint verification, a target overall benefit assessment model adapted to the current resource interaction / transaction scenario is generated, providing a quantitative decision-making basis for subsequent transaction matching. The output of the target overall benefit assessment model can generate an objective function that includes the time characteristics of the current transaction cycle, such as maximizing supply and demand benefits.

[0036] S103. Using a preset target model optimization algorithm, iteratively optimize the overall benefit evaluation model of the target to obtain the target equilibrium attribute value of energy resources.

[0037] The target model optimization algorithm refers to a distributed optimization computing framework embedded in smart contracts, designed to solve the overall benefit evaluation model of the target. For example, it can support parallel execution of iterative calculations in a blockchain node network. This algorithm may include the improved alternating direction multiplier method (ADMM), distributed gradient descent, etc., and features fast convergence speed and strong resistance to data heterogeneity.

[0038] Iterative optimization refers to the process of gradually approaching the optimal solution through multiple rounds of calculation. Each iteration can adjust the decision variables based on the previous results until the preset convergence conditions (such as error threshold or maximum number of iterations) are met.

[0039] The target equilibrium attribute value can represent the core parameter set of the optimal matching state of energy trading, which may include equilibrium price, equilibrium trading volume, etc.

[0040] For example, the server can call the pre-set distributed optimization algorithm in the smart contract to perform multiple rounds of iterative solutions on the overall benefit evaluation model of the target generated in step S102, and finally output the energy resource target equilibrium attribute value that satisfies the balance constraint, thus completing the mathematical optimal solution calculation for transaction matching.

[0041] Optionally, each node (including resource-providing nodes and resource-demanding nodes) can submit its local computation results to the blockchain and continuously exchange information through smart contracts on the blockchain, eventually converging to an equilibrium solution. Convergence termination can be determined by convergence criteria, such as terminating the iteration when the rate of change of the global variable is less than a threshold for two consecutive iterations, or by forcibly terminating the iteration if the number of iterations exceeds a preset limit, triggering a timeout mechanism and outputting the current optimal solution.

[0042] S104. Through smart contracts, based on the target equilibrium attribute value, execute the energy resource transfer process from the resource providing node to the resource demanding node.

[0043] Among them, energy resource transfer processing can refer to the technical process of converting the matching results of resource interaction into energy transmission control signals in the physical power grid based on the blockchain consensus mechanism, which may include operations such as electricity metering and power grid dispatching instruction issuance.

[0044] For example, the server can resolve the target equilibrium attribute value through smart contracts, generate atomic transaction instructions, and after verification through blockchain consensus, drive the resource-providing nodes and resource-demanding nodes to complete energy interaction and synchronously update the power grid status and ownership records.

[0045] In some exemplary examples, to achieve decentralized matching, a smart contract can perform the following steps: all resource-providing nodes submit resource supply attribute parameters, such as the price curve. All resource requirement nodes submit resource requirement attribute parameters, such as demand curves. Smart contracts solve for the target equilibrium attribute value based on the optimization problem, which may include the equilibrium price λ. And determine the optimal trading volume q Transactions are executed automatically, energy resources are transferred, and virtual resources can be transferred through the blockchain; the blockchain can update transaction records, ensuring transparency and traceability.

[0046] In this embodiment, data submission is achieved through a distributed node network of the blockchain, avoiding global paralysis caused by the failure of a central node. An initial overall benefit assessment model, incorporating balance constraints, reflects the supply and demand relationship in real time, adapting to fluctuating resource interaction environments and achieving a balance in resource supply and demand attributes. For example, a Lagrange constraint can be introduced to enforce total balance, improving equilibrium. Furthermore, a pre-defined target model optimization algorithm, such as distributed gradient descent iterative solution, enables decentralized solutions, allowing resource exchange attribute values ​​to dynamically change with supply and demand, thereby improving the balance of supply and demand attribute values.

[0047] In one exemplary embodiment, Figure 2 A flowchart illustrating an iterative optimization target overall benefit evaluation model provided in this application embodiment is shown below. Figure 2 As shown, in Figure 1 Based on this, the steps of the energy resource transfer method based on smart contracts are further illustrated. In step S103, a preset target model optimization algorithm is used to iteratively optimize the overall benefit evaluation model of the target to obtain the target equilibrium attribute value of the energy resources. Specifically, this may include steps S201 to S202, wherein: S201. Obtain the resource supply interaction quantity updated by the resource providing node and the resource demand interaction quantity updated by the resource demand node; wherein, the resource supply interaction quantity is obtained by the resource providing node using the distributed gradient descent algorithm locally, and the resource demand interaction quantity is obtained by the resource demand node using the distributed gradient descent algorithm locally.

[0048] S202. If the interaction between resource supply and resource demand satisfies the preset equilibrium conditions, then the target equilibrium attribute value is determined based on the interaction between resource supply and resource demand.

[0049] The resource supply interaction quantity refers to the amount of energy that resource-providing nodes can supply to the resource exchange network (trading market) within a certain period of time, which is dynamically adjusted through a local optimization algorithm. The resource demand interaction quantity refers to the amount of energy that resource-demanding nodes need to obtain from the resource exchange network (trading market) within a certain period of time, which is also dynamically adjusted through a local optimization algorithm. The preset equilibrium condition refers to the criteria for determining whether supply and demand have reached a balance; for example, it can typically refer to the difference between total supply and total demand being less than a set threshold.

[0050] For example, resource-providing nodes can calculate their supply locally. Each resource-providing node, based on current market information (such as price, supply-demand gap, etc.), uses a distributed gradient descent algorithm to calculate and update the amount of energy it can provide locally (resource supply interaction quantity). Resource-demanding nodes can calculate their demand locally. Each resource-demanding node, based on current market information (such as price, electricity priority), uses a distributed gradient descent algorithm to calculate and update the amount of energy it needs to acquire locally (resource demand interaction quantity).

[0051] The server can aggregate the resource supply interactions of all resource-providing nodes and the resource demand interactions of all resource-demanding nodes, and calculate the difference between the resource supply interactions and the total resource demand interactions. If the difference meets a preset equilibrium condition, then the energy resource interactions can be considered to have reached an equilibrium state.

[0052] When the market is in equilibrium, the server can calculate key parameters of the target equilibrium attribute value, such as equilibrium price and optimal transaction volume, based on the current interaction between resource supply and demand.

[0053] In this embodiment, the supply and demand equilibrium point is gradually approached through distributed iteration, and infinite loops are prevented by preset equilibrium conditions, ensuring efficient convergence of the algorithm. Supply and demand sides can avoid reliance on centralized scheduling through local computation, and the distributed gradient descent algorithm ensures that each node only needs local data to optimize its own decisions. This guarantees that the equilibrium attribute value can dynamically change with supply and demand, improving the balance of resource interaction.

[0054] In one exemplary embodiment, Figure 3 A flowchart illustrating the steps for constructing an initial overall benefit assessment model, as provided in this application embodiment, is shown below. Figure 3 As shown, in Figure 1 Based on this, the steps of the energy resource transfer method based on smart contracts are further illustrated with examples. Specifically, the construction method of the initial overall benefit assessment model may include S301 to S303, wherein: S301. Obtain a supply benefit quantification model based on multiple resource supply nodes, and obtain a demand benefit quantification model based on multiple resource demand nodes.

[0055] S302. Determine the balance attribute value parameters.

[0056] S303. Based on the supply benefit quantification model, demand benefit quantification model and equilibrium attribute value parameters, an initial overall benefit assessment model is constructed.

[0057] The supply-benefit quantification model refers to a model describing the benefits of resource-providing nodes in energy supply. For example, it could be a utility function of the resource-providing node, typically including the difference between electricity sales revenue and generation costs. The demand-benefit quantification model refers to a model describing the benefits of resource-demanding nodes in energy consumption. For example, it could be a utility function of the resource-demanding node, typically including the difference between the value of electricity consumption and the expenditure on electricity purchase. The equilibrium attribute value parameter can be a core parameter used to balance supply and demand (such as the market equilibrium price), ensuring that the total resource supply equals the total demand. The equilibrium attribute value parameter can be a Lagrange multiplier, introducing Lagrange terms through the Lagrange multiplier.

[0058] For example, the server can construct a supply-benefit quantification model by inputting data such as the generation cost, electricity price, and available electricity of resource-providing nodes, and construct a demand-benefit quantification model by inputting data such as the electricity consumption value (e.g., production efficiency), electricity purchase price, and electricity consumption of resource-demanding nodes. The server can also determine equilibrium attribute values ​​representing marginal prices or resource scarcity indicators at market equilibrium, which are used to enforce supply-demand balance constraints in the optimization model.

[0059] Optionally, adding the supply-benefit model and the demand-benefit model can form a total benefit equilibrium function. Furthermore, by using equilibrium attribute values ​​as parameters, supply and demand balance conditions can be integrated into the model to construct a Lagrangian function. Maximizing the total benefit equilibrium while simultaneously satisfying supply and demand balance constraints yields the target equilibrium attribute value.

[0060] Schematic, the initial overall benefit assessment model is as shown in expression (1):

[0061] in, and Let N represent the utility functions of the resource-providing nodes and the resource-demanding nodes, respectively. N is the number of resource-providing nodes, and M is the number of resource-demanding nodes. Provides resource transfer revenue for resource nodes; For resource transfer expenditures. These are Lagrange multipliers, representing the market equilibrium price.

[0062] In this embodiment, by modeling the resource interaction benefits of the supply side and the demand side separately, the individual benefits can be quantified. Furthermore, by introducing equilibrium attribute value parameters to force supply and demand matching, the dynamic adjustment of transaction prices and market equilibrium can be ensured, thereby improving the balance between supply and demand resource attribute values.

[0063] In some exemplary embodiments, To find the optimal solution in expression (1), let right , and The partial derivatives are 0, as shown in expression (2):

[0064] Market equilibrium price The total supply must equal the total demand, and the individual transaction volume q must be equal. ( , The marginal cost to the supplier is equal to the marginal utility of the demander minus the equilibrium price.

[0065] Optionally, the smart contract needs to perform the following steps: all resource-providing nodes submit resource supply attribute parameters, such as the price curve. All resource requirement nodes submit resource requirement attribute parameters, such as demand curves. Smart contracts solve for the target equilibrium attribute value based on the optimization problem, which may include the equilibrium price λ. And determine the optimal trading volume q Transactions are executed automatically, energy resources are transferred, and virtual resources can be transferred through the blockchain; the blockchain can update transaction records, ensuring transparency and traceability.

[0066] In practical deployment, distributed gradient descent (DGD) can be used for decentralized solution, where each participant updates their own transaction volume locally and continuously exchanges information through smart contracts on the blockchain, eventually converging to an equilibrium solution. The distributed update rule is as follows (3):

[0067] in, Provide energy to resource provider i in the k-th iteration; The step size parameter for the k-th iteration controls the magnitude of energy supply adjustment; The electricity sales price per unit for resource provider i; Let i be the marginal cost function of resource provider i, representing the production of the i-th resource provider. Additional cost per unit of energy. Let be the equilibrium price in the k-th iteration.

[0068] Let j be the energy demand of resource demander j in the k-th iteration. Let be the marginal utility function of resource demander j, representing the consumption of the first... The additional value generated per unit of energy. The unit price of electricity purchased by resource demander j.

[0069] Let be the equilibrium price in the k-th iteration; This is the step size parameter for the k-th iteration, controlling the magnitude of price adjustments; Provide total energy for all resource providers; The total energy required by all resource demanders.

[0070] In this embodiment, by constructing a decentralized market equilibrium optimization problem and combining Lagrange optimization and distributed gradient descent methods, it is possible to realize automatic energy trading matching based on smart contracts and ensure dynamic adjustment of trading prices and market equilibrium.

[0071] In an exemplary embodiment, step S301, obtaining a supply efficiency quantification model determined based on multiple resource providing nodes, may specifically include: Determine the amount of resource transfer revenue for the resource-providing node.

[0072] Based on the pre-set resource cost function and the amount of resource transfer revenue, a quantitative model of supply efficiency is obtained.

[0073] Resource transfer revenue refers to the resource income that a resource-providing node receives through resource interaction (such as electricity). The resource cost function describes the total cost for a resource-providing node to produce or supply energy. The supply benefit quantification model represents the net revenue of a resource-providing node, such as revenue minus costs.

[0074] For example, the server can determine the revenue from resource transfer based on market prices and energy supply, and can reflect the actual expenditure on energy supply through a resource cost function, with the difference between revenue and cost serving as the supply benefit.

[0075] Alternatively, the supply efficiency quantification model can be as shown in expression (4):

[0076] in, It is the cost function of the resource-providing node, usually set as a convex function (e.g., = ). This represents the functional relationship between the resource attribute values ​​of a resource-providing node and the energy it provides. Provides energy to nodes for resources.

[0077] In this embodiment, by separating revenue and cost, the economic drivers of each resource-providing node can be clearly identified, and a supply-efficiency model provides a foundation for constructing the overall social welfare function, ensuring the optimization objective. By incorporating real-time price and cost changes, the model can dynamically adjust the supply capacity, thus adapting to market fluctuations.

[0078] In an exemplary embodiment, step S301, obtaining a demand-benefit quantification model based on a set of multiple resource demand nodes, may specifically include: Determine the amount of resource transfer expenditure at the resource demand nodes.

[0079] A demand benefit quantification model is obtained by using a pre-set energy value function and resource transfer expenditure.

[0080] Resource transfer expenditures can be the total cost paid by resource-demanding nodes to acquire energy, including electricity purchase costs and other related costs. The energy value function describes the utility or benefit that resource-demanding nodes derive from energy consumption.

[0081] For example, the server can determine the amount of resource transfer expenditure based on market prices and energy demand, and reflect the actual benefits of energy consumption through a pre-set electricity value function. The difference between the value and the expenditure can be used as the demand benefit.

[0082] Alternatively, the demand benefit quantification model can be as shown in expression (5):

[0083] in, This indicates the revenue that consumers obtain from consuming electricity. This represents the functional relationship between the resource attribute value of a resource demand node and the energy demand. This represents the energy demand of a resource demand node.

[0084] In this embodiment, by separating the value of electricity consumption from expenditure, the consumption drivers at each resource demand node can be clearly identified. Using a demand-benefit model as a key input to the overall social welfare function ensures the optimization objective is achieved. Furthermore, by incorporating real-time price and electricity value changes, the model can dynamically adjust energy demand and optimize user electricity consumption strategies.

[0085] In one exemplary embodiment, the method further includes: Record information on energy resource transfer; The energy resource transfer information includes the amount of resources transferred from resource-providing nodes to resource-demanding nodes, the resource transfer attribute value of the energy, and the resource transfer time. The resource transfer attribute value can refer to the unit price of the resource.

[0086] For example, the server can automatically record key transaction data through smart contracts to ensure that the information is transparent, tamper-proof, and traceable.

[0087] In this embodiment, the smart contract automatically triggers the recording process upon detecting the completion of an energy transfer, requiring no manual intervention. All participants can query transaction details through a blockchain explorer to verify the authenticity of the energy source, price, and time. Decentralized recording eliminates reliance on third-party intermediaries, allowing supply and demand parties to directly verify data authenticity.

[0088] In some exemplary examples, this application provides a smart contract-based energy resource transfer method centered around a decentralized matching mechanism. The aim is to eliminate centralized trading institutions, automatically match supply and demand and dynamically adjust prices through smart contracts, thereby improving the fairness, security, and efficiency of transactions. The following are the key points and areas of protection of this invention. This application utilizes blockchain smart contracts to automatically execute energy transactions, eliminating the dispatching agencies that are essential in traditional centralized electricity markets, thus making electricity transactions within microgrids completely decentralized. Smart contracts store and execute transaction rules, ensuring that energy supply and demand are matched without human intervention, reducing transaction costs. Traditional electricity markets rely on centralized dispatch to optimize transaction volume and pricing. This application provides an equilibrium solution method based on Lagrange optimization and distributed gradient descent (DGD) algorithms, enabling market pricing to dynamically change with supply and demand and adaptively adjust in a decentralized environment.

[0089] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0090] The following describes the smart contract-based energy resource transfer device provided in the embodiments of this application. The smart contract-based energy resource transfer device has the same inventive concept as the smart contract-based energy resource transfer method described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more smart contract-based energy resource transfer device embodiments provided below can be found in the limitations of the smart contract-based energy resource transfer method described above. The smart contract-based energy resource transfer device described below and the smart contract-based energy resource transfer method described above can be referred to each other, and will not be repeated here.

[0091] In one exemplary embodiment, Figure 4 A schematic diagram of the structure of an energy resource transfer device based on a smart contract, as provided in this application embodiment, is shown below. Figure 4 As shown, the smart contract-based energy resource transfer device 40 includes: an attribute parameter acquisition module 410, an evaluation model determination module 420, a model iteration optimization module 430, and an energy resource transfer module 440, wherein: The attribute parameter acquisition module 410 is used to acquire the resource supply attribute parameters submitted to the blockchain by the resource providing node for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand node.

[0092] The evaluation model determination module 420 is used to input resource supply attribute parameters and resource demand attribute parameters into a pre-built initial overall benefit evaluation model through a blockchain smart contract to form a target overall benefit evaluation model, wherein the initial overall benefit evaluation model includes balance constraint terms.

[0093] The model iterative optimization module 430 is used to iteratively optimize the overall benefit evaluation model of the target by using a preset target model optimization algorithm to obtain the target equilibrium attribute value of energy resources.

[0094] The energy resource transfer module 440 is used to perform energy resource transfer processing from resource-providing nodes to resource-demanding nodes based on the target equilibrium attribute value through smart contracts.

[0095] In an exemplary embodiment, the model iterative optimization module is used to obtain the resource supply interaction quantity updated by the resource providing node and the resource demand interaction quantity updated by the resource demand node; wherein, the resource supply interaction quantity is obtained by the resource providing node locally using the distributed gradient descent algorithm, and the resource demand interaction quantity is obtained by the resource demand node locally using the distributed gradient descent algorithm; if the resource supply interaction quantity and the resource demand interaction quantity satisfy a preset equilibrium condition, then the target equilibrium attribute value is determined based on the resource supply interaction quantity and the resource demand interaction quantity.

[0096] The resource supply interaction quantity refers to the amount of energy that resource-providing nodes can supply to the resource exchange network (trading market) within a certain period of time, which is dynamically adjusted through a local optimization algorithm. The resource demand interaction quantity refers to the amount of energy that resource-demanding nodes need to obtain from the resource exchange network (trading market) within a certain period of time, which is also dynamically adjusted through a local optimization algorithm. The preset equilibrium condition refers to the criteria for determining whether supply and demand have reached a balance; for example, it can typically refer to the difference between total supply and total demand being less than a set threshold.

[0097] For example, resource-providing nodes can calculate their supply locally. Each resource-providing node, based on current market information (such as price, supply-demand gap, etc.), uses a distributed gradient descent algorithm to calculate and update the amount of energy it can provide locally (resource supply interaction quantity). Resource-demanding nodes can calculate their demand locally. Each resource-demanding node, based on current market information (such as price, electricity priority), uses a distributed gradient descent algorithm to calculate and update the amount of energy it needs to acquire locally (resource demand interaction quantity).

[0098] The server can aggregate the resource supply interactions of all resource-providing nodes and the resource demand interactions of all resource-demanding nodes, and calculate the difference between the resource supply interactions and the total resource demand interactions. If the difference meets a preset equilibrium condition, then the energy resource interactions can be considered to have reached an equilibrium state.

[0099] When the market is in equilibrium, the server can calculate key parameters of the target equilibrium attribute value, such as equilibrium price and optimal transaction volume, based on the current interaction between resource supply and demand.

[0100] In an exemplary embodiment, the evaluation model determination module is used to obtain a supply benefit quantification model determined based on multiple resource supply nodes, and to obtain a demand benefit quantification model determined based on multiple resource demand nodes; determine equilibrium attribute value parameters; and construct an initial overall benefit evaluation model based on the supply benefit quantification model, the demand benefit quantification model, and the equilibrium attribute value parameters.

[0101] The supply-benefit quantification model refers to a model describing the benefits of resource-providing nodes in energy supply. For example, it could be a utility function of the resource-providing node, typically including the difference between electricity sales revenue and generation costs. The demand-benefit quantification model refers to a model describing the benefits of resource-demanding nodes in energy consumption. For example, it could be a utility function of the resource-demanding node, typically including the difference between the value of electricity consumption and the expenditure on electricity purchase. The equilibrium attribute value parameter can be a core parameter used to balance supply and demand (such as the market equilibrium price), ensuring that the total resource supply equals the total demand. The equilibrium attribute value parameter can be a Lagrange multiplier, introducing Lagrange terms through the Lagrange multiplier.

[0102] For example, the server can construct a supply-benefit quantification model by inputting data such as the generation cost, electricity price, and available electricity of resource-providing nodes, and construct a demand-benefit quantification model by inputting data such as the electricity consumption value (e.g., production efficiency), electricity purchase price, and electricity consumption of resource-demanding nodes. The server can also determine equilibrium attribute values ​​representing marginal prices or resource scarcity indicators at market equilibrium, which are used to enforce supply-demand balance constraints in the optimization model.

[0103] Optionally, adding the supply-benefit model and the demand-benefit model can form a total benefit equilibrium function. Furthermore, by using equilibrium attribute values ​​as parameters, supply and demand balance conditions can be integrated into the model to construct a Lagrangian function. Maximizing the total benefit equilibrium while simultaneously satisfying supply and demand balance constraints yields the target equilibrium attribute value.

[0104] Schematic, the initial overall benefit assessment model is as shown in expression (1):

[0105] in, and Let N represent the utility functions of the resource-providing nodes and the resource-demanding nodes, respectively. N is the number of resource-providing nodes, and M is the number of resource-demanding nodes. Provides resource transfer revenue for resource nodes; For resource transfer expenditures. These are Lagrange multipliers, representing the market equilibrium price.

[0106] In some exemplary embodiments, To find the optimal solution in expression (1), let right , and The partial derivatives are 0, as shown in expression (2):

[0107] Market equilibrium price The total supply must equal the total demand, and the individual transaction volume q must be equal. ( , The marginal cost to the supplier is equal to the marginal utility of the demander minus the equilibrium price.

[0108] Optionally, the smart contract needs to perform the following steps: all resource-providing nodes submit resource supply attribute parameters, such as the price curve. All resource requirement nodes submit resource requirement attribute parameters, such as demand curves. Smart contracts solve for the target equilibrium attribute value based on the optimization problem, which may include the equilibrium price λ. And determine the optimal trading volume q Transactions are executed automatically, energy resources are transferred, and virtual resources can be transferred through the blockchain; the blockchain can update transaction records, ensuring transparency and traceability.

[0109] In practical deployment, distributed gradient descent (DGD) can be used for decentralized solution, where each participant updates their own transaction volume locally and continuously exchanges information through smart contracts on the blockchain, eventually converging to an equilibrium solution. The distributed update rule is as follows (3):

[0110] in, Provide energy to resource provider i in the k-th iteration; The step size parameter for the k-th iteration controls the magnitude of energy supply adjustment; The electricity sales price per unit for resource provider i; Let i be the marginal cost function of resource provider i, representing the production of the i-th resource provider. Additional cost per unit of energy. Let be the equilibrium price in the k-th iteration.

[0111] Let j be the energy demand of resource demander j in the k-th iteration. Let be the marginal utility function of resource demander j, representing the consumption of the first... The additional value generated per unit of energy. The unit price of electricity purchased by resource demander j.

[0112] Let be the equilibrium price in the k-th iteration; This is the step size parameter for the k-th iteration, controlling the magnitude of price adjustments; Provide total energy for all resource providers; The total energy required by all resource demanders.

[0113] In an exemplary embodiment, the evaluation model determination module is used to determine the resource transfer revenue of the resource providing node; based on the pre-set resource cost function and the resource transfer revenue, a supply benefit quantification model is obtained.

[0114] Resource transfer revenue refers to the resource income that a resource-providing node receives through resource interaction (such as electricity). The resource cost function describes the total cost for a resource-providing node to produce or supply energy. The supply benefit quantification model represents the net revenue of a resource-providing node, such as revenue minus costs.

[0115] For example, the server can determine the revenue from resource transfer based on market prices and energy supply, and can reflect the actual expenditure on energy supply through a resource cost function, with the difference between revenue and cost serving as the supply benefit.

[0116] Alternatively, the supply efficiency quantification model can be as shown in expression (4):

[0117] in, It is the cost function of the resource-providing node, usually set as a convex function (e.g., = ). This represents the functional relationship between the resource attribute values ​​of a resource-providing node and the energy it provides. Provides energy to nodes for resources.

[0118] In an exemplary embodiment, the evaluation model determination module is used to determine the resource transfer expenditure of the resource demand node; and a demand benefit quantification model is obtained by using a pre-set energy value function and the resource transfer expenditure.

[0119] Resource transfer expenditures can be the total cost paid by resource-demanding nodes to acquire energy, including electricity purchase costs and other related costs. The energy value function describes the utility or benefit that resource-demanding nodes derive from energy consumption.

[0120] For example, the server can determine the amount of resource transfer expenditure based on market prices and energy demand, and reflect the actual benefits of energy consumption through a pre-set electricity value function. The difference between the value and the expenditure can be used as the demand benefit.

[0121] Alternatively, the demand benefit quantification model can be as shown in expression (5):

[0122] in, This indicates the revenue that consumers obtain from consuming electricity. This represents the functional relationship between the resource attribute value of a resource demand node and the energy demand. This represents the energy demand of a resource demand node.

[0123] In an exemplary embodiment, the energy resource transfer module is further configured to record energy resource transfer information; wherein, the energy resource transfer information includes the amount of resources transferred from the resource providing node to the resource demanding node, the resource transfer attribute value of the energy, and the resource transfer time.

[0124] In one exemplary embodiment, this application also provides a computer-readable storage medium storing a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps of any of the smart contract-based energy resource transfer methods described in the above embodiments.

[0125] In one exemplary embodiment, this application also provides a computer device storing a computer program in which computer-readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of any of the smart contract-based energy resource transfer methods described in the above embodiments.

[0126] In one exemplary embodiment, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the smart contract-based energy resource transfer methods described in the above embodiments.

[0127] Indicatively, such as Figure 5 As shown, Figure 5 This is a schematic diagram of the internal structure of a computer device 500 provided in an embodiment of this application. The computer device 500 can be provided as a server. (Refer to...) Figure 5 The computer device 500 includes a processing component 502, which further includes one or more processors, and memory resources represented by memory 501 for storing instructions, such as application programs, that can be executed by the processing component 502. The application programs stored in memory 501 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 502 is configured to execute instructions to perform the text recognition method of any of the above embodiments.

[0128] The computer device 500 may also include a power supply component 503 configured to perform power management of the computer device 500, a wired or wireless network interface 504 configured to connect the computer device 500 to a network, and an input / output (I / O) interface 505. The computer device 500 may operate on an operating system stored in memory 501, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0129] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0131] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0132] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0133] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for energy resource transfer based on smart contracts, characterized in that, The method includes: The resource supply attribute parameters submitted to the blockchain by the resource providing nodes for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand nodes; Through the smart contract of the blockchain, the resource supply attribute parameters and the resource demand attribute parameters are input into a pre-built initial overall benefit evaluation model to form a target overall benefit evaluation model, wherein the initial overall benefit evaluation model includes a balance constraint term. Using a preset target model optimization algorithm, the overall benefit evaluation model of the target is iteratively optimized to obtain the target equilibrium attribute value of the energy resource. Through the smart contract, based on the target equilibrium attribute value, the energy resource transfer process from the resource providing node to the resource demanding node is executed.

2. The method according to claim 1, characterized in that, The step of iteratively optimizing the overall benefit evaluation model of the target using a preset target model optimization algorithm to obtain the target equilibrium attribute value of the energy resource includes: The resource supply interaction quantity updated by the resource providing node and the resource demand interaction quantity updated by the resource demand node are obtained; wherein, the resource supply interaction quantity is obtained by the resource providing node using the distributed gradient descent algorithm locally, and the resource demand interaction quantity is obtained by the resource demand node using the distributed gradient descent algorithm locally. If the resource supply interaction quantity and the resource demand interaction quantity meet the preset equilibrium conditions, then the target equilibrium attribute value is determined based on the resource supply interaction quantity and the resource demand interaction quantity.

3. The method according to claim 2, characterized in that, The construction method of the initial overall benefit assessment model includes: Obtain a supply benefit quantification model based on multiple resource supply nodes, and obtain a demand benefit quantification model based on multiple resource demand nodes; Determine the balance attribute value parameters; Based on the supply benefit quantification model, the demand benefit quantification model, and the equilibrium attribute value parameters, the initial overall benefit assessment model is constructed.

4. The method according to claim 3, characterized in that, The acquisition of a supply efficiency quantification model based on multiple resource providing nodes includes: Determine the amount of resource transfer revenue for the resource-providing node; The supply efficiency quantification model is obtained based on the pre-set resource cost function and the resource transfer revenue.

5. The method according to claim 3, characterized in that, The acquisition of a demand-benefit quantification model based on a set of multiple resource demand nodes includes: Determine the amount of resource transfer expenditure at resource demand nodes; The demand benefit quantification model is obtained by using a pre-set energy value function and the amount of resource transfer expenditure.

6. The method according to claim 1, characterized in that, The method further includes: Record information on energy resource transfer; The energy resource transfer information includes the amount of resources transferred from the resource providing node to the resource demanding node, the resource transfer attribute value of the energy, and the resource transfer time.

7. An energy resource transfer device based on smart contracts, characterized in that, The device includes: The attribute parameter acquisition module is used to acquire the resource supply attribute parameters submitted to the blockchain by the resource providing node for the energy resources to be transferred, and the resource demand attribute parameters submitted to the blockchain by the resource demand node. The evaluation model determination module is used to input the resource supply attribute parameters and the resource demand attribute parameters into a pre-built initial overall benefit evaluation model through the smart contract of the blockchain to form a target overall benefit evaluation model, wherein the initial overall benefit evaluation model includes a balance constraint term; The model iterative optimization module is used to iteratively optimize the overall benefit evaluation model of the target using a preset target model optimization algorithm, so as to obtain the target equilibrium attribute value of the energy resource. The energy resource transfer module is used to execute the energy resource transfer process from the resource providing node to the resource demanding node based on the target equilibrium attribute value through the smart contract.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.