# A Framework for Decentralized Energy Trading Based on Blockchain Technology
## 1 Introduction  
The demand of energy is growing worldwide, and this has to be met in a more environmental way, which has promoted the rapid development of distributed energy systems [1]. Moreover, the rapid development of technology has brought about a significant price reduction of photo voltaic panels and wind turbines, which led to the thriving of small-scale power plants. It is expected that most homes will be equipped with small-scale solar panels and wind turbines [2; 3; 4]. In the visible future, they can not only realize energy self-sufficiency but also can make profit by selling excess energy to the main grid. Meanwhile, a large number of autonomous systems brings scheduling difficulty to the central operator and affects grid security. Establishing a central operator will lead to a lot of problems, including high cost, low information security and personal privacy leakage [5; 6]. Therefore, it is difficult to use the current centralized framework to operate future energy systems. In order to extract the most value from this trend, there is a need for understanding the future energy trading mechanism. Fortunately, the use of smart meters can realize autonomous bidirectional energy flow [7]. Nevertheless, considering the drawback of the existing trading process, a more suitable trading framework is needed to cope with the increasing number of entities who want to play a more important role in the energy market instead of being a passive buyer. For a suitable energy trading framework, several requirements must be considered during the design period. The first is a low access threshold resulting in a larger amount of renewable energy resources. Secondly, a framework needs to design a mechanismto promote the deployment of energy storage devices to balance the fluctuations of the renewable energy resources and demand. Third, safety is always a priority, and the framework should fully consider the energy's real-time balance in the network and prevent price gouging behavior. To address these issues, we leverage an emerging technology which has been developed to allow a decentralized consensus between a large amount of non-trusted agents: the blockchain. Despite extensive and mature use in financial applications, the blockchain has just begun to attract the attention of researchers mostly in the smart grid area. This research can be roughly divided into the following categories. Energy currency: A decentralized digital currency for renewable energy called NRGcoin was introduced by [PERSON] [8]. Locally produced renewable energy is converted directly to NRGcoins independent of their value on the market. The currency can then be exchanged at any time on an open market for its monetary equivalent. A new energy trading currency based on Bitcoin was designed by [PERSON] to represent the energy used to trade in the energy market to solve the proof of trading and privacy preservation problems [9]. Security and privacy analysis: [PERSON] implemented a proof of concept for a decentralized energy trading system using blockchain technology, multi-signatures and anonymous encrypted messaging streams, enabling peers to anonymously negotiate energy prices and securely perform trading transactions [10]. Considering the physical constraints in a grid: [PERSON] presented a blockchain-based architecture for energy markets and posed a decentralized optimal power flow (OPF) model for scheduling shapeable loads on an electricity distribution network [11]. [PERSON] introduced improved convergence stability in a distributed security checking method tested in a six-node power system [12]. These works have not considered the special design of an energy trading mechanism, with distributed anonymous transactions and a detailed model of participants in particular not being mentioned. The example presented in this paper explores the potential of that scenario. In this paper, we examine how a blockchain architecture can be used to distribute the aggregator's role across all devices on a network.