Research Article Distributed Power Trading System Based on Blockchain Technology

. 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 ﬁnd 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 eﬀectiveness of the algorithm and model.


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, mediumand 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. erefore, 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. e distributed power market adopts the electricity market model, which is mainly based on medium-and longterm 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. e 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. e combination of large-scale centralized multiparty transactions and decentralized bilateral market transactions is now a relatively mature market transaction model in the world.
is 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. e feasibility of the distributed power market is relatively strong in the short term. e 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. e 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. e main business of the power trading system is all around the sensitive data such as electricity price. e 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. e 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 datadriven 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]. e 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-topoint transmission, consensus mechanism, and encryption algorithm. Its data storage method is distributed, which is consistent with the design principle of distributed transaction mechanism. e 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. e 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. en, the order book table automatically clears the market according to the clearing mechanism corresponding to different transaction methods in the smart contract. e 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. e value corresponding to the transaction will be automatically settled and paid between the matched transaction users. e 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. erefore, 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. e connotation of value flow in this article mainly includes forecasting transaction nodes, electricity supply and demand gaps, and game pricing strategies among transaction entities. e 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. is paper expands the relevant research on the application of blockchain technology in the field of energy system. e 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. e main structure of this article is as follows: 2 Complexity (1) Section 3.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, Section 3.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) Section 4 uses the US PJM electricity market data to conduct a case analysis to verify the feasibility of the algorithm and model

Literature Review
Blockchain is a term in the field of information technology. In essence, it is a shared database. e 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. e 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. e 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. en, 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.
e new technological revolution is fundamentally changing the form and development of the world energy industry. e increase in energy demand and the change in energy structure require a great improvement in energy supply capacity, which often requires a huge cost. e energy system based on block chain technology can greatly reduce the management cost of energy supply and energy demand. e study in [6] discusses the impact of blockchain on the US power industry, and analyzes and evaluates pilot projects that have been launched. e 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. e 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. e 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. e 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. e 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. e 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. e 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. erefore, it is particularly important to predict the power supply and demand gap and use the operation information to adjust the gap.
ere 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. e main types of distributed power generation are photovoltaic power generation, wind power generation, and biomass energy power generation, mainly providing renewable energy. e 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. e study in [11] focused on the relationship between the cumulative R&D expenditure and cumulative installed capacity of Complexity 3 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. e carbon tax policy in climate policy is broadly binding. e 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. e 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. e 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. e proposed technique was tested and clarified with an IEEE-30, IEEE-57, and practical 75-bus Indian system. Electricity demand involves nonlinear data. e forecasting methods include: time series method, neural network algorithm, fuzzy logic algorithm, support vector machine algorithm, and adaptive boost algorithm (AdaBoost). e time series method comes from Econometrics, and forecasts are mainly based on the context of time series. e 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. e 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, e 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. e 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. e 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. e 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. e 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. e 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. is 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. e 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 shortterm demand and electricity prices in smart grids. e proposed model comprises a linear ARMA-FLNN obtained by using a nonlinear expansion of the weighted inputs. e 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. e 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. e 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. e 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. e 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. e 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. e 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. e main application value of blockchain is to reduce the uncertainty of information between the two sides of the game.
erefore, incomplete information model has been widely applied by many scholars. e 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. e 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. e 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. e 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. e 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.
is 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.

Algorithms and Models
Realizing live power supply and demand balance is the key problem of distributed power trading based on block chain technology. is 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.

eoretical Basis.
e 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. e weak classifier is trained based on the training set. e next weak classifier is obtained by training on different weight sets of samples. e 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. e 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. is process involves an iterative change of the two weights. e 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. e iteration direction is described as a decrease in Complexity 5 the weight of the correctly classified samples and an increase in the weight of the wrongly classified samples. e 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. e weak classifier with larger classification error has a smaller weight and plays a smaller role. Finally, the final strong classifier is obtained.

eoretical Derivation.
AdaBoost algorithm is a forward-distributed addition algorithm model, which is divided into two steps: addition model and forward distribution algorithm. e final classifier is defined as where G m (x) is the basic classifier (weak classifier) and α m is the weight coefficient of the basic classifier,m � 1, 2, . . . , M. e loss function of forward distribution algorithm is defined as the exponential loss function: Suppose the iteration starts with m � 1, . . .
After m − 1 round of iteration, f m−1 (x) is obtained. According to the forward distribution algorithm, f m (x) can be obtained: e goal is to minimize the exponential loss of f m (x) on the training set, using f m−1 (x) and G m (x) obtained by the forward distribution algorithm, namely, where, w m,i � exp(−y i [f m−1 (x)]) can be regarded as the sample weight of each round of iteration, which depends on the sample weight of the previous round. e above equation is equal to 1 − e m exp −α m + e m exp α m . (6) Minimizing Loss, that is, taking the derivative of loss function Loss with respect to α m and making it equal to 0 yields where Based on the above setting of loss function and classifier weight, the algorithm flow of AdaBoost forward-distributed addition model is as follows. Set T � (x 1 , y 1 ), (x 2 , y 2 ), . . . , (x n , y n )}, i � 1, 2, . . . , N, y i ∈ ± 1, where, (x 1 , x 2 , . . . , x n ) is the input set, which can reflect the power demand index on a node of the block chain at a certain time, and (y 1 , y 2 , . . . , y n ) is the output set, which reflects the power supply and demand gap of the node: Step 1: initialize the weight, D 1 � (w 1,1 , w 1,2 , w 1,3 , . . . , w 1,n ), which follows the uniform distribution, w 1,i � 1/N.
Step 2: use the sample data set with weight D m for learning, construct weak classifier G m (x), where m � 1, 2, . . . , M, and then calculate the classification error rate of G m (x) on the training data set based on equation (8).
Step 3: calculate the weight coefficient α m of G m (x) in the strong classifier based on equation (7).
Step 4: update the sample distribution, namely, the sample weight, where z m is the normalization factor: Step 5: iterate to get the final classifier: 6 Complexity

AdaBoost Algorithm Improvement.
e 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. is section will improve the performance of the weak classifier by adjusting the updated sample centralization weight.
is 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. Suppose h(x i ) is the predicted output of the weak classifier to the sample x i . e loss function l t (x i ) after the t rounds iteration is defined as Its complement function is: Assuming that at the tth iteration, the training sample drawn from the random distribution of the sample is T t , then the complement of the training set is T t � T − T t . e weight of this iteration is updated to It can be seen that l t reflects the ability of the weak classifier to classify samples belonging to class G m (x) and samples not belonging to class G m (x), which ensures the robustness of correct classification. For this paper, when i � 1, 2, the rule of weight updating above is Correspondingly, the weight coefficient α m of the proportion of G m (x) in the strong classifier is e 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, l t increases by 1. And, when the classification is wrong, l t decreases by 1. erefore, the imbalance of the classification error ratio will affect the classification and its integration.

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.
ere are both competitive relations and cooperative relations among the trading entities in the power market, which conforms to the basic setting of game theory. erefore, 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. erefore, this section focuses on league chain. ere are power supply side and power demand side under the framework of alliance chain.

e 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. e 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. erefore, the essence of the power market transaction is the asymmetric information game between the power supplier and the demand side, Complexity 7 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) e profit function on the supply side e profit of the power supplier depends on the net profit per unit and the amount of transaction. Assuming that the transaction power Q s,t is the power supply in time t, and p s,t is the price scheme provided by the supplier, c t 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 I s,t is If the electricity consumers do not accept the supplier's price plan, then they will put forward their own price p d,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 I s,t is It is worth noting that the power supply side knows the demand quantity of the demand side, so Q d,t � Q s,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 Q s,t c t . (2) e profit function on the demand side e 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 isp d,t > p s,t , then the corresponding income is where R(p s,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 p d,t in the second stage of the game, where the implicit condition is p d,t < p s,t . If the supplier agrees with the scheme, then the transaction is concluded. And, the profit function of the power demand side is 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 is R(p d,t ).

Solution of Bilateral Game Decision Model Based on
Nash Equilibrium. e game describes the decision-making process of two or more players pursuing their respective goals.
e 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. erefore, the twosided game model considered in this section has Nash equilibrium solution.
Suppose the set of decision makers is P 1 , P 2 , . . . , P n , the set of adopted policies is S 1 , S 2 , . . . , S n , and the corresponding set of payment functions is I 1 , I 2 , . . . , I 3 , where n is the number of participants. is section only involves the supply side and the demand side of the power market, so we denote the set of decision-makers as P s , P d , where P s represents the power supply side and P d represents the power demand side. e payment function of the two sides is I s , I d . e supply side and the demand side need to determine their respective power purchase price in two stages, and the set of strategies is p s , p d . e equilibrium equation is as follows, where p * s and p * d represent the final Nash equilibrium solution respectively. For the power supplier, given the optimal pricing strategy p * d of the demander, the power supplier chooses the optimal pricing p * s to maximize their profits. Similarly, for the power supplier, given that the optimal price of the supply side is p * s , the optimal pricing of consumers maximizing their profits is p * d : p * s � arg max I s p s , p * d , p * d � arg max I s p d , p * s .
8 Complexity Based on the above analysis, in the two-stage game model, the backward method is usually used to solve out the Nash equilibrium. e 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 demander P d formulates the price plan, and P d needs to compare the profit function of P s under two states of agreeing to the price plan and disagreeing to the price plan. erefore, the optimal price p * s 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 supplier P s makes the price plan, P s needs to compare the profit function under the two states of P d agreeing to the price plan and disagreeing to the price plan. erefore, the optimal price p * d is obtained when the payment under the two states is equal.

Forecast Power Supply and Demand Gap.
is 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. e 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 Table 1.
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 index x i in the sample set, and the S&D gap as output index y i 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. e sample interval is from 0 : 00 to 12 : 00 on July 30, 2020. e data sets required in this experiment are summarized in Table 2.
After calculation, when we use the actual regional marginal electricity price as the input indicator, the sample weight is .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.

Optimal Pricing Strategy.
is section uses the electricity market data of the US PJM market on July 30, 2020, for empirical demonstration. e 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, . e first-order condition can be obtained as a − 2bp d + bp d p * s + R ′ (p d ) � 0. erefore, the optimal pricing of the power demander is e profit function of the power supplier in the first stage is I s � (a − bp s )(p s − c). e first-order condition can be obtained as a − 2bp s + bp s c � 0. erefore, the optimal pricing of the power demander is Substitute p * s , the optimal pricing of power supplier in the first stage, into the formula of p * d in the second stage. en, we can obtain the final Nash equilibrium solutions of p * d and p * s .

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. e 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. is paper expands the relevant research on the application of blockchain technology in the field of energy system. e 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. e peak electricity price can be obtained by the AdaBoost algorithm as the input indicator with the smallest error rate. e 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. e 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.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.