Next Article in Journal
Optimal Decision-Making Strategy of an Electric Vehicle Aggregator in Short-Term Electricity Markets
Next Article in Special Issue
Integrated Energy System Configuration Optimization for Multi-Zone Heat-Supply Network Interaction
Previous Article in Journal
Transparency of a Geographically Distributed Test Platform for Fuel Cell Electric Vehicle Powertrain Systems Based on X-in-the-Loop Approach
Previous Article in Special Issue
A Compound Controller Design for a Buck Converter
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

Integrated Energy Transaction Mechanisms Based on Blockchain Technology

School of Electrical Engineering, Southeast University, Nanjing 210096, China
Author to whom correspondence should be addressed.
Energies 2018, 11(9), 2412;
Received: 31 July 2018 / Revised: 6 September 2018 / Accepted: 7 September 2018 / Published: 12 September 2018
(This article belongs to the Special Issue Communications in Microgrids)


With the rapid development of distributed renewable energy (DRE), demand response (DR) programs, and the proposal of the energy internet, the current centralized trading of the electricity market model is unable to meet the trading needs of distributed energy. As a decentralized and distributed accounting mode, blockchain technology fits the requirements of distributed energy to participate in the energy market. Corresponding to the transaction principle, a blockchain-based integrated energy transaction mechanism is proposed, which divides the trading process into two stages: the call auction stage and the continues auction stage. The transactions among the electricity and heat market participants were used as examples to explain the details of the trading process. Finally, the smart contracts of the transactions were designed and deployed on the Ethereum private blockchain site to demonstrate the validity of the proposed transaction scheme.

1. Introduction

With the promotion of technologies for distributed renewable energy (DRE) generators and demand response (DR) programs, the boundaries between generators and consumers are becoming blurred. Jeremy Rifkin presented the concept of energy interconnection, the cores of which are renewable distributed energy and energy internet that would enable access to distributed energy and fair trade [1]. This concept would also enable more forms of demand-side energy resources, such as heat and gas, to participate in the market. Traditional electricity transactions will develop into integrated energy resource (IER) transactions, which makes the transactions more complicated and the management more difficult [2]. The direction of energy delivery is vital to enhance efficiency and decrease energy consumption, such how to handle the first mile and last mile delivery logistics [3]. Therefore, designing an efficient trading scheme is vital to facilitate the development of the energy internet. The management of transactions can be divided into two primary categories: centralized and decentralized [4]. The centralized transactions may have such issues as high operating costs, excessive time consumption, and security problems. To arrange scheduling instructions, the trading center has to collect all information regarding the distributed energy, which will lead to personal privacy concerns [5]. In addition, when the number of transaction users increase, the data information will increase geometrically, which will increase the difficulty of scheduling resources in real time. Therefore, several scholars have presented the idea of decentralizing the distributed energy transactions [6].
The preconditions for the distributed energy trading were analyzed [7], which included the real-time information exchange, the self-optimizing strategy selection, the automatic transaction settlement, and the trading platform decentralization for the local energy internet. In [8], a fully decentralized microgrid platform, “Overgrid”, is presented in order to carry out peer-to-peer (P2P) transactions. An automated DR program is presented in [9], which is not fully decentralized, since the transactions are considered at the level of energy aggregators, together with being not for each individual part. In both [10,11], the multiagent system is adopted to realize grid decentralization. Each of the energy consumption devices is controlled by the agent that may respond to the signals from the network. Also, in [12], the action policy put forward by each agent (termed as “scheduler” in this paper) becomes more complex, meanwhile considering more traffic issues. The distributed optimization algorithms are also employed for the purpose of decentralizing the power grid dispatching, for instance [13]. A decentralized price-based DR system is presented in [14], wherein, the price signal is adjusted by the difference in the supply and demand, and the users can adjust their demands in accordance with the signal.
Thereafter, blockchain has been considered as one of the emerging technologies, which can be employed for developing a platform for the decentralized energy transactions [15]. Considering the blockchain technology’s characteristics of being open, decentralized, transparent, and tamper-resistant, it has the potential to effectively improve the efficiency of transactions, in addition to ensuring transaction security [7]. Study [16] concentrates on security issues for energy interactions and information in electric vehicles cloud and edge computing, and [17] proposes a framework based on hierarchy and distributed trust to maintain security and privacy. Solutions, methodologies and technical considerations for addressing issues of data protection, security and privacy are described in [18]. Meanwhile, blockchain is conducive to effectively improve the efficiency of transactions. In comparison with other methods, the main benefits associated with the blockchain adoption for the decentralized energy trading are that a third-party intermediary (for instance, a distribution system operator) is not required for the management and security of the energy transactions; and different kinds of energies (electricity, heat, etc.) can be freely traded [5], catering to the requirements of IER trading. Currently, blockchain technology has been thoroughly studied for its basic principles, characteristics, and applications in finance, energy and other fields [19,20,21]. Some research works have been carried out addressing the technical details of blockchain in order to scale up both the volume and speed of transaction by adopting the research results of cloud storage [22,23]. The research dealing with the applications of blockchain technology in energy transactions can be divided into three categories. The first category is the feasibility analysis, concentrating on the application possibilities and its capability with the trading mechanisms, for instance, renewable energy transactions, ancillary services, and large consumer’s direct power trading [24,25,26]. The second category involves the research on the transaction process design and the smart contract design, for instance, automatic demand response, EV charging, and DRE’s P2P transactions in the distribution network [27,28,29,30,31]. The third category deals with analysing the effect on the retail electricity market if the blockchain is widely utilized in the distributed power transactions [32]. However, the current trading mode lacks consideration for the multiple energy types as well as multilateral trading parties in local IER transactions.
This study applied blockchain to the transactions among local IER resources. The idea of blockchain-based decentralized trading was put forward for the realization of the coordinated allocation of local IER resources. Corresponding to the transaction principles, a blockchain-based integrated energy transaction mechanism is proposed, dividing the trading process into two stages: the call auction stage and the continues auction stage. We designed the smart contracts of the users’ energy demands, the trading matchmaking, and the trading settlement, which were deployed on a private chain on the Ethernet for the simulation of the transaction process. The results can promote the development of a blockchain-based IER trading protocol as well as the engineering application of IER transactions.
The organization of this paper is as follows. Section 2 provides introduction to the blockchain technology and its applicability to the distributed energy transactions. Section 3 puts forward the decentralized IER transaction mechanism. Section 4 presents both the functions and elements of the smart contracts built and deployed on the Ethernet. Section 5 presents a simple case study, aimed at validating the transaction mechanism proposed.

2. Blockchain and Decentralized Energy Transactions

2.1. Blockchain and Smart Contracts

Blockchain is a chain structure in which all transaction data are packed into blocks, and the blocks are connected in chronological order [30]. Using the technology of the asymmetric encryption, the Merkel tree, and the proof of work consensus mechanism, the transaction data can be transparent, non-destructive, and traceable. The essence of a blockchain is a decentralized distributed database. Compared with the traditional database, blockchain has the advantage that the data are tamper-resistant; therefore, information is safe. However, if blockchain is only applied to data storage, its function is limited. Therefore, it is proposed to combine blockchain with smart contracts to achieve more complex functions.
A smart contract is a set of digital programs that prescribes the rights and obligations to the consumer that is automatically executed by the computer system [15]. When an agent executes a contract locally, the other agents will update the contract’s content to reach a new consensus. Thus, a credible partnership can be established in a distributed system without central supervision. The blockchain is the supporting technology of smart contracts and the Ethernet is the most widely used open source blockchain platform [33]. However, for the mass adoption of this technology, volume and speed of transaction processing need to be scaled up. There is presently an unresolved tension between scalability, security, and decentralization concerns, as only two of them at a time can (so far) be addressed satisfactorily. To address the trilemma, several solutions have been proposed, such as off-chain interaction technology.

2.2. Off-Chain Interaction Technologies

Each action on the main-chain is packed and recorded into a block, which is time-consuming and limits the transaction speed. To improve the speed of the transaction processing on blockchain, off-chain technologies that build onto the main-chain are proposed. Base-level protocols do not need to change. Instead, they exist as smart contracts on the Ethereum site that interact with off-chain software. The function of a public blockchain can be expanded such that the security and irreversibility are ensured.
The typical “off-chain” technologies include state channels, Plasma, and Truebit [34]. State channels and Plasma allow interactions outside the blockchain such that the platform will have an increased transaction throughput. Truebit completes the complex calculations in the smart contracts that are off-chain. This reduces the cost of executing smart contracts, i.e., gas in Ethereum, while completing those operations with costly computation expenses or those that cannot be completed on-chain.
Off-chain technologies allow transactions to achieve a balance among speed, irreversibility, and costs by sacrificing a little decentralization. Therefore, blockchain may be applied to more extensive and complex trading modes.

2.3. Decentralized Transactions of Integrated Energy

Distributed exchange models were first applied to the financial field. With an increase in the types of tokens, the circulation among them became more difficult. Centralized exchanges are confronted with multiple risks, such as network security and protection. To solve these problems, the open source community has completed a series of attempts to build distributed exchanges, such as EtherDelta, 0x protocol, Loopring and Kyber Network. The core of the distributed exchanges is a decentralized trading protocol, which is based on blockchain [35]. This study uses Loopring as an example to explain the exchanges’ working mechanisms. In Loopring, a user authorizes the matchmaking contract to transfer the tokens to a smart contract. The exchange searches for a set of orders that can be matched and transfers the matching results to the smart contract’s address after the user signs in, then the order can be matched off-chain and the asset is secured [36]. By using the off-chain technologies, the distributed exchanges can complete complex deals.
The distributed exchanges on blockchain can meet the demand which integrated energy requires in market transactions. First, the characteristics of blockchain, such as equality and decentralization, can support the numerous peer-to-peer transactions among the distributed energy resources. Second, the managers of the energy subsystems are different, but blockchain provides multiple users with a decentralized and trustless power market to reduce transaction costs. Third, smart contracts provide a platform for the implementation of advanced transactions [37]. As the decision-making mode of the energy system gradually transforms to the distributed mode, the users’ decisions and transactions can be written into contracts to ensure efficient decision-making and fair transaction.

3. Transaction Framework of Distributed Integrated Energy Trading

In the distributed energy trading framework designed in this paper, we assumed that each user had a blockchain account with a pair of keys, i.e., a public key and a private key [4], and that smart meters were available to upload power data to the network. An energy usage plan should be determined before the trading session. The participants in the distributed energy trading must authorize the exchange to transfer a set number of tokens from their blockchain accounts to multi-signature wallets. Inspired by the mechanism of the stock market exchange, the transaction process proposed in this paper is divided into two stages: the call auction stage and the continuous double auction stage. The schematic process is presented in Figure 1. The energy buyer authorizes the exchange so that the software could transfer a set number of tokens from the blockchain account to multi-signature wallets (signed by both the buyer and the exchange). The order contracts which contain the buyers’ order information and the sellers’ information can be sent to the exchange with the digital signatures by using their private key. The exchange classifies the orders provided by the buyers and the sellers, followed by combining them into order books. The form of the order books requires conforming to two principles: the same kind of energy and the same delivery time, so that the two principles could enter the settlement within the same trading period T. Thereafter, the transaction processing contract or the matchmaking trading contract will facilitate the transactions. Moreover, the settlement contract will be created and deployed to the main chain for the purpose of ensuring the assets’ safety for the traders. After reaching the transaction agreement, the smart meters’ data will be uploaded to the settlement smart contract automatically and the tokens will be transferred as well.
The parameters used in this section are given in abbreviations Table 1.

3.1. Call Auction Stage

During the call auction stage, the seller and buyer will make disposable matchmaking transactions providing guiding prices for various types of energy at each period in a day. The matchmaking transaction may be used as a reference for the quoted price during the double auction stage. It should be noted that while there are many ways to hold a call auction, this paper uses only one of them.
Besides the proceeding transaction process, the process in call stage has its own features:
(1) In call stage, a demand order contract address is required for each buyer’s order; and the seller i writes its supply p G i T and price floor p G i T , min during the trading period T into its bid order. For presentation purpose, the superscript letter T of parameters are omitted in the following.
(2) All the information is sent to the exchange, which is responsible for classifying the orders into groups based on the energy types and trading time. The orders in the same order-book will be sent to one transaction processing smart contract, and the contract calculates the maximum value of the price floors submitted by all sellers, followed by delivering the price signal to the demand order contract. Demand (obtained from the demand order contract) and supply are followed by adjusting the price signal in accordance with the Formulas (1)–(3).
(3) In each interaction, the demand order contract modifies the amount of demand in accordance with its utility function. In the meantime, the supply is calculated at the quoted price signal. The interactions end until Formula (4) is satisfied.
σ = i = 1 N G P G i j = 1 N L P D j  
λ 0 = max ( p G i min )  
λ k + 1 = λ k + ρ ( σ / i = 1 N G P G i )  
σ ε  
We use the power buyers as an example. The electricity users’ utility function [38] and profit function are shown as Formulas (5) and (6). Meanwhile, there are constraints on the users’ purchase quantity, per Formula (7).
U D i ( P D i ) = { α i P D i 2 + ω i P D i      P D i ω i / 2 α i ω j 2 / 4 α i                      P D i > ω i / 2 α i  
π D i = U D i ( P D i ) λ P D i  
P D i min P D i P D i max  
Based on the principle of profit maximization, the demand can be calculated according to Formula (8):
P D i = { ( ω i λ ) / 2 α i          P D i min ω i / 2 α i P D i min                        P D i min > ω i / 2 α i    
Therefore, according to price λ i k + 1 , corresponding P D i is provided by electricity users. This process can be written as a contract, which is deployed on the side-chain managed by the exchange, and executed off the main chain.
(4) When Formula (4) is satisfied, pre-transaction orders are generated. The exchange adjusts the orders as per the amounts of another type of energy provided by the multi-energy sellers.
For instance, the sellers, capable of supplying two or more types of energy, require special handling. The pre-transaction orders should be adjusted in accordance with their operation mode. For instance, combined cooling, heating and power (CCHP) follows the supply formula presented hereunder:
P C H P ( t ) = F C H P ( t ) η C H P , E  
Q C H P ( t ) = F C H P ( t ) ( 1 η C H P , E ) η C H P , H  
The operation mode should be determined through the determination of either the power by heat or the heat by power. In case of determination of power by heat, the pending transaction will be based on the power. The heat energy supply is subsequently calculated in accordance with the power transaction volume. The exchange will replace the heat seller having the same amount, but at a higher price in the same period, and vice versa.
(5) The transaction processing smart contract creates objects for the settlement contracts based on the consensus of the transaction. Following the settlement, the transaction amount is calculated in accordance with the Formula (11), which is based on the seller’s smart meter’s data. The money E t h , i in the multi-signature wallet is subsequently transferred to the seller by the means of state channels:
E t h , i = P G i p T τ  

3.2. Continuous Double Auction Stage

After the call auction, traders who do not have a deal and new traders can hold continuous double auctions. During the trading cycle, buyers and sellers can submit their quotations at any time. The buyers’ prices are ranked from high to low and the highest quotation is the optimal purchase price. The sellers’ prices are ranked from low to high and the lowest quotation is the optimal selling price. The buyer who has the highest quotation can match the seller who has the lowest quotation. When the optimal purchase price is higher than or equal to the optimal selling price (the price margin is less than or equal to zero), a deal can be made, as Figure 2 shows. Actual price is the average price of the two quotations. If the prices are identical, the transactions are completed according to the quotations’ submission time. During the matchmaking process, the matchmaking smart contracts need to update the status of each quotation (withdrawal or addition) in real time.
During the auction, market participants can adjust their quotations based on market information for the next cycle of trading until the total amount of electricity is sold out or the trading time is cut off. After completing the matching transactions, the two sides create the settlement smart contract and transfer the tokens.
Unlike the centralized approach, in the continuous double auction stage, the individuals participating in energy trading are interested in maximizing its utility (energy to be requested) without concern for the interests of others. Every participant can submit bidding to the matching contract at each trading interval. In this paper, we assume all participants adopted the AA strategy [39], which adjusts the price according to the marketing environment.
Before entering the market, each buyer and seller calculate an appraisal price according to the expected purchasing price, production cost, deal price from the centralized competitive bidding stage and trading willingness [39]. Thus, the buyer’s quoted price p b ( t ) and the seller’s quoted price p s ( t ) are calculated according to Formulas (12) and (13), respectively:
p b ( t ) = { p c a l l ,   t = 1 p O b i d ( t ) + η b ( τ b ( t ) p O b i d ( t ) ) ,   t 2  
p s ( t ) = { p c a l l ,   t = 1 p O a s k ( t ) η s ( p O a s k ( t ) τ s ( t ) ) ,   t 2  
In the first iteration of trading, the results of the call auction are used as the optimal purchase price and the optimal selling price. In the following transactions, if the sellers and the buyers have not completed a deal, the buyer and the seller can adjust the quotation according to the base price and the current optimal selling price.

4. Formulation of Smart Contracts

Off-chain interaction technology is still in the initial stage of development; even the most mature application, Lightning Network, which promises to ease network congestion by moving transactions off the main blockchain, while it has not been suitable for high value payment system in light of security, only realizes the micropayment function in the network. Therefore, we will only discuss the contract related to the transaction mechanism in this paper. This section will discuss the construction of smart contracts by using the transaction between the distributed generators and electricity users as an example.
The transaction process involves five smart contracts in chronological order, including the transaction processing in the call auction stage, the determination of each user’s demand, the adjustment of scheduled orders, the matchmaking in the continuous double auction stage and the transaction settlement.

4.1. The Transaction Processing Contract

The input of this contract is the supply amount during a certain period and the corresponding price floor submitted by the sellers. The smart contract will record all orders and calculate the total power supply at the power price obtained by the iterative double auction. The smart contract will subsequently adjust the price and send the new price to the address of the customer’s demand order contract. The outputs include new electricity price (being sent back to the user’s wallet when the iterative termination criteria are not satisfied) and the trading volume of each seller (output when the iterative termination criteria are satisfied).
When electricity supply equals the demand, the contract will check whether the heat orders have been processed. If so, the contract will do two jobs. One is to calculate the heat supply according to the quantity of electricity provided by the CCHP and then transmit the data to the adjustment contract of the scheduled heat sellers. The other is to adjust the scheduled sellers according to the power data from the adjustment contract of the scheduled heat sellers and replace the same amount of electricity bought from the generators with the highest price floor. The basic elements of the contract are provided in Table 2.

4.2. Demand Order Contract of Electricity Buyers

The buyers should transfer a deposit to the multi-signature wallet’s address according to the local electricity retail price. This part of the work is done before the buyer joins the market (building a status channel or joining the side-chain managed by the exchange). The input of this contract is the energy type, energy amount, and delivery time of sellers and buyers. The output includes the buyer’s address, the seller’s address, the energy amount and the energy price.
The function of this contract is to calculate user demand according to the price provided by the transaction processing contract. The basic elements of the contract are shown in Table 3.

4.3. The Matchmaking Trading Contract

The matchmaking trading contract checks the delivery time and the energy type of the sellers and the buyers and classifies buyers and sellers of the same delivery time according to bid price. The contract then matches the sellers and buyers by the transaction mechanism presented in Section 3.2.
The basic elements of the contract are shown in Table 4.

4.4. The Settlement Contract

By means of the settlement contract, the funds can be automatically transferred according to the pre-agreed terms and deal terms after the delivery time of the transaction. The basic elements of the contract are shown in Table 5.
The energy amount supplied by the sellers is submitted by smart meters. The settlement rules should be clarified in the market access agreements signed before the smart contract is created. After the delivery period, the electric data will be transferred to the settlement contract. The contract will be executed and the tokens will be transferred from the multi-signature wallet to the multi-signature wallet of the seller and the exchange account.

5. Case Study

To verify the effectiveness of the transaction mechanism proposed in this paper, the smart contracts for the distributed transaction were released on the test network of the Ethernet for simulation. There were five electricity buyers, in addition to four generators, merely providing electricity and two CCHP in this test. One of the two CCHP works to determine power by heat operation mode (this CCHP joins in the heat transaction processing contact) and other works in the determination of the heat by power operation mode (this CCHP joins the electricity transaction processing contract). We employ the Remix platform to test the smart contracts.

5.1. Deploying the Demand Order Contract of Electricity Buyers

The demand order contract consists of a constructor, a power calculation function, a data transfer function, and auxiliary functions. Constructor function has the same name as the contract. With the aid of this function, the contract can be deployed preliminarily and the initial variable can be initialized. The inputs of constructor are the parameters of the electricity buyers’ demand strategies, which are shown in Table 6. These buyers create the demand orders and send them to the exchange address. This paper places all user data into one contract for demonstration purposes.
We use Solidity programming language, which is a contract-oriented, high-level language designed to target the Ethereum Virtual Machine (EVM), to build the contracts. Considering that the Solidity does not support decimal numeric storage, in order to ensure the accuracy of the calculation results, the initial data are magnified. The values of the buyers’ parameters are magnified 100 times as the constructor input. The operating results of the contract are shown in Figure 3, which indicate the state of execution of the contract, the address of the contract, the address of the executor, the gas value of the execution of the contract, the contract’s hash value, the log, and other information.
The demand order contract calculates the output based on the quoted price according to Formulas (9) and (10). As shown in Figure 4, the outputs of four users from the initial quotation (11 Finney/MW, where Finney is the unit of virtual currency in Ethereum) are 920, 590, 960, 800 and 1460 kW.
The call function can transmit the output of each electricity buyer to the transaction processing contracts. In case of being successful, call function will return a Boolean parameter “true”. The process is presented in Figure 5. An array of five integer variables, presenting the buyers’ electricity demand, was transmitted from the address of the demand order contract to the transaction processing contract.

5.2. Deploying the Transaction Processing Contract

The transaction processing contract can be deployed on the exchange’s wallet, to which the energy buyers transfer a margin prior to trading. This contract consists of a constructor, an input interface function, call functions, a price adjustment function, a supply amount calculation function, the other kind of energy’s amount calculation function, a seller readjustment function, and auxiliary functions.
The assumed seller’s parameters are presented in Table 7. It requires observation that only the sellers, having the same delivery time, will be sent to the same contract.
The result of input interface is presented in Figure 6. Furthermore, the initial quotation (11 Finney/MW) is transmitted to the buyers’ demand order contract, and the process is recorded in an event. By the call function, the integer data 1100 is transferred from the address of the transaction processing contract to the demand order contract, as presented in Figure 7.
The output returned by the demand order contract is [92,59,96,80,146]. Thereafter the transaction processing contract adjusts the prices in accordance with the values for Formulas (1)–(3) and the updated price is 12.21 Finney/MW. The supply calculation function calculates the electricity provided during the iterations, which is 4500 kW. Also, if the supply is not equal to demand, then proceed to the next iteration.
Following three iterations, the buyers’ demands are 890, 550, 900, 760 and 1400 kW correspondingly, while the price is 12.24 Finney/MW. Subsequently, setting the balance indicator inside the contract to be “true” and checking the balance indicator of heat transaction processing contract. If the indicator is “true”, then this contract will get the electricity generated by the CCHP that is scheduled by the heat transaction processing contract and send the heat generated by the CCHP which is scheduled by this contract. The way to transfer data between contracts is same to the call function mentioned above.
The sellers’ scheduled energy amount is presented in Table 8. Assuming the electricity amount received from the heat transaction processing contract is 400 kW, which is provided by the CCHP “0xdd870fa1b7c4700f2bd7f44238821c26f7392148”. The adjustment is recorded as an event, which is presented in Figure 8. This figure suggests that the seller “0x14723a09acff6d2a60dcdf7aa4aff308fddc160c” reduces 400 kW.

5.3. Deploying the Matchmaking Trading Contract

This contract realizes the matchmaking of the sellers and the buyers in accordance with the method in the continuous double auction stage. This contract consists of a constructor, two input interface functions, a matchmaking function, a withdraw function and auxiliary functions.
The two input interface functions are used to receive the data from both the sellers and buyers, together with distributing them into order sets of different times and energy types. The interface function for the buyers is “payable” function, requiring the buyer to send its’ advance deposit. The bidding of buyers and sellers is presented in Table 9. With regard to the demonstration purposes, they are assumed to bid for the same energy type and delivery time.
The matchmaking function finds the highest buyers’ bidding price and the lowest sellers’ bidding price, followed by comparing them and calculating the transaction price and amount. If the bidding is executed in all, the contract will set the state indicator of the buyer or the seller as “true” in order to exclude them from the order set. The transaction in the first round is recorded in the event, called “Transaction log”, as presented in Figure 9. The Seller0 sells Buyer1 200 kW at 10.72 Finney/MW, and the state indicator of Seller0 is set to be “true”, implying that the Seller0’s energy has been sold out.
Other functions are common in the functional design of smart contracts. The heat bidding can be processed in the same manner.
Over the trading cycle, there are 5 transactions concluded in 2 rounds of trading, as presented in Table 10.

5.4. Deploying the Transaction Settlement Contract

The transaction settlement contract primarily comprises the constructor, the funds transferring function, and auxiliary functions. This contract should be deployed on the main chain of Ethereum and the transfer of funds should be confirmed by the multiple signatures (the exchange and the buyer).
This paper takes the Seller0 and the Buyer1 in Table 8 as an example for the illustration of the process of the transaction settlement when the energy has been delivered.
The input parameters of the contractor function include “0xb868ab9cf247345f586fa0f0750ce110c2202db3” (the address of the user), 200 kW (the target output), 10.72 Finney/MW (the transaction price).
Assuming that the actual output of the seller is 150 kW, which is insufficient, the seller faces a punishment that the contract is settled at 90% of the transaction price. The amount that the buyer requires paying to the seller is presented in Figure 10. It records the transfer of tokens between the two addresses in the form of an event.
These contracts were deployed on Metamask, an application allowing the users to run Ethereum dApps in a browser. The event that records the transaction’s process is presented in Figure 10. This figure reveals that 1.4472 Finney has been transferred from the address of the generator to the user.

5.5. Transaction Mechanism Comparision

The social welfare and market efficiency [40] are chosen as the evaluation indicators in order to compare the mechanism put forward in this paper, the single call auction mechanism and the single continuous action mechanism. The social welfare of the proposed mechanism, the single call auction mechanism and the single continuous action mechanism is 130.88 Finney, 130.49 Finney and 121.72 Finney, correspondingly. Market efficiency is the ratio between actual social welfare and maximum social welfare 134.18 Finney (all transactions are dealt with at a time, which is unrealistic because of the renewable energy’s forecast errors and uncertainty of consumers’ behaviors), which are 97.25%, 97.54% and 90.71%, correspondingly.
In accordance with the principle of economics, when the market transaction price is equal to the equilibrium price, social welfare is the largest, which is the situation with maximum social welfare. In the single call auction mechanism situation, the market is cleared once in each trading cycle (for instance, once in an hour); if the seller’s or buyer’s delivery time is close to the bidding time, it would not have a second bidding chance. The transaction model put forward in this paper is a compromise of market efficiency and uncertainty characteristics of market participants (for instance, renewable energies and energy consumption behaviour), which achieve the best performance among the three practical mechanisms. The mechanism put forward in this paper is superior to the single call auction mechanism since the transactions made in call stage reach the beneficial maximum. In short, the transaction model has the potential to balance the market efficiency and the trading convenience.

6. Conclusions

The decentralized characteristic of blockchain technology is its high compatibility with the trading demand of integrated energy resources. This paper discussed the application of blockchain technology in the integrated energy trading and put forward a decentralized transaction scheme, including the interaction process of the smart contracts.
The transaction process put forward in this paper is divided into two stages: the call auction stage and the continuous double auction stage. Accordingly, the trading parties adjusted their bidding by monitoring the information broadcasted in the blockchain so that more freedom could be provided for them to participate in the market. The authors designed and deployed the trading smart contracts on the Ethereum website, in addition to verifying the trading process. In the study case, distributed generations and users can achieve transaction conclusion and transaction settlement without the participation of centralized institutions; besides, the characteristics of blockchain can guarantee the interests of the market participants. In comparison with the single type transaction model, the proposed mechanism finds a compromise between the market efficiency and the participants’ convenience. The proposed mechanism can meet the demand of the distributed, small-scale and low-cost transaction of the integrated energy resources in micro-grid, and can be extended to the transactions for the other production forms, such as energy efficiency in supply chain and transportation solutions.
Further studies will focus on two major parts: firstly, setting up a platform to put the distributed transaction mechanism into practice, and evaluating its effectiveness and practicability. Secondly, designing the blockchain-based transaction mechanism among the virtual power plants and the distributed resources.

Author Contributions

Conceptualization, S.Z. and B.W.; Methodology, S.Z. and B.W.; Software, Y.L. (Yachao Li); Writing—Original Draft Preparation, S.Z.; Writing—Review and Editing, Y.L. (Yachao Li); Supervision, Y.L. (Yang Li).


This research was funded by National Natural Science Foundation of China with the project No.71471036 and by National Power Grid Corp Headquarter Science and Technology Project No.52110118000A.

Conflicts of Interest

The authors declare no conflict of interest.


  1. Rifkin, J. The third industrial revolution: How lateral power is transforming energy, the economy, and the world. Survival 2011, 2, 67–68. [Google Scholar] [CrossRef]
  2. Nieße, A.; Lehnhoff, S.; Tröschel, M.; Uslar, M.; Wissing, C.; Appelrath, H.J. Market-based self-organized provision of active power and ancillary services: An agent-based approach for Smart Distribution Grids. In Proceedings of the 2012 Complexity in Engineering (COMPENG), Aachen, Germany, 11–13 June 2012. [Google Scholar]
  3. Bányai, T. Real-Time Decision Making in First Mile and Last Mile Logistics: How Smart Scheduling Affects Energy Efficiency of Hyperconnected Supply Chain Solutions. Energies 2018, 11, 1833. [Google Scholar] [CrossRef]
  4. Aitzhan, N.Z.; Svetinovic, D. Security and privacy in decentralized energy trading through multi-signatures, blockchain and anonymous messaging streams. IEEE Trans. Depend. Secur. Comput. 2016, 99, 1–14. [Google Scholar] [CrossRef]
  5. Pop, C.; Cioara, T.; Antal, M.; Anghel, I.; Salomie, I.; Bertoncini, M. Blockchain based decentralized management of demand response programs in smart energy grids. Sensors 2018, 18, 162. [Google Scholar] [CrossRef] [PubMed]
  6. Yuan, Y.; Wang, F.Y. Blockchain: The state of the art and future trends. Acta Autom. Sin. 2016, 42, 481–494. [Google Scholar] [CrossRef]
  7. Zeng, M.; Cheng, J.; Wang, Y.; Li, Y.; Yang, Y.; Dou, J. Primarily research for multi module cooperative autonomous mode of energy internet under blockchain framework. Proc. CSEE 2017, 37, 3672–3681. [Google Scholar] [CrossRef]
  8. Croce, D.; Giuliano, F.; Tinnirello, I.; Galatioto, A.; Bonomolo, M.; Beccali, M.; Zizzo, G. Overgrid: A Fully Distributed Demand Response Architecture Based on Overlay Networks. IEEE Trans. Autom. Sci. Eng. 2017, 14, 471–481. [Google Scholar] [CrossRef][Green Version]
  9. Giovanelli, C.; Kilkki, O.; Seilonen, I.; Vyatkin, V. Distributed ICT Architecture and an Application for Optimized Automated Demand Response. In Proceedings of the IEEE ISGT-Europe, Ljubljana, Slovenia, 9–12 October 2017; pp. 1–6. [Google Scholar] [CrossRef]
  10. Dusparic, I.; Taylor, A.; Marinescu, A.; Cahill, V.; Clarke, S. Maximizing Renewable Energy Use with Decentralized Residential Demand Response. In Proceedings of the 2015 International Smart Cities Conference, Guadalajara, Mexico, 25–28 October 2015. [Google Scholar] [CrossRef]
  11. Siebert, L.C.; Ferreira, L.R.; Yamakawa, E.K.; Custodio, E.S.; Aoki, A.R.; Fernandes, T.S.P.; Cardoso, K.H. Centralized and Decentralized Approaches to Demand Response Using Smart Plugs. In Proceedings of the 2014 IEEE PES T&D Conference and Exposition, Chicago, IL, USA, 14–17 April 2014; pp. 1–5. [Google Scholar] [CrossRef]
  12. Shojafar, M.; Cordeschi, N.; Baccarelli, E. Energy-efficient adaptive resource management for real-time vehicular cloud services. IEEE Trans. Cloud Comput. 2016. [Google Scholar] [CrossRef]
  13. Ma, W.J.; Wang, J.; Gupta, V.; Chen, C. Distributed energy management for networked microgrids using online admm with regret. IEEE Trans. Smart Grid 2018, 9, 847–856. [Google Scholar] [CrossRef]
  14. Liu, N.; Yu, X.; Wang, C.; Li, C.; Ma, L.; Lei, J. An Energy Sharing Model with Price-based Demand Response for Microgrids of Peer-to-Peer Prosumers. IEEE Trans. Power Syst. 2017, 32, 3569–3583. [Google Scholar] [CrossRef]
  15. Christidis, K.; Devetsikiotis, M. Blockchains and smart contracts for the internet of things. IEEE Access 2016, 4, 2292–2303. [Google Scholar] [CrossRef]
  16. Liu, H.; Zhang, Y.; Yang, T. Blockchain-enabled security in electric vehicles cloud and edge computing. IEEE Netw. 2018, 32, 78–83. [Google Scholar] [CrossRef]
  17. Dorri, A.; Kanhere, S.S.; Jurdak, R.; Gauravaram, P. Blockchain for IoT Security and Privacy: The Case Study of a Smart Home. In Proceedings of the IEEE International Conference on Pervasive Computing and Communications Workshops, Kona, HI, USA, 13–17 March 2017; pp. 618–623. [Google Scholar] [CrossRef]
  18. Rios, E.; Prünster, B.; Suzic, B.; Prieto, E.; Notario, N.; Suciu, G.; Ruiz, J.F.; Orue-Echevarria, L.; Rak, M.; Franchetto, N.; et al. Cloud Technology Options towards Free Flow of Data; DPSP Cluster: Reggio Calabria, Italy, 2017; pp. 1–110. [Google Scholar] [CrossRef]
  19. Goopal. Digital Point Based on Blockchain Technology. 2015. Available online: (accessed on 15 December 2017).
  20. Burger, C.; Kuhlmann, A.; Richard, P.; Weinmann, J. Blockchain in the Energy Transition: A Survey among Decision-Makers in the German Energy Industry; Deutsche Energie-Agentur GmbH (dena); German Energy Agency: Berlin, Germany, 2016. [Google Scholar]
  21. Kawasmi, E.A.; Arnautovic, E.; Svetinovic, D. Bitcoin-Based Decentralized Carbon Emissions Trading Infrastructure Model. Syst. Eng. 2015, 18, 115–130. [Google Scholar] [CrossRef]
  22. Shojafar, M.; Canali, C.; Lancellotti, R.; Abawajy, J. Adaptive computing-plus-communication optimization framework for multimedia processing in cloud systems. IEEE Trans. Cloud Comput. 2016. [Google Scholar] [CrossRef]
  23. Pooranian, Z.; Conti, M. RARE: Defeating Side Channels based on Data-Deduplication in Cloud Storage. In Proceedings of the INFOCOM Workshops CCSNA, Honolulu, HI, USA, 15–19 April 2018. [Google Scholar] [CrossRef]
  24. Ping, J.; Chen, S.; Zhang, N.; Yan, Z.; Yao, L. Decentralized transactive mechanism in distribution network based on smart contract. Proc. CSEE 2017, 37, 3682–3690. [Google Scholar] [CrossRef]
  25. Li, B.; Cao, W.; Qi, B.; Sun, Y.; Guo, N.; Su, Y.; Cui, G. Overview of application of block chain technology in ancillary service market. Power Syst. Technol. 2017, 41, 736–744. [Google Scholar] [CrossRef]
  26. Ouyang, X.; Zhu, X.; Ye, L.; Yao, J. Preliminary applications of blockchain technique in large consumers direct power trading. Proc. CSEE 2017, 37, 3737–3745. [Google Scholar] [CrossRef]
  27. Wu, G.; Zeng, B.; Li, R.; Zeng, M. Research on the application of blockchain in the integrated demand response resource transaction. Proc. CSEE 2017, 37, 3717–3728. [Google Scholar] [CrossRef]
  28. She, W.; Hu, Y.; Yang, X.; Gao, S.; Liu, W. Virtual power plant operation and scheduling model based on energy blockchain network. Proc. CSEE 2017, 37, 3729–3736. [Google Scholar] [CrossRef]
  29. Tai, X.; Sun, H.; Guo, Q. Electricity transactions and congestion management based on blockchain in energy internet. Power Syst. Technol. 2016, 40, 3630–3638. [Google Scholar] [CrossRef]
  30. Mattila, J.; Seppälä, T. Industrial Blockchain Platforms: An Exercise in Use Case Development in the Energy Industry; Etla Working Papers: Berkeley, CA, USA, 2016. [Google Scholar]
  31. He, Y.; Li, H.; Cheng, X.; Liu, Y.; Yang, C.; Sun, L. A blockchain based truthful incentive mechanism for distributed p2p applications. IEEE Access 2018, 6, 27324–27335. [Google Scholar] [CrossRef]
  32. Fan, T.; He, Q.; Nie, E.; Chen, S. A study of pricing and trading model of Blockchain & Big data-based Energy-Internet electricity. In Proceedings of the 3rd International Conference on Environmental Science and Material Application (ESMA 2017), Chongqing, China, 25–26 November 2017; pp. 1–12. [Google Scholar] [CrossRef]
  33. Buterin, V. A Next Generation Smart Contract and Decentralized Application Platform. 2014. Available online: (accessed on 25 April 2018).
  34. Stark, J. Making Sense of Ethereum’s Layer 2 Scaling Solutions: State Channels, Plasma, and Truebit. 2018. Available online: (accessed on 23 July 2018).
  35. Warren, W.; Bandeali, A. 0x: An Open Protocol for Decentralized Exchange on the Ethereum Blockchain. 2017. Available online: (accessed on 19 May 2018).
  36. Dahlquist, O.; Hagstrom, L. Scaling Blockchain for the Energy Sector. Master’s Thesis, University of Uppsala, Uppsala, Sweden, June 2017. [Google Scholar]
  37. Wang, D.; Zhou, J.; Wang, A. Loopring: A Decentralized Token Exchange Protocol. 2018. Available online: (accessed on 2 July 2018).
  38. Zhao, C.; He, J.; Cheng, P.; Chen, J. Consensus-based energy management in smart grid with transmission losses and directed communication. IEEE Trans. Smart Grid 2017, 8, 2049–2061. [Google Scholar] [CrossRef]
  39. Wang, J.; Zhou, N.; Wang, Q.; Wang, P. Electricity direct transaction mode and strategy in microgrid based on blockchain and continuous double auction mechanism. Proc. CSEE 2018. [Google Scholar] [CrossRef]
  40. Nicolaisen, J.; Petrov, V.; Tesfatsion, L. Market power and efficiency in a computational electricity market with discriminatory double-auction pricing. IEEE Trans. Evol. Comput. 2001, 5, 504–523. [Google Scholar] [CrossRef][Green Version]
Figure 1. Process diagram of the transactions.
Figure 1. Process diagram of the transactions.
Energies 11 02412 g001
Figure 2. Matching process of continuous double auction.
Figure 2. Matching process of continuous double auction.
Energies 11 02412 g002
Figure 3. Input of the buyers’ characteristic parameters.
Figure 3. Input of the buyers’ characteristic parameters.
Energies 11 02412 g003
Figure 4. Buyers’ demand value at the initial quoted price.
Figure 4. Buyers’ demand value at the initial quoted price.
Energies 11 02412 g004
Figure 5. Transferring of buyers’ demand using the initial quoted price.
Figure 5. Transferring of buyers’ demand using the initial quoted price.
Energies 11 02412 g005
Figure 6. Input of sellers’ parameters.
Figure 6. Input of sellers’ parameters.
Energies 11 02412 g006
Figure 7. Record of transferred quoted price.
Figure 7. Record of transferred quoted price.
Energies 11 02412 g007
Figure 8. Record of the sellers’ scheduled amount after adjustment.
Figure 8. Record of the sellers’ scheduled amount after adjustment.
Energies 11 02412 g008
Figure 9. The transaction log in the first matchmaking round.
Figure 9. The transaction log in the first matchmaking round.
Energies 11 02412 g009
Figure 10. The record of the amount transferred in Metamask.
Figure 10. The record of the amount transferred in Metamask.
Energies 11 02412 g010
Table 1. Abbreviations.
Table 1. Abbreviations.
P C H P ( t ) The electricity production of CCHP at time t
F C H P The natural gas consumed by CCHP
η C H P , E The electricity generation efficiency of CCHP
Q C H P The recovered heat energy of CCHP
η C H P , H The heat recovery efficiency of CCHP
P G i The energy amount provided by energy seller i
p G i min The price floor of energy seller i
P D j The energy demand of the buyer j
σ The difference between energy demand and supply
λ 0 The initial quoted price broadcasted to buyers
λ k The energy price in k th iteration
ρ The step length set in the iterative process
α i , ω i The coefficients of the electricity user i ’s utility function
U D i ( P D i ) The benefit of the electricity user i if P D i is purchased
π D i The profits of electricity user i
E t h , i The i th energy seller’s profit
P G i The actual energy amount provided by the i th energy seller
p T The energy’s price
τ The penalty parameter if the actual energy is too much or too little
τ b ( t ) The buyer’s appraisal price in the t th iteration of trading
τ s ( t ) The seller’s appraisal price in the t th iteration of trading
p c a l l The energy price got form call auction
p O b i d ( t ) The optimal purchase price in the t th iteration of trading
p O a s k ( t ) The optimal selling price in the t th iteration of trading
η b , η s ( 0 , 1 ] the increment rates of the buyer’s and seller’s quotation
Table 2. Basic elements of a transaction processing contract.
Table 2. Basic elements of a transaction processing contract.
The Parameters’ NameTypeMeaning
Seller addressAddressAccount address of sellers
Electricity supplyUintDetermined by sellers
Heat supplyUintDetermined by DG type and the DG’s electricity supply
Price floorUintDetermined by sellers
The delivery timeInt256Determined by sellers
Demand order contract’s addressAddressThe demand order contract’s address of the Order Set
PriceUintInitial value is determined by the average value of price floor. Final value is determined by iterative double auction.
Table 3. Basic elements of a demand order contract.
Table 3. Basic elements of a demand order contract.
The Items of ContractTypeMeaning
Buyer addressAddressAccount address of the buyer
Total amountInt256Determined by the buyer’s strategy
The delivery timeInt256Determined by the buyer
Table 4. Basic elements of a matchmaking trading contract.
Table 4. Basic elements of a matchmaking trading contract.
The Parameters’ Name TypeMeaning
Seller addressAddressAccount address of sellers
Seller’s energy typeUintDetermined by sellers, use 0 for electricity, 1 for heat.
Seller’s energy quantityUintDetermined by sellers
Seller’s energy priceUintDetermined by sellers
Sellers’s delivery timeUintDetermined by sellers
Buyer’s energy typeUintDetermined by buyers, use 0 for electricity, 1 for heat.
Buyer’s energy quantityUintDetermined by buyers
Buyer’s energy priceUintDetermined by buyers
Buyer’s delivery timeUintDetermined by buyers
Table 5. Basic elements of a settlement contract.
Table 5. Basic elements of a settlement contract.
The Parameters’ NameTypeMeaning
Seller addressAddressAccount address of sellers
Buyer addressAddressAccount address of buyers
Target energy amountUintDetermined by the transaction result
PriceUintDetermined by double auction
Actual energy amountUintDetermined by the seller’s electricity supply
Penalty parameterUintDetermined by pre-agreed terms
The delivery timeInt256Determined by sellers
Table 6. Parameters of users’ demand function.
Table 6. Parameters of users’ demand function.
No. 2 α i   ω i   P G i max   ( × 100   kW ) P G i min   ( × 100   kW )
Table 7. Sellers’ parameters.
Table 7. Sellers’ parameters.
No.Generator Type (1 for CCHP, 0 for Normal DG)Delivery Time P G (×100 kW)The Corresponding Price (Finney/MW) P G min (×100 kW)The Number of Bidding’s Piecewise
Table 8. Sellers’ scheduled energy amount before adjustment.
Table 8. Sellers’ scheduled energy amount before adjustment.
SellerAddressThe Scheduled Amount before Adjustment
Table 9. The bidding of buyers and sellers.
Table 9. The bidding of buyers and sellers.
SellerEnergy Type (0 for Electricity, 1 for Heat)Energy AmountDelivery Time (1 h as an Interval)Bidding Price (×0.01 Finney)Appraisal Price (×0.01 Finney)
Table 10. The transactions’ information over the trading cycle.
Table 10. The transactions’ information over the trading cycle.
Trading CycleTransaction Sequence The Transaction PartiesEnergy AmountTransaction Price (×0.01 Finney)
Round 11Seller0→Buyer1201072
Round 12Seller1→Buyer1101143
Round 13Seller1→Buyer3501125
Round 14Seller1→Buyer0201091
Round 25Seller2→Buyer0201112

Share and Cite

MDPI and ACS Style

Zhao, S.; Wang, B.; Li, Y.; Li, Y. Integrated Energy Transaction Mechanisms Based on Blockchain Technology. Energies 2018, 11, 2412.

AMA Style

Zhao S, Wang B, Li Y, Li Y. Integrated Energy Transaction Mechanisms Based on Blockchain Technology. Energies. 2018; 11(9):2412.

Chicago/Turabian Style

Zhao, Shengnan, Beibei Wang, Yachao Li, and Yang Li. 2018. "Integrated Energy Transaction Mechanisms Based on Blockchain Technology" Energies 11, no. 9: 2412.

Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop