Next Article in Journal
A Wideband and Low-Power Distributed Cascode Mixer Using Inductive Feedback
Next Article in Special Issue
SimBlock Simulator Enhancement with Difficulty Level Algorithm Based on Proof-of-Work Consensus for Lightweight Blockchain
Previous Article in Journal
A Dynamic Deployment Method of Security Services Based on Malicious Behavior Knowledge Base
Previous Article in Special Issue
Health-zkIDM: A Healthcare Identity System Based on Fabric Blockchain and Zero-Knowledge Proof
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Privacy-Preserving, Two-Party, Secure Computation Mechanism for Consensus-Based Peer-to-Peer Energy Trading in the Smart Grid

1
China Electric Power Research Institute, Beijing 100081, China
2
State Grid Corporation of China, Beijing 100031, China
3
School of Electrical and Information Engineering, Tianjin University, Tianjin 300072, China
4
Hangzhou Innovative Institute, Beihang University, Hangzhou 310051, China
5
Key Laboratory of Cryptography of Zhejiang Province, Hangzhou Normal University, Hangzhou 311121, China
*
Author to whom correspondence should be addressed.
Sensors 2022, 22(22), 9020; https://doi.org/10.3390/s22229020
Submission received: 22 August 2022 / Revised: 14 November 2022 / Accepted: 14 November 2022 / Published: 21 November 2022
(This article belongs to the Special Issue Cryptographic Technologies for Securing Blockchain)

Abstract

:
Consumers in electricity markets are becoming more proactive because of the rapid development of demand–response management and distributed energy resources, which boost the transformation of peer-to-peer (P2P) energy-trading mechanisms. However, in the P2P negotiation process, it is a challenging task to prevent private information from being attacked by malicious agents. In this paper, we propose a privacy-preserving, two-party, secure computation mechanism for consensus-based P2P energy trading. First, a novel P2P negotiation mechanism for energy trading is proposed based on the consensus + innovation (C + I) method and the power transfer distribution factor (PTDF), and this mechanism can simultaneously maximize social welfare and maintain physical network constraints. In addition, the C + I method only requires a minimum set of information to be exchanged. Then, we analyze the strategy of malicious neighboring agents colluding to attack in order to steal private information. To defend against this attack, we propose a two-party, secure computation mechanism in order to realize safe negotiation between each pair of prosumers based on Paillier homomorphic encryption (HE), a smart contract (SC), and zero-knowledge proof (ZKP). The energy price is updated in a safe way without leaking any private information. Finally, we simulate the functionality of the privacy-preserving mechanism in terms of convergence performance, computational efficiency, scalability, and SC operations.

1. Introduction

Recently, renewable distributed energy resources (DERs) [1], electric vehicles (EVs) [2,3,4,5,6], and energy storage systems (ESSs) have turned traditional consumers into prosumers; therefore, they can share energy locally to optimize the load and costs. Many households are now equipped with renewable generators, such as solar panels or wind turbines, which can provide energy in order to satisfy their own demand. The use of these DERs can help more DERs be absorbed into the grid in order to further reduce pollution. However, consumers who participate in the electricity market are required to behave more proactively and are, thus, known as prosumers. The increase in the number of prosumers naturally implies the need for a decentralized energy-trading mechanism that allows prosumers to freely trade with each other without a central supervising entity. Therefore, the network architecture is also changing from centralized to decentralized. A fully decentralized network architecture can be defined as a peer-to-peer (P2P) network in which the participants in the network share a portion of their own resources with one another. These shared resources can be accessed directly by other peers without the intervention of a mediating entity [7]. A formal definition of P2P networks can be found in [8]. In this context, P2P trading mechanisms have emerged as a next-generation energy-management technique that enables prosumers to actively participate in the energy market.
Although the P2P mechanism provides better scalability, reliability, and resilience, growing privacy concerns are hindering its widespread adoption. In a P2P network, it is expected that prosumers will trade their energy with each other without any influence from a central coordinator, which makes P2P platforms a trustless and unreliable system. In addition, P2P energy trading requires a significant amount of data to be exchanged in order to compute the optimal energy amounts and prices for all sellers and buyers [9]. Disclosing such local data for computation would be damaging to their privacy. For instance, local generation reveals the generation capacities and time series of generation patterns [10], and the local demand load reveals consumption patterns [11,12].
Therefore, protecting prosumers’ privacy and encouraging them to cooperate are challenges in such an environment with a lack of trust and security. Different technologies have been used to solve these problems. Blockchain has emerged as a promising, user-friendly, and efficient technology for the implementation of secure and reliable P2P energy-trading mechanisms. Existing studies have exploited a large variety of blockchain-enabled platforms to ensure secure and transparent P2P energy trading [13,14,15,16,17,18,19,20,21,22]. It makes communication transparent for prosumers and allows them to make decisions about energy dispatches in a decentralized and untrusted environment. In blockchain, security mainly means that data are stored on all nodes, are resistant to single points of failure, and are unalterable. Existing blockchain-based energy-trading studies mainly used blockchain to store and protect the final trading results. In addition, smart contracts (SCs) play a very important role in P2P energy trading, as they control the energy transactions between two peers by following predefined rules [17,19,23].
Homomorphic encryption (HE) is a form of encryption that allows for computations on ciphertexts, which generate an encrypted result that, when decrypted, matches the results of the operations as if they had been performed on the plaintext [24]. HE can be further categorized into two classes: semi-HE and fully HE. Semi-HE methods are schemes that only support a subset of the encrypted arithmetic. For example, the Paillier algorithm only supports arithmetic that uses addition; therefore, it is also known as additive semi-HE. On the contrary, fully HE schemes support all encrypted arithmetic. The main advantage of HE is that the security is very high, since it is based on cryptographic techniques, while the most commonly known drawback of HE-based methods is the increased computing power that is required for their complex encryption and decryption operations. Some works have studied the application of HE technology to energy systems. A novel private collaborative distributed energy-management system (P-CoDEMS) was proposed in order to solve the problem of AC optimal power flow (ACOPF) in a distributed and private manner in [25]. Yi et al. integrated HE, blockchain, and other technologies to implement a secure energy trading system [26]. Liu et al. adopted the Paillier method to protect the privacy of ADMM-based distributed DC optimal power flow in [27]. The Paillier-based distributed optimization method was generalized for all gradient-based distributed optimization in [28], and it was reported to be applied to a distributed transactive problem in [29].
However, to our knowledge, existing works did not adequately consider privacy issues in the negotiation process for fully decentralized P2P energy-trading mechanisms. In the P2P energy-trading market, there are multiple agents who negotiate energy trades with each other, and the objective of the market mechanism is to determine the trading prices and amounts for each pair of agents. Thus, in this paper, we propose a privacy-preserving, two-party—instead of multi-party—secure computation mechanism for the negotiation process for each pair of agents. The novel privacy-preserving P2P energy-trading framework combines the technologies of blockchain, SCs, HE, and zero-knowledge proof (ZKP). In detail, we first propose a P2P negotiation mechanism that uses a combination of the consensus + innovation (C + I) method with a power transfer distribution factor (PTDF) model. Then, we analyze the privacy disclosure risk of this mechanism in the case of collusive attacks from neighboring agents. To avoid this risk, a secure, two-party computation framework is designed for updating the energy price between each pair of agents. Finally, the simulation results demonstrate the performance of market convergence, and the line-limit constraints, scalability, and encryption/decryption computation are maintained. The main contributions are the following:
  • We propose a novel P2P negotiation mechanism that incorporates the power transfer distribution factor (PTDF) model into the consensus + innovation (C + I) method, which can simultaneously maximize social welfare and comply with physical line constraints. By introducing line prices into the update process, agents are encouraged not to transfer power over congested lines.
  • Although the C + I method exchanges a minimum amount of information, there is still a risk of revealing private information. We analyze how individual private information (e.g., coefficients of generation, utility functions, and power limits) can be stolen and computed through a collusion attack by a group of collusive neighboring agents in the context of the P2P negotiation mechanism based on the C + I method.
  • The security objective and novelty of this paper are to protect the information exchanged between each pair of agents in the energy-trading negotiation process. We propose a novel, secure, two-party computation mechanism for the energy price update between each pair of agents based on the SC and Paillier encryption algorithm, which is known as an efficient additive HE method. Moreover, we propose a ZKP protocol to prove that the decrypted plaintext matches the ciphertext computed by SC.
The rest of the paper is organized as follows: Section 1 presents the formulation of the P2P energy-trading and social welfare maximization problem. Section 2 proposes the SC-based P2P negotiation mechanism for energy trading, followed by the two-party, secure computation framework in Section 3. The numerical results are presented in Section 4. Finally, in Section 5 and Section 6, the discussions, conclusions, and future perspectives are drawn.

2. Problem Formulation

A typical P2P architecture for electricity markets is shown in Figure 1, which consists of simultaneous negotiation of the price and energy of multilateral trades based on predefined trading rules. It can be seen that a P2P mechanism for electricity markets is much more decentralized than existing centralized markets, where all agents must submit all their information, e.g., cost or utility function, power limits, and uncertainty information, to the market operator (MO), who centrally determines the dispatches of energy. In contrast, in P2P markets, all agents can freely negotiate the prices and quantities with each other for multilateral trading.

2.1. Peer-to-Peer Trading

In this paper, we build a market with a set Ω of agents defined as either producers or consumers. The market-clearing mechanism proposed below is for a day-ahead market to allocate the supply and demand of energy. It is assumed that all agents are supposed to be rational and truthful, as in [30], which means that they always make decisions to maximize individual benefits. A similar model of the P2P energy-trading process was proposed in our previous work [31,32].
First, the power injection E n of each agent n Ω is divided into a sum of bilaterally traded quantities with a set of neighboring agents m ω n as
E n = m ω n E n m , n Ω
A positive value of E n represents surplus energy and a negative value means required energy. Before P2P energy trading, each prosumer will individually calculate the value of E n according to the power generation and consumption and then decide to be a buyer or seller in the trading. A positive value of E n m represents a sale/production, and a negative value means a purchase/consumption. To lighten notations, E n = { E n 1 , , E n m , m ω n } is used to represent the whole set of transactions of agent n. The power of an agent n is constrained as below:
E n ̲ E n E n ¯ , n Ω
Each agent is restrained to either producer or consumer ( E n ̲ E n ¯ 0 ). Hence, the decision variables are constrained to be positive ( E n m 0 ) if it is a producer and negative ( E n m 0 ) if it is a consumer, as follows:
E n m 0 , ( n , m ) ( Ω p , ω n ) E n m 0 , ( n , m ) ( Ω c , ω n )
where Ω p and Ω c are the sets of energy producers and consumers, respectively.
Finally, the market equilibrium between energy production and consumption is represented by a set of balance constraints of each pair of agents
E n m + E m n = 0 , ( n , m ) ( Ω , ω n )

2.2. Line Flow Constraints of Power Network

In this paper, PTDF is used to compute the power flow of lines and to label the lines used for power transfer in each transaction [33,34]. The PTDF for line l is denoted by φ i j l and indicates the fraction of the energy generated by the agents on bus i that is transmitted over line l to the agents on bus j. The PTDF is calculated by φ i j l = ψ i l ψ j l , where ψ i l , ψ j l are injection shift factors (ISF) in line l for bus i and j. The ISF is an approximation of the sensitivity matrix and quantifies the redistribution of power through each branch after a change in generation or load on a particular bus. The ISF matrix is represented by Ψ [ ψ i l ] R L × N , where N is the number of buses and L is the number of lines. This matrix can be obtained using Ψ B A C 1 by a diagonal branch susceptance matrix ( B ), a branch-node incidence matrix (A), and a reduced nodal susceptance matrix (C). In the matrix A, a l T is the lth row where a line exists between bus i and j.
A [ a 1 , a 2 , , a L ] R L × N , a l T [ 0 0 1 i 0 0 1 j 0 0 ]
B d i a g [ b 1 , b 2 , , b L ] R L × L , C A T B A R N × N
By having PTDF matrix and traded energy between prosumers, the power flow in line l can be computed by (6)
P l = n Ω p m Ω c φ i j l E n m
In the above Equation (6), the producer n is at bus i and the consumer m is at bus j. Their traded power E n m has an impact on the flow of the line l. If the value is below or above the boundaries, the line prices υ ¯ l , υ ̲ l are sent to the agents using that particular line to transfer power to avoid overflow or congestion.
Since the agents in the power grid use the conventional grid to transmit energy, both social welfare and line flow constraints should be considered. Here, line flow constraints are added as a constraint to the objective function to model the physical network in energy trading. To avoid damage to the transmission lines, the real power flow P l in each line l is bounded by the maximum capacity P l m a x with respect to the heat they can dissipate.
P l m a x P l P l m a x , l L .

2.3. Social Welfare Maximization Problem

To simplify the formulation of the process, we model the production cost and consumer utility functions as quadratic functions of the power set-point, as below:
C n ( E n ) = a n E n 2 + b n E n + c n ,
where a n , b n , and c n are predetermined positive constants. From above, the P2P market has the objective to maximize the social welfare of all agents under the constraints. The problem can be equivalently formulated as a cost minimization problem, as below:
min n Ω C n ( E n )
s . t . E n ̲ E n E n ¯ n Ω
E n m 0 ( n , m ) ( Ω p , ω n )
E n m 0 ( n , m ) ( Ω c , ω n )
E n m + E m n = 0 ( n , m ) ( Ω , ω n )
P l m a x n Ω p m Ω c φ i j l E n m P l m a x l L
Since the social welfare maximization (or cost minimization) problem is a convex optimization problem, it has a unique optimum that can be achieved by a plethora of centralized methods. However, this requires the disclosure of all the agents’ information. It is better to design a P2P negotiation mechanism that can achieve optimal dispatches of the above optimization problem (9).

3. Blockchain-Based P2P Negotiation Mechanism for Energy Trading

In this section, we first design a novel P2P negotiation mechanism for energy trading inspired by the consensus-based approach proposed in [35]. We then present the implementation of P2P energy trading using blockchain and SC.

3.1. C + I-Based Decentralized Negotiation Mechanism

The decentralized negotiation mechanism for P2P energy trading is based on the C + I method, which consists of updates to the primary energy quantity variables, updates to the dual variables, and convergence criteria. The main reason for choosing the C + I method to design the market-clearing algorithm is that the information exchanged between agents is minimal compared to other methods, such as the ADMM method [36,37] and the primal-dual gradient [33]. Since the shared information is very small, the communication overhead is lower and the risk of leakage of private information is also lower. Compared with the previous results in [35], the first difference is that the physical line flow constraints of the power grid are considered in our model. Line prices are introduced to induce agents to spontaneously adjust their power generation or consumption, as shown in (13). The second difference is that SC is used to implement the mechanism, including updating the energy quantities and prices, calculating the power flows, updating the line prices, convergence checking, storing the transaction results, and querying. Therefore, compared with previous work, the mechanism we developed is a more realistic and practical decentralized negotiation algorithm for P2P energy trading.

3.1.1. Local Optimization Problem

For each agent n in bus i, the local optimization problem at a given iteration k is
min C n ( E n ) m Ω n λ n m k E n m + l L n , m i , j m ω n φ i j l υ ¯ l k υ ̲ l k E n m
s . t . E n ̲ E n E n ¯
E n m 0 m ω n if n Ω p
E n m 0 m ω n if n Ω c
where λ n m are the dual variables of the equilibrium conditions (4) and define the traded energy prices E n m . λ n = { λ n 1 , . . . , λ n m } is used to represent the total traded energy prices between neighboring agents.

3.1.2. Primal Variable Updates

Updates to the energy quantities of agent n are based on the Karush–Kuhn–Tucker (KKT) conditions of the local optimization problem. The relaxed Lagrangian function of the local optimization problem (10) at iteration k can be expressed as follows:
L n l o c = C n ( E n ) m Ω n λ n m k E n m + l L n , m i , j m ω n φ i j l υ ¯ l k υ ̲ l k E n m + μ n ¯ ( E n E n ¯ ) μ n ̲ ( E n E n ̲ )
According to the first-order optimality conditions of the Lagrangian problem, for all trades between agents n Ω and m ω n , we have
a n E n + b n λ n m k + n , m i , j l L φ i j l υ ¯ l k υ ̲ l k + μ n ¯ k μ n ̲ k = 0
Then, we can obtain that
E n k + 1 = λ n m k n , m i , j l L φ i j l υ ¯ l k υ ̲ l k μ n ¯ k + μ n ̲ k b n a n
According to the complementary conditions μ n ¯ × E n ¯ = μ n ̲ × E n ̲ = 0 , the above update (13) can be equivalently transformed to another more concise form, as below:
E n k + 1 = max min λ n m k n , m i , j l L φ i j l υ ¯ l k υ ̲ l k b n a n , E n ¯ , E n ̲
In this way, the dual variables { υ ¯ l k , υ ̲ l k } is omitted and the update process is simpler. Then, the primal variables E n m , m ω n are updated as below (here for a producer):
E n m k + 1 = E n m k + f n m k ( E n ( m ) , k + 1 E n ( m ) , k ) +
where f n m is an asymptotically proportional factor defined as
f n m k = E n m k + δ k l ω n E n l k + δ k
with δ k a positive constant. The operator [ · ] + = max ( 0 , · ) in (15) is used to enforce the sign constraint of the decision variables and is replaced in the case of a consumer by operator [ · ] = min ( 0 , · ) .

3.1.3. Dual Variable Updates

The price for a given trade is calculated individually by each agent. After convergence, a consensus has to be reached on these prices (i.e., λ n m = λ m n ). The energy price λ n m k + 1 will be updated in this form:
λ n m k + 1 = λ n m k β k ( λ n m k λ m n k ) α k ( E n m k + E m n k ) .
Price convergence is ensured in the price update by a consensus term. The last term, the innovation term, ensures energy equilibrium between agents. α k and β k are sequences of positive factors set by the individuals such that each excitation is persistent so that the series of each sequence converge. The tuning of these parameters ( α k and β k ) is key to the convergence performance of the algorithm and usually requires a trade-off between convergence speed and adaptation to changes in setting. Performance could be improved by using an adaptive parameter. The calculations steps (13)–(16) are all performed locally without communicating with others. Only in step (17) does agent n need to receive information { E m n k , λ m n k } from agent m to update the energy price λ n m k + 1 .
Finally, the line manager (LM) will be responsible for calculating the power flows in each line by (6), and the line prices υ ¯ l k + 1 , υ ̲ l k + 1 will be updated as
υ ¯ l k + 1 = υ ¯ l k + ϕ k P l k + 1 P l m a x +
υ ̲ l k + 1 = υ ̲ l k ϕ k P l k + 1 + P l m a x +
where ϕ k is the tuning parameter.

3.1.4. Condition of Convergence

The above decentralized algorithm converges as long as the following conditions are met:
n Ω m ω n E n m k + 1 E n m k χ E
n Ω m ω n λ n m k + 1 λ n m k χ λ
l L υ ¯ l k + 1 υ ¯ l k + υ ̲ l k + 1 υ ̲ l k χ υ
where χ E , χ λ and χ υ are stopping criterion predetermined by market operator.

3.2. Implementation of P2P Energy Trading by Smart Contracts

An illustration of the blockchain-based P2P trading architecture is shown in Figure 2. The process is described below.
  • In the first step, all agents initiate a pair of energy prices and quantities in parallel and send it to neighboring agents. Then, each agent updates its quantities and prices for its neighbors using (15) and (17), respectively. The update process is automatically performed by SC, which is installed on each agent.
  • After updating each agent, all agents send their traded energy to LM, which calculates the power flows and line prices on each line using (6) and (18), also from SC.
  • Then, LM sends the line flow prices to the corresponding agents using the particular line for power transmission. By applying these line usage price signals, the agents will try to trade energy with nearby ones, which can reduce power losses.
  • After each iteration, each agent and LM send the updated results to MO, who will check if the stopping criteria are met (19).
  • Finally, after the market converges, MO collects all transactions and stores them in the blockchain.

4. Privacy-Friendly P2P Computation Framework

We have formulated a decentralized negotiation algorithm between agents based on the C + I method, but there are still obvious shortcomings. During the negotiation process, agents need to share the updated energy and price data with neighboring agents, and privacy may be lost during the process. Malicious attackers can obtain private information by studying the updated energy and prices. Therefore, developing a privacy-friendly information exchange scheme is the prerequisite for P2P energy trading. In this paper, we propose a privacy-friendly, two-party, secure computation scheme, mainly using HE technology, SC, and ZKP to realize secure information exchange between agents. To our knowledge, none of the existing work uses HE for P2P energy trading. Previous works mainly use HE to solve the AC optimal power flow (ACOPF) problem [25], DC optimal power flow [27], and gradient-based distributed optimization [28]. Our work is the first attempt to combine the HE method with a consensus-based approach and to apply it to the P2P energy-trading mechanism. In the proposed scheme, encryption is implemented by the Paillier cryptosystem [38].
There are two security goals for the privacy-friendly P2P computational framework. The first is to protect individual private information F n m k = E n m k , λ n m k from attacks and acquisition by malicious neighboring agents. The second task is to guarantee that the third party (not the agents) follows the energy price update rules (17) during operation.

4.1. Collusion Attack

To perform C + I updates, a minimum amount of information must be exchanged. At each iteration of the process, the set F n m k of information sent from one agent n Ω to a neighboring agent m ω n at iteration k must be the following:
F n m k = E n m k , λ n m k
The internal production/consumption parameters ( a n , b n , E n ¯ , E n ̲ ) of all agents need not be shared to achieve optimality.
However, this mechanism cannot protect individual privacy. Consider a specific scenario in which the neighboring agents of agent n conspire to obtain the internal production/consumption parameters of agent n, as shown in Figure 3a. We will introduce two attack strategies to derive the parameters ( E n ¯ , E n ̲ ) and ( a n , b n ) , respectively.
1.
If agent n is a producer, all neighboring agents (consumers) can intentionally increase the purchase price λ m n little by little until E n m remains unchanged between two iterations. In this case, the output of agent n has reached the upper bound E n ¯ . After that, all neighboring agents can communicate with each other to sum all E n m and obtain the private information E n ¯ . Similarly, a group of malicious neighboring agents can cooperatively lower the purchase price to obtain the lower bound E n ̲ .
2.
Since the neighboring agents of agent n have received the information about the power boundaries, the group of neighbors for the power update (13) can construct a set λ n such that the output does not reach ( E n ¯ , E n ̲ ) , (means μ n ¯ = μ n ̲ = 0 ). Under this construction, the update (13) can be simplified as follows:
E n k + 1 = λ n m k n , m i , j l L φ i j l υ ¯ l k υ ̲ l k b n a n , m ω n
By substituting two iteration results λ n k , E n k + 1 , λ n k + 1 , E n k + 2 (where E n can be obtained by summing up all E n m ) into (21), a n can be solved by randomly choosing a trade with neighbor m, as below:
a n = λ n m k + 1 λ n m k V n m k + 1 V n m k E n k + 1 E n k
where V n m k = n , m i , j l L φ i j l υ ¯ l k υ ̲ l k , and this is all public information. After obtaining a n , b n can be readily calculated by (21).
Thus, although very little information needs to be shared in C + I updates, there is still the risk of loss of privacy in the event of a clandestine attack by a group of malicious neighboring agents. There is a need to develop a privacy-protection mechanism for P2P negotiations between agents.

4.2. Homomorphic Encryption/Decryption Mechanism

The Paillier algorithm implementation scheme is detailed below [39].
Key generation: Two prime numbers p and q are randomly chosen to satisfy g c d ( p q , ( p 1 ) ( q 1 ) ) = 1 , where g c d stands for the greatest common divisor. Then, N = p q and λ = l c m ( p 1 , q 1 ) are founded, where l c m stands for the least common multiple. We randomly pick g Z N 2 to satisfy g c d ( L ( g λ m o d N 2 ) , N ) = 1 and ensure there exists
μ = ( L ( g λ m o d N 2 ) ) 1 m o d N
where L ( x ) = x 1 N . The public key is found as N , g , and the private key is found as λ , μ .
Encryption Function (Enc): Let the plaintext message be m Z N and the public key be p k ; then, the encrypting function is
E n c ( m , p k ) = g m · r N m o d N 2
where r is a random pad r Z N 2 .
Decryption Function (Enc): Let the ciphertext be c and the secret key be s k , the plaintext can be computed as follows:
m = D e c ( c , s k ) = L ( c λ m o d N 2 ) L ( g λ m o d N 2 ) m o d N = L ( c λ m o d N 2 ) μ m o d N .
Property 1. (Additive Homomorphic):
The additive homomorphic property allows the user to operate the message in its ciphertext directly. Assume the two plaintexts are m 1 , m 2 and the key pair is s k i , p k i ; then, we have
c 1 = E n c ( m 1 , p k i ) g m 1 · r 1 N m o d N 2 c 2 = E n c ( m 2 , p k i ) g m 2 · r 2 N m o d N 2
Obviously, we have c 1 c 2 g m 1 + m 2 · ( r 1 · r 2 ) N m o d N 2 ; thus, we can conclude that
m 1 + m 2 m o d N = D e c ( E n c ( m 1 , p k i ) E n c ( m 2 , p k i ) , s k i ) = D e c ( c 1 c 2 , s k i ) .
Property 2. (Non-Deterministic):
The non-deterministic means that a given plaintext can be encrypted into a very large set of possible ciphertexts. This property prevents an adversary from associating ciphertext with observed information.

4.3. Two-Party, Secure Computation

A privacy-preserving, two-party, secure computation framework is designed using HE, ZKP, and SC, as shown in Figure 3b. Before submitting the transaction data to SC, the agents use the public keys generated by the Paillier encryption algorithm to encrypt the aggregated transaction data. The data are in the form of ciphertext, which does not reveal any private information of the agents even if an attacker obtains it. The result of the ciphertext operation matches the result of the plaintext operation Compared to standard public key encryption, it is the simpler method with the same result, but there is no guarantee that agent n follows the rules to compute λ n m k + 1 . Agent n can increase λ n m k + 1 to make more profit but runs the risk of not offering enough goods in real time. The combination of HE and SC costs more computational resources but can guarantee the update of energy prices, fend off privacy attacks, and restore the computation result to the blockchain for verification.
Looking at the update steps, only the energy price update (17) will use the information F n m k = E n m k , λ n m k received from neighbor m. Thus, the energy price update is implemented by the Paillier encryption algorithm since it satisfies additive homomorphic. The HE- based secure two-party computation algorithm is described below.
  • Agent n generates an individual public key p k n and a secret key s k n . The public key is sent to agent m for encryption.
  • Agent n performs an aggregation operation I n m = ( 1 β k ) λ n m k α k E n m k , and an encryption E n c ( I n m , p k n ) is sent to SC on Agent n.
  • Agent m also first performs an aggregation operation I m n = β k λ m n k α k E m n k and an encryption E n c ( I m n , p k n ) using agent n’s public key and sends it to SC.
  • After collecting the information from two agents, SC computes E n c ( I n m , p k n ) E n c ( I m n , p k n ) . From (17), we have λ n m k + 1 = I n m + I m n . Thus, according to the additive homomorphic encryption property, the result is E n c ( λ n m k + 1 , p k n ) , which will be sent to agent n and m.
  • Agent n executes D e c E n c ( λ n m k + 1 , p k n ) , s k n to obtain the decryption λ n m k + 1 and sends it to Agent m.
  • Agent n generates and sends a ZKP to Agent m to prove that the plaintext λ n m k + 1 is correct with the ciphertext E n c ( λ n m k + 1 , p k n ) computed by SC. Details of the construction of the ZKP are provided in Appendix A.
Remark 1.
Another challenge is to verify the authenticity of the message E n c ( I n m , p k n ) . To solve this problem, we can take advantage of digital signatures. Agent n first uses a one-way hash function to obtain a 128-bit digest H ( E n c ( I n m , p k n ) ) and then encrypts the digest with its private key to obtain the encrypted digest D n = E n c ( H ( E n c ( I n m , p k n ) ) , s k n ) ) . The message E n c ( I n m , p k n ) , the encrypted digest D n , and the public key p k n are packed and sent to SC. SC verifies the authenticity of the message by checking that the digest of the message processed by the hash function matches the decryption of the received encrypted digest with the public key, i.e.,
H ( E n c ( I n m , p k n ) ) = ? D e c ( D n , p k n )

4.4. Security and Privacy Analysis

Given the two security goals, to achieve the first goal, we first perform an information aggregation operation for agent n and m, respectively ( I n m = ( 1 β k ) λ n m k α k E n m k and I m n = β k λ m n k α k E m n k ). By using aggregation operations, even if attackers obtain the information, they cannot reveal the original information. Then, agent n uses public key p k n to encrypt I n m and sends p k n to neighboring agent m to encrypt I m n . The information is encrypted with the public key of agent n, so even if the information is obtained by malicious attackers, the original data cannot be recovered without the private key. The information is encrypted with agent n’s public key, so it is undeniable that agent n can recover I m n . However, agent n can only obtain the value of I m n ; there is no way for agent n to recover the original private information { E m n k , λ m n k } from I m n since the aggregation operation is performed locally in agent m.
To achieve the second goal, the third party is traditionally required to provide zero-knowledge proof of the additional operation. However, this can lead to a higher computational cost for generating the proof. In this work, HE ensures that the decryption value of the result of the ciphertext computation is equal to the result of the plaintext computation, and we use secure SC to realize the ciphertext computation E n c ( I n m , p k n ) E n c ( I m n , p k n ) . Thus, the combination of SC and HE can ensure the correctness of the result E n c ( λ n m k + 1 , p k n ) . Moreover, we design a ZKP protocol to prove that the decrypted result is correct with the ciphertext computed by SC using Paillier’s algorithm.
Through the above analysis, it is concluded that using a combination of HE, SC, and ZKP to build the two-party secure operation is a very useful and efficient way to satisfy the security goals of P2P energy trading.

5. Results

This section presents numerical results for performance evaluation of the proposed privacy-preserving, P2P negotiation mechanism using different case studies. The case studies were conducted on a computer with an Intel Core i7 processor running at 2.90 GHz and 32 GB RAM. We use Ganache to set up a private Ethereum Homestead blockchain test network. Remote procedure calls via Web3.py/HTTP allow the Python scripts to communicate with the SCs. The Solidity language is used to develop the SCs, which is a special language for SCs on Ethereum.

5.1. Simulation Setup

For illustration and discussion, a small distribution network with seven agents is considered as in [33]. The convergence performance, line congestion management, and encryption algorithm performance are shown in Figure 4, Figure 5 and Figure 6, respectively. Then, we investigate the impact of the number of agents on convergence performance, as measured by the number of iterations and computation time, and the results are shown in Figure 7. The results verify that our proposed mechanism is feasible for networks with a large number of agents. For line congestion management, the verification results in networks with 13 nodes are sufficient to prove the feasibility of the proposed mechanism in large networks. Finally, regarding the performance of the encryption algorithm, increasing the number of nodes has little impact on the computational performance since the method is used for the negotiation process between two agents.
There are seven agents in the power network, consisting of four sellers and three buyers. The test system is a 13-node network, as shown in Figure 8. The sellers are located at buses 2, 5, 8, and 10, and the buyers are located at buses 3, 4, and 9. Bus 1 is the reference bus. The connections indicate the physical electrical connections, and the communication network is assumed to have a connected network for the communication of all agents. The parameters of sellers and buyers are listed in Table 1. We set the susceptance of each branch to b 1 = b 2 = = b L = 10 s . All stopping criteria χ are set to 10 4 . The tuning parameters are chosen as follows:
δ k = 0.1 , β k = 0.1 k 0.1 , α k = 0.1 k 0.01 , ϕ k = 10
and the stopping criteria are set to
χ E = 0.01 , χ λ = 0.01 , χ υ = 0.01

5.2. Convergence Performance of the Negotiation Mechanism

In this case study, the maximum line capacity P l m a x for all lines is set to 10. The convergence process of the algorithm is shown in Figure 4, from which it can be seen that all trading between sellers and buyers converges after about 160 iterations. Although the consensus-based algorithm requires a minimum amount of information to be exchanged, the main drawback is that the number of iterations to converge can be higher than other methods. It can be seen that the sum of the absolute values of the gap of energy quantity and prices decreases with oscillation, while the sum of the absolute values of the gap of line prices remains at zero since no line is congested. The final traded energy quantities and prices are shown in Table 2. It is noticeable that the results of S1 and S3 are the same because their parameters a n and b n are the same. For B1 and B3, the purchase prices are the same, but the quantities of B3 are higher because the demand of B3 is higher (−8 < −7).

5.3. Performance of Line Congestion Management

The impact of line capacity limit on power flow is investigated. The maximum line capacity for these lines ranges from 3 to 8 kW. In the test system, the results are shown only for lines with non-zero power flow. The results are shown in Figure 5, and it is confirmed that the power flows in these lines are always within the maximum line capacity, which means that the proposed algorithm can meet the line flow constraints in the P2P power grid. If there is a congested line in the network, agents will avoid trading over the congested lines because they have to pay additional network charges

5.4. Performance of Scalability

In the real world, the P2P energy trading mechanism will be used in power networks with a large number of agents, and the number of transactions will be significant. The computation time and the number of iterations are two key factors that measure the scalability of the mechanism. To demonstrate the scalability of our mechanism, we add more agents to each bus. The parameters of the agents are chosen randomly, while the tuning parameters ( δ k , β k , and   α k ) are carefully designed for tolerable performance. The line capacity is chosen large enough to make no congestion happens. Figure 7 shows the effects of the number of agents (between 70 and 420) on the two factors. It can be seen that both the computation time and the number of iterations increase approximately linearly with the number of agents. The performance of computational time is excellent (under 4 s for 420 agents), but more iterations (almost 450) cost. The results show that our proposed mechanism is feasible for networks with a large number of agents.

5.5. Encryption Algorithm Computation Performance Analysis

In this section, we analyze the trade-off between privacy and computational cost. In the original decentralized negotiation mechanism, where no homomorphic encryption is applied, the computation time of each agent for each iteration is so small that it is negligible. To ensure privacy, a privacy-preserving mechanism based on homomorphic encryption is proposed to be used at each iteration. Agents need to encrypt their private information and to submit it to SC to perform ciphertext computation. The Paillier homomorphic encryption used in the simulation comes from the phe (Partially Homomorphic Encryption) library in Python. Figure 6a shows the encryption and decryption time of the agents. The encryption time of agent n and m is close to each other and is about 0.11 s. The decryption time is much lower compared to the encryption time and is about 0.03 s. Figure 6b shows the public/private key and the size of the ciphertext. The size of the ciphertext is slightly larger than 1750, while the public/private keys are much smaller.

5.6. Computational Performance under Different Mechanisms

In this section, we investigate the computational performance under four different mechanisms. (1) P2P trading is performed without a privacy-preserving mechanism. (2) P2P trading runs under the Paillier HE mechanism. The agents each encrypt their bid information { λ n m , E n m } and send it to a program to perform cipher computation. (3) P2P trading runs under the two-party, secure computation mechanism without ZKP. (4) P2P trading runs under the two-party, secure computation mechanism with ZKP. The computation time for each agent in one iteration is displayed in Figure 9. It can be seen that the computation efficiency is very high without any privacy mechanism. The time spent on the second mechanism is higher than for the third because more information needs to be encrypted, which is very time-consuming. The efficiency of the third mechanism is at a medium level and is acceptable. The agents only need to encrypt the aggregated information { I n m , I m n } , which can greatly reduce the time consumption. Finally, the fourth mechanism is the most ineffective one because the ZKP protocol is very time-consuming and, most of the time, is for computing the inverse element by the expand Euclid algorithm ( M = N 1 m o d ϕ ( N ) ). This problem will be studied in our future work.

5.7. Blockchain-Based P2P Energy-Trading Platform

In our simulation, we use Ganache to establish a private Ethereum homestead blockchain named ”Privacy-Preserving P2P Market”, as shown in Figure 10. The first address belongs to MO; the second is LM’s address. The remaining addresses are assigned to each agent. The local computation steps are performed by Python’s codes, and then, the encrypted information is sent via Web3.py/HTTP to SC installed on Ganache.
The agents have two ways to update the energy prices. The first is to run SC S C A G to automatically update the energy prices. The second option is to submit the encrypted information to SC S C A G H E to implement the ciphertext calculation. After updating the energy quantities and prices disseminated over the network, LM updates the power flows and line prices via SC S C L M , while MO checks whether the market converges via S C C O . Finally, after all trades are balanced, MO stores the transaction results on the blockchain via S C T R , which can be checked by anyone on the network.

6. Discussion

The most valuable achievement of our proposed mechanism is to provide a privacy-preserving, two-party, secure computation mechanism for the P2P negotiation mechanism between each pair of agents. The agents cannot know each other’s actual bidding information. However, operational efficiency has been sacrificed for privacy protection. A lot of time and computing power are spent on encrypting and decrypting information. In addition, the introduction of SC further extends the time to achieve convergence.
Therefore, our future work will mainly focus on how to increase the computational efficiency under the privacy-friendly mechanism. The first way is to develop a P2P negotiation mechanism that uses a more efficient decentralized optimization algorithm. For example, the consensus ADMM algorithm [31,32], which can guarantee convergence with a smaller number of iterations. The challenge is to combine the consensus ADMM with the HE mechanism. Another way to increase efficiency is to reduce the amount of information to be encrypted or protected. As we analyzed in Section 3.1, in the C + I method, private information is revealed and disclosed only in the collusion attack by all neighboring agents. If we carefully select a part of the exchanged information to be encrypted, the private information can also be protected. We can perform the two-party secure computation with only one neighboring agent, and that is enough to protect private information from attacks. With this strategy, the computation cost can be reduced from O ( N 2 Δ T ) to O ( N Δ T ) , where Δ T is the sum of the encryption and decryption time of the two-party secure computation.

7. Conclusions

In the P2P energy market, agents must exchange a large amount of information to reach consensus on the final trade. However, this fully decentralized negotiation may lead to the disclosure of private information. In this paper, we propose a privacy-preserving, two-party, secure computation mechanism for P2P energy trading that leverages many technologies. We first design a P2P negotiation mechanism based on the C + I method and the PTDF model. This mechanism can maximize social welfare while satisfying the physical line flow constraints. Then, for this mechanism, we analyze the two collusion attack strategies to obtain private information from a group of malicious neighboring agents. To protect against this kind of attacks, a two-party, secure computation mechanism is proposed for each pair of agents to update the energy prices. The agents first aggregate their bid price and bid quantity and then encrypt the information with the public key generated by the Paillier algorithm. Then, the computation of the ciphertext is automatically performed by SC, and the correctness of the decryption is proved by a ZKP protocol. The simulation results demonstrate the performance of convergence, line congestion management, scalability, computation efficiency, and SC operations.

Author Contributions

Conceptualization, Z.L. and Z.G.; Methodology, Z.L. and Z.G.; Validation, F.Z.; Investigation, B.Z.; Software, M.X.; Writing—original draft, Z.L. and H.X.; Writing—review and editing, Z.G.; Project administration, H.X.; Funding acquisition, Z.L. and Z.G. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the 2020 Industrial Internet Innovation and Development Project—For the Power Industry Industrial Internet Network Trust Support Platform Project (grant number: JL71-20-017), the Populus Euphratica Found grand number (grant number: CCF-HuaweiBC2021009), and the Open Research Fund of Key Laboratory of Cryptography of Zhejiang Province (grand number: ZCL21007).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Nomenclature

C n ( · ) Production cost or utility function of agent n
i , j Indices for buses
n , m Indices for agents
lIndex for power lines
E ̲ , E ¯ Boundaries of power
a n , b n , c n Coefficients of the quadratic function of agent n
L Set of lines
N Set of buses
Ω Set of agents
Ω p Set of energy producers
Ω c Set of energy consumers
ω Set of neighboring agents
λ n m Energy prices provided by n to m
E n Power injection or total traded quantity of agent n
E n m Traded energy quantity from n to m
P l Power flow of line l
φ i j Power transfer distribution factor of line l connecting bus i and j
ψ i l Injection shift factor in line l for bus i
ABranch to node incidence matrix
B Diagonal branch susceptance matrix
CReduced nodal susceptance matrix
P l m a x Maximum capacity of line l
υ ¯ l , υ ̲ l Upper bound and lower bound prices of l
μ n ¯ , μ n ̲ k Dual variables for power boundaries
f n m Asymptotically proportional factor
α k , β k Sequences of positive factors at iteration k
ϕ k Tuning parameter
χ E , χ λ , χ υ Stopping criterion
I n m Aggregation Information
p k n , s k n Public key and secret key of agent n

Appendix A

The problem is how agent n can prove that the decrypted result λ n m k + 1 is correct with the ciphertext E n c ( λ n m k + 1 , p k n ) computed by SC. This can be carried out using a zero-knowledge proof to prove that a Paillier ciphertext is an encryption of zero. For simplicity, let c = E n c ( λ n m k + 1 , p k n ) be the original ciphertext, and let d be the decryption that agent n sends to agent m. Then, both n and m can each locally use the homomorphic property to compute a ciphertext c equal to the value of c minus the encrypted d, i.e., c = c E ( d ) . Note: If c is an encryption of d; then, c is an encryption of zero, since c = E ( d ) E ( d ) = E ( d d ) = E ( 0 ) .
Thus, it suffices for n with zero knowledge to prove that c is an encryption of zero (or, put another way, that c = r N m o d N 2 ). This can be carried out very efficiently using an improved method described in Section 5.2 of “A Generalization of Paillier’s Public-Key System with Applications to Electronic Voting” by Damgard and Jurik [40]. In this method, the inverse element is computed using the expand Euclid algorithm. The protocol is described in detail in Algorithm A1, and for a detailed proof, we refer to Lemma 3 in Section 5.2 of [40].
Algorithm A1: Protocol for proving c is an encryption of zero
Input: N = p q , c
1
Prover P calculate: M = N 1 m o d ϕ ( N ) and r = c M m o d N such that c = E ( 0 , r )
2
P chooses v at random in Z N 2 and sends a = E ( 0 , v ) to Verifier V
3
V chooses e, a random t bit number, and sends e to P.
4
P sends z = v r e m o d N to V.
5
V checks that c , a, z are prime to N and E ( 0 , z ) = a c e m o d N 2 , and accepts if and
  only if this is the case.

References

  1. Hussain, S.; Kim, Y.C. Fault resilient communication network architecture for monitoring and control of wind power farms. In Proceedings of the 2016 18th International Conference on Advanced Communication Technology (ICACT), PyeongChang, Republic of Korea, 31 January–3 February 2016; pp. 685–692. [Google Scholar]
  2. Hussain, S.; Thakur, S.; Shukla, S.; Breslin, J.G.; Jan, Q.; Khan, F.; Kim, Y.S. A two-layer decentralized charging approach for residential electric vehicles based on fuzzy data fusion. J. King Saud Univ. Comput. Inf. Sci. 2022, 34, 7391–7405. [Google Scholar] [CrossRef]
  3. Hussain, S.; Mohammad, F.; Kim, Y.C. Communication network architecture based on logical nodes for electric vehicles. In Proceedings of the 2017 International Symposium on Information Technology Convergence, Shijiazhuang, China, 18–20 October 2017; pp. 19–21. [Google Scholar]
  4. Hussain, S.; Kim, Y.S.; Thakur, S.; Breslin, J.G. Optimization of waiting time for electric vehicles using a fuzzy inference system. IEEE Trans. Intell. Transp. Syst. 2022, 23, 15396–15407. [Google Scholar] [CrossRef]
  5. Cao, Y.; Kaiwartya, O.; Zhuang, Y.; Ahmad, N.; Sun, Y.; Lloret, J. A decentralized deadline-driven electric vehicle charging recommendation. IEEE Syst. J. 2018, 13, 3410–3421. [Google Scholar] [CrossRef] [Green Version]
  6. Hassan, A.N.; Abdullah, A.H.; Kaiwartya, O.; Cao, Y.; Sheet, D.K. Multi-metric geographic routing for vehicular ad hoc networks. Wirel. Netw. 2018, 24, 2763–2779. [Google Scholar] [CrossRef]
  7. Schollmeier, R. A definition of peer-to-peer networking for the classification of peer-to-peer architectures and applications. In Proceedings of the First International Conference on Peer-to-Peer Computing, Linkoping, Sweden, 27–29 August 2001; pp. 101–102. [Google Scholar]
  8. Tushar, W.; Saha, T.K.; Yuen, C.; Morstyn, T.; McCulloch, M.D.; Poor, H.V.; Wood, K.L. A motivational game-theoretic approach for peer-to-peer energy trading in the smart grid. Appl. Energy 2019, 243, 10–20. [Google Scholar] [CrossRef]
  9. Tushar, W.; Chai, B.; Yuen, C.; Smith, D.B.; Wood, K.L.; Yang, Z.; Poor, H.V. Three-party energy management with distributed energy resources in smart grid. IEEE Trans. Ind. Electron. 2014, 62, 2487–2498. [Google Scholar] [CrossRef] [Green Version]
  10. Kursawe, K.; Danezis, G.; Kohlweiss, M. Privacy-friendly aggregation for the smart-grid. In International Symposium on Privacy Enhancing Technologies Symposium; Springer: Berlin/Heidelberg, Germany, 2011; pp. 175–191. [Google Scholar]
  11. Ács, G.; Castelluccia, C. I have a dream! (differentially private smart metering). In International Workshop on Information Hiding; Springer: Berlin/Heidelberg, Germany, 2011; pp. 118–132. [Google Scholar]
  12. Hong, Y.; Liu, W.M.; Wang, L. Privacy preserving smart meter streaming against information leakage of appliance status. IEEE Trans. Inf. Forensics Secur. 2017, 12, 2227–2241. [Google Scholar] [CrossRef]
  13. Shukla, S.; Thakur, S.; Hussain, S.; Breslin, J.G. A Blockchain-Enabled Fog Computing Model for Peer-To-Peer Energy Trading in Smart Grid. In International Congress on Blockchain and Applications; Springer: Berlin/Heidelberg, Germany, 2021; pp. 14–23. [Google Scholar]
  14. Dang, C.; Zhang, J.; Kwong, C.P.; Li, L. Demand side load management for big industrial energy users under blockchain-based peer-to-peer electricity market. IEEE Trans. Smart Grid 2019, 10, 6426–6435. [Google Scholar] [CrossRef]
  15. Luo, F.; Dong, Z.Y.; Liang, G.; Murata, J.; Xu, Z. A distributed electricity trading system in active distribution networks based on multi-agent coalition and blockchain. IEEE Trans. Power Syst. 2018, 34, 4097–4108. [Google Scholar] [CrossRef]
  16. Kang, J.; Yu, R.; Huang, X.; Maharjan, S.; Zhang, Y.; Hossain, E. Enabling localized peer-to-peer electricity trading among plug-in hybrid electric vehicles using consortium blockchains. IEEE Trans. Ind. Inform. 2017, 13, 3154–3164. [Google Scholar] [CrossRef]
  17. Yang, X.; Wang, G.; He, H.; Lu, J.; Zhang, Y. Automated demand response framework in ELNs: Decentralized scheduling and smart contract. IEEE Trans. Syst. Man Cybern. Syst. 2019, 50, 58–72. [Google Scholar] [CrossRef]
  18. Wang, S.; Taha, A.F.; Wang, J.; Kvaternik, K.; Hahn, A. Energy crowdsourcing and peer-to-peer energy trading in blockchain-enabled smart grids. IEEE Trans. Syst. Man Cybern. Syst. 2019, 49, 1612–1623. [Google Scholar] [CrossRef] [Green Version]
  19. Han, D.; Zhang, C.; Ping, J.; Yan, Z. Smart contract architecture for decentralized energy trading and management based on blockchains. Energy 2020, 199, 117417. [Google Scholar] [CrossRef]
  20. AlSkaif, T.; Crespo-Vazquez, J.L.; Sekuloski, M.; van Leeuwen, G.; Catalão, J.P. Blockchain-based fully peer-to-peer energy trading strategies for residential energy systems. IEEE Trans. Ind. Inform. 2021, 18, 231–241. [Google Scholar] [CrossRef]
  21. Zhang, M.; Eliassen, F.; Taherkordi, A.; Jacobsen, H.A.; Chung, H.M.; Zhang, Y. Demand–Response Games for Peer-to-Peer Energy Trading With the Hyperledger Blockchain. IEEE Trans. Syst. Man Cybern. Syst. 2021, 52, 19–31. [Google Scholar] [CrossRef]
  22. AlAshery, M.K.; Yi, Z.; Shi, D.; Lu, X.; Xu, C.; Wang, Z.; Qiao, W. A blockchain-enabled multi-settlement quasi-ideal peer-to-peer trading framework. IEEE Trans. Smart Grid 2020, 12, 885–896. [Google Scholar] [CrossRef]
  23. Li, Y.; Yang, W.; He, P.; Chen, C.; Wang, X. Design and management of a distributed hybrid energy system through smart contract and blockchain. Appl. Energy 2019, 248, 390–405. [Google Scholar] [CrossRef]
  24. Acar, A.; Aksu, H.; Uluagac, A.S.; Conti, M. A survey on homomorphic encryption schemes: Theory and implementation. ACM Comput. Surv. (CSUR) 2018, 51, 1–35. [Google Scholar] [CrossRef]
  25. Cheng, Z.; Ye, F.; Cao, X.; Chow, M.Y. A homomorphic encryption-based private collaborative distributed energy management system. IEEE Trans. Smart Grid 2021, 12, 5233–5243. [Google Scholar] [CrossRef]
  26. Yi, H.; Lin, W.; Huang, X.; Cai, X.; Chi, R.; Nie, Z. Energy trading IoT system based on blockchain. Swarm Evol. Comput. 2021, 64, 100891. [Google Scholar] [CrossRef]
  27. Liu, N.; Wang, C.; Cheng, M.; Wang, J. A privacy-preserving distributed optimal scheduling for interconnected microgrids. Energies 2016, 9, 1031. [Google Scholar] [CrossRef] [Green Version]
  28. Lu, Y.; Zhu, M. Privacy preserving distributed optimization using homomorphic encryption. Automatica 2018, 96, 314–325. [Google Scholar] [CrossRef] [Green Version]
  29. Lu, Y.; Lian, J.; Zhu, M. Privacy-preserving transactive energy system. In Proceedings of the 2020 American Control Conference (ACC), Denver, CO, USA, 1–3 July 2020; pp. 3005–3010. [Google Scholar]
  30. Day, R.H. Rational choice and economic behavior. Theory Decis. 1971, 1, 229–251. [Google Scholar] [CrossRef]
  31. Guo, Z.; Pinson, P.; Chen, S.; Yang, Q.; Yang, Z. Chance-constrained peer-to-peer joint energy and reserve market considering renewable generation uncertainty. IEEE Trans. Smart Grid 2020, 12, 798–809. [Google Scholar] [CrossRef]
  32. Guo, Z.; Pinson, P.; Chen, S.; Yang, Q.; Yang, Z. Online optimization for real-time peer-to-peer electricity market mechanisms. IEEE Trans. Smart Grid 2021, 12, 4151–4163. [Google Scholar] [CrossRef]
  33. Khorasany, M.; Mishra, Y.; Ledwich, G. A decentralized bilateral energy trading system for peer-to-peer electricity markets. IEEE Trans. Ind. Electron. 2019, 67, 4646–4657. [Google Scholar] [CrossRef] [Green Version]
  34. Liu, M.; Gross, G. Role of distribution factors in congestion revenue rights applications. IEEE Trans. Power Syst. 2004, 19, 802–810. [Google Scholar] [CrossRef]
  35. Sorin, E.; Bobo, L.; Pinson, P. Consensus-based approach to peer-to-peer electricity markets with product differentiation. IEEE Trans. Power Syst. 2018, 34, 994–1004. [Google Scholar] [CrossRef] [Green Version]
  36. Baroche, T.; Pinson, P.; Latimier, R.L.G.; Ahmed, H.B. Exogenous cost allocation in peer-to-peer electricity markets. IEEE Trans. Power Syst. 2019, 34, 2553–2564. [Google Scholar] [CrossRef] [Green Version]
  37. Moret, F.; Pinson, P. Energy collectives: A community and fairness based approach to future electricity markets. IEEE Trans. Power Syst. 2019, 34, 3994–4004. [Google Scholar] [CrossRef]
  38. Paillier, P. Public-key cryptosystems based on composite degree residuosity classes. In Proceedings of the International Conference on the Theory and Applications of Cryptographic Techniques, Prague, Czech Republic, 2–6 May 1999; Springer: Berlin/Heidelberg, Germany, 1999; pp. 223–238. [Google Scholar]
  39. Ma, Y.; Qiu, J.; Sun, X.; Tao, Y. A Multi-Stage Information Protection Scheme for CDA-Based Energy Trading Market in Smart Grids. IEEE Trans. Smart Grid 2021, 13, 2305–2317. [Google Scholar] [CrossRef]
  40. Damgård, I.; Jurik, M.; Nielsen, J.B. A generalization of Paillier’s public-key system with applications to electronic voting. Int. J. Inf. Secur. 2010, 9, 371–385. [Google Scholar] [CrossRef]
Figure 1. P2P energy-trading market architecture.
Figure 1. P2P energy-trading market architecture.
Sensors 22 09020 g001
Figure 2. Blockchain-based P2P energy-trading market architecture.
Figure 2. Blockchain-based P2P energy-trading market architecture.
Sensors 22 09020 g002
Figure 3. Collusion attack for malicious neighboring agents and two-party, secure computation between two agents.
Figure 3. Collusion attack for malicious neighboring agents and two-party, secure computation between two agents.
Sensors 22 09020 g003
Figure 4. Convergence of the algorithm.
Figure 4. Convergence of the algorithm.
Sensors 22 09020 g004
Figure 5. Power flow in different lines under different line capacities.
Figure 5. Power flow in different lines under different line capacities.
Sensors 22 09020 g005
Figure 6. Encryption algorithm computation performance. (a) Agent encryption and decryption time. (b) The size of the public/private keys and ciphertext.
Figure 6. Encryption algorithm computation performance. (a) Agent encryption and decryption time. (b) The size of the public/private keys and ciphertext.
Sensors 22 09020 g006
Figure 7. Impact of number of agents on computation time and number of iterations for convergence.
Figure 7. Impact of number of agents on computation time and number of iterations for convergence.
Sensors 22 09020 g007
Figure 8. Test system schematic.
Figure 8. Test system schematic.
Sensors 22 09020 g008
Figure 9. Computational time of different P2P negotiation mechanisms.
Figure 9. Computational time of different P2P negotiation mechanisms.
Sensors 22 09020 g009
Figure 10. P2P energy-trading blockchain, smart contracts, and transactions results stored on the blockchain.
Figure 10. P2P energy-trading blockchain, smart contracts, and transactions results stored on the blockchain.
Sensors 22 09020 g010
Table 1. Sellers’ and buyers’ parameters of a simple case study.
Table 1. Sellers’ and buyers’ parameters of a simple case study.
AgentBusan (USD/kW2)bn (USD/kW) E n ¯ (kW) E n ¯ (kW)
S120.04117
S250.046114
S380.04116
S4100.05115
B130.053−7−1
B240.0563−6−1
B390.053−8−1
Table 2. Final traded quantities and prices of energy.
Table 2. Final traded quantities and prices of energy.
B1B2B3
S11.75 kW/1.21 USD/kW1.50 kW/1.19 USD/kW2.00 kW/1.24 USD/kW
S21.33 kW/2.74 USD/kW1.27 kW/2.72 USD/kW1.37 kW/2.74 USD/kW
S31.75 kW/1.21 USD/kW1.50 kW/1.19 USD/kW2.00 kW/1.24 USD/kW
S41.67 kW/2.66 USD/kW1.50 kW/1.24 USD/kW1.75 kW/2.65 USD/kW
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Li, Z.; Xu, H.; Zhai, F.; Zhao, B.; Xu, M.; Guo, Z. A Privacy-Preserving, Two-Party, Secure Computation Mechanism for Consensus-Based Peer-to-Peer Energy Trading in the Smart Grid. Sensors 2022, 22, 9020. https://doi.org/10.3390/s22229020

AMA Style

Li Z, Xu H, Zhai F, Zhao B, Xu M, Guo Z. A Privacy-Preserving, Two-Party, Secure Computation Mechanism for Consensus-Based Peer-to-Peer Energy Trading in the Smart Grid. Sensors. 2022; 22(22):9020. https://doi.org/10.3390/s22229020

Chicago/Turabian Style

Li, Zhihu, Haiqing Xu, Feng Zhai, Bing Zhao, Meng Xu, and Zhenwei Guo. 2022. "A Privacy-Preserving, Two-Party, Secure Computation Mechanism for Consensus-Based Peer-to-Peer Energy Trading in the Smart Grid" Sensors 22, no. 22: 9020. https://doi.org/10.3390/s22229020

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop