Transaction Model Based on Stackelberg Game Method for Balancing Supply and Demand Sides of Multi-Energy Microgrid

: To improve the coordination and complementarity of multiple energy sources, balancing the interests of different participants in a multi-energy system is of great importance. However, traditional centralized optimization can hardly reﬂect the game relationship between supply side and demand sides. A trading model based on the Stackelberg game model is proposed in this paper to balance the interests of the supply side and demand side and reduce the carbon emissions. First of all, the process of trading between the supply side and demand side based on smart contracts is described. A contractual consensus is obtained through an internal game, and the transaction is completed automatically. Secondly, a bilevel optimization model is established to coordinate the beneﬁts of both parties based on the Stackelberg game model. The energy operator acts as a leader, and considers the two objectives, i.e., maximizing net income and minimizing carbon emissions, and uses the linear weighting method to convert the dual objectives into single objective. Users act as followers and aim to increase the comprehensive beneﬁts, including energy cost and comfort. Then, Karush–Kuhn–Tucker optimality condition is used to transform the bilevel optimization model into an equivalent single-level model. Finally, simulation results show that the proposed method can coordinate the economic interests of both sides of supply and demand and effectively reduce the carbon emissions of the energy operator.


Introduction
As the world's energy demand increases and natural resources come under enormous pressure, it has become an important strategy for all countries to improve the efficiency of energy utilization [1]. The operation and planning of traditional energy systems are limited to systems formed by single energy sources, such as electricity, gas, and heat, which cannot meet the needs of the current society. Therefore, the multi-energy system (MES) that combines multiple energy sources has emerged, which helps to improve the overall efficiency of energy utilization [2,3]. At present, China's primary energy consumption is still dominated by coal. At the same time, environmental pollution caused by coal has become increasingly serious. Due to the higher calorific value of natural gas, combustion products have less environmental pollution, which has attracted people's attention. With the popularization of urban natural gas pipelines and the elimination of small coal-fired boilers, China's natural gas consumption has grown rapidly. In 2018, natural gas consumption increased by about 17.7% year-on-year, and its share in energy consumption increased by 0.8% year-on-year. Therefore, it is necessary to study the natural gas-fired equipment in MES to improve energy efficiency and reduce carbon emissions.
With the popularization of demand side management (DSM), technologies of demand response (DR) have gradually been applied [4]. Wang et al. [5] designed a networkload interaction optimization framework based on multi-time period flexible random fuzzy uncertain demand response model, including shifting of loads' operation time and uncertain response to the price signal. In order to reduce the peak-to-average ratio of power demand, Parizy et al. [6] proposed a new heuristic DR technology for consumption scheduling of appliances. This technology ensures the privacy of users with a hopping scheme. In Refs. [5,6], only electrical loads are focused on. However, with the emergence of MES, some scholars have noticed that there are defects in the DR of single power. Therefore, the traditional DR is developing in the direction of integrated demand response (IDR) [7]. Gan-yun et al. [8] established IDR model, considering different response models of load including electricity, heat, cold, and gas. The results show that IDR can reduce the distinction between peak and valley and improve the wind power consumption capacity. In Ref. [9], an edge-cloud framework based on IDR is proposed to achieve an effectpredictable residential DR with protecting the interests of users. IDR can make full use of the coordination of multiple energy sources, which is of great significance to promote the sustainable development of the MES.
In the process of continuous development of MES, the factors interacting are becoming more and more complex [3]. Participants in the current energy market are showing a trend of complexity and diversification. In 2015, the Chinese government proposed to encourage multiple entities in social capital to participate in electricity market transactions, including electricity sellers, energy service providers, and users, to increase the diversity of electricity market entities [10]. With the increasingly prominent phenomenon of multi-stakeholder competition in multi-energy systems, traditional centralized optimization can hardly reflect the game relationship between different stakeholders [11]. Some scholars have noticed this phenomenon and tried to use game-theoretic approaches to describe the interest relationship of different subjects and proposed three major categories of games to solve the problem of multi-agent interaction in the power system, including a non-cooperative game, cooperative game, and evolutionary game [12,13]. In Ref. [14], the demand response problem in the smart grid is regarded as a Stackelberg game between retailers and consumers and a non-cooperative game between consumers. Three dynamic prices are compared through four evaluation indicators. The result shows the effectiveness of the pricing method. Ghorbanian et al. [15] proposed a method based on game theory for operation of the smart distribution network with distributed generation and demand response programs. The result shows the proposed method can effectively reduce the total cost and can also improve the performance of the grid. Dashti et al. [16] proposed an energy pricing model of smart distribution networks with multiple microgrids based on the non-cooperative game theory, in which the profits of all beneficiaries are guaranteed. Oladejo et al. [17] proposed a generalized Nash bargaining method based on cooperative game theory, which is to make the new profit distribution beneficial to a certain participant by specifying different values of the negotiation power in the objective function. Cheng et al. [18] analyzed the behavioral decision-making problems in power demand-side response management from a perspective of multi-population evolutionary game dynamics.
The transaction interaction between the supply side and demand side is usually described as a bilevel game model. For the bilevel optimization model, many literatures directly transfer the associated variables between the upper and lower models, such as prices of energy in the upper layer and power of load in the lower layer. This method is easily causes the upper model to fall into the local optimal solution. The Karush-Kuhn-Tucker (KKT) optimality condition can be used to convert the lower model into a series of constraint conditions, which can be added to the upper model. In this way, the bilevel model becomes an equivalent single-level model, which can ensure the optimization results in the global optimal solution [19].
As the international community pays attention to global climate change, governments are taking various measures in various fields to reduce carbon emissions [20]. Carbon  [21]. MES is widely regarded as an effective way to reduce carbon emissions by integrating renewable energy and cascading energy utilization [22].
Some references are cited, as shown in Table 1. In Refs. [23,24], the impact of IDR on operation of system is not considered. In the literature [25][26][27], IDR is considered but the benefits of users and carbon emissions are ignored. In [28,29], IDR and carbon emissions are considered, but the benefits of users are still ignored. In [30,31], the benefits of users are considered, but the carbon emissions are not considered. Additionally, the iterative method easily causes the bilevel model to fall into the local optimal solution in Refs. [30,31]. In addition, although in the literatures [23,24,28,29], carbon emissions are considered, only the impact of carbon emissions fines on economic benefits is considered, and carbon emissions are disregarded as the optimization objective. Therefore, in the current scenario of supply and demand interaction, how to optimize the low-carbon operation of MES is still a difficult problem.  [23,24] × × - [25][26][27] × × - [28,29] × - [30,31] × × This paper Besides, time-of-use energy price is considered as an effective method to stimulate DR, but it also has disadvantages. For example, if all users consume energy in the same period of low price, it is possible to create new demand peaks [32]. In addition, users are often heterogeneous, which means different energy users have different energy requirements and have different energy management strategies. Therefore, energy operators need to set different energy prices for different users in order to make better use of the flexibility of demand-side resources. Therefore, this paper proposes an interaction method between supply and demand sides based on the Stackelberg game. On the premise of ensuring the interests of all participants, the output of equipment and pricing strategy of energy operator and the energy consumption strategies of users are optimized. The main work of this paper is as follows: (1) Based on smart contracts, an energy trading mode for supply side and demand sides is proposed. Firstly, the two sides negotiate different energy transaction prices based on the characteristics of users' different energy demand through internal game. Then the transaction is automatically completed. (2) Considering the users' initiative, a bilevel optimization model is established based on the Stackelberg game model. The energy operator, as a leader, considers two objectives, i.e., economic net income and carbon emissions, and uses the linear weighting method to convert the two objectives into single objective. Users, as followers, aim to increase the comprehensive benefits, including energy cost and comfort. The rights of users, making decisions on energy use independently, can be as far as possible guaranteed. (3) KKT optimality condition is used to transform the bilevel optimization model into an equivalent single-level model, which can ensure that the global optimal solution is obtained.
The rest of the paper is organized as follows: Section 2 briefly introduces a trading model for supply side and demand sides based on smart contracts. Section 3 establishes the mathematical model of supply and demand sides. Section 4 transform the bilevel opti-

Trading Model Based on Stackelberg Game
In energy trading, the operator hopes to set higher energy prices to obtain higher profit. However, users want to buy energy at a lower cost. Therefore, the interests of both parties are in conflict. In this paper, the operator and users are regarded as Stackelberg game relations, shown in Figure 1. As a leader, the operator needs to formulate reasonable energy prices for maximizing interests based on the response of each user. As a follower, each user formulates a rational energy strategy based on price information and then reports power information to operator. The rest of the paper is organized as follows: Section 2 briefly introduces a trading model for supply side and demand sides based on smart contracts. Section 3 establishes the mathematical model of supply and demand sides. Section 4 transform the bilevel optimization model into an equivalent single-level model based on KKT optimality condition. The simulation results are shown in Section 5. The conclusions are conducted in Section 6.

Trading Model Based on Stackelberg Game
In energy trading, the operator hopes to set higher energy prices to obtain higher profit. However, users want to buy energy at a lower cost. Therefore, the interests of both parties are in conflict. In this paper, the operator and users are regarded as Stackelberg game relations, shown in Figure 1. As a leader, the operator needs to formulate reasonable energy prices for maximizing interests based on the response of each user. As a follower, each user formulates a rational energy strategy based on price information and then reports power information to operator.

Trading Architecture Based on Smart Contracts
The operator and users voluntarily register as participants and generate corresponding smart contracts. As the consensus, the contracts are recognized by all participants. All participants must strictly abide by the consensus and conduct transaction settlement according to the provisions of the contracts [33].
The trading architecture proposed in this paper is shown in Figure 2. Firstly, both parties upload information and pay a deposit to the address of their smart contracts. Secondly, the prices and power of transaction are determined through the internal game, and the results are distributed to each participant. After the participants receive the result of the internal game, they confirm the transaction and trigger the smart contracts. Finally, the smart contracts automatically achieve energy transaction and amount settlement.

Trading Architecture Based on Smart Contracts
The operator and users voluntarily register as participants and generate corresponding smart contracts. As the consensus, the contracts are recognized by all participants. All participants must strictly abide by the consensus and conduct transaction settlement according to the provisions of the contracts [33].
The trading architecture proposed in this paper is shown in Figure 2. Firstly, both parties upload information and pay a deposit to the address of their smart contracts. Secondly, the prices and power of transaction are determined through the internal game, and the results are distributed to each participant. After the participants receive the result of the internal game, they confirm the transaction and trigger the smart contracts. Finally, the smart contracts automatically achieve energy transaction and amount settlement.
The most prominent advantage of this model is that users have the initiative and can directly participate in the formulation of energy prices. In addition, energy operator can set different energy prices for different users. The most prominent advantage of this model is that users have the initiative and can directly participate in the formulation of energy prices. In addition, energy operator can set different energy prices for different users.

Energy Operator
The MES structure is established based on an energy station in central China, as shown in Figure 3. The energy operator effectively manages the operation of all equipment including cooling heat and power cogeneration system (CCHP), gas boiler (GB), heat pump (HP), centrifuge (Cen), and thermal storage tank (ST) to increase economic benefits and reduce carbon emissions. CCHP consists of an internal combustion generator (G) and a lithium bromide unit (LB). The natural gas is converted into electric energy by G, and the waste heat is converted into the heating or cooling energy suitable for users by LB. If the heating demand is not met, GB and HP will produce heating energy. ST stores the excess heating energy and releases it when needed. If the supply of cooling energy is insufficient, Cen will produce cooling energy.

Energy Operator
The MES structure is established based on an energy station in central China, as shown in Figure 3. The energy operator effectively manages the operation of all equipment including cooling heat and power cogeneration system (CCHP), gas boiler (GB), heat pump (HP), centrifuge (Cen), and thermal storage tank (ST) to increase economic benefits and reduce carbon emissions. CCHP consists of an internal combustion generator (G) and a lithium bromide unit (LB). The most prominent advantage of this model is that users have the initiative and can directly participate in the formulation of energy prices. In addition, energy operator can set different energy prices for different users.

Energy Operator
The MES structure is established based on an energy station in central China, as shown in Figure 3. The energy operator effectively manages the operation of all equipment including cooling heat and power cogeneration system (CCHP), gas boiler (GB), heat pump (HP), centrifuge (Cen), and thermal storage tank (ST) to increase economic benefits and reduce carbon emissions. CCHP consists of an internal combustion generator (G) and a lithium bromide unit (LB). The natural gas is converted into electric energy by G, and the waste heat is converted into the heating or cooling energy suitable for users by LB. If the heating demand is not met, GB and HP will produce heating energy. ST stores the excess heating energy and releases it when needed. If the supply of cooling energy is insufficient, Cen will produce cooling energy. The natural gas is converted into electric energy by G, and the waste heat is converted into the heating or cooling energy suitable for users by LB. If the heating demand is not met, GB and HP will produce heating energy. ST stores the excess heating energy and releases it when needed. If the supply of cooling energy is insufficient, Cen will produce cooling energy.

Objectives of Operator
Operator's objectives include economic objective and environmental objective, i.e., maximizing net income and minimizing carbon emissions.
The total income of the operator comes from the sales of electric, cooling, and heating energy to all users. The total cost of operator includes the cost of purchasing natural gas and the cost of purchasing electricity from the grid. This paper does not consider the operating cost of the equipment. For the convenience of calculation, the maximum net income is converted to the minimum equivalent cost in this paper, as (1).
where F prt is the equivalent cost of operator; C buy mes is the total cost of operator; f sale mes is the total income of operator; e t grid is the electricity price of the grid; P t g2t is the power from the grid; e t gas is the price of natural gas; ξ gas is the calorific value of natural gas, and this paper takes the average low calorific value (35,588 kJ/m 3 ); Q t G is the natural gas power consumed by G; Q t GB is the natural gas power consumed by GB; Q t HP is the natural gas power consumed by HP; π t i,j is the price at which the operator sells energy j to user i; P t i,j is the power required by user i for energy j; Ω = {e, h, c} is a collection of electric, cooling and heating energy; Φ = {1, 2, · · · , N} is the number of users; Γ = {1, 2, · · · , T} is the scheduling metric.
For MES, carbon emissions are mainly released by the combustion of natural gas by G, GB, and HP. The environmental objective of operator is to reduce carbon emissions, as (4) [34].
where µ gas is the CO 2 emission conversion factor of natural gas (220 g/kWh); µ grid is the CO 2 emission conversion factor of electricity from grid (968 g/kWh).

Equations and Constraints
The power of G is calculated as follows: where η e G is the efficiency of gas-to-electricity conversion of G; Q t G is the natural gas power consumed by G; P N G is the rated power of G. The output of LB is calculated as follows [35]: where H t LB and C t LB are the output thermal and cooling power of LB; η h LB and η c LB are the thermal and cooling efficiency of LB to convert the waste heat of G into cooling and heating energy; η h G is the gas-to-heat efficiency of G; H N LB and C N LB are the rated heating and cooling output power of LB; h t LB is the state of LB, heating at 1 and cooling at 0, which is set by on-site personnel as required.
The heating models of GB and HP are similar. They both burn natural gas to produce heating energy, but their conversion efficiency and investment cost are different. Their heating output is calculated as follows: where k ∈ {GB, HP}; η k is the conversion efficiency of GB and HP; H N k is the rated heating power of GB and HP.
The cooling power of Cen is calculated as follows: where η Cen is the cooling efficiency of Cen; P t Cen is the input electric power of Cen; C N Cen is the rated electric power of Cen.
The model of ST is as follows [35]: The interactive power constraint of MES and the grid is as follows: where P max g2t is the maximum power, which is purchased from the grid by the operator. Constraints on energy prices are as follows: where π max i,j and π min i,j are the maximum and minimum prices at which energy operator sell energy j to user i.

Multi-Objective Linear Weighting Processing
The optimization problem of the operator is a multi-objective optimization problem. The idea of solving multi-objective optimization problems is generally to convert multi-objectives into a single objective. Additionally, the widely used method is the linear weighting method. Firstly, it is important to assign a weight coefficient to each objective. The larger the weight coefficient, the more important the objective is. Secondly, all objectives are multiplied by the weight coefficients and accumulated into a new objective function. Finally, it would be solved under the same constraints as the original problem [36]. However, the premise of this method is that all objectives must have the same dimension. If the dimensions are different, they must be normalized [36].
Thus, this article firstly normalizes the two objectives of operator and then performs linear weighting. The normalized calculation formulas for the objectives of equivalent cost and carbon emissions are as follows [37,38]: where F * prt is the calculation formula after the equivalent cost is normalized; F * CO 2 is the calculation formula after the carbon emissions are normalized; F min prt is the equivalent cost when the model is solved with the minimum equivalent cost as the optimization objective; F max prt is the equivalent cost when the model is solved with the maximum equivalent cost as the optimization objective; F min CO 2 is the carbon emissions when the model is solved with the minimum carbon emissions as the optimization objective; F max CO 2 is the carbon emissions when the model is solved with the maximum carbon emissions as the optimization objective.
The calculation formula for linear weighting the two normalized objectives is as follows: where F 1 is a single objective of the operator after conversion; w prt is the weight coefficient of net income, which reflects the importance of economic objective for operator; w CO 2 is the weight coefficient of carbon emissions, which reflects the importance of environmental objective for operator.

Energy User
This paper divides the loads of users into two types according to their characteristics, which are shiftable loads and cuttable loads, and establishes corresponding load response models.
The cuttable loads are that users reduce the consumption of certain energy sources according to price signals or incentive mechanisms, including air-conditioning, heating equipment, etc., which are abundant in household users and commercial buildings. The shiftable loads are some energy-consuming devices that can be translated and adjusted, including washing machines, electric vehicles, batteries, etc., in which the total energy consumption is approximately unchanged during the control time [12,39].
In this article, for the heating load and cooling load, the main optimization is the cuttable part. For electrical loads, the main optimization is the shiftable part.

Heating Load and Cooling Load
The cuttable heating load and the cuttable cooling load are similar. Their calculation formula is as follows [40]: where m ∈ {h, c}; c and h represent cooling load and heating load, respectively;P t i,m is the power of cooling load and heating load of user i; P t 0,i,m is the power of initial load, including fixed load and cuttable load; ∆P t i,m is the power of the cuttable load; ∆W i,m is the total amount of cuttable load; ∆P t i,m,max is the maximum power of the cuttable load.

Electric Load
Electrical load includes the fixed load and the shiftable load, which is calculated as follows [40]: where P t i,e is the power of electrical load of user i; P t 0,i,e is the power of the fixed electrical load; ∆P t i,e is the power of the shiftable electric load; ∆W i,e is the total amount of shiftable electric load; ∆P t i,e,max is the maximum power of the shiftable electric load.

Objective of User
When users adjust their load, they consider the comprehensive benefits, including energy cost and energy satisfaction. For convenience, this article turns the optimization goal of the largest comprehensive benefit into the smallest equivalent cost. The calculation formula is as follows [40,41]: where F i,user is the comprehensive benefit of user i; C i,user is the energy cost of user i; f i,user is the energy satisfaction of user i; α i,j and β i,j are the preference coefficients; The larger α i,j /β i,j is, the more energy will be needed, which can be set according to the users' energy preferences [42].

Model Solving Steps
The model solving process is shown in Figure 4. The solution steps of the model in this paper are as follows: For convenience, the problem is solved by Extended Mathematical Programming (EMP) in GAMS environment in this paper.

Data
The time scale of this paper is 24 h of a day. An energy station in central China is selected as the research object. The energy station supplies energy for three users. Load data in summer and winter are taken for analysis, as shown in Figure A1 in Appendix A. The shiftable electric load, the cuttable heating load and the cuttable cooling load of three users account for 20%, 15%, and 15% of the original load, respectively. The maximum power of the shiftable electric load, the cuttable heating load, and the cuttable cooling load are 35%, 20%, and 20% of the original load power, respectively. The preference coefficients of users are shown in Table A1 in Appendix A. The parameters of energy prices are shown in Table A2 in Appendix A. The price of natural gas is 2.92 RMB/m 3 in summer and 3.28 RMB/m 3 in winter. The time-of-use electricity price of the grid is shown in Figure A2 in the Appendix A. The parameters of equipment are shown in Table A3 in Appendix A. LB produces cooling energy in summer and heating energy in winter.
In this paper, three cases are set to compare. Case1: Ignoring the objective of carbon emissions, the operator only considers economic objective and sets the same price of each energy. At the same time, users do not consider DR.
Case2: The operator ignores the objective of carbon emissions and users consider DR. At the same time, the supply and demand sides negotiate different transaction prices for different users through internal game.
Case3: On the basis of case2, operator consider the objective of carbon emissions. At the same time, the weight coefficient of the operator's economic benefit is 0.7 in summer and 0.9 in winter. Raw data is input, including equipment, load, energy preference, weight coefficient, etc. b.
KKT optimality condition is used to transform the bilevel optimization model into an equivalent single-level model. c.
The equivalent single-layer model is solved with the minimum equivalent cost as the optimization objective and F min prt is found. In the same way, the equivalent single-layer model is solved with the maximum equivalent cost as the optimization objective and F max prt is found. According to Formula (25), F * prt can be found. d.
The equivalent single-layer model is solved with minimum carbon emissions as the optimization goal and F min CO 2 is found. In the same way, the equivalent single-layer model is solved with maximum carbon emissions as the optimization goal and F min CO 2 is found. According to Formula (26), F * CO 2 can be found. e.
F * prt and F * CO 2 are substituted into Formula (27) to transform the multi-objective optimization problem into a single-objective problem. Then, the equivalent singlelayer model is solved with F 1 minimum as the optimization objective. f.
The equipment operation status of operator and load adjustment status of users are obtained.
For convenience, the problem is solved by Extended Mathematical Programming (EMP) in GAMS environment in this paper.

Data
The time scale of this paper is 24 h of a day. An energy station in central China is selected as the research object. The energy station supplies energy for three users. Load data in summer and winter are taken for analysis, as shown in Figure A1 in Appendix A. The shiftable electric load, the cuttable heating load and the cuttable cooling load of three users account for 20%, 15%, and 15% of the original load, respectively. The maximum power of the shiftable electric load, the cuttable heating load, and the cuttable cooling load are 35%, 20%, and 20% of the original load power, respectively. The preference coefficients of users are shown in Table A1 in Appendix A. The parameters of energy prices are shown in Table A2 in Appendix A. The price of natural gas is 2.92 RMB/m 3 in summer and 3.28 RMB/m 3 in winter. The time-of-use electricity price of the grid is shown in Figure A2 in the Appendix A. The parameters of equipment are shown in Table A3 in Appendix A. LB produces cooling energy in summer and heating energy in winter.
In this paper, three cases are set to compare. Case1: Ignoring the objective of carbon emissions, the operator only considers economic objective and sets the same price of each energy. At the same time, users do not consider DR.
Case2: The operator ignores the objective of carbon emissions and users consider DR. At the same time, the supply and demand sides negotiate different transaction prices for different users through internal game.
Case3: On the basis of case2, operator consider the objective of carbon emissions. At the same time, the weight coefficient of the operator's economic benefit is 0.7 in summer and 0.9 in winter.

Summer
The benefits of three users in three cases in summer are shown in Figure 5. Compared with case1, the energy costs of the users in case2 and case3 are reduced, and the comprehensive benefits are slightly improved. The game method proposed in this paper can reduce the energy costs of users under the premise of ensuring the comprehensive benefits of the users. In addition, by comparing case2 and case3, the objective of carbon emissions of the operator has little impact on the benefits of users.  The economic and environmental benefits of operator in summer are shown in Figure  6. Compared with case1, the net income of operator in case2 and case3 are improved, and carbon emissions are reduced. In addition, compared with caes2, the net income in case3 is reduced by 0.93%, but carbon emissions are reduced by 32.96%. It shows that the model mentioned in this paper can minimize carbon emissions while increasing economic benefits of all participants as much as possible. The economic and environmental benefits of operator in summer are shown in Figure 6. Compared with case1, the net income of operator in case2 and case3 are improved, and carbon emissions are reduced. In addition, compared with caes2, the net income in case3 is reduced by 0.93%, but carbon emissions are reduced by 32.96%. It shows that the model mentioned in this paper can minimize carbon emissions while increasing economic benefits of all participants as much as possible.
The economic and environmental benefits of operator in summer are shown in Figure  6. Compared with case1, the net income of operator in case2 and case3 are improved, and carbon emissions are reduced. In addition, compared with caes2, the net income in case3 is reduced by 0.93%, but carbon emissions are reduced by 32.96%. It shows that the model mentioned in this paper can minimize carbon emissions while increasing economic benefits of all participants as much as possible. The pricing strategies of operator in case1 in summer are shown in Figure 7. Users do not participate in energy pricing, and the operator directly optimizes energy prices based on the total load power. Users can only passively accept energy prices.
Because of the limited space, this article will not list all the strategies of participants but only give some examples of results. The operator sets different energy prices for different users in order to guide users to use energy rationally. For example, as shown in Figure 8a, in case2, the operator sets a higher heating price for user3 when user3 consumes more heating energy to guide user3 to reduce the heating load during peak time. As shown in Figure 8b, the operator sets a higher cooling price for user2 when user2 consumes more cooling energy to guide user2 to reduce the cooling load during peak time. As shown in Figure 8c, operator set higher electricity prices for user1 at the peak of electricity consumption of user1 to guide user1 to shift part of the peak load to valley hours to reduce the peak-to-valley difference. Additionally, it also shows that, in the interactive game process, the operator is dominant, which is in line with the characteristics of the master-slave game. The pricing strategies of operator in case1 in summer are shown in Figure 7. Users do not participate in energy pricing, and the operator directly optimizes energy prices based on the total load power. Users can only passively accept energy prices. Because of the limited space, this article will not list all the strategies of participants but only give some examples of results. The operator sets different energy prices for different users in order to guide users to use energy rationally. For example, as shown in Figure 8a, in case2, the operator sets a higher heating price for user3 when user3 consumes more heating energy to guide user3 to reduce the heating load during peak time. As shown in Figure 8b, the operator sets a higher cooling price for user2 when user2 consumes more cooling energy to guide user2 to reduce the cooling load during peak time. As shown in Figure 8c, operator set higher electricity prices for user1 at the peak of electricity consumption of user1 to guide user1 to shift part of the peak load to valley hours to reduce the peak-to-valley difference. Additionally, it also shows that, in the interactive game process, the operator is dominant, which is in line with the characteristics of the master-slave game.  The objective of operator's carbon emissions has little effect on the pricing strategy of operator and the energy consumption strategy of users. Three examples of strategies in case2 and case3 in summer are shown in Figure 9. When operator considers the objective of carbon emissions, there is little impact on energy consumption strategies of users, which can be in turn affect operator's pricing. Therefore, the carbon emissions objective of operator has little impact on his pricing strategy. The conflict of interests between the supply and demand sides is mainly reflected in economic interests.  Figure 9. When operator considers the objective of carbon emissions, there is little impact on energy consumption strategies of users, which can be in turn affect operator's pricing. Therefore, the carbon emissions objective of operator has little impact on his pricing strategy. The conflict of interests between the supply and demand sides is mainly reflected in economic interests.
The output of operator' equipment in case2 and case3 in summer are shown in Figures 10 and 11. G-E and E-Grid are, respectively, the electric power from G and grid. LB-C and Cen-C are, respectively, the cooling power of LB and Cen. HP-H and GB-H are, respectively, the heating power of HP and GB. ST-c and ST-d are the power of charging and discharging heat of ST. E-Cen is the electric power of Cen. Because the heating load is mainly supplied by HP, and CCHP mainly produces cooling energy, the heating output of the two cases is similar. Because of the environmental friendliness of CCHP, when the electric power from G is low (22 h-5 h in case2), case3 increases its power and reduces the power purchase from the grid. At the same time, the waste heat is increased, the cooling power of LB is increased, and the power consumption of Cen is reduced.  The output of operator' equipment in case2 and case3 in summer are shown in Figures 10 and 11. G-E and E-Grid are, respectively, the electric power from G and grid. LB-C and Cen-C are, respectively, the cooling power of LB and Cen. HP-H and GB-H are, respectively, the heating power of HP and GB. ST-c and ST-d are the power of charging and discharging heat of ST. E-Cen is the electric power of Cen. Because the heating load is mainly supplied by HP, and CCHP mainly produces cooling energy, the heating output of the two cases is similar. Because of the environmental friendliness of CCHP, when the electric power from G is low (22 h-5 h in case2), case3 increases its power and reduces the power purchase from the grid. At the same time, the waste heat is increased, the cooling power of LB is increased, and the power consumption of Cen is reduced.   Because the heating load is mainly supplied by HP, and CCHP mainly produces cooling energy, the heating output of the two cases is similar. Because of the environmental friendliness of CCHP, when the electric power from G is low (22 h-5 h in case2), case3 increases its power and reduces the power purchase from the grid. At the same time, the waste heat is increased, the cooling power of LB is increased, and the power consumption of Cen is reduced.

Winter
The benefits of three users in three cases in winter are shown in Figure 12. User2 has only a small amount of heating load in winter, so the benefit of user2 hardly changes. Compared with case1, the energy costs of user1 and user2 in case2 and case3 can be decreased on the premise that the overall benefits are not reduced. Comparing case2 and case3, the benefits of users are almost the same, which is similar to the situation in summer. The economic and environmental benefits of the operator in winter are shown in Figure 13. Compared with case1, the net income of operator is increased by 1.4% in case2 and 0.8% in case3, and carbon emissions are decreased by 1.7% in case2 and 4.8% in case3. Compared with case2, the net income in case3 is reduced by 0.6%, but carbon emissions are reduced by 3.2%. Although the net income has dropped a little in case3, the carbon emissions have been reduced even more. The multi-objective optimization method proposed in this paper can coordinate economic objective and environmental objective.

Winter
The benefits of three users in three cases in winter are shown in Figure 12. User2 has only a small amount of heating load in winter, so the benefit of user2 hardly changes. Compared with case1, the energy costs of user1 and user2 in case2 and case3 can be decreased on the premise that the overall benefits are not reduced. Comparing case2 and case3, the benefits of users are almost the same, which is similar to the situation in summer.

Winter
The benefits of three users in three cases in winter are shown in Figure 12. User2 has only a small amount of heating load in winter, so the benefit of user2 hardly changes. Compared with case1, the energy costs of user1 and user2 in case2 and case3 can be decreased on the premise that the overall benefits are not reduced. Comparing case2 and case3, the benefits of users are almost the same, which is similar to the situation in summer. The economic and environmental benefits of the operator in winter are shown in Figure 13. Compared with case1, the net income of operator is increased by 1.4% in case2 and 0.8% in case3, and carbon emissions are decreased by 1.7% in case2 and 4.8% in case3. Compared with case2, the net income in case3 is reduced by 0.6%, but carbon emissions are reduced by 3.2%. Although the net income has dropped a little in case3, the carbon emissions have been reduced even more. The multi-objective optimization method proposed in this paper can coordinate economic objective and environmental objective. The economic and environmental benefits of the operator in winter are shown in Figure 13. Compared with case1, the net income of operator is increased by 1.4% in case2 and 0.8% in case3, and carbon emissions are decreased by 1.7% in case2 and 4.8% in case3. Compared with case2, the net income in case3 is reduced by 0.6%, but carbon emissions are reduced by 3.2%. Although the net income has dropped a little in case3, the carbon emissions have been reduced even more. The multi-objective optimization method proposed in this paper can coordinate economic objective and environmental objective.

Conclusions
A transaction model using the Stackelberg game method and smart contracts is proposed to balance the interests of supply side and demand sides in this paper. In the proposed model, the energy operator considers two objectives, i.e., maximizing net income and minimizing carbon emissions, and users aim to increase the comprehensive benefits, including energy cost and comfort. The specific conclusions of the work include the following: (1) In order to break the pricing monopoly of energy operator, demand-side interests are considered. Additionally, different energy transaction prices are formulated according to different user characteristics, which can guide users to use energy rationally. (2) In order to obtain the global optimal solution, the KKT condition is used to transform the bilevel optimization model into an equivalent single-level model. (3) The simulation results show that the conflict of interests between the supplier and the demanders is mainly reflected in the economic aspect. Additionally, the method proposed can coordinate the economic interests of both parties. Furthermore, compared to the single-objective model, the operator's multi-objective optimization model can reduce carbon dioxide emissions by 32.96% in summer and 3.2% in winter.
There are deficiencies in this article. For energy stations, this article does not consider the addition of new energy sources, such as photovoltaics and wind turbines. In addition, this article focuses on the carbon emissions of energy station but disregards life cycle assessment method to calculate the net emissions of the energy flow from the energy station to the user including energy transport. The above deficiencies will be the focus of the future research.

Conclusions
A transaction model using the Stackelberg game method and smart contracts is proposed to balance the interests of supply side and demand sides in this paper. In the proposed model, the energy operator considers two objectives, i.e., maximizing net income and minimizing carbon emissions, and users aim to increase the comprehensive benefits, including energy cost and comfort. The specific conclusions of the work include the following: (1) In order to break the pricing monopoly of energy operator, demand-side interests are considered. Additionally, different energy transaction prices are formulated according to different user characteristics, which can guide users to use energy rationally. (2) In order to obtain the global optimal solution, the KKT condition is used to transform the bilevel optimization model into an equivalent single-level model. (3) The simulation results show that the conflict of interests between the supplier and the demanders is mainly reflected in the economic aspect. Additionally, the method proposed can coordinate the economic interests of both parties. Furthermore, compared to the single-objective model, the operator's multi-objective optimization model can reduce carbon dioxide emissions by 32.96% in summer and 3.2% in winter.
There are deficiencies in this article. For energy stations, this article does not consider the addition of new energy sources, such as photovoltaics and wind turbines. In addition, this article focuses on the carbon emissions of energy station but disregards life cycle assessment method to calculate the net emissions of the energy flow from the energy station to the user including energy transport. The above deficiencies will be the focus of the future research.        Figure A2. Time-of-use electricity price of grid.