Privacy-Preserving Energy Scheduling for ESCOs Based on Energy Blockchain Network

: Capable of aggregating multiple energy resources, the energy service company (ESCO) has been regarded as a promising alternative for improving power system ﬂexibility and facilitate the consumption of renewable resources in the energy market. However, the issues have become signiﬁcantly more serious related to the privacy and security of the data in consumption and trading. In this paper, we address the problem by proposing a privacy-preserving energy scheduling (PPES) model based on energy blockchain network. A Lagrangian relaxation method is applied to decompose the model into several individual optimal scheduling problems, and the individual scheduling problems are solved by consensus algorithm and smart contracts in energy blockchain network. The performance of the proposed model and method is evaluated with several case studies based on multiple energy nodes. Simulation results show the rationality and validity of the proposed method, and the model is conducive to the protection of environment and transparent scheduling of energy service companies (ESCOs). In addition, it can reﬂect the information of energy demand and supply to improve the privacy and security of data.


Introduction
Nowadays, efficient energy conservation and emission reduction is put out in a primary strategic position due to the climate variation and sustainable development.The promotion of distributed renewable energy becomes the important solutions to alleviate the contradiction between economic development and environmental pollution [1].With the large-scale construction of distributed energy, the demand for energy scheduling and trading gradually stands out in the distributed energy market.
However, renewable energy resources cannot directly participate in the trade in a deregulated energy market due to their intermittency [2,3].Traditional integration conceptions, such as load aggregator (LA) and virtual power plant (VPP), are only used to manage the distributed energy resources in an electrical power system [4], and they are difficult to meet the diversified demands of end users.In this situation, as the integration conception of energy service, the energy service company (ESCO) is put forward, which is defined as a public or private company providing commercial, technical, and financial services for end users [5].ESCOs can render high effective management for multiple energy coupled system in order to stabilize the system operation and reduce the maintenance cost [6,7].Bertoldi [8] analyzed the barriers and drivers for the development of ESCO markets in Europe between 2010 and 2013.The barriers of ESCOs mainly include market, institutional, and financial barriers [5], which may result in several issues emerging in the ESCO activities, such as contractual, economic, and information security issues [9,10].
Energies 2019, 12, 1530 2 of 16 During the above issues, the information security issue is particularly important in energy systems, especially when there is cooperation among sub-energy systems [11].In a certain extent, the information of trade parties, including financial information and behavior information, is obtained by the appointed direct or indirect way, which may cause the privacy issues in the distributed energy market.Normally, a centralized solution is difficult to solve the problems related to the end users' behaviors because of the complicated privacy constraints.Considering the disadvantages of the centralized solutions, decentralized approaches with the characteristics of transaction security and identity privacy become more and more important in the energy trade.In this situation, it is challenging and significant to put forward a privacy-preserving energy scheduling for ESCOs.As for the privacy issue, this research has been investigated by scholars.To ensure the security and efficiency of the active distribution network operation, Zhao [12] proposed a privacy-preserving economic dispatch model and adopted a generalized Benders decomposition to dispersedly solve the energy scheduling problem.As to the energy management in microgrid system, Wang [13] proposed an optimization strategy to achieve privacy protection of information, and Abdullah [14] addressed an optimal privacy-preserving model for integrated microgrids to reduce the data sharing with each other.Without knowing the users' information, such as the users' locations, Fatih [15] adopted bichromatic mutual nearest neighbor method to solve a privacy-preserving problem.The above methods are feasible but have respective limitations.With the increasing importance of information, ESCOs require new and improved method to realize privacy protection.
The blockchain technology has been applied in several occasions, such as credit investigation, authentication, virtual trade, and the general Internet of Things (IoT) [16], and it promotes trust, reduces cost, and enhances security to many industries.Based on the distributed databases, the blockchain technology can satisfy the needs of executing an optimal privacy-preserving energy management [17].Many previous papers have indicated that it is potential and necessary to build a decentralized energy trading system at an appropriate cost based on the blockchain technology.Combining smart contracts with blockchain technology, Kang [18] established a decentralized energy trading system to implement security and automation between microgrids.Li [19] put forward a secure decentralized energy trading platform with the consortium blockchain technology to promote P2P energy trading, instead of trusted third parties.The Grid+ is a distributed power supplier.With the help of smart Ethereum contracts, it provides a new concept of accounting management system for the power market [20].When the geographical position of users is close or the information is similar, the network attackers can steal users' information privacy through the data mining technology more easily.Gai [21] presented a derivative method with consortium blockchain to avoid the leakage of information privacy.Blockchain technology has been researched and discussed for applications in coordinating energy trade [22][23][24][25][26][27], but the physical constraints of energy system operation are not considered generally, and instead, just the trading energy as idealized financial assets.This will result in that the established model does not make sense in practice, due to the influence on the physical security constraints.Distributed energy resources and ESCOs cannot form two-way choices with symmetrical information, resulting in the increasing of credit cost and transaction cost in the process of energy trade.Previous papers have not considered these factors about blockchain applications in energy trade.Considering the issues above, the paper proposes a privacy-preserving energy scheduling for ESCOs (PPES-ESCOs) based on energy blockchain network.
In summary, the main contributions of the paper are summarized as follows.
(1) Based on the blockchain technology and the concept of ESCO, this paper proposes a model of energy blockchain network, which plays the role of information exchange and integrate to reduce the credit cost in the trade.(2) A PPES-ESCOs model based on energy blockchain network is established, which is more applicative and efficient than conventional models in achieving secure and reliable energy trading.(3) This paper employs Lagrange relaxation (LR) decomposition technology and smart contracts to solve the proposed PPES-ESCOs problem.The proposed model minimizes the overall system energy cost while protecting environment and data security.
The remainder of this paper is organized as follows.Section 2 describes the concept of energy blockchain and provides the model of energy blockchain network.Section 3 provides the mathematical model of the overall energy system and formulates the PPES-ESCOs model along with the proposed decomposition strategy based on energy blockchain network.In Section 4, numerical simulations of the real case are applied to demonstrate the effectiveness and feasibility of the method.Finally, the conclusions and the further research of this paper are drawn in Section 5.

Blockchain Technology
Combining the distributed consensus mechanisms and password signatures, blockchain is regarded as a new technology of distributed computing and data storage to achieve security of information [28].It is mainly divided into three types, including private blockchain, public blockchain, and consortium blockchain [29].Public blockchain is a completely decentralized blockchain, and any nodes in distributed system can be involved in reading and writing, validation, and consensus.Private blockchain is a totally centralized blockchain, which is suitable for internal data management in specific institutions.Consortium blockchain is between the above two blockchains, which is applied to the combination of multiple entity organizations, and the process of consensus mechanisms is predefined controlled by a series of nodes [16].
The general data structure in blockchain shown in Figure 1 is mainly divided into two parts of block header and block body.Block n and block n + 1 is linked by its cryptographic hashes H(B n ).The block header is formed with a block number, a validator ID to test the results of a verification, the timestamp, and a concise cryptographic hashes H(B) to connect the precious block.The block body is constitutive of the main valid transaction information M i of this block which indicate the system states, including control status, trading information, and so on.
Energies 2019, 12, x FOR PEER REVIEW 3 of 17 (3) This paper employs Lagrange relaxation (LR) decomposition technology and smart contracts to solve the proposed PPES-ESCOs problem.The proposed model minimizes the overall system energy cost while protecting environment and data security.The remainder of this paper is organized as follows.Section 2 describes the concept of energy blockchain and provides the model of energy blockchain network.Section 3 provides the mathematical model of the overall energy system and formulates the PPES-ESCOs model along with the proposed decomposition strategy based on energy blockchain network.In Section 4, numerical simulations of the real case are applied to demonstrate the effectiveness and feasibility of the method.Finally, the conclusions and the further research of this paper are drawn in Section 5.

Blockchain Technology
Combining the distributed consensus mechanisms and password signatures, blockchain is regarded as a new technology of distributed computing and data storage to achieve security of information [28].It is mainly divided into three types, including private blockchain, public blockchain, and consortium blockchain [29].Public blockchain is a completely decentralized blockchain, and any nodes in distributed system can be involved in reading and writing, validation, and consensus.Private blockchain is a totally centralized blockchain, which is suitable for internal data management in specific institutions.Consortium blockchain is between the above two blockchains, which is applied to the combination of multiple entity organizations, and the process of consensus mechanisms is predefined controlled by a series of nodes [16].
The general data structure in blockchain shown in Figure 1 is mainly divided into two parts of block header and block body.Block n and block n+1 is linked by its cryptographic hashes ( ) n H B .The block header is formed with a block number, a validator ID to test the results of a verification, the timestamp, and a concise cryptographic hashes H(B) to connect the precious block.The block body is constitutive of the main valid transaction information Mi of this block which indicate the system states, including control status, trading information, and so on.Blockchain as a new technology, puts forward multiple technical innovations to solve the problems of security and scalability.The most prominent innovations are asymmetric encryption technology, consensus mechanism, and smart contract [30].In order to ensure data security and personal privacy, the information of account identity is highly encrypted with asymmetric algorithms, despite the transparency of trading information in the blockchain.But how to reach a Blockchain as a new technology, puts forward multiple technical innovations to solve the problems of security and scalability.The most prominent innovations are asymmetric encryption technology, consensus mechanism, and smart contract [30].In order to ensure data security and personal privacy, the information of account identity is highly encrypted with asymmetric algorithms, despite the transparency of trading information in the blockchain.But how to reach a consensus between nodes, and how to judge the effectiveness of a transaction, is still not unified.According to different application scenarios, blockchain puts forward different consensus mechanisms to reach a balance between efficiency and safety.The common consensus mechanisms contain proof-of-stake (PoS), proof-of-work (PoW), and delegated-proof-of-stake (DPoS) [29].
The emergence of smart contracts may lead to an overturn in business model.The smart contracts based on blockchain greatly reduce the manual participation, while traditional business cooperation usually needs a third-party agency or third-party guarantee.As to the execution of contract, smart contracts can not only avoid the influence of users' malicious behavior, but also can draw on strengths of cost efficiency.Smart contracts are written in digital form in blockchain, with the characteristics of blockchain technology to guarantee the transparency of the whole process [28].Meanwhile, the smart contracts can run efficiently based on the consensus algorithm of blockchain.While these smart contracts introduce some computational overhead, they offer transparency, verifiability, and immutability, which are suited for coordination between parties without the intervention of a trusted third party.

Energy Blockchain Network
Blockchain provides a new solution to data and information security problem about distributed energy resources due to its features, such as smart contract and safety credibility.These features also make it possible that the blockchain technology is applied to the energy scheduling for ESCOs.In order to improve the overall operating efficiency of ESCOs, ESCOs earn a greater degree of information security with the characteristic of cryptography in energy blockchain network.
According to above description of the blockchain analysis, this article puts forward an energy blockchain network model shown in Figure 2. The main relevant terms in the model of energy blockchain network are listed clearly in Table 1. Figure 2 shows main components in energy blockchain network (EBN): Nodes, energy supply index blockchain (ESIB), energy trading blockchain (ETB), and smart contract (SC).There are three types of energy nodes: Energy sellers, energy buyers, and energy idle nodes.They play a variety of roles in energy trading, according to their energy demands and states.
Energies 2019, 12, x FOR PEER REVIEW 4 of 17 consensus between nodes, and how to judge the effectiveness of a transaction, is still not unified.
According to different application scenarios, blockchain puts forward different consensus mechanisms to reach a balance between efficiency and safety.The common consensus mechanisms contain proof-of-stake (PoS), proof-of-work (PoW), and delegated-proof-of-stake (DPoS) [29].
The emergence of smart contracts may lead to an overturn in business model.The smart contracts based on blockchain greatly reduce the manual participation, while traditional business cooperation usually needs a third-party agency or third-party guarantee.As to the execution of contract, smart contracts can not only avoid the influence of users' malicious behavior, but also can draw on strengths of cost efficiency.Smart contracts are written in digital form in blockchain, with the characteristics of blockchain technology to guarantee the transparency of the whole process [28].Meanwhile, the smart contracts can run efficiently based on the consensus algorithm of blockchain.While these smart contracts introduce some computational overhead, they offer transparency, verifiability, and immutability, which are suited for coordination between parties without the intervention of a trusted third party.

Energy Blockchain Network
Blockchain provides a new solution to data and information security problem about distributed energy resources due to its features, such as smart contract and safety credibility.These features also make it possible that the blockchain technology is applied to the energy scheduling for ESCOs.In order to improve the overall operating efficiency of ESCOs, ESCOs earn a greater degree of information security with the characteristic of cryptography in energy blockchain network.
According to above description of the blockchain analysis, this article puts forward an energy blockchain network model shown in Figure 2. The main relevant terms in the model of energy blockchain network are listed clearly in Table 1. Figure 2 shows main components in energy blockchain network (EBN): Nodes, energy supply index blockchain (ESIB), energy trading blockchain (ETB), and smart contract (SC).There are three types of energy nodes: Energy sellers, energy buyers, and energy idle nodes.They play a variety of roles in energy trading, according to their energy demands and states.
The data structure of ESIB can be described as shown in Figure 3 [31].Energy sell nodes submit information about themselves such as node ID, energy types, and energy price to EBN to form blocks of ESIB, and energy buy nodes search the most matched seller according to information of the latest ESIB blocks.Once the trade between buyers and sellers is formed, trade information will be sent to the EBN to aggregate into a block and converge to ETB.The main difference between the data structure of ETB and ESIB is the main information in the block body, which is represented in Table 2.
Energies 2019, 12, x FOR PEER REVIEW 5 of 17 The data structure of ESIB can be described as shown in Figure 3 [31].Energy sell nodes submit information about themselves such as node ID, energy types, and energy price to EBN to form blocks of ESIB, and energy buy nodes search the most matched seller according to information of the latest ESIB blocks.Once the trade between buyers and sellers is formed, trade information will be sent to the EBN to aggregate into a block and converge to ETB.The main difference between the data structure of ETB and ESIB is the main information in the block body, which is represented in Table 2.In the EBN, the network collects trading information to form dynamic energy scheduling.The energy scheduling makes the distributed energy for the whole system open and transparent based on the allocation effectively with smart contracts.At the same time, according to the different outside environment and the social demand, we can adjust the smart contract parameters dynamically to achieve different effects, in order to promote the security operation of system.In this paper, we propose the smart contract as Equation (3) to improve the protection of environment  In the EBN, the network collects trading information to form dynamic energy scheduling.The energy scheduling makes the distributed energy for the whole system open and transparent based on the allocation effectively with smart contracts.At the same time, according to the different outside environment and the social demand, we can adjust the smart contract parameters dynamically to achieve different effects, in order to promote the security operation of system.In this paper, we propose the smart contract as Equation (3) to improve the protection of environment while minimizing the cost of the overall energy system.M means the supply amount of energy; S1 means the stability of supply; P means the cost of energy; and EN means the degree of environmental protection.In the process of trade, the stability of supply S1 must satisfy the stability of demand S2.
With the EBN as a decentralized network, all transaction information is verified and analyzed by all nodes, and finally form two blockchains of ESIB and ETB.In the process, data is encrypted with elliptic curve digital signature algorithm (ECDSA) to guarantee the security of exchange and storage of data [32].Meanwhile, considering the common maintenance features of EBN, the transaction information will not miss due to the failure of partial nodes.These characteristics make EBN play an important role in the privacy-preserving energy scheduling.

Privacy-Preserving Energy Scheduling Model
In this section, a privacy-preserving energy scheduling model based on energy blockchain network for ESCOs is proposed.The detailed mathematical formulation of the proposed model and the key methodology are presented in the following article.

Privacy-Preserving Mathematical Model
The objective function is to realize the minimization of the energy cost in the energy scheduling.As to the energy cost, four distinct categories of costs are included, namely the distributed generators (DGs) cost, the energy exchange with the power grid cost, the energy exchange with ESCOs cost, and the cost due to reduction of environmental pollution.The objective function of the model is represented as shown in Equation ( 4 The decision variables in Equation ( 4) are the power output of multiple parts, including P e,i,t,s that comes from dispatchable unit, P M e,t,s that comes from the power grid, P N ed,t,s that comes from other ESCOs, and M e,t,s that comes from itself respectively.
Firstly, the energy balance shown in Equation (5) Secondly, the dispatchable energy is limited by the capacity and commitment constraints by itself, which are expressed by the state of the unit and lower or upper values as follows: I e,i,t P min e,i ≤ P e,i,t,s ≤ I e,i,t P max e,i ∀e, ∀t, ∀i, ∀s P e,i,t,s − P e,i,t−1,s ≤ UR i ∀e, ∀t, ∀i, ∀s P e,i,t−1,s − P e,i,t,s ≤ DR i ∀e, ∀t, ∀i, ∀s Thirdly, the exchanged energy of energy supply is also subject to the physical flow constraint with the line as shown in Equations ( 9) and (10).
Moreover, the value of coupling energy between any two trading ESCOs is equal but has the opposite signs at any time, shown in Equation (11).

Solution Methodology
As to the proposed privacy-preserving energy scheduling model based on energy blockchain network, two key issues need to be solved.Firstly, how to effectively decompose the original problem into a series of individual scheduling problems for each ESCO influences the final solution efficiency of the proposed model.Secondly, how to integrate the problem with energy blockchain network affects the results of privacy protection.

LR method
A general optimization problem can be expressed as the following program: The problem contains hard and simple constraints, and it is difficult to solve due to the hard constrains.The fundamental principle of LR is absorbing the hard constraints into the objective function to make the problem easy to solve.The expression (12) can be converted to (13): Dx ≥ e (simple) Theorem 1.The Lagrangian problem [LR] yields a lower bound to the original problem [P]: z LR (η) ≤ z.The detailed proof of theorem 1 can be found in Reference [33].Based on this, the LR method can effectively decompose the problem with hard constrains into a series of smaller and individual scheduling problems for each ESCO [34].The proposed iteration procedure of LR method is as follows (Algorithm 1):

Solution Methodology
As to the proposed privacy-preserving energy scheduling model based on energy blockchain network, two key issues need to be solved.Firstly, how to effectively decompose the original problem into a series of individual scheduling problems for each ESCO influences the final solution efficiency of the proposed model.Secondly, how to integrate the problem with energy blockchain network affects the results of privacy protection.

LR method
A general optimization problem can be expressed as the following program: ) The problem contains hard and simple constraints, and it is difficult to solve due to the hard constrains.The fundamental principle of LR is absorbing the hard constraints into the objective function to make the problem easy to solve.The expression (12) can be converted to ( 13   .The detailed proof of theorem 1 can be found in Reference [33].Based on this, the LR method can effectively decompose the problem with hard constrains into a series of smaller and individual scheduling problems for each ESCO [34].The proposed iteration procedure of LR method is as follows (Algorithm 1):

end for end for
It is evident that the hard constraints in the above proposed model is Equation (11), which presents the coupling relationship with ESCOs.Based on the above LR method, the problem expressed in Equation ( 4) can be successfully decomposed into a series of individual scheduling problems with a Lagrangian multiplier η ed,t .The individual ESCO model (IESCOM) is expressed as follows: The constraints in the individual ESCO model are similar to Equations ( 5)- (10).As for the above models, this paper illustrates and compares the following two scenarios to investigate the advantages based on energy blockchain network, where s = 0 denotes the traditional model as above and s ≥ 1 denotes the novel model based on energy blockchain network.

Privacy-Preserving Solution Method
The operational process of individual ESCO model based on EBN (EBN-IESCOM) is shown in Figure 4.The detailed are as follows: Firstly, the energy buyers participating in the system will submit their own information of energy demands to the market.Then, the energy sellers participating in the system submit their own information of energy supply to EBN to form ESIB, and the EBN broadcasts the ESIB to ensure energy buyers can search the best sellers to match their demands.During the matching process, smart contracts play an important role depending on different situations.Once the energy match is successful, both trade counterparties complete an energy deal according to the content of smart contracts.
The constraints in the individual ESCO model are similar to Equations ( 5)- (10).As for the above models, this paper illustrates and compares the following two scenarios to investigate the advantages based on energy blockchain network, where s = 0 denotes the traditional model as above and s ≥ 1 denotes the novel model based on energy blockchain network.

Privacy-Preserving Solution Method
The operational process of individual ESCO model based on EBN (EBN-IESCOM) is shown in Figure 4.The detailed procedures are as follows: Firstly, the energy buyers participating in the system will submit their own information of energy demands to the market.Then, the energy sellers participating in the system submit their own information of energy supply to EBN to form ESIB, and the EBN broadcasts the ESIB to ensure energy buyers can search the best sellers to match their demands.During the matching process, smart contracts play an important role depending on different situations.Once the energy match is successful, both trade counterparties complete an energy deal according to the content of smart contracts.The EBN-IESCOM can be solved by blockchain technology including consensus algorithm and smart contracts in Equation (3). Figure 5 describes the response model of smart contract.The model includes the triggering condition, response rules, and the port of external data.The execution status and conditions of smart contracts are monitored by the EBN, and the smart contract is triggered to perform specific transactions through querying external data.The consensus algorithms in this paper are all on the basis of PoS.Algorithm 2 shows the consensus algorithm in pseudocode of ESIB.The differences in consensus algorithm about ESIB and ETB are the weights of consensus.The former focuses on the aspects of energy supply, such as energy price, energy degree of stability, and environmental protection performance.However, the latter is partial to trade information including trading price, trading amount, and spared quantity.
Energies 2019, 12, x FOR PEER REVIEW 9 of 17 environmental protection performance.However, the latter is partial to trade information including trading price, trading amount, and spared quantity.

Overview of Methodology
In summary, the objective function for ESCOs is to realize the minimization of the energy cost in the energy scheduling.Decomposing the whole problem with hard constraints into a series of smaller and individual scheduling problems is executed with a Lagrangian multiplier centrally.As for the smaller and individual scheduling problems, they are solved in a decentralized mode, by smart contracts with consensus algorithm based on EBN.The solutions are checked by the coupling energy relationship among ESCOs and updated through a LR multiplier.Combining Lagrange relaxation decomposition technology and smart contracts with consensus algorithm effectively, the optimal solution will be obtained finally.The specific flowchart of the proposed method can be described as follows (Figure 6).environmental protection performance.However, the latter is partial to trade information including trading price, trading amount, and spared quantity.

Overview of Methodology
In summary, the objective function for ESCOs is to realize the minimization of the energy cost in the energy scheduling.Decomposing the whole problem with hard constraints into a series of smaller and individual scheduling problems is executed with a Lagrangian multiplier centrally.As for the smaller and individual scheduling problems, they are solved in a decentralized mode, by smart contracts with consensus algorithm based on EBN.The solutions are checked by the coupling energy relationship among ESCOs and updated through a LR multiplier.Combining Lagrange relaxation decomposition technology and smart contracts with consensus algorithm effectively, the optimal solution will be obtained finally.The specific flowchart of the proposed method can be described as follows (Figure 6).

Overview of Methodology
In summary, the objective function for ESCOs is to realize the minimization of the energy cost in the energy scheduling.Decomposing the whole problem with hard constraints into a series of smaller and individual scheduling problems is executed with a Lagrangian multiplier centrally.As for the smaller and individual scheduling problems, they are solved in a decentralized mode, by smart contracts with consensus algorithm based on EBN.The solutions are checked by the coupling energy relationship among ESCOs and updated through a LR multiplier.Combining Lagrange relaxation decomposition technology and smart contracts with consensus algorithm effectively, the optimal solution will be obtained finally.The specific flowchart of the proposed method can be described as follows (Figure 6).

Parameter and Settings
Based on simulation programs with Matlab and smart contracts with Remix-Solidity integrated development environment (IDE) on a PC with an 8GB random access memory (RAM) and a 2.6 GHz Intel Core i5-3320 M processor, this paper takes two energy scheduling simulations and comparison analysis processes as examples to verify the characteristic of the EBN-IESCOM.
The ESCOs of energy supply are illustrated in Table 3.Each ESCO as an energy node participates in the operation of EBN-IESCOM in the EBN.ESCO1 and ESCO3 are photovoltaic power generation; ESCO2 and ESCO4 are wind power generation; ESCO5 is hydro power generation; and ESCO6 is thermal power generation.The ESCOs of energy demand are illustrated in Table 4. D means the demand amount of energy and S2 means the stability of demand.

Parameter and Settings
Based on simulation programs with Matlab and smart contracts with Remix-Solidity integrated development environment (IDE) on a PC with an 8GB random access memory (RAM) and a 2.6 GHz Intel Core i5-3320 M processor, this paper takes two energy scheduling simulations and comparison analysis processes as examples to verify the characteristic of the EBN-IESCOM.
The ESCOs of energy supply are illustrated in Table 3.Each ESCO as an energy node participates in the operation of EBN-IESCOM in the EBN.ESCO1 and ESCO3 are photovoltaic power generation; ESCO2 and ESCO4 are wind power generation; ESCO5 is hydro power generation; and ESCO6 is thermal power generation.The ESCOs of energy demand are illustrated in Table 4. D means the demand amount of energy and S2 means the stability of demand.

Results of the Proposed EBN-IESCOM
Depending on the parameters of nodes above, sell nodes publish their information to the EBN to form ESIN based on the consensus algorithm of ESIB.According to the predetermined SC of EBN, the matched supply set of each buy node can be determined and used to form new energy trading block with the consensus algorithm of ETB.The simulation results of four buy nodes are shown in Tables 5-8.The initial matched pairs of ESCOs in energy scheduling is shown in Figures 7 and 8 describes the final optimal matched pairs and the formations of ETB in the EBN.The optimal energy scheduling process of EBN-IESCOM is shown in Figure 9. energy scheduling process of EBN-IESCOM is shown in Figure 9.          From Tables 9-13, the proposed EBN-IESCOM with higher cost consumes less coal and causes less environment pollution to meet the same capacity and stability requirements.In Tables 9 and 12, the coal consumption of EBN-IESCOM is much less than that of traditional model, while the cost is a little lager.However, the prices of these ESCOs are higher than ESCOs composed of thermal power generations, which results in the higher cost.The conclusions are consistent with the simulation results in tables.In Table 13, the total coal consumption of the traditional model is twice that of the proposed EBN-IESCOM, while the energy cost is 82.6% of the proposed model.The slightly higher cost reduces carbon emissions and promotes the distributed energy trade indirectly.From the perspective of data security and privacy protection, all the transaction information is verified and analyzed by all energy nodes, and, finally, used to establish the energy block in EBN.The proposed EBN-IESCOM is a better reflection of demand side information and more conducive to energy scheduling of emission reduction and information transparency.

Conclusions
The paper proposes a privacy-preserving energy scheduling model for ESCOs based on energy blockchain network, with the aim to solve the issues related to the privacy and security of the data in consumption and trading.According to the blockchain technology, a model of energy blockchain network is proposed firstly.To achieve secure and reliable energy trading, a privacy-preserving energy scheduling for ESCOs based on energy blockchain network is designed.Through Lagrange relaxation decomposition technology and smart contracts, the proposed PPES-ESCOs problem can be solved.Compared with the traditional energy scheduling without the energy blockchain network, the proposed model minimizes the overall system energy cost while protecting environment and data security.Moreover, simulation results and comparative analysis show that the proposed EBN-IESCOM is a better reflection of demand side information and more conducive to energy scheduling of emission reduction and information transparency.
However, the proposed PPES-ESCOs model also presents several shortcomings, which further research can aim to improve.Firstly, we ignore the cost of virtual currency during the trade based on energy blockchain network.Secondly, the efficient application of the proposed method on the large-scale energy nodes needs to be further researched.

Figure 1 .
Figure 1.The general data structure of blockchains.

Figure 1 .
Figure 1.The general data structure of blockchains.

Theorem 1 :
The Lagrangian problem [LR] yields a lower bound to the original problem [P]:

Figure 5
describes the response model of smart contract.The model includes the triggering condition, response rules, and the port of external data.The execution status and conditions of smart contracts are monitored by the EBN, and the smart contract is triggered to perform specific transactions through querying external data.The consensus algorithms in this paper are all on the basis of PoS.Algorithm 2 shows the consensus algorithm in pseudocode of ESIB.The differences in consensus algorithm about ESIB and ETB are the weights of consensus.The former focuses on the aspects of energy supply, such as energy price, energy degree of stability, and

Figure 5 .Algorithm 2 :
Figure 5.The response model of smart contract.

Figure 5 .Algorithm 2 :
Figure 5.The response model of smart contract.

Figure 6 .
Figure 6.The flowchart of the proposed method.

Figure 6 .
Figure 6.The flowchart of the proposed method.

Figure 7 .
Figure 7.The initial matched pairs of energy service companies (ESCOs).

Figure 8 .
Figure 8.The final matched pairs and the formation of ETB.

Figure 8 .
The final matched pairs and the formation of ETB.

Figure 9 .
Figure 9.The energy scheduling process of EBN-IESCOM.Four types of ESCOs are examined to investigate the energy scheduling process of EBN-IESCOM with different parameters of buy nodes.(1) ESCO7 with household energy demand: The stability of energy demand is 0.5, all ESCOs meet the condition, except ESCO4.According to the established smart contract considering multiple factors including price, stability, and environment, ESCO7 searches for the best-matched energy supply nodes through ESIB.As shown in Figure 9, the ESCO2, ESCO3, ESCO1, ESCO5, and ESCO6 constitute the supply set of ESCO7 orderly.However, with the smart contracts, the ETB of ESCO7 is ESCO2, ESCO3, and ESCO6, finally, and the energy amount of each ESCO is 45 MW, 50 MW, and 25 MW.(2) ESCO8 with emergent energy demand: The stability of energy demand is very high to ensure the reliability of energy supply, which results in that only ESCO5 and ESCO6 can reach the requirements.Due to the high degree of environmental protection, ESCO5 has the priority to carry on energy trade.The process of ETB formation of ESCO8 also verifies the conclusion.The ETB of ESCO8 is ESCO5 and ESCO6, and the energy amount of each ESCO is 800MW and 100MW.

Figure 9 .
Figure 9.The energy scheduling process of EBN-IESCOM.Four types of ESCOs are examined to investigate the energy scheduling process of EBN-IESCOM with different parameters of buy nodes.(1) ESCO7 with household energy demand: The stability of energy demand is 0.5, all ESCOs meet the condition, except ESCO4.According to the established smart contract considering multiple factors including price, stability, and environment, ESCO7 searches for the best-matched energy supply nodes through ESIB.As shown in Figure 9, the ESCO2, ESCO3, ESCO1, ESCO5, and ESCO6 constitute the supply set of ESCO7 orderly.However, with the smart contracts, the ETB of ESCO7 is ESCO2, ESCO3, and ESCO6, finally, and the energy amount of each ESCO is 45 MW, 50 MW, and 25 MW.(2) ESCO8 with emergent energy demand: The stability of energy demand is very high to ensure the reliability of energy supply, which results in that only ESCO5 and ESCO6 can reach the requirements.Due to the high degree of environmental protection, ESCO5 has the priority to carry on energy trade.The process of ETB formation of ESCO8 also verifies the conclusion.The ETB of ESCO8 is ESCO5 and ESCO6, and the energy amount of each ESCO is 800MW and 100MW.(3) ESCO9 with commercial energy demand: The stability of energy demand is in middle level, lead to ESCO9 having many choices.Due to the large demand of the commercial energy, the limited capacity of one ESCO cannot meet the requirements.The shortage departments are supplied by other ESCOs.Therefore, the demand of the commercial energy can be supplied by ESCO1, ESCO5, and ESCO6, and finally the ETB of ESCO9 is ESCO1 and ESCO6.The energy amount of ESCO1 and ESCO6 is 60 MW and 840 MW, respectively.(4) ESCO10 with storage energy demand: The stability level of energy demand is low.All the ESCOs can offer services for ESCO10.In traditional mode; ESCO6 will match the demand due to the lowest price.Because of the established smart contract considering multiple factors, the optimal result is ESCO4.However, the storage demand needs multi-ESCOs to meet due to the limited capacity of ESCO4.As shown in Figure 9, the relatively matched is ESCO6.The corresponding energy amount is 30 MW and 120 MW.According to different types of energy demand, the energy scheduling process of EBN-IESCOM and the formations of ESIB and ETB are analyzed above.Assume the average coal consumption is 0.45kg/kWh.The results of energy consumption and cost in EBN-IESCOM and traditional model in the four cases are shown in Tables 9-13.

Table 1 .
Main relevant terms in energy blockchain network (EBN).are the core of the entire energy blockchain network.The ESIB and ETB can be formed based on original blockchain with consensus algorithm as shown in Equations (1) and (2).B ESIB and B ETB are the original blockchains of ESIB and ETB, respectively.ESCA and ETCA are consensus algorithm of ESIB and ETB, respectively.

Table 1 .
(2)n relevant terms in energy blockchain network (EBN).are the core of the entire energy blockchain network.The ESIB and ETB can be formed based on original blockchain with consensus algorithm as shown in Equations (1) and(2).are the original blockchains of ESIB and ETB, respectively.ESCA and ETCA are consensus algorithm of ESIB and ETB, respectively.

Table 2 .
Main difference between the data structure of energy trading blockchain (ETB) and ESIB.

Table 2 .
Main difference between the data structure of energy trading blockchain (ETB) and ESIB.
ensures that the sum of energy supply exchanged with grid or other ESCOs owned by itself matches the local energy demand.

Algorithm 1 :
(11)ange Relaxation Algorithm.Moreover, the value of coupling energy between any two trading ESCOs is equal but has the opposite signs at any time, shown in Equation(11).
(11)s evident that the hard constraints in the above proposed model is Equation(11), which presents the coupling relationship with ESCOs.Based on the above LR method, the problem expressed in Equation (4) can be successfully decomposed into a series of individual scheduling problems with a Lagrangian multiplier

Table 3 .
Sell nodes in the EBN.

Table 4 .
Buy nodes in the EBN.

Table 3 .
Sell nodes in the EBN.

Table 4 .
Buy nodes in the EBN.

Table 5 .
Simulation results of ESCO7 in the EBN.

Table 6 .
Simulation results of ESCO8 in the EBN.

Table 7 .
Simulation results of ESCO9 in the EBN.

Table 8 .
Simulation results of ESCO10 in the EBN.

Table 5 .
Simulation results of ESCO7 in the EBN.

Table 6 .
Simulation results of ESCO8 in the EBN.

Table 7 .
Simulation results of ESCO9 in the EBN.

Table 8 .
Simulation results of ESCO10 in the EBN.

Table 9 .
Simulation results of energy consumption and cost in ESCO7.

Table 10 .
Simulation results of energy consumption and cost in ESCO8.

Table 11 .
Simulation results of energy consumption and cost in ESCO9.

Table 12 .
Simulation results of energy consumption and cost in ESCO10.

Table 13 .
Simulation results of energy consumption and cost totally.