An Architecture for Distributed Energies Trading in Byzantine-Based Blockchain
Abstract
With the development of smart cities, not only are all corners of the city connected to each other, but also connected from city to city. They form a large distributed network together, which can facilitate the integration of distributed energy station (DES) and corresponding smart aggregators. Nevertheless, because of potential security and privacy protection arisen from trustless energies trading, how to make such energies trading goes smoothly is a tricky challenge. In this paper, we propose a blockchain-based multiple energies trading (B-MET) system for secure and efficient energies trading by executing a smart contract we design. Because energies trading requires the blockchain in B-MET system to have high throughput and low latency, we design a new byzantine-based consensus mechanism (BCM) based on node’s credit to improve efficiency for the consortium blockchain under the B-MET system. Then, we take combined heat and power (CHP) system as a typical example that provides distributed energies. We quantify their utilities, and model the interactions between aggregators and DESs in a smart city by a novel multi-leader multi-follower Stackelberg game. It is analyzed and solved by reaching Nash equilibrium between aggregators, which reflects the competition between aggregators to purchase energies from DESs. In the end, we conduct plenty of numerical simulations to evaluate and verify our proposed model and algorithms, which demonstrate their correctness and efficiency completely.
Index Terms:
Distributed energies trading, Smart city, Consortium blockchain, Byzantine consensus, Stackelberg game.I Introduction
The deployment of distributed energy stations (DESs) based on the internet built by the development of smart cities has been a hot topic because of its great potential to reduce the consumption of fossil fuels and curb greenhouse gas emission [1]. Consider a smart community equipped with a DES, it is used to supply residents in this community with multiple energies, such as electricity and heat. DES existing in the community can reduce residents’ dependence on the centralized supply of energies, such as electricity from power grid and heat from heat station, thus save resources and reduce the cost of using energies. Moreover, it can sell surplus electricity and heat to the aggregators of power grid and heat station for making revenue. DESs can trade their surplus energies with aggregators that are responsible for collecting energies from their communities in a peer-to-peer (P2P) manner, thereby the multiple energies trading problem discussed in this paper is formulated.
Traditional P2P energies trading is performed on the centralized energy management platform, however, such a mechanism has many drawbacks. Traders often worry that their payment security and privacy protection when trading in an untrusted and opaque third centralized platform. This intermediary needs to verify and manage transactions between aggregators and DESs. If troubled by some damages such as single point of failure, it will lead to privacy leakage and transaction loss [2]. Thus, it is urgent to create a secure energies trading system to guarantee trading among the distributed internet of energy can be executed effectively. It encourages the DESs to sell their energies to aggregators without worry, which promotes the rational use of energies.
Blockchain is a public and distributed database that is designed to store verified transactions among all valid participants without a trusted intermediary. Here, a new transaction is required to be validated by a group of authorized participants, and then it can be added into the blockchain in a permanent and tamper-resistant manner. It can be used to construct a secure and reliable energies trading system because of its decentralization, security, and anonymity [3] [4]. Consider a smart city, it consists of a number of communities, each of which is equipped with a DES. There are two aggregators, electricity aggregator (EA) and heat aggregator (HA), trading with DESs in this city. The aggregators of different cities are interconnected to form a wide area network. Based on that, we propose a blockchain-based multiple energies trading (B-MET) system, where all aggregators are authorized participants required to store the blockchain and complete the consensus process. Thus this is a consortium blockchain as well, which is a little different from the classical public blockchain used in Bitcoin and Ethereum. Here, consortium blockchain is more convenient and flexible to achieve trading functions.
Based on such an architecture, we design a smart contract that ensures energies trading to be performed automatically when the trading conditions are satisfied. However, the proof-based consensus mechanism such as proof-of-work that is adopted by the most of blockchain applications is not suitable to our consortium blockchain in B-MET system because of its high latency, low throughput, and demanding computing power requirement. To finish the task of energies trading, it needs low latency and high throughput consensus mechanism. Thereby we design a new byzantine-based consensus mechanism (BCM) based on node’s credit, which reflects the performance of this node in the previous experience of participating in consensus. After each round of consensus, each node’s credit should be updated according to its voting result. If its voting is consistent with the result of consensus, its credit will be increased; otherwise will be decreased. Their credits affect directly their probabilities of being chosen as the leader and voting weight in the next round. This not only motivates participants to make the right decision, but also speeds up the consensus process.
In the aforementioned contract, there is an interaction between aggregator and DES before initiate a new energies trading, where the aggregator offers a unit price to purchase a kind of energy from DES, then DES decides the amount of energy they are willing to sell. In this paper, we take combined heat and power (CHP) system as an instance of DES, and aggregators are EA and HA. In a smart city, for each DES in this city, its utility consists of two parts: one is to serve the residents living in the community for satisfying their Daily consumption, and the other is sold to the aggregators for gaining revenues. For the aggregators in this city, their gains come from buying energies from DESs at a lower price and selling them at the retail price. To motivate the DESs to sell more energies, the aggregators should offer a higher price to them, but doing so raises costs and may result in lower overall profits. Since the multilevel decision-making processes between aggregators and DESs in a city, we formulate a novel multi-leader multi-follower (MLMF) Stackelberg game to model this bargain between them. Here the aggregators are leaders and DESs are followers. Their goals are to maximize their utilities or profits respectively. This MLMF Stackelberg game is analyzed and solved thoroughly in this paper, and we prove the Nash equilibrium (NE) among aggregators exists and is unique. Because the DESs are always able to respond aggregators with the optimal strategy according to their offered prices, the Stackelberg equilibrium (SE) exists and is unique as well. We propose a distributed algorithm that is guaranteed to reach the unique SE by limited information interactions. Finally, we conduct extensive numerical simulations to test the B-MET system, verify the correctness of our proposed utility functions and feasibility of our proposed algorithm.
The rest of this paper is organized as follows: Sec. II discusses the-state-of-art work. Sec. III introduces the architecture of B-MET system, describes CHP system, and defines utility functions. Sec. IV presents smart contract and byzantine-based blockchain. Sec. V introduces the Stackelberg game and discuess the solving process. Sec. VI conducts numerical simulations. Sec. VII is conclusion.
II Related Work
Distributed energy systems have been applied widely in many different forms, such as DES [5] and vehicle-to-grid [6] [7], to curb greenhouse gas and save cost. Integrating DESs into a smart grid [8] has attracted more and more researchers to participate in recently. This rouse the problems of energy management and energy trading problem. Cecati et al. [9] exploited DES to make the cost of power delivery minimized by use of an efficient smart grid management system. Georgilakis et al. [1] summarized the optimally distributed generation placement problem systematically, classified and analyzed current and future research about it. Zhang et al. [10] considered microgrid as a local energy supplier for domestic buildings by utilizing DES, and studied optimal scheduling of energy consumption through mixed-integer programming. However, they only focused on electricity trading between grid and DESs, in this paper we consider multiple energies trading due to the diversity of energy forms.
In P2P energy trading, blockchain technology has been introduced to address transaction security issues. Kang et al. [11] put forward a localized P2P electricity trading pattern based on consortium blockchain among plug-in hybrid electric vehicles. Li et al. [12] proposed a P2P energy trading architecture based on consortium blockchain for the industrial internet of things relied on a credit-based payment scheme. zhou et al. [7] considered the scenario of vehicle-to-grid, and developed a secure energy trading mechanism based on consortium blockchain. Guo et al. [13] studied a blockchain-based energy management system that guarantees secure electricity trading between grid and DESs. However, they lose sight of low throughput and high latency in their proof-based consensus process, in this paper we try to address it by proposing a new byzantine-based consensus mechanism.
Stackelberg game is an effective tool to model the interactions in energies trading. Maharjan et al. [14] studied the demand response management by establishing a Stackelberg game between multiple utility companies and customers to maximized their utilities respectively. Bu et al. [15] proposed a four-stage Stackelberg game to consider a real-time pricing problem for the electricity retailer in the demand-side management. Yao et al. [16] modeled the interactions between cloud server and mines by Stackelberg game, and solved it by multiagent reinforcement learning algorithm. Chen et al. [17] proposed a Stackelberg game-based framework to simulate the multiple resources allocation between cloud server and end users, and found an equilibrium solution by a backward induction process. However, most of these models have only one leader, in this paper the interactions between aggregators and DESs are MLMF, more complex and realistic.
III System Architecture
Consider a smart city, it consists of a number of disjoint smart communities, each of which is equipped with a distributed energy station (DES) responsible for supplying multiple energies, such as electricity and heat, to these residents living in this community. In this city, there are several aggregators, which represent different companies respectively, collecting different kinds of energies from all DESs appertained to this city. The architecture of blockchain-based multiple energies trading (B-MET) system is shown in Fig. 1. In the B-MET system, given a smart city , the entities in this smart city can be shown as follows:

1) Aggregators: There are two aggregators, electricity aggregator () and heat aggregator (), associated with this smart city . The (resp. ) is delegated by power grid (resp. heat station) as a monopoly of the energy market. They purchase electric energy (resp. heat energy) generated by DESs in those communities that belong to this smart city.
2) DESs: The city can be partitioned into an uncertain number of disjoint smart communities, denoted by set . In community , there is a distributed energy station supplying electricity and heat to the residents living in this community. Besides, is able to sell surplus electric energy (resp. heat energy) to the corresponding (resp. ) in order to make revenues.
3) Smart meters: It is a built-in component installed in each aggregator that monitors the energy flow transferred by each DES in this city in real-time, and decide whether the transaction has been accomplished.
Then, consider a larger ecosystem, such as a country, it is composed of a number of smart cities. This ecosystem can be denoted by . Here, each is a smart city in this ecosystem, and . For convenience, the notation can be considered equivalent to . Our B-MET system is established on such an ecosystem, in which all aggregators, including EAs and HAs, are interconnected each other to form a peer-to-peer (P2P) network called “blockchain network”, shown in the upper half of Fig. 1. In order to support secure energy trading between aggregators and DESs, we adopt consortium blockchain to construct our B-MET. In traditional blockchain, the consensus process is carried out by all participants. But the blockchain in the B-MET takes all aggregators in the ecosystem as authorized participants, and they are charged with storing the whole blockchain and performing the consensus process. Each aggregator manages and records those transactions between it and DESs in its city. The transactions are packaged into blocks and added into blockchain when the consensus among aggregators is reached, thus stored in all aggregators permanently.
III-A Combined Heat and Power System
Here, the aforementioned DES is implemented by the combined heat and power (CHP) system. The CHP system consumes natural gas to generate electricity and heat that serve its community or sell to the aggregators of its corresponding city, shown in Fig. 2. The gas is fed into the gas turbine (GT) which will generate electricity and emit high-temperature waste heat . The heat can be recovered by heat recovery system that can generate heat . Here, (resp. ) is used to supply electricity (resp. heat) to community, and (resp. ) is sold to EA (resp. HA).

Shown as Fig. 2, the total electricity generated by GT is . Measured in days, the units of quantities denoted by and are . The gas consumption per day can be defined as
(1) |
where is the calorific value of natural gas, thereby the total energy generated by is definitely. The is the electric conversion of GT, percentage energy that transferred to electricity. Given a specific GT, its electric conversion can be considered as a constant. Besides, let be the thermal efficiency of heat recovery system, and be the thermal efficiency of heat component. We have and respectively.
As mentioned above, for a given CHP system, the electricity (resp. heat) generated by it can be divided into two parts: one is used to serve local residents, another is sold to EA (resp. HA). Thus, we define two dispatching factor for this CHP, where is the electric dispatching factor and is the heat dispatching factor. This DES needs to buy natural gas from the gas company. The company is for profit, thus it is valid to assume the gas company always supply enough gas that is able to meet the DES’s requirement. Given a smart city and a smart community , the energy relationships in the CHP system of has been obtained, that is
(2) | ||||
(3) | ||||
(4) | ||||
(5) |
In this model, we assume all the CHP equipments in this ecosystem has the same efficiency parameters and . Each can determine the amount of electricity (resp. heat) that can be sold to (resp. ) by adjusting its dispatching factor (resp. ) automonously. For example, when is one, it means that will not sell any electricity to for making revenue.
III-B Utility Functions
Consider a smart city , the (resp. ) offers a unit price (resp. ) to collect surplus electricity (resp. heat) generated by , where the units of and are . For each , it is a risk-averse agent in the energy market. If chooses dispatching factor , , and consume natural gas , that is
(6) |
where (resp. ) is the satisfaction function of community that provides electricity (resp. heat) to satisfy the usage of local residents in this community, and , , , and are defined from (2) to (5). Here, is the unit cost of natural gas.
From our simplified CHP model, we denote the cost of electricity (resp. heat) produced from by (resp. ). Then, the cost of electricity and heat can be quantified, that is and . Thus, we have . If the price (resp. ) offered by (resp. ) is less than the cost (resp. ), this will not sell any electricity (resp. heat) to them. It will reduce the gas intake such that only meet its local requirement. Like this, there is no energies trading between aggregators and DESs, and obviously, it is not what we want to see. Thus, it is reasonable to consider the prices offered by aggregators satisfy and . At this time, for each , it will produce electricity and heat as much as possible, because of the fact that it is always profitable to sell them to the aggregators. For maximizing its utility, each CHP system will run at full capacity. Here, for each , we define its maximum production capacity (maximum gas consumption) per day as . Therefore, the utility can be denoted by , because is considered as a constant.
Remark 1.
After here, we denote and for convenience.
Based on [14] [18] [6], the natural logarithmic functions were adopted extensively in characterizing the satisfaction of comsuming energy. That is
(7) | ||||
(8) |
where (resp. ) is a non-negative satisfaction coefficient for electricity (resp. heat) in community , and (resp. ) is a non-negative adaption coefficient electricity (resp. heat) in this community as well. The adaption coefficients were proposed in [13] first, which aimed to control the variation range of the term , avoid it growing infinitely. Generally, we let (resp. ) when we choose (resp. ) by setting a valid adaption coefficient (resp. ) [13]. Base on that, thereby we can formulate and as follows:
(9) |
For aggregators in this city, power grid and heat station are the retailers for electricity and heat, however they do not have pricing power, because the retail prices of electricity and heat subject to government’s regulation. Hence, we define a retail price (resp. ) of electricity (resp. heat). As a selfish participant, it requires that and . From (6), if (resp. ) offered by (resp. ) is too low, each will respond with raising its dispatching factor (resp. ), and sell less energy to aggregators. If the aggregators offer a high price to purchase energy, their profitable spaces are reduced even if DESs are willing to sell more energies to them. Both of these cases will cause aggregators’ profit to be cut down. Therefore, it is important for aggregators to offer a optimal price such that not only encourage DESs to sell more energies, but also ensure sufficient profitability. If (resp. ) offers a price (resp. ), its profit function can be defined as
(10) | ||||
(11) |
where (resp. ) is the profit function of the (resp. ) that collects electricity (resp. heat) from DESs in its city, and and are defined in (3) and (5).
IV Byzantine-Based Blockchain
In this section, we will introduce a smart contract used to perform energies trading, and design a novel byzantine-based consensus mechanism based on the B-MET system.
IV-A Smart Contract
A smart contract is a collection of programmable digital agreement that every participant commit to comply. Under our blockchain-based energies trading ecosystem, a transaction can only happen between aggregators and DESs in the same city. Thereby, consider a city , a smart contract can be decided together by its participants, which consist of an aggregator and a . We denote such a smart contract by . Between anonymous and untrusted entities in a city, the smart contract is able to execute credible transactions without third institutions. Then, the procedure of its smart contract is presented as follows:
1) System initialization: At the beginning, each needs to acquire a unique identification by registering in the designated institution authorized by government. It will be assigned with its public/private key pair and a . That is
where each account is associated with its wallet address and balance, . Then, for each aggregator in this city, it has those necessary information as well. But there is a credit value that represent the reputation of aggregator , thereby we have . Here, technologies of asymmetric encryption are usually adopted by current blockchain system for the sake of security, privacy, and data integrity. Given a massage encrypted by , we have , where the unforgeability and integrity is guaranteed.
2) Creation: An aggregator offers a price to buy energy from communities in its city, then responds it with the amount of energy that can be sold to . Like this, a new smart contract is generated by signing with their private key respectively. Then, this contract will be broadcasted to all authorized participants (aggregators) in the ecosystem . After reaching a consensus, this smart contract will be deployed and executed automatically. Each smart contract between aggregator and DES, , is associated with several variables, which include account information , offered price , amount of energy , expected transaction time , and timestamp . To guarantee this contract can be executed successfully, it needs to verify whether aggregator has sufficient balance such that and whether has enough production capacity to supply amount of corresponding energy on time.
3) Execution: The will be executed if current time after reaching a consensus among aggregators in blockchain network. From now on, it begins to trade energy and finish payment. The smart meter in aggregator verifies whether the amount of energy has been transported to the designated location. Then, fed this result from smart meter into the smart contract, if yes, it will execute the payment process automatically, that is
Here, we design a mechanism that the balance is permitted to be negative. At the moment of payment, the smart contract will complete payment as usual if the ’s balance is not enough to pay. In this way, the ’s balance will become negative. Then, any contract that aggregator participants in will not be executed until its balance back to be positive.
Generally speaking, the energies trading between aggregators and DESs can be summarized as follows: In a smart city, a DES begins a smart contract with an aggregator by responding it according to its offered price. This contract needs to be verified by the consensus process in blockchain network. Then, it will execute the predefined procedure automatically once the trading conditions are met, which achieves the digital currency and energy exchange specified by contract between participants in a secure manner.
IV-B Byzantine-based Consensus mechanism
As mentioned early, a consensus process is necessary to be performed so as to ensure the consistency of blockchain stored in every authorized node. Castro et al. [19] proposed a practical byzantine fault tolerance (PBFT) algorithm, which has been used in consortium blockchain system widely. Based on it and combined with the characteristics of energies trading, we design a new byzantine-based consensus mechanism (BCM). Our consensus process is performed among all aggregators in the ecosystem , and each of them has a local transaction pool (LTP) to store all transactions it receives. The consensus process is executed round by round, and the time interval of block generation is given by . There are three main stages, shown in Fig. 3, that is pre-prepare, prepare, and commit.

First, let us introduce the credit model, which will be used in leader election and to decide whether to reach a consensus. Let be the collection of consensus nodes. We have known that there is an attribute for each , where a larger implies node is more trustworthy. We denote by the credit of node after finishing the -th round consensus. Then, we can define according to the result of consensus in the -th round, where this result is whether to add the leader’s block into the blockchain. That is: (1) when is the leader, we have if its block is accepted to be added into the blockchain, else if its block is rejected; and (2) when is not the leader, we have if its decision is consistent with consensus result; else if it disagrees with the majority. We usually give and initialize the credit of each consensus node as . Consider entering the -th round consensus, the detailed process of BCM is represented as follows:
1) Leader election: The first step in this round is to select a leader from all consensus nodes. This leader election is based on node’s credit. Generally speaking, the better the credit value of a node, the more likely it is to be elected as the leader. Thus, the result of leader selection is unpredictable. For a node , the probability that it is elected as the leader of the -th round consensus is ,
(12) |
where represents the leader of the -th round consensus. Obviously, there is no chance to select a node whose credit is zero as the leader.
2) Broadcast: Each aggregator in broadcasts all transactions which happen in current and co-signed with a DES in its city to the blockchain network. All the consensus nodes will verify whether their received transactions are valid. Those valid transactions will be stored in their LTP, and invalid transactions will be discarded.
3) Pre-prepare: After all non-leader consensus nodes in have completed above verification process for received transactions, the leader will package those selected valid transactions in its LTP into a block . Then, the leader signs this block and broadcasts pre-prepare message - to the blockchain network.
4) Prepare: For each non-leader node , it will check the identity of leader and verify the pre-prepare message from the leader. The block verification needs to confirm the pointer to the previous block, mercle root is correct and compare the transactions in with the corresponding transactions in its LTP. If node believes is valid, it broadcasts this prepare message to the blockchain network. All consensus nodes must make decisions in this step, whether to agree or disagree with adding block into the blockchain. Then for each node , it gathers all prepare massages from other consensus node, checks their identities and counts the weighted sum of received prepare messages. Let be the set of nodes from which node receives prepare messages, including itself. If satisfying the following inequality
(13) |
where , we say node will accept block and broadcast commit message to the blockchain network.
5) Commit: After sending their commit messages, they should waiting commit messages from other consensus node. For each node , its consensus process is completed until it recieve sufficient commit messages such that , where is the set of nodes from which node receives commit message, including itself.
5) Add a block and update credits: If a consensus node accepts the new block , it will be appended into the blockchain in a linear and chronological order, which includes a pointer to the previous block. Any failure occurs in these three stages will terminate the consensus of current round (do not add the new block). Besides, before finishing this round, we need to update the credits of all the consensus nodes according to the credit model. In next round, the consensus process will perform based on their new credits.
Failures that terminate the current round and do not add a new block mainly include the following reasons: (1) the leader sends invalid block or do not send its packaged block before the deadline; and (2) too many malicious nodes do not breadcast prepare messages even though this block is valid. Shown as node in Fig. 3, it is a faulty node. The credit of those nodes that make mistakes in this consensus process will be reduced. Let be the number of malicious nodes. According to [19], supposing , the faults can be tolerated by the consensus system with nodes. In our BCM, each consensus node’s credit is initialized as a constant, thereby good nodes can make sure that (13) is satisfied. As the consensus process performs more and more times, the good nodes’ credit increase but malicious nodes’ credit decrease gradually. Therefore, the credits in system will be more accumulative in good nodes. According to (13), the number of prepare message and commit message required to reach a consensus declines, which helps reduce latency and improve throughput. In summary, secure and traceable energies trading and digital currency exchange can be guaranteed by our proposed B-MET system.
V Multiple Energies Trading: A Stackelberg Approach
A non-cooperative Stackelberg game generally refers to the multilevel decision making processes of a number of independent decision-makers in response to the decision taken by the leading player of the game [20]. In this section, we put forward a multi-leader multi-follower (MLMF) Stackelberg game to model the interactions in above smart contract between aggregators and DESs. Consider a smart city , the MLMF Stackelberg game can be defined as
(14) |
where the components are shown as follows:
1) Players set : The aggregators and act as leaders, and offer a price respectively to the DESs. Then, act as followers, and decide on the amount of electricity and heat they want to sell respectively according to the offered prices.
2) Strategy spaces and : Let be the strategy space of two aggregators, where we say is a feasible strategy of and . Then, let be the strategy space of all DESs in this city, and we have is a feasible strategy of DESs.
3) Utility functions and : Each player in this game aims to maximize its utility or profit, which reflects the quality of strategy that this player chooses. is the profits of aggregators, defined in (9) and (10); and are the utilities of DESs in , defined in (6).
V-A DESs (Followers) Side Analysis
Given a price strategy offered by two aggregators in city , each decides the amount of electricity (resp. heat ) that sold to the (resp. ) by adjusting its dispatching factor (resp. ). Thus, each aims to choose its optimal dispatching factors according to by solving the following optimization problem (), that is
(15) | |||
(16) |
where is the minimum amount of energy that is required to maintain the basic life for those residents living in this community. The objective function, shown in (6), is strictly concave and continuously differentiable, this is a convex optimization problem, which will be proved later. Thus, the stationary solution is unique and optimal.
To ensure reasonableness, the should be in a valid range, thus we have . It means that this minimum requirement is larger than the production capacity of electricity or heat separately, which implies that and are impossible to approach zero definitely. Hence, the restrictions on (16) can be converted equivalently to constraint (17), that is
(17) |
Then, its first-order derivatives is
(18) | |||
(19) |
Let and , we have
(20) |
Here, we need to note that the setting of parameter (resp. ) must be in a valid range such that (resp. ) for any offered price (resp. ). Or else, this utility function is monotone, and it is meaningless to adjust its dispatching factors. Base on that, thereby we can restrict and as follows:
(21) |
where it assume (resp. ), or else no such (resp. ) can keep (resp. ) satisfied for any offered prices.
Sequentially, we use Lagrange’s multipliers , and for constraint (17), thereby the , shown as (15) and (17), can be converted to the following form , that is
(22) |
where we denote . Then, Based on (22), the complementary slackness conditions (KKT conditions) of are demonstrated as follows:
(23) | |||
(24) | |||
(25) | |||
(26) | |||
(27) | |||
(28) |
The optimal solutions of , shown as (15) and (17), can take one of the following four cases, that is
1) Case 1: For and , we have . Look at (25), if , substitute it into (23) and (24), we can get a solution according to (20). Then, we need to check whether constraint (17) can be satisfied. If yes, the optimal solution is . If no, it means and . At this time, by solving (23) and (24), we have
(29) | |||
(30) |
Substitute (29) and (30) into (25),
(31) |
where , , and . By solving (31), we have two solutions, they are
(32) |
Here, it is easy to verify and based on (9), (21), and , thus it is possible that . If , there is no real solution; else we need to check whether the defined on (32) satisfies . If , substitute (32) into (29) and (30), we obtain a solution . If it is feasible, namely , the optimal solution can be determined by .
2) Case 2: For and , we have . Look at (25), if , substitute it into (24), we can get a solution according to (20). Then, we need to check whether constraint (17) can be satisfied and . If yes, the optimal solution . If no, it means and . According to (24), we have which is shown as (30). Substitute (30) into (25),
(33) |
By solving (33), we have
(34) |
If and , substitute (34) into (30), we obtain a solution . If we have , the optimal solution can be determined by .
3) Case 3: For and , we have . Look at (25), if , substitute it into (23), we can get a solution according to (18). Then, we need to check whether constraint (17) can be satisfied and . If yes, the optimal solution is . If no, it means and . According to (23), we have which is shown as (29). Substitute (29) into (25),
(35) |
By solving (35), we have
(36) |
If and , substitute (36) into (29), we obtain a solution . If we have , the optimal solution can be determined by .
4) Case 4: For and , we have because we have assumed before. Substitute it into (23) and (24), we have
(37) | |||
(38) |
By solving (37) and (38), we have
(39) |
According to (9) (21), the maximum value of can be obtained when giving . Substitute it into (39), we have because of . By using the same way, we have because of as well. It does not satisfy (28), thus this solution is not feasible and cannot occur.
To sum up, offered a price strategy by aggregators, the optimal response of each will be obtained by above procedure. It is one of the three cases, except case 4, that depends on the offered prices, minimum requirement , and choice of satisfaction cofficient and . Since the expressions of the solution is very complicated, we cannot give a unified formal expression to summarize the results that contains all cases.
V-B Aggregators (Leaders) Side Analysis
After receiving the responses (resp. ) of all in city , the profit gained by aggregators (resp. ) can be determined according to (10) and (11). They assume each will respond to them with the optimal strategy according to their offered price. Thus, and aim to choose its optimal prices by solving the following optimization problem (), that is
(40) | |||
(41) |
where (resp. ) attempts to select an optimal price (resp. ) to maximize its profit given (resp. ). The objective function, shown in (10) (resp. (11)), is strictly concave and continuous differentiable with respect to (resp. ), which will be proved later.
First, we consider electricity aggregator alone. Feed a price into , the response of each must be in one of the following four events: (1) ; (2) ; (3) ; and (4) . Then, its first order derivatives is
(42) | ||||
(43) | ||||
(44) | ||||
(45) |
where it is one-to one correspondences between (42)(45) and event (1)(4). Then, the first-order derivative of ’s objective function is
(46) |
Combined with (42)(45), let , we can get a solution that maximizes given . However, this is constrained on the range of , thus the optimal price strategy of is shown as follows:
(47) |
Due to the fact that the profit function given is strictly concave with respect to , it increases first and then decreases with the increase of . Thus, the maximum profit is obtained at the price of when ; Similarly, the maximum profit is obtained at the price of when ; else obtained at stationary point.
Then, we consider heat aggregator alone. Feed a price into , the respone of each must be in one of the following four events: (1) ; (2) ; (3) ; and (4) . Then, its first order derivative can be computed by replacing with , with , and with in (42)-(45), corresponding to event (1)(4). Then, the first-order derivative of ’s objective function is
(48) |
Let , we can get a solution that maximizes given . Similar to (47), constrained on the range of , the optimal price of can be formulated similar to the analysis of (47) from its concavity.
V-C Stackalberg Equilibrium
The aggregators, and in a smart city , play a non-cooperative game with each other to offer the unit prices for electricity and heat. They all want to maximize their profit according to their profit function defined on (10) and (11). We denote this game between aggregators by and introduce the concept of the Nash equilibrium (NE) shown as follows:
Definition 1 (Nash Equilibrium).
Given a game defined as above, a feasible price strategy is the Nash equilibrium if no player can improve its profit by changing its strategy unilaterally, that is
(49) |
There is a property that at the NE, no aggregator attempts to offer a new price again because they all achieve their mutually satisfactions respectively. Then, we need to study the existence and uniqueness of the NE of game between two aggregators in a city.
Lemma 1.
The Nash equilibirum of game between aggregators always exist and is unique.
Proof.
The strategy space in game has been denoted by , which is a convex, closed, and non-empty subset of the space . Take aggregate as an example, is the responsive dispatching factor given the offered price from community . From (42)(45), its second-order derivatives is
(50) | ||||
(51) | ||||
(52) | ||||
(53) |
where they correspond to event (1)(4). Then, the second-order derivative of ’s objective function is
(54) |
Here, observe that from (42)(45), and from (50)(53), we have . Thus, is concave with respect to .
Consider aggregator and from community , its second-order derivative can be computed by replacing with , with , and with in (48)(51). Then, the second-order derivative of ’s objective function is
(55) |
By similar analysis, we have and is concave with respect to . Thus, game is a concave 2-person game. Because of their concavity, the Nash equilibrium exists and is unique according to [21]. ∎
In a smart city , the aggregators offer the price strategy in the first stage, then each decides its optimal dispatching strategy according to the offered prices in the second stage. It formulates a MLMF Stackelberg game between aggregators and DESs, shown as (14). The optimal strategy set , where is the optimal response of community based on its previous leaders’ prices, can be obtained at the Stackelberg equilibrium (SE), defined as follows:
Definition 2 (Stackelberg Equilibrium).
Given a game defined as (14), a feasible strategy is the Stackelberg equilibrium if no player, including leaders and followers, can improve its utility or profit by changing its strategy unilaterally, that is
(56) | |||
(57) | |||
(58) |
where we denote prices and is any feasible strategy of .
After reaching the SE, none of them tends to change its strategy again because they cannot improve their utilities or profits further by changing unilaterally. Then, we need to study the existence and uniqueness of the SE of game between aggregators and DESs in a city.
Theorem 1.
The Stackelberg equilibirum of game between aggregators and DESs always exist and is unique.
Proof.
In this game , the aggregators will offer prices to those DESs to purchase energies in their city first. From Lemma 1, a Nash equilibrium always exists and is unique between aggregators. According to the aforementioned analysis on DESs side, they are able to respond to aggregators with their optimal dispatching strategies based on the offered prices and their restrictions. Thus, the Stackelberg equilibrium always exists and is unique. ∎
V-D Distributed Algorithm
In order to find the NE between aggregators based on the optimal responses from DESs, we adopt the sub-gradient technique [22] [23] [24] for determining price strategies. It is shown in Algorithm 1. In Algorithm 1, each aggregators is assigned with its lowest price. At this time, the dispatching factors of each DES in this city is closest to one, which should be in feasible space defined on (17). Then, consider aggregator , in each iteration, it updates its price in manner of increasing by or decreasing by , where is a given small step. According to current prices , we compare the profits of by offering a price , , and , then choose the best one and update the price . Consider aggregator similarly, we compare the profits of by offering a price , , and , then choose the best one and update the price . At last, we update with where is a attenuation factor.
Theorem 2.
Given an initial price strategy and step , the Nash equilibrium of game can be obtained by the sub-gradient algorithm, shown in Algorithm 1.
VI Numerical Simulations
In this section, we conduct several experiments to model price competition and energies trading in a smart city.
VI-A Simulation Setup
Consider a city , we denote the number of communities in this city by . At the standard atmosphere, the calorific value of natural gas is on average. The retail price of electricity in U.S. is . According to the conversion relationship of , it is . Equivalently, we regard it as in our B-METS. The electric conversion of GT is . We define the maximum gas consumption and its unit price . Thus, we have and for the EA definitely. The efficiency of heat recovery system is given by , thereby we have . The retail price of heat is . Thus, we have for the HA definitely. According to (9), we have and . Then according to (21), we have and .






VI-B Simulation Results
1) Concavity of functions: Consider a city that has only one community, we define this DES’s satisfaction coefficient under two settings and . Fig. 4 draws the objective function of entities in city under the two settings, where we define the minimum energy restriction at as . It means that there is no restriction on DES to choose their partition coefficients in order to demonstrate complete functional properties. Let us look at (a) (b) (c) in Fig. 4. Shown as (a), as increases, EA’s profit function increases first and then decreases under any price offered by HA, and its objective value has nothing to do with . There is no competitiveness between EA and HA because of no restriction. It proves the profit function is concave with respect to . Similarly, shown as (b), we have HA’s profit function is concave with respect to as well. From (c), it is the utility function of this DES according to offered prices , which prove the concavity of DES’s utility function. It shows that our previous analysis about DESs’ response is valid, and DESs are always able to respond aggregators with the optimal strategy according to the prices offered by aggregators. If a Nash equilibrium exists between aggregators, then a Stackelberg equilibrium among players in game must exist definitely.
2) Effect of satisfaction coefficients: Shown as (d) (e) (f) in Fig. 4, under the setting , shown as (d) (e) (f) in Fig. 4, we increase but decrease . Shown as (d), as increases, the maximum point that obtains the maximum profit for EA moves toward the positive direction. It implies that the EA has to offer a higher price to buy electricity from DES in order to gain the maximum profit, because electricity used to serve community can contribute more utility than before. Similarly, shown as (e), as decreases, the maximum point that obtains the maximum profit for HA moves toward the negative direction. From (f), as increases and decreases, the maximum point that obtains the maximum utility for DES according to moves from in (c) to in (f). Thus, we have (resp. ) increases with the growth of (resp. ).












3) Effect of restrictions: From the definition of , we have a restriction that requires a feasible solution must satisfy and . Here, we all adopt satisfaction coefficient . In this part, we consider two different settings, that is and where . In order to demonstrate the effect of restrictions clearly, we use 2D figures instead of 3D figures. Fig. 5 and Fig. 6 draw the objective functions of aggregators and optimal responses of DES according to aggregators’ offered prices in city under the two settings. Let us discuss the typical black curve, shown as (a) with in Fig. 5. At the beginning, EA’s profit increases from to where DES’s decreases but keeps constant. This response implies that DES’s optimal strategy can be obtained at where the first-order derivative is equal to zero. Then, the middle section is a smooth curve, where DES’s response is at the tight border . In this section, we can see DES’s response decreases linearly and increases linearly. Finally starting from , EA’s profit decreases linearly because of . Let us look at the yellow curve, shown as (a) with in Fig. 5. At the beginning, EA’s profit is equal to zero since DES responds with . Due to the high price offered by EA and low price offered by EA, all electricity should be partitioned to meet the minimum energy restriction and only sell heat for making revenue. For Fig. 6, compared with Fig. 6, we find that these functions show some structural changes as increases. The restriction in Fig. 6 is larger than in Fig. 5, which indicates the DES has to use more energy to serve its community. Shown as (a) (d) in Fig. 6, we can know that the DES’s optimal strategy cannot be obtained at stationary points . All DES’s responses are at the tight border . Besides, the sections of or are much larger than that under the restriction . However, no matter what is, the EA (HA) always needs to offer an increasing price in order to get its maximum profit as the price offered by HA (EA) increases. This reflects the competition between aggregators, which is different from that there is no restriction in Fig. 4. Therefore, the restriction settings in have significant effects on the objective functions of aggregators and optimal responses of DES.






4) Stackelberg Equilibrium: Consider a city that has five communities, we define these ’s satisfaction coefficients as where . We assume , , , , and in this part. Fig. 7 draws the process of converging to Stackelberg equilibrium with different initializations under the restriction . Here, the parameters defined in Algorithm 1 is given by and . The initialization implies to give in line 3 of Algorithm 1. Take (a) (b) in Fig. 7 as an example, at the beginning, the aggregators offer the highest prices, thus they hardly gain any profit. By interacting with the five DES, the aggregators decrease their offering prices gradually in each iteration in order to improve profits. At approximately -th iteration, they cannot improve their revenues by changing their strategies unilaterally, thus reaching the Nash Equilibrium. The DESs in always respond aggregators with their optimal strategies, thus the Stackelberg equilibrium can be reached. From (a) (c) (e) in Fig. 7, we can see that they can reach the same equilibrium point regardless of what initialization is. However, the initialization affects the rate of convergence, and a good initialization can converge to the equilibrium point quickly. Fig. 8 draws the process of converging to Stackelberg equilibrium with different under the restriction . Here, we adopt the initialization and as well. From (a) (c) in Fig. 8, they can quickly approach to equilibrium point when we adopt the larger . Nevertheless, it has to wait for to drop to a relatively low level in order to improve this solution further. Therefore, how to choose the value of depends on your demand. If we do not require high accuracy but high speed, it is recommended to choose a large ; otherwise we should choose a small one.




5) Centralized vs. Distributed: For the aggregators, it is hard to know the complete information about all DESs in its city. Even if knowing partial coefficients, such as coefficient satisfactions, the settings of minimum energy restriction are very flexible, which will change with the fluctuations of the community population, season, and other factors. The optimal responses from DES are unpredictable. Thereby the aggregators can only obtain feedback information of DESs in a distributed manner, that is to update their offering price iteratively by interacting with DESs in their city.
VII Conclusion
In this paper, we studied multiple energies trading problem systematically. First, we proposed an architecture of B-MET system to address the security and privacy protection issues in distributed energy trading. In order to reduce latency and improve throughput, we introduce a credit model and design a new byzantine-based consensus mechanism based on it. Then, we model the interactions between aggregators and DESs in a smart city by MLMF Stackelberg game, which is more complex and realistic than the modes that have appeared before. We solve it step by step, show the existence and uniqueness of SE, and design a sub-gradient algorithm to find NE between aggregators. Finally, the results of numerical simulations indicated that our model is valid, and verify the correctness and efficiency of our algorithm.
Acknowledgment
This work is partly supported by National Science Foundation under grant 1747818 and 1907472.
References
- [1] P. S. Georgilakis and N. D. Hatziargyriou, “Optimal distributed generation placement in power distribution networks: models, methods, and future research,” IEEE Transactions on power systems, vol. 28, no. 3, pp. 3420–3428, 2013.
- [2] N. Z. Aitzhan and D. Svetinovic, “Security and privacy in decentralized energy trading through multi-signatures, blockchain and anonymous messaging streams,” IEEE Transactions on Dependable and Secure Computing, vol. 15, no. 5, pp. 840–852, 2016.
- [3] M. Li, J. Weng, A. Yang, W. Lu, Y. Zhang, L. Hou, J.-N. Liu, Y. Xiang, and R. H. Deng, “Crowdbc: A blockchain-based decentralized framework for crowdsourcing,” IEEE Transactions on Parallel and Distributed Systems, vol. 30, no. 6, pp. 1251–1266, 2018.
- [4] Y. Jiao, P. Wang, D. Niyato, and K. Suankaewmanee, “Auction mechanisms in cloud/fog computing resource allocation for public blockchain networks,” IEEE Transactions on Parallel and Distributed Systems, vol. 30, no. 9, pp. 1975–1989, 2019.
- [5] D. Wu and R. Wang, “Combined cooling, heating and power: A review,” progress in energy and combustion science, vol. 32, no. 5-6, pp. 459–495, 2006.
- [6] Z. Su, Y. Wang, Q. Xu, M. Fei, Y.-C. Tian, and N. Zhang, “A secure charging scheme for electric vehicles with smart communities in energy blockchain,” IEEE Internet of Things Journal, vol. 6, no. 3, pp. 4601–4613, 2018.
- [7] Z. Zhou, B. Wang, M. Dong, and K. Ota, “Secure and efficient vehicle-to-grid energy trading in cyber physical systems: Integration of blockchain and edge computing,” IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 50, no. 1, pp. 43–57, 2019.
- [8] J. C. Vasquez, J. M. Guerrero, J. Miret, M. Castilla, and L. G. De Vicuna, “Hierarchical control of intelligent microgrids,” IEEE Industrial Electronics Magazine, vol. 4, no. 4, pp. 23–29, 2010.
- [9] C. Cecati, C. Citro, A. Piccolo, and P. Siano, “Smart operation of wind turbines and diesel generators according to economic criteria,” IEEE Transactions on Industrial Electronics, vol. 58, no. 10, pp. 4514–4525, 2011.
- [10] D. Zhang, N. Shah, and L. G. Papageorgiou, “Efficient energy consumption and operation management in a smart building with microgrid,” Energy Conversion and Management, vol. 74, pp. 209–222, 2013.
- [11] J. Kang, R. Yu, X. Huang, S. Maharjan, Y. Zhang, and E. Hossain, “Enabling localized peer-to-peer electricity trading among plug-in hybrid electric vehicles using consortium blockchains,” IEEE Transactions on Industrial Informatics, vol. 13, no. 6, pp. 3154–3164, 2017.
- [12] Z. Li, J. Kang, R. Yu, D. Ye, Q. Deng, and Y. Zhang, “Consortium blockchain for secure energy trading in industrial internet of things,” IEEE transactions on industrial informatics, vol. 14, no. 8, pp. 3690–3700, 2017.
- [13] J. Guo, X. Ding, and W. Wu, “Combined cooling, heating, and power system in blockchain-enabled energy management,” arXiv preprint arXiv:2003.13416, 2020.
- [14] S. Maharjan, Q. Zhu, Y. Zhang, S. Gjessing, and T. Basar, “Dependable demand response management in the smart grid: A stackelberg game approach,” IEEE Transactions on Smart Grid, vol. 4, no. 1, pp. 120–132, 2013.
- [15] S. Bu and F. R. Yu, “A game-theoretical scheme in the smart grid with demand-side management: Towards a smart cyber-physical power infrastructure,” IEEE Transactions on Emerging Topics in Computing, vol. 1, no. 1, pp. 22–32, 2013.
- [16] H. Yao, T. Mai, J. Wang, Z. Ji, C. Jiang, and Y. Qian, “Resource trading in blockchain-based industrial internet of things,” IEEE Transactions on Industrial Informatics, vol. 15, no. 6, pp. 3602–3609, 2019.
- [17] Y. Chen, Z. Li, B. Yang, K. Nai, and K. Li, “A stackelberg game approach to multiple resources allocation and pricing in mobile edge computing,” Future Generation Computer Systems, vol. 108, pp. 273–287, 2020.
- [18] W. Tushar, B. Chai, C. Yuen, D. B. Smith, K. L. Wood, Z. Yang, and H. V. Poor, “Three-party energy management with distributed energy resources in smart grid,” IEEE Transactions on Industrial Electronics, vol. 62, no. 4, pp. 2487–2498, 2014.
- [19] M. Castro, B. Liskov et al., “Practical byzantine fault tolerance,” in OSDI, vol. 99, no. 1999, 1999, pp. 173–186.
- [20] T. Başar and G. J. Olsder, Dynamic Noncooperative Game Theory, 2nd Edition. Society for Industrial and Applied Mathematics, 1998.
- [21] J. B. Rosen, “Existence and uniqueness of equilibrium points for concave n-person games,” Econometrica: Journal of the Econometric Society, pp. 520–534, 1965.
- [22] S. Boyd, S. P. Boyd, and L. Vandenberghe, Convex optimization. Cambridge university press, 2004.
- [23] Y. Xiao, G. Bi, and D. Niyato, “A simple distributed power control algorithm for cognitive radio networks,” IEEE Transactions on Wireless communications, vol. 10, no. 11, pp. 3594–3600, 2011.
- [24] H. Zhang, Y. Xiao, L. X. Cai, D. Niyato, L. Song, and Z. Han, “A multi-leader multi-follower stackelberg game for resource management in lte unlicensed,” IEEE Transactions on Wireless Communications, vol. 16, no. 1, pp. 348–361, 2016.