# Distributed Power Trading System Based on Blockchain Technology

Authors: Shuguo Chen; Weibin Ding; Zhongzheng Xiang; Yuanyuan Liu
Journal: Complexity
 (2021)

---

## Abstract

The power trading system has the characteristics of nonlinearity, dynamics, and complexity. Part of the business data in the trading system needs to be exposed to numerous external business systems. The traditional centralized power trading model has some problems, such as low data security and trust crisis of regulators. Blockchain technology provides prominent ideas for solving these problems. Firstly, the improved AdaBoost algorithm is used to predict the supply and demand gap of power trading nodes. Secondly, based on the fact that the information on the blockchain is only open to the power supply side, a two-stage game model of asymmetric information between the power supply side and the power user is constructed to capture the price competition behavior between them in order to find the Nash equilibrium price in two stages. Finally, the US PJM market electricity market data are used to carry out an example analysis to verify the effectiveness of the algorithm and model.


---

## Body

## 1. Introduction

With increasing economic development, the demand for energy source and electricity increases continually [1]. At this stage, the main form of China’s electric energy trading is centralized trading. In the centralized spot market, medium- and long-term transactions are financial contracts, which are purely bilateral contracts. In principle, the trading center may not play a role. Foreign medium- and long-term contracts are often completed through over-the-counter transactions or future exchanges. In the spot market stage, economy, real-time power balance, grid constraints, climbing constraints, ancillary service constraints, etc., must be considered comprehensively. Dispatching and trading are inseparable. Therefore, in a centralized power market, dispatching and trading agencies are often the same main body. According to the Power Reform No. 9 document, “Separate the transaction business originally undertaken by the power grid company from other businesses, and realize the relatively independent operation of the transaction agency.” If the dispatch and the transaction agencies are separated, how to solve the real-time power imbalance will be a big problem.The distributed power market adopts the electricity market model, which is mainly based on medium- and long-term physical contracts. Both the generator and the consumer determine the daily electricity consumption curve by themselves in the day-ahead stage, and the deviated electricity is adjusted through day-ahead and real-time balance transactions. The market model that combines distributed power market and centralized power market is the mainstream model of foreign markets, and it also meets the current development needs of China’s power market. The combination of large-scale centralized multiparty transactions and decentralized bilateral market transactions is now a relatively mature market transaction model in the world. This model gives users the right to independently choose transaction objects, electricity and prices, and enables users to select appropriate transaction entities based on their own electricity consumption, power quality requirements, and other factors, which further amplifies the decisive role of the market in resource allocation and meets the characteristics of China’s electricity market. The feasibility of the distributed power market is relatively strong in the short term. The bilateral physical transaction and the real-time balanced market are the basic models of the distributed spot power market. In addition, the distributed transaction method also has the advantages of energy saving and environmental protection, high energy conversion rate, high operational reliability, small equipment scale, etc.However, in order to achieve real-time equilibrium in the power market, in addition to integrating distributed transactions in the power trading mode, breakthroughs need to be made at the technical level to ensure the reliability of transactions while realizing distributed power transactions between power energy suppliers and users.The power trading system is a kind of nonlinear complex system. As a trading platform for the public, it covers the whole process of market management, trading declaration, and market settlement. With the reform of electric power system, electric power trading system will conduct business with more external business systems due to business needs. In this process, it is inevitable to carry out a large amount of data interaction, and it involves various data types and large amounts of data. At this point, the importance of data security is highlighted. Data security is the premise of transaction reliability. The main business of the power trading system is all around the sensitive data such as electricity price. The business data contain the real declaration, volume, and transaction price information of market participants in market transactions. If the data are not properly stored and leaked through some links, it may cause huge economic losses. The traditional centralized power transaction mode has low data security and cannot guarantee the reliability of the transaction. With the rapid development and wide application of big data, many data-driven approaches for analyzing management problems have emerged [2]. Blockchain technology is one of the most advanced technologies out there and has potential in many fields [3]. The problem of data security and transaction reliability can be solved by introducing blockchain technology into power transaction and using intelligent contract to store and manage the information of power transaction. Because the transaction data on the blockchain node can be updated in real time, it greatly reduces the information asymmetry between transaction subjects and can improve the security and transparency of transaction behavior, effectively control transaction costs and credit costs, and achieve features such as customized electricity sales plan, peer-to-peer transaction, and automatic settlement.Blockchain is a new application mode of computer technology, such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Its data storage method is distributed, which is consistent with the design principle of distributed transaction mechanism. The distributed transaction process based on blockchain technology reflects the flow relationship between energy flow, information flow, and value flow among transaction subjects. Distributed transactions often involve distribution network operators, distributed generation aggregators, energy storage operators, major power users, and decentralized power users. In actual operation, each transaction subject has a platform network service interface, through which the transaction platform publishes information flow while electricity demanders upload their own demand information. Under the transaction network constructed by the blockchain, various types of transaction methods and clearing mechanisms are programmed to form smart contracts. The transaction node in the blockchain sends the purchase and sale orders corresponding to the trading period to the network through the service interface to form an order book table, and selects the corresponding transaction method according to its own needs. Then, the order book table automatically clears the market according to the clearing mechanism corresponding to different transaction methods in the smart contract. The clearing result is further confirmed and checked by the authorized node to complete the transaction matching and pass the clearing result to the user through the service interface. After the actual delivery, the smart meter uploads the measured energy flow to the trading platform through the service interface, so as to ensure the accuracy of measurement, and then the transaction is settled. The value corresponding to the transaction will be automatically settled and paid between the matched transaction users. The authorized node is responsible for adding the transaction record to a new block and packaging it on the chain, and at the same time publicizing the viewing authority to the relevant node. For the unsuccessful matching transaction in the distributed transaction process and the power deviation generated in the actual delivery, it needs to be balanced by the upper grid. Therefore, it is necessary to establish a deviation assessment and guaranteed power supply mechanism, and the corresponding transaction contracts and prices should also be embedded in the market mechanism in the form of smart contracts.In summary, the core variables of a distributed power trading system based on blockchain technology are the energy flow, information flow, and value flow of the transaction, and the value flow is judged based on the energy flow and information flow. The connotation of value flow in this article mainly includes forecasting transaction nodes, electricity supply and demand gaps, and game pricing strategies among transaction entities. The core value of the value stream of transaction behavior lies in its predictive ability. Using historical information of transaction nodes to build models to predict the relationship between power supply and demand and provide decision-making information for power suppliers is the fundamental way to optimize transaction efficiency. This paper expands the relevant research on the application of blockchain technology in the field of energy system. The algorithm is innovatively improved to adapt to the data evolution characteristics of the distributed power system, and the characteristics of general information asymmetry in the power market are fully considered when analyzing the formation of power price, so that the price of the distributed power system is more consistent with the market reality. For the first time, the applicability of the model is verified by using the data of electricity market in the United States. The main structure of this article is as follows:(1)
Section3.1 uses the improved AdaBoost algorithm to predict the power supply and demand relationship of blockchain transaction nodes(2)
Based on the predicted supply-demand relationship, Section3.2 constructs a two-stage incomplete information game model between the power supplier and the demander and, respectively, formulates the optimal pricing strategy in line with their respective interests(3)
Section4 uses the US PJM electricity market data to conduct a case analysis to verify the feasibility of the algorithm and model


## 2. Literature Review

Blockchain is a term in the field of information technology. In essence, it is a shared database. The data or information stored in it has the characteristics of unforgeable, traceable, open and transparent, and collective maintenance. Based on these characteristics, blockchain technology greatly enhances credibility, reduces the cost of business cooperation, and has broad application prospects. The study in [4] believes that blockchain technology has proliferated in almost all industries, but to varying degrees. Specifically, he found that some industries such as transportation, communications, electricity, and new energy have a high degree of technological integration and a wide range of application scenarios. The study in [5] gave a prospective on using Blockchain as a secure, distributed cyber infrastructure for the future grid. Firstly, the basic principles of Blockchain and its state-of-the-art are introduced. Then, a Blockchain-based smart grid cyber-physical infrastructure model is proposed. Afterward, some promising application domains of Blockchain in future grids are presented. Following this, some potential challenges are discussed. In contrast, the application of blockchain technology in finance, insurance, real estate, and other industries is in the stage of theoretical innovation, with few concrete application examples. For most industries, the application field of blockchain technology still has a large room for expansion, especially in the power and energy industries.The new technological revolution is fundamentally changing the form and development of the world energy industry. The increase in energy demand and the change in energy structure require a great improvement in energy supply capacity, which often requires a huge cost. The energy system based on block chain technology can greatly reduce the management cost of energy supply and energy demand. The study in [6] discusses the impact of blockchain on the US power industry, and analyzes and evaluates pilot projects that have been launched. The research results show that the block chain technology can improve the power supply elasticity of distributed generation, stabilize the supply efficiency of power grid, and thus improve the energy transaction efficiency. The study in [7] analyzed and compared the four mainstream trading modes of China’s power market. On this basis, he integrated block chain technology, proposed the basic development ideas of smart grid, and emphasized the important impact of smart grid on power demand management. Blockchain technology can improve the efficiency of energy trading, and it has also dramatically changed the transaction mode of the energy industry. The study in [8] took the photovoltaic industry as an example and found that the production efficiency, product competitiveness, market share, and innovation ability of companies adopting blockchain technology have all been greatly improved. Although many theories and proof-of-concept studies on energy blockchain have been published, many of them are not supported by large-scale real data. The study in [9] made a deep analysis of 131 energy blockchain projects and found that the energy blockchain in the real world is highly dependent on the participation of power grid operators, engineers, and energy suppliers. The results of the systematic analysis also show that the real-world energy blockchain is developing very rapidly, with an exponential growth year-on-year. However, the content of the information-sharing agreement for energy transactions has become the biggest point of contention. Based on a block chain of photovoltaic on the given transaction mode, the authors of [10] set up the benefit function of photovoltaic power users and distributed photovoltaic aggregators, used Stackelberg game model to determine the internal prices, made optimal utilization planning through the calculation of edge, and designed local consumption and transaction mechanism based on credit scoring which punish the users who consume low electricity and encourage the users to consume through a moving load.The above literature comprehensively introduces the combination mode and combination degree of block chain technology and energy system from the aspects of energy supply and demand management cost, energy trading mode, and the development status and constraints of the energy block chain in real world. The core of blockchain-based distributed energy transactions is smart contracts, which require the power generation and energy storage capacity of blockchain transaction nodes to meet the real-time supply and demand balance. Therefore, it is particularly important to predict the power supply and demand gap and use the operation information to adjust the gap.There are many ways to predict the gap between power supply and demand. Power supply is often related to macroeconomic environment, output decisions of power supply manufacturers, and relevant government policies. Power supply mode is divided into integrated, distributed and integrated distributed. The main types of distributed power generation are photovoltaic power generation, wind power generation, and biomass energy power generation, mainly providing renewable energy. The supply decision of distributed power supplier is mainly based on cost-benefit analysis. Various mathematical models for measuring costs have been proposed. Among them, the most common model is the learning curve, also known as the experience curve, which represents the relationship between unit cost and power generation, and is also used as a common method for planning energy development and policy analysis. The study in [11] focused on the relationship between the cumulative R&D expenditure and cumulative installed capacity of renewable energy. Due to the different costs of renewable energy generation, the author finds that there are some differences in the shapes and inflection points of different learning curves by comparing the differences in the learning curves of wind power generation, solar power generation, and hydro power generation. The carbon tax policy in climate policy is broadly binding. The study in [12] used a stylized electricity market numerical model to analyze the problems of carbon tax and electricity supply, and found that carbon tax can adjust energy prices to varying degrees, increase the price of nonrenewable energy, and expand the market demand for renewable energy. In addition, it was found that the decarbonization policy of the electricity market can promote the development of renewable technologies, thereby improving overall social welfare. The reality that renewable energy is volatile and uncertain makes it difficult to predict the power supply accurately. How to quantitatively describe the distribution of wind power output is the focus of [13]. Based on the assumption that wind speed is a random variable that satisfies the normal distribution and the nonlinear relationship between wind speed and wind power, the authors of [14] established the distribution model of wind power prediction from the viewpoint of the physical mechanism. The study in [15] used the improved whale optimization algorithm to form the bidding strategy model for maximizing the power supplier’s profit and Weibull and Beta distribution functions for modeling the stochastic characteristics of wind‐speed profile and solar‐irradiation, respectively. The proposed technique was tested and clarified with an IEEE‐30, IEEE‐57, and practical 75‐bus Indian system.Electricity demand involves nonlinear data. The forecasting methods include: time series method, neural network algorithm, fuzzy logic algorithm, support vector machine algorithm, and adaptive boost algorithm (AdaBoost). The time series method comes from Econometrics, and forecasts are mainly based on the context of time series. The work in [16] used two different time series methods to study the prediction problem of monthly peak demand for electricity in north India, one was seasonal ARIMA method, and the other was Holt exponential smoothing method. The empirical results show that the seasonal ARIMA method is superior to the Holt exponential smoothing method in terms of square error and absolute error. Similarly, The work in [17] used multiple regression time series to predict power demand in Nigeria, and took electricity consumption and national grid data as independent variables of the model. Although the time series method has prediction ability to some degree, its prediction accuracy is often not high. The work in [18] used the neural network to predict the monthly electricity demand of Spain. He found that the electricity consumption had a cyclical characteristic and this cyclical behavior can be predicted through Fourier series. The results show that the neural network with Fourier series is superior to ARIMA and other neural networks. Fuzzy algorithms are often used to describe inaccurate or fuzzy data and make decisions based on fuzzy data. The study in [19] used fuzzy prediction method to predict the demand of Huatacondo renewable energy microgrid of Chile, and compared the model with the adaptive neural network. The results show that the fuzzy model has better predictive ability. Similarly, [20] also uses fuzzy methods to predict the demand of the distribution system. Based on historical data, the author used the fuzzy system to predict the future power demand. And, through iterating the prediction error step by step, the fuzzy system obtains higher prediction ability. Support Vector Machine (SVM) is a machine learning method developed by [21]. It has the ability of classification and regression and belongs to unsupervised learning. The study in [22] used the SVM model to predict the power demand in Northeast China. By applying the first-order moving average, a smooth data set that does not consider seasonal changes was generated. This data set was used as the training sample of the SVM model to predict the power demand. Compared with SVM, AdaBoost algorithm belongs to supervised learning, and the output index has a clear classification label, which reduces the uncertainty of the system. In order to obtain higher power demand prediction accuracy, [23] compared the weak classifier weight-setting methods of static weight and dynamic weight. In order to improve the adaptability of the classifier, the weight is adjusted according to the similarity between the predicted output and the real output during each iteration. Afterward, [24] combined Gaussian process regression (GPR) algorithm and AdaBoost algorithm, introduced preset threshold from the perspective of statistics, and determined the weight of the final classifier after two layers of training, thus obtaining a high prediction accuracy. The study in [25] presented a new hybrid adaptive autoregressive moving average (ARMA) and functional link neural network (FLNN) trained by adaptive cubature Kalman filter (ACKF) for forecasting day-ahead mixed short-term demand and electricity prices in smart grids. The proposed model comprises a linear ARMA-FLNN obtained by using a nonlinear expansion of the weighted inputs. The nonlinear functional block helps introduce nonlinearity by expanding the input space to higher dimensional space through basis functions. To train the ARMA-FLNN, an ACKF is used to obtain faster convergence and higher forecasting accuracy. In [5], the study proposed a support vector machine (SVM) forecasting model based on rough set (RS) data by combining the rough set attribute reduction and the support vector machine regression algorithm. In [26], the authors proposed a learning method, which consists of a deep learning algorithm with LSTM networks, and tested the validity of the proposed method successfully on the prediction of the load and price by using data collected from the Pennsylvania-New Jersey-Maryland (PJM), the Spain electricity markets, and Iran. The study in [27] presents a generic optimization framework (ANNEX model), including three alternative algorithms for the electricity market-clearing process in order to optimally determine the annual energy mix of a power system. The study in [28] introduces a new short-term electricity price forecasting approach called SASVQR, which is based on support vector quantile regression (SVQR) optimized by simulated annealing algorithm. The study in [29] solved the problem of increasing the energy efficiency of urban electrical networks based on identifying factors affecting power consumption, developed a forecasting model on the basis of seasonal schedules of electricity consumption by household consumers, and proposed a control algorithm based on the proposed seasonal power consumption schedules by household consumers.The above literature collates and discusses various methods of measuring power demand and supply, so as to predict the gap between electricity supply and electricity demand. The power trading system based on block chain technology needs to meet the real-time power supply and demand balance. In addition to improving their own capacity, power suppliers can also balance the gap between power supply and demand through price, which involves a game process between power suppliers and power demanders. The classical game model can be divided into static game and dynamic game in terms of time limit, and can also be divided into complete information game and incomplete information game in terms of information uncertainty. The main application value of blockchain is to reduce the uncertainty of information between the two sides of the game. Therefore, incomplete information model has been widely applied by many scholars. The authors of [29, 30] creatively introduced the multi-agent system and then established a cooperative game model among power grid operators, energy suppliers, and users, which characterized the mutual game relationship among energy trading participant and provided a basic model reference for subsequent scholars. The study in [31] preliminarily explored the multimodule collaborative autonomy model of the energy Internet under the blockchain framework, and proposed the key technologies for the development of the energy Internet. He believed that most of the researches explored and analyzed the application of blockchain technology in the energy system from the perspective of application mode and overall framework, and rarely involved the solution of specific problems. On the basis of the above studies, [32] analyzed the relationship between the block chain technology and the competitive game in the power market from five aspects: information transparency, decentralization, dynamics, security, and rewards and punishments. He established the local multi-microgrid market competition game model under the blockchain technology and explored the practical application mode of the block chain technology in the power market. In addition, the authors of [33] used the noncooperative static game model to study the market competition relationship between power grid companies, newly added power supply entities, and users. In order to solve the limitations of the static game model, [34] established dynamic games of complete information in active distribution network with multi-stakeholder participation while taking the demand side response into consideration. The study in [35] proposed a trading model of PV microgrid cluster based on cooperative game theory. On this basis, the researchers also extended the traditional game theory. For example, the authors of [36] studied the bilateral contract transactions between generation companies and large consumers by using the master-slave game model, and the authors of [37] introduced the gray game theory to establish the gray game model of auxiliary binding strategy in the power market.The above game models are all carried out on the premise that the decision-making participants are completely rational. But in fact, for the actual power market game, various random factors will affect the final strategy, and the participants in the game usually have only finite rationality. In this context, evolutionary game theory is gradually applied to power grid operation analysis. The authors of [38] combined evolutionary game theory with coevolutionary game algorithm and analyzed the economic benefits of interactive operation of microgrids and distribution networks. However, there are few researches on the power market operation mechanism of active distribution network by using evolutionary game theory, and the algorithm to solve the evolutionary game model still needs to be further studied.This paper innovates in the following two aspects. First, the AdaBoost algorithm is improved by adjusting the updated sample centralization weight to the characteristics of electricity market trading data, and then the research of solving evolutionary game model is advanced. Second, a two-stage incomplete information game model between the power supplier and the demander is constructed to, respectively, formulate the optimal pricing strategy.


## 3. Algorithms and Models

Realizing live power supply and demand balance is the key problem of distributed power trading based on block chain technology. This section first uses the improved AdaBoost algorithm to predict the electricity supply and demand gap at the transaction node. And then, the manufacturer can conduct a two-stage game with electricity consumers based on this supply and demand relationship, thus formulating an equilibrium price that is in line with the interests of both parties.


### 3.1. AdaBoost Algorithm

#### 3.1.1. Theoretical Basis

The AdaBoost algorithm has been proven to be an effective and practical and representative boosting algorithm. AdaBoost algorithm was improved by Yoav Freund and Robert Schapire in 1995, whose algorithm principle is to select the weak classifier with the lowest weight coefficient from the trained weak classifier and combine them into a final strong classifier by adjusting the weight of the sample and the weight of the weak classifier. The weak classifier is trained based on the training set. The next weak classifier is obtained by training on different weight sets of samples. The weight is determined by the difficulty of each sample to be classified, which is estimated by the output of the classifier in the previous step.AdaBoost is an iterative algorithm. The core idea is to train different weak classifiers for the same training set, and then combine these weak classifiers linearly to form the final strong classifier. This process involves an iterative change of the two weights. The first is the weight of the sample, the initial value is uniformly distributed, and the new weight of the sample is calculated through the iteration of the weak classifier. The iteration direction is described as a decrease in the weight of the correctly classified samples and an increase in the weight of the wrongly classified samples. The second is the weight of the weak classifier. According to the classification error of the current weak classifier, its weight in the strong classifier can be calculated. With the increase of the number of iterations, the weak classifier with smaller classification error has a larger weight and plays a more decisive role in the final classification function. The weak classifier with larger classification error has a smaller weight and plays a smaller role. Finally, the final strong classifier is obtained.


#### 3.1.2. Theoretical Derivation

AdaBoost algorithm is a forward-distributed addition algorithm model, which is divided into two steps: addition model and forward distribution algorithm. The final classifier is defined as(1)fx=∑m=1MαmGmx,where Gmx is the basic classifier (weak classifier) and αm is the weight coefficient of the basic classifier,m=1,2,…,M. The loss function of forward distribution algorithm is defined as the exponential loss function:(2)Ly,fx=e−yfx.Suppose the iteration starts withm=1,(3)f1x=α1G1x,f2x=α1G1x+α2G2x,…fm−1x=α1G1x+α2G2x+⋯+αm−1Gm−1x.Afterm−1 round of iteration, fm−1x is obtained. According to the forward distribution algorithm, fmx can be obtained:(4)fmx=α1G1x+α2G2x+⋯+αm−1Gm−1x+αmGmx=fm−1x+αmGmx.The goal is to minimize the exponential loss offmx on the training set, using fm−1x and Gmx obtained by the forward distribution algorithm, namely,(5)Loss=min∑m=1Mexp−yfx=min∑m=1Mexp−yifmx=min∑m=1Mexp−yi⋅fm−1x+αmGmx,where, wm,i˜=exp−yifm−1x can be regarded as the sample weight of each round of iteration, which depends on the sample weight of the previous round. The above equation is equal to(6)=∑m=1Mexp−yifm−1x⋅exp−yiαmGmx=∑yi=Gmxwm,i˜exp−αm+∑yi≠Gmxwm,i˜expαm=∑i=1N1−emexp−αm+emexpαm.MinimizingLoss, that is, taking the derivative of loss function Loss with respect to αm and making it equal to 0 yields(7)αm=12ln1−emem,where(8)em=∑i=1Nwm,i˜Iyi≠Gmx.Based on the above setting of loss function and classifier weight, the algorithm flow of AdaBoost forward-distributed addition model is as follows. SetT=x1,y1,x2,y2,…,xn,yn, i=1,2,…,N, yi∈±1, where, x1,x2,…,xn is the input set, which can reflect the power demand index on a node of the block chain at a certain time, and y1,y2,…,yn is the output set, which reflects the power supply and demand gap of the node:Step 1: initialize the weight,D1=w1,1,w1,2,w1,3,…,w1,n, which follows the uniform distribution, w1,i=1/N.Step 2: use the sample data set with weightDm for learning, construct weak classifier Gmx, where m=1,2,…,M, and then calculate the classification error rate of Gmx on the training data set based on equation (8).Step 3: calculate the weight coefficientαm of Gmx in the strong classifier based on equation (7).Step 4: update the sample distribution, namely, the sample weight, wherezm is the normalization factor:(9)wm+1,i=wm,izmexp−yiαmGmxi,i=1,2,…,N,zm=∑i=1Nwm,iexp−yiαmGmxi.Step 5: iterate to get the final classifier:(10)fMx=sign∑m=1MαmGmx.


#### 3.1.3. AdaBoost Algorithm Improvement

The above basic AdaBoost algorithm has two important problems. First, the composition of the weak classifier is often based on the single-layer decision tree, which is too simple to be suitable for unbalanced data classification. However, the transaction data in the power market tend to be highly volatile, which will greatly reduce the efficiency of the weak classifier. Second, when the training sample set contains some samples that are difficult to distinguish, the sample weight will increase due to the misclassification of the weak classifier in the last iteration. If a certain target classification set contains too many samples that are difficult to distinguish, the sample data distribution of the next selection training will be distorted and the algorithm will fail. This section will improve the performance of the weak classifier by adjusting the updated sample centralization weight.This part will focus on solving the problem of supply and demand prediction of block chain nodes. Now, the supply and demand gap only have two directions, so the weight of its loss function needs to be adjusted again and selected as the category function of positive and negative. Supposehxi is the predicted output of the weak classifier to the sample xi. The loss function ltxi after the t rounds iteration is defined as(11)ltxi=0,hxi=yi,1,hxi≠yi.Its complement function is:I¯txi=1−ltxi. Assuming that at the tth iteration, the training sample drawn from the random distribution of the sample is Tt, then the complement of the training set is T˜t=T−Tt. The weight of this iteration is updated to(12)lt=1zm∑xi∈Gmxxj∉Gmxltxiltxj−∑xi∈Gmxxj∉GmxI¯txiI¯txj.It can be seen thatlt reflects the ability of the weak classifier to classify samples belonging to class Gmx and samples not belonging to class Gmx, which ensures the robustness of correct classification. For this paper, when i=1,2, the rule of weight updating above is(13)lt=1zm∑x1∈Gmx1x2∈Gmx2ltxiltxj−∑x1∈Gmx1x2∈Gmx2I¯txiI¯txj.Correspondingly, the weight coefficientαm of the proportion of Gmx in the strong classifier is(14)αm=12ln1−emem+lt.The traditional AdaBoost algorithm is a classification problem of symmetric distribution of accuracy, that is, the classification error rate of positive samples and the error rate of negative samples are in a uniform and equal position throughout the training process. However, the regional electricity consumption data studied in this paper does not conform to the above rules. For example, there is a big difference in the variation of the relevant indicators of electricity demand data and the relevant indicators of electricity supply between regions, which makes the sample set to excessively focus on a certain category after training, thus leading to an increase in the error rate. In this section, the classification performance of different types of samples is used to adjust the specific weights of training samples on the whole data set. When the weak classifier classifies the power supply and demand relationship in a certain area correctly,lt increases by 1. And, when the classification is wrong, lt decreases by 1. Therefore, the imbalance of the classification error ratio will affect the classification and its integration.


### 3.2. Bilateral Game Model Based on Incomplete Information

Given the above research, we can more accurately predict the power supply and demand gap of each node on the blockchain by AdaBoost algorithm. Based on the gap between supply and demand, power producers can make decisions such as pricing and scheduling, energy storage planning, and coordination and scheduling. According to the characteristics of the distributed power generation, power consumers can use electricity and sell electricity. There are both competitive relations and cooperative relations among the trading entities in the power market, which conforms to the basic setting of game theory. Therefore, this section applies the incomplete information dynamic model to the game between power producers and consumers.Usually, the blockchain types in the power grid are divided into public chain, alliance chain, and private chain according to the target audience. Because the power system is related to people’s livelihood and national security, the blockchain of the power system is mainly aimed at large, state-owned power service manufacturers, and has the characteristics of partial decentralization. Therefore, this section focuses on league chain. There are power supply side and power demand side under the framework of alliance chain.


#### 3.2.1. The Profit Function of the Trading Entities

Based on the AdaBoost algorithm, the gap between supply and demand of power trading nodes is predicted. According to the characteristics of the alliance chain, the information about the gap is only known to the power market suppliers but not to the demand side. The trading rules in the power market are as follows: after all buyers and sellers submit bids, the market matches from the lowest selling price according to the pricing rules, and the final successful matching price is the market-clearing price. Therefore, the essence of the power market transaction is the asymmetric information game between the power supplier and the demand side, which is a process of mutual correlation and restriction of bilateral income.In the two-stage game, neither the supply side nor the demand side knows the pricing strategy that the other side may adopt. Since the supplier can predict the supply and demand gap of a certain trading node, the supplier has the first-mover pricing advantage in the first stage. After observing the pricing strategy proposed by the supplier, the power consumers have two strategies: accepting prices or not accepting prices. When the consumer refuses, the game goes to the second stage; the consumer comes up with the price plan first. Similarly, the supplier can choose to accept or not to accept. If the supplier chooses to accept, the transaction will be concluded. If the supplier chooses not to accept, the transaction will be cancelled, and both parties shall bear corresponding losses, respectively.(1)
The profit function on the supply sideThe profit of the power supplier depends on the net profit per unit and the amount of transaction. Assuming that the transaction powerQs,t is the power supply in time t, and ps,t is the price scheme provided by the supplier, ct is the marginal power generation cost of the power supplier. If the power demand is equal to the power supply when the transaction is concluded, and the consumer accepts the price of the power supplier, then the power supplier’s profit function Is,t is(15)Is,t=Qs,tps,t−ct.If the electricity consumers do not accept the supplier’s price plan, then they will put forward their own pricepd,t in the second stage of the game. If the supplier agrees with the scheme, then the transaction is concluded. In this case, the profit function of the power supplier Is,t is(16)Is,t=Qd,tpd,t−ct.It is worth noting that the power supply side knows the demand quantity of the demand side, soQd,t=Qs,t in the above equation. If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power supplier is Qs,tct.(2)
The profit function on the demand sideThe demand-side profit function is similar to the supply side return model. In the first stage, if the transaction is concluded, that is, the consumer accepts the price scheme of the power supplier, where the implied condition ispd,t>ps,t, then the corresponding income is(17)Id,t=Qs,tpd,t−ps,t+Rps,t,whereRps,t is the income after electricity purchase, and R>0,R′<0. If the power consumers do not accept the supplier’s price scheme, they will put forward their own price pd,t in the second stage of the game, where the implicit condition is pd,t<ps,t. If the supplier agrees with the scheme, then the transaction is concluded. And, the profit function of the power demand side is(18)Id,t=Rpd,t.If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power demander isRpd,t.


#### 3.2.2. Solution of Bilateral Game Decision Model Based on Nash Equilibrium

The game describes the decision-making process of two or more players pursuing their respective goals. The four elements of game are decision-maker, strategy, payment function, and equilibrium solution. Nash equilibrium also provides decision-makers with the consistent prediction of the possible outcome of the game, that is, the optimal decision result of rational decision-makers, thus pointing out the direction of strategy making.In any game model, the existence of Nash equilibrium is particularly important. When the game strategy is a nonempty, bounded convex set in the Euclidean space, the reward function is continuous and upper quasi-convex in the sub-strategy space. In this case, the game model has pure strategy Nash equilibrium. For the game model studied in this section, the strategy space of bilateral games obviously satisfies the characteristics of nonempty, bounded, and convex sets. And, because the pricing strategy is continuous, the profit function is also continuous, and satisfies the upper convex condition that the first derivative is not zero and the second derivative is not less than zero. Therefore, the two-sided game model considered in this section has Nash equilibrium solution.Suppose the set of decision makers isP1,P2,…,Pn, the set of adopted policies is S1,S2,…,Sn, and the corresponding set of payment functions is I1,I2,…,I3, where n is the number of participants. This section only involves the supply side and the demand side of the power market, so we denote the set of decision-makers as Ps,Pd, where Ps represents the power supply side and Pd represents the power demand side. The payment function of the two sides is Is,Id. The supply side and the demand side need to determine their respective power purchase price in two stages, and the set of strategies is ps,pd.The equilibrium equation is as follows, whereps∗ and pd∗ represent the final Nash equilibrium solution respectively. For the power supplier, given the optimal pricing strategy pd∗ of the demander, the power supplier chooses the optimal pricing ps∗ to maximize their profits. Similarly, for the power supplier, given that the optimal price of the supply side is ps∗, the optimal pricing of consumers maximizing their profits is pd∗:(19)ps∗=argmaxIsps,pd∗,pd∗=argmaxIspd,ps∗.Based on the above analysis, in the two-stage game model, the backward method is usually used to solve out the Nash equilibrium. The specific steps are as follows:Step 1: establish the framework of two-stage game model, and define the strategy space and reward function of power supplier and demander in each stage.Step 2: starting from the second stage, the power demanderPd formulates the price plan, and Pd needs to compare the profit function of Ps under two states of agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price ps∗ is obtained when the payment under the two states is equal.Step 3: discount the payment of both parties in the second period to the first period. Similarly, when the power supplierPs makes the price plan, Ps needs to compare the profit function under the two states of Pd agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price pd∗ is obtained when the payment under the two states is equal.


## 3.1. AdaBoost Algorithm

### 3.1.1. Theoretical Basis

The AdaBoost algorithm has been proven to be an effective and practical and representative boosting algorithm. AdaBoost algorithm was improved by Yoav Freund and Robert Schapire in 1995, whose algorithm principle is to select the weak classifier with the lowest weight coefficient from the trained weak classifier and combine them into a final strong classifier by adjusting the weight of the sample and the weight of the weak classifier. The weak classifier is trained based on the training set. The next weak classifier is obtained by training on different weight sets of samples. The weight is determined by the difficulty of each sample to be classified, which is estimated by the output of the classifier in the previous step.AdaBoost is an iterative algorithm. The core idea is to train different weak classifiers for the same training set, and then combine these weak classifiers linearly to form the final strong classifier. This process involves an iterative change of the two weights. The first is the weight of the sample, the initial value is uniformly distributed, and the new weight of the sample is calculated through the iteration of the weak classifier. The iteration direction is described as a decrease in the weight of the correctly classified samples and an increase in the weight of the wrongly classified samples. The second is the weight of the weak classifier. According to the classification error of the current weak classifier, its weight in the strong classifier can be calculated. With the increase of the number of iterations, the weak classifier with smaller classification error has a larger weight and plays a more decisive role in the final classification function. The weak classifier with larger classification error has a smaller weight and plays a smaller role. Finally, the final strong classifier is obtained.


### 3.1.2. Theoretical Derivation

AdaBoost algorithm is a forward-distributed addition algorithm model, which is divided into two steps: addition model and forward distribution algorithm. The final classifier is defined as(1)fx=∑m=1MαmGmx,where Gmx is the basic classifier (weak classifier) and αm is the weight coefficient of the basic classifier,m=1,2,…,M. The loss function of forward distribution algorithm is defined as the exponential loss function:(2)Ly,fx=e−yfx.Suppose the iteration starts withm=1,(3)f1x=α1G1x,f2x=α1G1x+α2G2x,…fm−1x=α1G1x+α2G2x+⋯+αm−1Gm−1x.Afterm−1 round of iteration, fm−1x is obtained. According to the forward distribution algorithm, fmx can be obtained:(4)fmx=α1G1x+α2G2x+⋯+αm−1Gm−1x+αmGmx=fm−1x+αmGmx.The goal is to minimize the exponential loss offmx on the training set, using fm−1x and Gmx obtained by the forward distribution algorithm, namely,(5)Loss=min∑m=1Mexp−yfx=min∑m=1Mexp−yifmx=min∑m=1Mexp−yi⋅fm−1x+αmGmx,where, wm,i˜=exp−yifm−1x can be regarded as the sample weight of each round of iteration, which depends on the sample weight of the previous round. The above equation is equal to(6)=∑m=1Mexp−yifm−1x⋅exp−yiαmGmx=∑yi=Gmxwm,i˜exp−αm+∑yi≠Gmxwm,i˜expαm=∑i=1N1−emexp−αm+emexpαm.MinimizingLoss, that is, taking the derivative of loss function Loss with respect to αm and making it equal to 0 yields(7)αm=12ln1−emem,where(8)em=∑i=1Nwm,i˜Iyi≠Gmx.Based on the above setting of loss function and classifier weight, the algorithm flow of AdaBoost forward-distributed addition model is as follows. SetT=x1,y1,x2,y2,…,xn,yn, i=1,2,…,N, yi∈±1, where, x1,x2,…,xn is the input set, which can reflect the power demand index on a node of the block chain at a certain time, and y1,y2,…,yn is the output set, which reflects the power supply and demand gap of the node:Step 1: initialize the weight,D1=w1,1,w1,2,w1,3,…,w1,n, which follows the uniform distribution, w1,i=1/N.Step 2: use the sample data set with weightDm for learning, construct weak classifier Gmx, where m=1,2,…,M, and then calculate the classification error rate of Gmx on the training data set based on equation (8).Step 3: calculate the weight coefficientαm of Gmx in the strong classifier based on equation (7).Step 4: update the sample distribution, namely, the sample weight, wherezm is the normalization factor:(9)wm+1,i=wm,izmexp−yiαmGmxi,i=1,2,…,N,zm=∑i=1Nwm,iexp−yiαmGmxi.Step 5: iterate to get the final classifier:(10)fMx=sign∑m=1MαmGmx.


### 3.1.3. AdaBoost Algorithm Improvement

The above basic AdaBoost algorithm has two important problems. First, the composition of the weak classifier is often based on the single-layer decision tree, which is too simple to be suitable for unbalanced data classification. However, the transaction data in the power market tend to be highly volatile, which will greatly reduce the efficiency of the weak classifier. Second, when the training sample set contains some samples that are difficult to distinguish, the sample weight will increase due to the misclassification of the weak classifier in the last iteration. If a certain target classification set contains too many samples that are difficult to distinguish, the sample data distribution of the next selection training will be distorted and the algorithm will fail. This section will improve the performance of the weak classifier by adjusting the updated sample centralization weight.This part will focus on solving the problem of supply and demand prediction of block chain nodes. Now, the supply and demand gap only have two directions, so the weight of its loss function needs to be adjusted again and selected as the category function of positive and negative. Supposehxi is the predicted output of the weak classifier to the sample xi. The loss function ltxi after the t rounds iteration is defined as(11)ltxi=0,hxi=yi,1,hxi≠yi.Its complement function is:I¯txi=1−ltxi. Assuming that at the tth iteration, the training sample drawn from the random distribution of the sample is Tt, then the complement of the training set is T˜t=T−Tt. The weight of this iteration is updated to(12)lt=1zm∑xi∈Gmxxj∉Gmxltxiltxj−∑xi∈Gmxxj∉GmxI¯txiI¯txj.It can be seen thatlt reflects the ability of the weak classifier to classify samples belonging to class Gmx and samples not belonging to class Gmx, which ensures the robustness of correct classification. For this paper, when i=1,2, the rule of weight updating above is(13)lt=1zm∑x1∈Gmx1x2∈Gmx2ltxiltxj−∑x1∈Gmx1x2∈Gmx2I¯txiI¯txj.Correspondingly, the weight coefficientαm of the proportion of Gmx in the strong classifier is(14)αm=12ln1−emem+lt.The traditional AdaBoost algorithm is a classification problem of symmetric distribution of accuracy, that is, the classification error rate of positive samples and the error rate of negative samples are in a uniform and equal position throughout the training process. However, the regional electricity consumption data studied in this paper does not conform to the above rules. For example, there is a big difference in the variation of the relevant indicators of electricity demand data and the relevant indicators of electricity supply between regions, which makes the sample set to excessively focus on a certain category after training, thus leading to an increase in the error rate. In this section, the classification performance of different types of samples is used to adjust the specific weights of training samples on the whole data set. When the weak classifier classifies the power supply and demand relationship in a certain area correctly,lt increases by 1. And, when the classification is wrong, lt decreases by 1. Therefore, the imbalance of the classification error ratio will affect the classification and its integration.


## 3.1.1. Theoretical Basis

The AdaBoost algorithm has been proven to be an effective and practical and representative boosting algorithm. AdaBoost algorithm was improved by Yoav Freund and Robert Schapire in 1995, whose algorithm principle is to select the weak classifier with the lowest weight coefficient from the trained weak classifier and combine them into a final strong classifier by adjusting the weight of the sample and the weight of the weak classifier. The weak classifier is trained based on the training set. The next weak classifier is obtained by training on different weight sets of samples. The weight is determined by the difficulty of each sample to be classified, which is estimated by the output of the classifier in the previous step.AdaBoost is an iterative algorithm. The core idea is to train different weak classifiers for the same training set, and then combine these weak classifiers linearly to form the final strong classifier. This process involves an iterative change of the two weights. The first is the weight of the sample, the initial value is uniformly distributed, and the new weight of the sample is calculated through the iteration of the weak classifier. The iteration direction is described as a decrease in the weight of the correctly classified samples and an increase in the weight of the wrongly classified samples. The second is the weight of the weak classifier. According to the classification error of the current weak classifier, its weight in the strong classifier can be calculated. With the increase of the number of iterations, the weak classifier with smaller classification error has a larger weight and plays a more decisive role in the final classification function. The weak classifier with larger classification error has a smaller weight and plays a smaller role. Finally, the final strong classifier is obtained.


## 3.1.2. Theoretical Derivation

AdaBoost algorithm is a forward-distributed addition algorithm model, which is divided into two steps: addition model and forward distribution algorithm. The final classifier is defined as(1)fx=∑m=1MαmGmx,where Gmx is the basic classifier (weak classifier) and αm is the weight coefficient of the basic classifier,m=1,2,…,M. The loss function of forward distribution algorithm is defined as the exponential loss function:(2)Ly,fx=e−yfx.Suppose the iteration starts withm=1,(3)f1x=α1G1x,f2x=α1G1x+α2G2x,…fm−1x=α1G1x+α2G2x+⋯+αm−1Gm−1x.Afterm−1 round of iteration, fm−1x is obtained. According to the forward distribution algorithm, fmx can be obtained:(4)fmx=α1G1x+α2G2x+⋯+αm−1Gm−1x+αmGmx=fm−1x+αmGmx.The goal is to minimize the exponential loss offmx on the training set, using fm−1x and Gmx obtained by the forward distribution algorithm, namely,(5)Loss=min∑m=1Mexp−yfx=min∑m=1Mexp−yifmx=min∑m=1Mexp−yi⋅fm−1x+αmGmx,where, wm,i˜=exp−yifm−1x can be regarded as the sample weight of each round of iteration, which depends on the sample weight of the previous round. The above equation is equal to(6)=∑m=1Mexp−yifm−1x⋅exp−yiαmGmx=∑yi=Gmxwm,i˜exp−αm+∑yi≠Gmxwm,i˜expαm=∑i=1N1−emexp−αm+emexpαm.MinimizingLoss, that is, taking the derivative of loss function Loss with respect to αm and making it equal to 0 yields(7)αm=12ln1−emem,where(8)em=∑i=1Nwm,i˜Iyi≠Gmx.Based on the above setting of loss function and classifier weight, the algorithm flow of AdaBoost forward-distributed addition model is as follows. SetT=x1,y1,x2,y2,…,xn,yn, i=1,2,…,N, yi∈±1, where, x1,x2,…,xn is the input set, which can reflect the power demand index on a node of the block chain at a certain time, and y1,y2,…,yn is the output set, which reflects the power supply and demand gap of the node:Step 1: initialize the weight,D1=w1,1,w1,2,w1,3,…,w1,n, which follows the uniform distribution, w1,i=1/N.Step 2: use the sample data set with weightDm for learning, construct weak classifier Gmx, where m=1,2,…,M, and then calculate the classification error rate of Gmx on the training data set based on equation (8).Step 3: calculate the weight coefficientαm of Gmx in the strong classifier based on equation (7).Step 4: update the sample distribution, namely, the sample weight, wherezm is the normalization factor:(9)wm+1,i=wm,izmexp−yiαmGmxi,i=1,2,…,N,zm=∑i=1Nwm,iexp−yiαmGmxi.Step 5: iterate to get the final classifier:(10)fMx=sign∑m=1MαmGmx.


## 3.1.3. AdaBoost Algorithm Improvement

The above basic AdaBoost algorithm has two important problems. First, the composition of the weak classifier is often based on the single-layer decision tree, which is too simple to be suitable for unbalanced data classification. However, the transaction data in the power market tend to be highly volatile, which will greatly reduce the efficiency of the weak classifier. Second, when the training sample set contains some samples that are difficult to distinguish, the sample weight will increase due to the misclassification of the weak classifier in the last iteration. If a certain target classification set contains too many samples that are difficult to distinguish, the sample data distribution of the next selection training will be distorted and the algorithm will fail. This section will improve the performance of the weak classifier by adjusting the updated sample centralization weight.This part will focus on solving the problem of supply and demand prediction of block chain nodes. Now, the supply and demand gap only have two directions, so the weight of its loss function needs to be adjusted again and selected as the category function of positive and negative. Supposehxi is the predicted output of the weak classifier to the sample xi. The loss function ltxi after the t rounds iteration is defined as(11)ltxi=0,hxi=yi,1,hxi≠yi.Its complement function is:I¯txi=1−ltxi. Assuming that at the tth iteration, the training sample drawn from the random distribution of the sample is Tt, then the complement of the training set is T˜t=T−Tt. The weight of this iteration is updated to(12)lt=1zm∑xi∈Gmxxj∉Gmxltxiltxj−∑xi∈Gmxxj∉GmxI¯txiI¯txj.It can be seen thatlt reflects the ability of the weak classifier to classify samples belonging to class Gmx and samples not belonging to class Gmx, which ensures the robustness of correct classification. For this paper, when i=1,2, the rule of weight updating above is(13)lt=1zm∑x1∈Gmx1x2∈Gmx2ltxiltxj−∑x1∈Gmx1x2∈Gmx2I¯txiI¯txj.Correspondingly, the weight coefficientαm of the proportion of Gmx in the strong classifier is(14)αm=12ln1−emem+lt.The traditional AdaBoost algorithm is a classification problem of symmetric distribution of accuracy, that is, the classification error rate of positive samples and the error rate of negative samples are in a uniform and equal position throughout the training process. However, the regional electricity consumption data studied in this paper does not conform to the above rules. For example, there is a big difference in the variation of the relevant indicators of electricity demand data and the relevant indicators of electricity supply between regions, which makes the sample set to excessively focus on a certain category after training, thus leading to an increase in the error rate. In this section, the classification performance of different types of samples is used to adjust the specific weights of training samples on the whole data set. When the weak classifier classifies the power supply and demand relationship in a certain area correctly,lt increases by 1. And, when the classification is wrong, lt decreases by 1. Therefore, the imbalance of the classification error ratio will affect the classification and its integration.


## 3.2. Bilateral Game Model Based on Incomplete Information

Given the above research, we can more accurately predict the power supply and demand gap of each node on the blockchain by AdaBoost algorithm. Based on the gap between supply and demand, power producers can make decisions such as pricing and scheduling, energy storage planning, and coordination and scheduling. According to the characteristics of the distributed power generation, power consumers can use electricity and sell electricity. There are both competitive relations and cooperative relations among the trading entities in the power market, which conforms to the basic setting of game theory. Therefore, this section applies the incomplete information dynamic model to the game between power producers and consumers.Usually, the blockchain types in the power grid are divided into public chain, alliance chain, and private chain according to the target audience. Because the power system is related to people’s livelihood and national security, the blockchain of the power system is mainly aimed at large, state-owned power service manufacturers, and has the characteristics of partial decentralization. Therefore, this section focuses on league chain. There are power supply side and power demand side under the framework of alliance chain.


### 3.2.1. The Profit Function of the Trading Entities

Based on the AdaBoost algorithm, the gap between supply and demand of power trading nodes is predicted. According to the characteristics of the alliance chain, the information about the gap is only known to the power market suppliers but not to the demand side. The trading rules in the power market are as follows: after all buyers and sellers submit bids, the market matches from the lowest selling price according to the pricing rules, and the final successful matching price is the market-clearing price. Therefore, the essence of the power market transaction is the asymmetric information game between the power supplier and the demand side, which is a process of mutual correlation and restriction of bilateral income.In the two-stage game, neither the supply side nor the demand side knows the pricing strategy that the other side may adopt. Since the supplier can predict the supply and demand gap of a certain trading node, the supplier has the first-mover pricing advantage in the first stage. After observing the pricing strategy proposed by the supplier, the power consumers have two strategies: accepting prices or not accepting prices. When the consumer refuses, the game goes to the second stage; the consumer comes up with the price plan first. Similarly, the supplier can choose to accept or not to accept. If the supplier chooses to accept, the transaction will be concluded. If the supplier chooses not to accept, the transaction will be cancelled, and both parties shall bear corresponding losses, respectively.(1)
The profit function on the supply sideThe profit of the power supplier depends on the net profit per unit and the amount of transaction. Assuming that the transaction powerQs,t is the power supply in time t, and ps,t is the price scheme provided by the supplier, ct is the marginal power generation cost of the power supplier. If the power demand is equal to the power supply when the transaction is concluded, and the consumer accepts the price of the power supplier, then the power supplier’s profit function Is,t is(15)Is,t=Qs,tps,t−ct.If the electricity consumers do not accept the supplier’s price plan, then they will put forward their own pricepd,t in the second stage of the game. If the supplier agrees with the scheme, then the transaction is concluded. In this case, the profit function of the power supplier Is,t is(16)Is,t=Qd,tpd,t−ct.It is worth noting that the power supply side knows the demand quantity of the demand side, soQd,t=Qs,t in the above equation. If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power supplier is Qs,tct.(2)
The profit function on the demand sideThe demand-side profit function is similar to the supply side return model. In the first stage, if the transaction is concluded, that is, the consumer accepts the price scheme of the power supplier, where the implied condition ispd,t>ps,t, then the corresponding income is(17)Id,t=Qs,tpd,t−ps,t+Rps,t,whereRps,t is the income after electricity purchase, and R>0,R′<0. If the power consumers do not accept the supplier’s price scheme, they will put forward their own price pd,t in the second stage of the game, where the implicit condition is pd,t<ps,t. If the supplier agrees with the scheme, then the transaction is concluded. And, the profit function of the power demand side is(18)Id,t=Rpd,t.If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power demander isRpd,t.


### 3.2.2. Solution of Bilateral Game Decision Model Based on Nash Equilibrium

The game describes the decision-making process of two or more players pursuing their respective goals. The four elements of game are decision-maker, strategy, payment function, and equilibrium solution. Nash equilibrium also provides decision-makers with the consistent prediction of the possible outcome of the game, that is, the optimal decision result of rational decision-makers, thus pointing out the direction of strategy making.In any game model, the existence of Nash equilibrium is particularly important. When the game strategy is a nonempty, bounded convex set in the Euclidean space, the reward function is continuous and upper quasi-convex in the sub-strategy space. In this case, the game model has pure strategy Nash equilibrium. For the game model studied in this section, the strategy space of bilateral games obviously satisfies the characteristics of nonempty, bounded, and convex sets. And, because the pricing strategy is continuous, the profit function is also continuous, and satisfies the upper convex condition that the first derivative is not zero and the second derivative is not less than zero. Therefore, the two-sided game model considered in this section has Nash equilibrium solution.Suppose the set of decision makers isP1,P2,…,Pn, the set of adopted policies is S1,S2,…,Sn, and the corresponding set of payment functions is I1,I2,…,I3, where n is the number of participants. This section only involves the supply side and the demand side of the power market, so we denote the set of decision-makers as Ps,Pd, where Ps represents the power supply side and Pd represents the power demand side. The payment function of the two sides is Is,Id. The supply side and the demand side need to determine their respective power purchase price in two stages, and the set of strategies is ps,pd.The equilibrium equation is as follows, whereps∗ and pd∗ represent the final Nash equilibrium solution respectively. For the power supplier, given the optimal pricing strategy pd∗ of the demander, the power supplier chooses the optimal pricing ps∗ to maximize their profits. Similarly, for the power supplier, given that the optimal price of the supply side is ps∗, the optimal pricing of consumers maximizing their profits is pd∗:(19)ps∗=argmaxIsps,pd∗,pd∗=argmaxIspd,ps∗.Based on the above analysis, in the two-stage game model, the backward method is usually used to solve out the Nash equilibrium. The specific steps are as follows:Step 1: establish the framework of two-stage game model, and define the strategy space and reward function of power supplier and demander in each stage.Step 2: starting from the second stage, the power demanderPd formulates the price plan, and Pd needs to compare the profit function of Ps under two states of agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price ps∗ is obtained when the payment under the two states is equal.Step 3: discount the payment of both parties in the second period to the first period. Similarly, when the power supplierPs makes the price plan, Ps needs to compare the profit function under the two states of Pd agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price pd∗ is obtained when the payment under the two states is equal.


## 3.2.1. The Profit Function of the Trading Entities

Based on the AdaBoost algorithm, the gap between supply and demand of power trading nodes is predicted. According to the characteristics of the alliance chain, the information about the gap is only known to the power market suppliers but not to the demand side. The trading rules in the power market are as follows: after all buyers and sellers submit bids, the market matches from the lowest selling price according to the pricing rules, and the final successful matching price is the market-clearing price. Therefore, the essence of the power market transaction is the asymmetric information game between the power supplier and the demand side, which is a process of mutual correlation and restriction of bilateral income.In the two-stage game, neither the supply side nor the demand side knows the pricing strategy that the other side may adopt. Since the supplier can predict the supply and demand gap of a certain trading node, the supplier has the first-mover pricing advantage in the first stage. After observing the pricing strategy proposed by the supplier, the power consumers have two strategies: accepting prices or not accepting prices. When the consumer refuses, the game goes to the second stage; the consumer comes up with the price plan first. Similarly, the supplier can choose to accept or not to accept. If the supplier chooses to accept, the transaction will be concluded. If the supplier chooses not to accept, the transaction will be cancelled, and both parties shall bear corresponding losses, respectively.(1)
The profit function on the supply sideThe profit of the power supplier depends on the net profit per unit and the amount of transaction. Assuming that the transaction powerQs,t is the power supply in time t, and ps,t is the price scheme provided by the supplier, ct is the marginal power generation cost of the power supplier. If the power demand is equal to the power supply when the transaction is concluded, and the consumer accepts the price of the power supplier, then the power supplier’s profit function Is,t is(15)Is,t=Qs,tps,t−ct.If the electricity consumers do not accept the supplier’s price plan, then they will put forward their own pricepd,t in the second stage of the game. If the supplier agrees with the scheme, then the transaction is concluded. In this case, the profit function of the power supplier Is,t is(16)Is,t=Qd,tpd,t−ct.It is worth noting that the power supply side knows the demand quantity of the demand side, soQd,t=Qs,t in the above equation. If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power supplier is Qs,tct.(2)
The profit function on the demand sideThe demand-side profit function is similar to the supply side return model. In the first stage, if the transaction is concluded, that is, the consumer accepts the price scheme of the power supplier, where the implied condition ispd,t>ps,t, then the corresponding income is(17)Id,t=Qs,tpd,t−ps,t+Rps,t,whereRps,t is the income after electricity purchase, and R>0,R′<0. If the power consumers do not accept the supplier’s price scheme, they will put forward their own price pd,t in the second stage of the game, where the implicit condition is pd,t<ps,t. If the supplier agrees with the scheme, then the transaction is concluded. And, the profit function of the power demand side is(18)Id,t=Rpd,t.If the two parties do not reach an agreement after the two-stage game, the corresponding loss is to be borne by the power demander isRpd,t.


## 3.2.2. Solution of Bilateral Game Decision Model Based on Nash Equilibrium

The game describes the decision-making process of two or more players pursuing their respective goals. The four elements of game are decision-maker, strategy, payment function, and equilibrium solution. Nash equilibrium also provides decision-makers with the consistent prediction of the possible outcome of the game, that is, the optimal decision result of rational decision-makers, thus pointing out the direction of strategy making.In any game model, the existence of Nash equilibrium is particularly important. When the game strategy is a nonempty, bounded convex set in the Euclidean space, the reward function is continuous and upper quasi-convex in the sub-strategy space. In this case, the game model has pure strategy Nash equilibrium. For the game model studied in this section, the strategy space of bilateral games obviously satisfies the characteristics of nonempty, bounded, and convex sets. And, because the pricing strategy is continuous, the profit function is also continuous, and satisfies the upper convex condition that the first derivative is not zero and the second derivative is not less than zero. Therefore, the two-sided game model considered in this section has Nash equilibrium solution.Suppose the set of decision makers isP1,P2,…,Pn, the set of adopted policies is S1,S2,…,Sn, and the corresponding set of payment functions is I1,I2,…,I3, where n is the number of participants. This section only involves the supply side and the demand side of the power market, so we denote the set of decision-makers as Ps,Pd, where Ps represents the power supply side and Pd represents the power demand side. The payment function of the two sides is Is,Id. The supply side and the demand side need to determine their respective power purchase price in two stages, and the set of strategies is ps,pd.The equilibrium equation is as follows, whereps∗ and pd∗ represent the final Nash equilibrium solution respectively. For the power supplier, given the optimal pricing strategy pd∗ of the demander, the power supplier chooses the optimal pricing ps∗ to maximize their profits. Similarly, for the power supplier, given that the optimal price of the supply side is ps∗, the optimal pricing of consumers maximizing their profits is pd∗:(19)ps∗=argmaxIsps,pd∗,pd∗=argmaxIspd,ps∗.Based on the above analysis, in the two-stage game model, the backward method is usually used to solve out the Nash equilibrium. The specific steps are as follows:Step 1: establish the framework of two-stage game model, and define the strategy space and reward function of power supplier and demander in each stage.Step 2: starting from the second stage, the power demanderPd formulates the price plan, and Pd needs to compare the profit function of Ps under two states of agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price ps∗ is obtained when the payment under the two states is equal.Step 3: discount the payment of both parties in the second period to the first period. Similarly, when the power supplierPs makes the price plan, Ps needs to compare the profit function under the two states of Pd agreeing to the price plan and disagreeing to the price plan. Therefore, the optimal price pd∗ is obtained when the payment under the two states is equal.


## 4. Example Analysis

### 4.1. Forecast Power Supply and Demand Gap

This section takes the electricity market data of the PJM market in the United States as an example, and the time-segment data of 9 regions from July 29th to 30th, 2020, are selected to forecast the power supply and demand gap. Electrical load measures the sum of the electrical power taken from the electrical equipment of the power users to the power system at a certain time. The PJM data provide the actual and predicted electrical loads. If the real power load is greater than the predicted value, the power demand will be greater than the supply, and the power supply and demand gap will be negative. If the real power load is less than the predicted value, the power demand will be less than the supply, and the power supply and demand gap will be positive. Take a certain period on July 30, 2020, as an example. And the S&D gap are shown in Table1.Table 1
S&D gap in a certain period on July 30, 2020.
AreaDatetime_beginingDatetime_endingActual_load (kW)Load_forcast (kW)S&D_gap12020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1600815928−22020/7/30 3 : 00 AM2020/7/30 4 : 00 AM60556069＋32020/7/30 3 : 00 AM2020/7/30 4 : 00 AM88468867＋42020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1395313844−52020/7/30 3 : 00 AM2020/7/30 4 : 00 AM36433654＋62020/7/30 3 : 00 AM2020/7/30 4 : 00 AM24042411＋72020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1389013838−82020/7/30 3 : 00 AM2020/7/30 4 : 00 AM19081905−92020/7/30 3 : 00 AM2020/7/30 4 : 00 AM15771576−Combined with the calculation rules of the S&D gap in the theoretical model, we can use the Ababoost algorithm to predict the S&D gap in the region. Take the voltage, system energy price, actual regional marginal price, peak price, and marginal loss price of the region as input indexxi in the sample set, and the S&D gap as output index yi in the sample set, and make the following provisions: if the S&D gap is positive, it is represented by the categorical variable +1, and vice versa. The sample interval is from 0 : 00 to 12 : 00 on July 30, 2020. The data sets required in this experiment are summarized in Table 2.Table 2
Input-output data from 0 : 00–12 : 00 on July 30, 2020.
AreaVoltage (kV)Sys_energy_pActual_LMPCongestion_pM_loss_pS&D_gap123016.13$/kWh18.48$/kWh2.33$/kWh0.02$/kWh−1223016.13$/kWh14.01$/kWh−1.55$/kWh−0.57$/kWh+132616.13$/kWh14.95$/kWh−1.40$/kWh0.22$/kWh+142616.13$/kWh11.53$/kWh−3.93$/kWh−0.66$/kWh−1523016.13$/kWh15.04$/kWh−0.42$/kWh−0.67$/kWh+1623016.13$/kWh14.19$/kWh−1.54$/kWh−0.40$/kWh+1713816.13$/kWh14.07$/kWh−1.56$/kWh−0.51$/kWh−1813816.13$/kWh15.38$/kWh−0.67$/kWh−0.08$/kWh−1913816.13$/kWh15.50$/kWh−0.51$/kWh−0.12$/kWh−1After calculation, when we use the actual regional marginal electricity price as the input indicator, the sample weight is [0.1, 0.125, 0.125, 0.1, 0.125, 0.125, 0.125, 0.1, 0.1, 0.1, 0.1], the optimal classification threshold is 0.5, the error rate is 0.5, and the predicted value of the output index is [1, −1, −1, −1, −1, −1, sum −1, −1, −1, −1, −1, −1, −1, −1]. When the peak electricity price is used as the input index, the sample weight is [0.08, 0.125, 0.125, 0.104, 0.125, 0.125, 0.104, 0.104, 0.1], the optimal classification threshold is 3.5, the error rate is 0.4, and the predicted value of the output index is [−1, −1, −1, 1, 1, 1, 1]. When the marginal loss price is used as the input index, the sample weight is [0.119, 0.132, 0.105, 0.095, 0.132, 0.132, 0.095, 0.095, 0.095], the optimal classification threshold is 1.5, the error rate is 0.475, and the predicted value of the output index is [−1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]. It can be seen that the error rate of taking peak electricity price as input index is the lowest.


### 4.2. Optimal Pricing Strategy

This section uses the electricity market data of the US PJM market on July 30, 2020, for empirical demonstration. The profit function of the electricity supplier involves transaction power, transaction price, and power generation cost. Generally, the transaction power can be used as a function of the transaction price, that is,Qp. For easy calculation, let Qp=a−bp. According to the sample data, ps∈16.51,25.34 and pd∈16.51,25.34, where the measuring unit of ps and pd is USD/KWH.Using the backward method, the profit function of the power demander in the second stage isId=a−bpdpd−ps∗+Rpd. The first-order condition can be obtained as a−2bpd+bpdps∗+R′pd=0. Therefore, the optimal pricing of the power demander is(20)pd∗=a+R′pd∗2b−bps∗.The profit function of the power supplier in the first stage isIs=a−bpsps−c. The first-order condition can be obtained as a−2bps+bpsc=0. Therefore, the optimal pricing of the power demander is(21)ps∗=a2b−bc.Substituteps∗, the optimal pricing of power supplier in the first stage, into the formula of pd∗ in the second stage. Then, we can obtain the final Nash equilibrium solutions of pd∗ and ps∗.


## 4.1. Forecast Power Supply and Demand Gap

This section takes the electricity market data of the PJM market in the United States as an example, and the time-segment data of 9 regions from July 29th to 30th, 2020, are selected to forecast the power supply and demand gap. Electrical load measures the sum of the electrical power taken from the electrical equipment of the power users to the power system at a certain time. The PJM data provide the actual and predicted electrical loads. If the real power load is greater than the predicted value, the power demand will be greater than the supply, and the power supply and demand gap will be negative. If the real power load is less than the predicted value, the power demand will be less than the supply, and the power supply and demand gap will be positive. Take a certain period on July 30, 2020, as an example. And the S&D gap are shown in Table1.Table 1
S&D gap in a certain period on July 30, 2020.
AreaDatetime_beginingDatetime_endingActual_load (kW)Load_forcast (kW)S&D_gap12020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1600815928−22020/7/30 3 : 00 AM2020/7/30 4 : 00 AM60556069＋32020/7/30 3 : 00 AM2020/7/30 4 : 00 AM88468867＋42020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1395313844−52020/7/30 3 : 00 AM2020/7/30 4 : 00 AM36433654＋62020/7/30 3 : 00 AM2020/7/30 4 : 00 AM24042411＋72020/7/30 3 : 00 AM2020/7/30 4 : 00 AM1389013838−82020/7/30 3 : 00 AM2020/7/30 4 : 00 AM19081905−92020/7/30 3 : 00 AM2020/7/30 4 : 00 AM15771576−Combined with the calculation rules of the S&D gap in the theoretical model, we can use the Ababoost algorithm to predict the S&D gap in the region. Take the voltage, system energy price, actual regional marginal price, peak price, and marginal loss price of the region as input indexxi in the sample set, and the S&D gap as output index yi in the sample set, and make the following provisions: if the S&D gap is positive, it is represented by the categorical variable +1, and vice versa. The sample interval is from 0 : 00 to 12 : 00 on July 30, 2020. The data sets required in this experiment are summarized in Table 2.Table 2
Input-output data from 0 : 00–12 : 00 on July 30, 2020.
AreaVoltage (kV)Sys_energy_pActual_LMPCongestion_pM_loss_pS&D_gap123016.13$/kWh18.48$/kWh2.33$/kWh0.02$/kWh−1223016.13$/kWh14.01$/kWh−1.55$/kWh−0.57$/kWh+132616.13$/kWh14.95$/kWh−1.40$/kWh0.22$/kWh+142616.13$/kWh11.53$/kWh−3.93$/kWh−0.66$/kWh−1523016.13$/kWh15.04$/kWh−0.42$/kWh−0.67$/kWh+1623016.13$/kWh14.19$/kWh−1.54$/kWh−0.40$/kWh+1713816.13$/kWh14.07$/kWh−1.56$/kWh−0.51$/kWh−1813816.13$/kWh15.38$/kWh−0.67$/kWh−0.08$/kWh−1913816.13$/kWh15.50$/kWh−0.51$/kWh−0.12$/kWh−1After calculation, when we use the actual regional marginal electricity price as the input indicator, the sample weight is [0.1, 0.125, 0.125, 0.1, 0.125, 0.125, 0.125, 0.1, 0.1, 0.1, 0.1], the optimal classification threshold is 0.5, the error rate is 0.5, and the predicted value of the output index is [1, −1, −1, −1, −1, −1, sum −1, −1, −1, −1, −1, −1, −1, −1]. When the peak electricity price is used as the input index, the sample weight is [0.08, 0.125, 0.125, 0.104, 0.125, 0.125, 0.104, 0.104, 0.1], the optimal classification threshold is 3.5, the error rate is 0.4, and the predicted value of the output index is [−1, −1, −1, 1, 1, 1, 1]. When the marginal loss price is used as the input index, the sample weight is [0.119, 0.132, 0.105, 0.095, 0.132, 0.132, 0.095, 0.095, 0.095], the optimal classification threshold is 1.5, the error rate is 0.475, and the predicted value of the output index is [−1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]. It can be seen that the error rate of taking peak electricity price as input index is the lowest.


## 4.2. Optimal Pricing Strategy

This section uses the electricity market data of the US PJM market on July 30, 2020, for empirical demonstration. The profit function of the electricity supplier involves transaction power, transaction price, and power generation cost. Generally, the transaction power can be used as a function of the transaction price, that is,Qp. For easy calculation, let Qp=a−bp. According to the sample data, ps∈16.51,25.34 and pd∈16.51,25.34, where the measuring unit of ps and pd is USD/KWH.Using the backward method, the profit function of the power demander in the second stage isId=a−bpdpd−ps∗+Rpd. The first-order condition can be obtained as a−2bpd+bpdps∗+R′pd=0. Therefore, the optimal pricing of the power demander is(20)pd∗=a+R′pd∗2b−bps∗.The profit function of the power supplier in the first stage isIs=a−bpsps−c. The first-order condition can be obtained as a−2bps+bpsc=0. Therefore, the optimal pricing of the power demander is(21)ps∗=a2b−bc.Substituteps∗, the optimal pricing of power supplier in the first stage, into the formula of pd∗ in the second stage. Then, we can obtain the final Nash equilibrium solutions of pd∗ and ps∗.


## 5. Conclusions

Power trading system is a nonlinear complex system, which has huge functions and complex business, and involves various types of data and huge amount of data. And, part of the business data in the power trading system need to interact with many external business systems, but the security of the data and the reliability of the transaction cannot be guaranteed. So, it needs to be addressed specifically. The core technology of a distributed power trading system based on blockchain technology is to achieve real-time power balance and provide preconditions for smart contracts, which ensures the reliability of power trading and data security. Using historical information of transaction nodes to build models that predict the relationship between power supply and demand and provide decision-making information for power suppliers is the fundamental way to optimize transaction efficiency. This paper expands the relevant research on the application of blockchain technology in the field of energy system. The algorithm is innovatively improved to adapt to the data evolution characteristics of the distributed power system. In this paper, the improved Adaboost algorithm is used to predict the supply and demand gap of power trading nodes, and then the prediction ability of the algorithm is tested by the time-sharing data of 9 randomly selected regions of the PJM market in the United States. Specifically, the input indicators in the sample set are the region’s voltage, system energy price, actual regional marginal electricity price, peak electricity price, and marginal loss price, and the output indicator of the sample set is the direction of the supply and demand gap. The peak electricity price can be obtained by the AdaBoost algorithm as the input indicator with the smallest error rate. The characteristics of general information asymmetry in the power market are fully considered when analyzing the formation of power price, so that the price of the distributed power system is more consistent with the market reality. Secondly, the essence of the power market transaction is the asymmetric information game between the power supplier and the demander because the information on the blockchain is only known to the power supplier. A two-stage game model is constructed in this paper to describe the price competition strategy between the power supplier and the power demander. The Nash equilibrium solution of the first stage and the second stage of the model can be obtained by the backward method, so that the decision-making optimization of the distributed power transaction under the blockchain framework is realized. Finally, the applicability of the model is verified by using the data of electricity market in the United States.



---

*Source: 5538195-2021-05-10.xml*