Smart contracts and homomorphic encryption for private P2P energy trading and demand response on blockchain

Heliyon. 2023 Nov 17;9(11):e22357. doi: 10.1016/j.heliyon.2023.e22357. eCollection 2023 Nov.

Abstract

Blockchain technology offers great value in terms of decentralization, data integrity, transparency, and traceability, however the transactional data is public, and accessible raising concerns about violating privacy regulations. For example, in the peer-to-peer energy trading and demand response use cases, the data stored in blockchain may allow a third party to infer the load profiles or even identify the behind the meter assets. In this paper, we employ homomorphic techniques to encrypt the energy transactional data stored on the blockchain allowing the smart contracts functions responsible for implementing the business logic of the energy flexibility trading and settlement to perform computations on encrypted data. As computations on smart contracts and public blockchains can be expensive, we have used the lighter version of the Partial Homomorphic Encryption scheme to obfuscate the energy data. To ensure the validity of the smart contracts' functions executed on encrypted data, we leverage on the consensus mechanism of the blockchain network, thus ensuring computation correctness. The solution was validated considering a micro-grid with 12 prosumers that trade their flexibility peer-to-peer (P2P). The results demonstrate the feasibility of maintaining encrypted energy data on the blockchain, executing smart contract functions on encrypted data, and preserving the privacy of computations. As anticipated, the trade-off for better privacy is the gas consumption overhead of the smart contracts' functions which is higher compared to the non-encrypted case, depending on the length of the public-private keys pair. Nonetheless, our solution exhibits consistent execution times for smart contracts, making it suitable for private networks where gas costs are of minimal concern.

Keywords: Blockchain; Demand response; Encrypted data; P2P energy trading; Privacy; Smart contracts.