# Privacy-Preserving Electricity Trading for Connected Microgrids
## 1 Introduction  
In the traditional way of managing electric power, electricity is generated at power plants by large-scale energy producers (EPs). That energy is transmitted through the high-voltage network by transmission system operators (TSOs) which deliver it to regional or local distribution system operators (DSOs). Finally, DSOs distribute the energy to the households which consume it. In the last years, technology has made it feasible for consumers to act as small-scale producers by installing, for instance, solar panels on their roofs. When their production exceeds their individual demand, households can inject the excess of energy they produce into the grid. Consequently, households do not simply act as energy consumers, but they also produce and sell electricity, becoming prosumers. Smart meters are a fundamental component of this emerging scenario. These devices continuously monitor the energy that is being consumed or injected into the grid so that prosumers can be charged or retributed accordingly. The integration of the energy grid with Internet technology opens the door to decentralized ways of managing an electricity market in a P2P fashion. Three different P2P trading scenarios are distinguished in [1]: over-the-grid trading (consumers remain fully connected to the main grid), partly independent microgrid (a community remains grid-connected for redundancy) and fully independent microgrid (isolated self-sufficient electricity network). The amount of electricity taken off the grid for consumption, and the amount of electricity being put on the grid by electricity generation assets need to match almost perfectly. This issue is investigated in [2], where the authors classify customers by their consumption patterns and investigate the way to optimize the capacity of distributed energy sources in order to ensure a proper demand supply balance. The survey presented in [3] analyses the research topics relevant for P2P energy trading and identifies six areas: trading platform, blockchain, game theory, simulation, optimization and algorithms. Regarding the underpinning technology, blockchain has been widely proposed as a secure medium for electricity trade data management. The survey paper [4] reviews the scientific literature focusing on the application of blockchain in smart grids. Its authorsalso review research projects and products. A more recent survey [5] focuses on the security and privacy protection techniques designed for energy trading in blockchain-based public networks. On the flip side, Internet-based energy management comes at a cost in terms of security and privacy. The authors of [6] review the existing threats in smart grid networks and propose a taxonomy composed of three categories: threats to system-level security, threats to services and threats to privacy. A smart grid connected to the Internet is exposed to threats resulting from cyberattacks aiming to play havoc with such critical infrastructure [7]. Regarding privacy, a fine-grained and automated management of electricity consumption and production enables unlawful monitoring and profiling of prosumers not only from external attackers but from energy market service providers as well [8]. In fact, NILM (nonintrusive load monitoring) techniques make it possible to detect the activation of common electrical appliances from an aggregated consumption trace [9]. These data lead to accurate knowledge on private information such as the time people go to work, come back home, or the days they are on holidays. We claim that in order to preserve prosumers' privacy, the information collected and available to the electricity company should enable it to compute the bills while it must not be possible to infer detailed consumption or production traces from it. In this paper, we present a privacy-preserving system for trading locally produced electricity in a scenario composed of geographically close prosumers in which production and consumption demands are matched.