1 Introduction

The integration of the increasing amount of distributed renewable energy sources (RES) into the energy supply system is one of the most important current challenges in energy informatics [19]. Existing wholesale markets lack the ability to react in real-time to the significant amount of volatile RES [27]. New market approaches need to reflect the locality of energy services to integrate RES into the energy system [30]. Local energy markets (LEM), on which consumers and prosumers (consumers that are also producers) can trade energy within their community, offer (near) real-time pricing, and facilitate a local balance of supply and demand. Thus, LEM provide a market place, market mechanism, and market access for local energy to a specific community. A community is a group of geographically (and socially) close energy agents. LEM may be the “decentralized, smart, and interconnected markets” [11] proposed by the European Commission in 2016. LEM can empower small-scale energy consumers and prosumers, and provide them with more choices regarding their energy supply. Interconnected LEM may provide a distributed system spanning the entire German energy supply system. However, the implementation of LEM requires new and innovative information and communication technology (ICT) [33]. Blockchain technology [28] as an emerging ICT offers new opportunities for decentralized market designs. It can provide the transparent and user-friendly applications needed for energy end users to participate in the process of energy consumption [4].

In this context, we investigate the following research question: How can LEM be designed in a decentralized fashion using blockchain technology as their main ICT? We answer this by designing a LEM on a private blockchain that runs without the involvement of a central intermediary. We present a proof-of-concept model including a simulation of a local blockchain-based energy market allowing consumers and prosumers to bilaterally trade energy within their community. We focus on introducing the market mechanism and the implemented blockchain, and present an economic concept to evaluate the market mechanism.

2 Related work

2.1 Local energy markets

LEM are geographically constrained market mechanisms with distinct pricing mechanisms between interconnected agents i (i.e. producers, prosumers and consumers). The agents have an energy generation \(g_{it}\) and demand \(d_{it}\) per time slot \(t \in T\). The market mechanism allows for trading energy between the agents [22]. Thus, LEM are market platforms that offer agents the chance to virtually trade energy within their community. Local energy trading often aims at empowering the community through possible energy cost reduction (e.g., [10]). This boosts the local economy, as profits are kept within the community, which may encourage additional investments in local RES generation [24].

Blouin and Serrano [8] propose a peer-to-peer negotiation LEM with decentralized, randomized buyer and seller matching. Trading is conducted bilaterally between directly affected agents. A more centralized LEM design is to use auction formats. This requires the submission of bid (buy) and ask (sell) orders for energy to a (public) order book [26]. The orders are then matched either continuously [37] or at discrete market closing times [20]. Block et al. [7] propose a combinatorial double auction mechanism. [22] focus on the structure of the overall energy system and integrate LEM into the entire energy system.

Active interaction with the LEM stakeholders is crucial to increase public acceptance. This is especially important when combining a new market model and a new ICT [1]. Although auctions involve a centralized market place, they can be run decentralized on a distributed economic system, i.e. a blockchain. While many studies on LEM mechanisms already exist, there are only few academic works that utilize blockchain technology as ICT for the market platform. We discuss several of these works (e.g., [25, 34]) at the end of this section.

2.2 Blockchain technology

Since its introduction as the underlying technology of Bitcoin [28], blockchain technology emerged from its use as verification mechanism for cryptocurrencies and heads to a broader field of economic applications. Blockchain-based systems are basically a combination of a distributed ledger, a decentralized consensus mechanism, and cryptographic security measures. In combination with smart contracts [39], they may revolutionize the functioning of transaction systems and enable fully decentralized market platforms [42]. More precisely, blockchain technology allows the resolution of conflicts and dismantles information asymmetries by providing a transparent and valid record of past transactions that cannot be altered retrospectively. As a result, governing intermediaries can be cut out, which leads to potentially more cost-efficient (micro) transactions [6].

The consensus mechanism is one key concept to avoid the dissemination of corrupted information. In a public and permission-less scenario, i.e. a system without access restrictions, the provision of new information needs to be associated with a certain amount of resources. E.g., the proof-of-work (PoW) consensus mechanism requires participating nodes to solve a numerical problem. Thus, it creates (computational) costs for adding new information, i.e. the next block [42]. The probability that a miner finds a solution and, thus, creates the next block, depends on his use of computational resources. In combination with all nodes approving the new block, this prevents the dissemination of corrupted information and ensures the database’s correctness without the need for a central authority. In a private and permissioned setup a predefined set of agents has access to the system. Thus, less costly consensus mechanisms may provide efficient alternatives. E.g., hash-based user authentication allows agents to vote on the correctness of new information based on their unique identification [proof-of-identity (PoI)] [23].

To conclude, a blockchain provides a distributed software architecture [41] that enables agents (human or artificial) to interact without a central governing institution. However, despite the absence of intermediaries during runtime, blockchain-based systems always rely on the correctness of predefined rules, and thus it is crucial to ensure they are secure, reliable and accurate [39]. Moreover, blockchain technology is still at an emergent stage and struggles with a variety of problems (e.g., limited transaction loads) [6], and the complexity of current protocols and implementations still provides challenges for researchers, practitioners, and users [16].

2.3 Blockchain-based energy markets

The usage of blockchain technology in energy markets was first addressed in 2014. [25] introduce a virtual currency to value RES according to (near) real-time smart meter information of local production and consumption.

Existing literature currently focuses on specific characteristics of blockchain-based energy markets, such as cryptocurrencies [25], privacy [2], or state estimations [13]. Existing implementations reach from (very) small-scale electricity markets in private blockchain setups [34] to markets for anonymous carbon emission trading between independent agents on public blockchains [3].

We introduce a simple, short-term LEM design with an operational auction mechanism for a small community that sets prices based on the agents’ orders in a decentralized fashion. This sets us apart from [25, 26] as they only include prices set centrally by the system operator. In comparison to [34], we set us apart by mainly by two reasons. Firstly, [34] implement a one-sided market. Our approach, however, consists of a double sided market. Furthermore, our market is designed for a larger number of agents while [34]’s work is designed for very small networks. The main differences between [3] and our work is that we focus on short-term electricity trading and use the Ethereum blockchain protocol, while [3] specialize on carbon emission trading and implement this market on the Bitcoin protocol. As carbon certificates are a purely virtual good, neither time dependence nor physical limitations (e.g., storage) need to be implemented as strict as in the electricity market. In contrast to [2], we focus on the conceptual implementation and not on privacy issues. Furthermore, state estimations [13] are a small part in operational LEM, however, we focus on the entire LEM.

As LEM are limited to their geographic or social community, private and permissioned blockchains are a logical choice to restrict market access to community members. Simultaneously, this saves computational resources. While academic research is still emerging, several industrial projects such as the Brooklyn Microgrid [10] are already testing the use of blockchains as the main ICT for energy markets.

3 Conceptual approach

To implement a LEM, we build on the studies of [7, 22] and focus on trading local electricity produced by residential photovoltaic (PV) systems. The market is based on a double auction, implemented via a closed order book, with discrete market closing times. A uniform market clearing price is determined for each time slot \(t \in T\). After the price determination, consumers with filled bid orders pay the market price and obtain the specified amount of electricity. Electricity, which cannot be bought or sold on the LEM has to be traded with an energy provider via the connected distribution grid. As a result, the price \(\overline{c}^g\) for excess demand bought from the grid represents an upper market price limit and \(\underline{c}^g\) for excess generation sold to the grid a lower market price limit. If contracts are not fulfilled (e.g., forecasting mistake), the party at fault clears the energy order over the grid at the expensive market price limits. We assume electricity taxes and fees (including grid fees, EEG-surcharge) to be fully scalable, i.e. at a constant percentage of the paid electricity price.

The virtual activities, i.e. the market mechanism and payment function, are both conducted on the blockchain. The agents’ demands \(d_{it}\) and generation \(g_{it}\) are automatically measured by smart meters and forecasted for each agent. Based on this information, excess demand or supply is computed and send to the agents’ corresponding blockchain accounts, while detailed customer-specific data remains locally stored. This way, we ensure a minimum level of private data protection and at the same time allow the system to generate orders that reflect the agents’ consumption patterns. For the sake of brevity, we refer to [2, 21] for further discussions on the very important topic of privacy, security and solution approaches in blockchain-based systems.

In addition to energy information, the accounts comprise the agents’ financial balances. Combining the information of their net energy surplus and credit balance allows the creation of orders according to the agents’ utility functions [29]. The offered monetary amounts are held as pledges as the blockchain acts as an escrow agent to ensure settlement of potential transactions. At specific clearing times t, the market mechanism then posts information about the matched amounts of electricity and the market price to all active agents. After the clearing, payments are automatically conducted as the pledged funds are released. Note that the physical exchange of electricity is conducted over the grid and is not influenced by the virtual trading mechanism as illustrated in Fig. 1. Therefore, our conceptual approach deviates from the operation of an autark microgrid as we always balance energy thorough the distribution grid in case demand does not equal supply. In addition, we go beyond known implementations [5, 12] and integrate the abstract concept of a decentralized market mechanism with a physical environment, i.e. an energy grid, distributed economic agents and RES.

Fig. 1
figure 1

Concept of blockchain-based local energy trading between residential households

Finally, our market setup complies with the following six out of the seven requirements for LEM designed by [7]: We implement an online mechanism matching supply and demand, and use price signals to indicate local energy scarcity. Furthermore, operational stability is ensured by balancing the energy supply over the distribution grid. Thus, a connection to the large-scale power grid exists. Consumption and generation is forecasted on an agent level and matched within the LEM’s demand and supply constraints. To limit complexity, we abstract from considering bundled orders (e.g., electricity and heat) and only include electricity trading.

4 Simulation of a blockchain-based LEM

4.1 Simulation setup

The simulation is set up in 15-min time slots \(t \in T\) over the course of one year. Trading is limited to the subsequent time slot and agents submit one order per time slot. The LEM consists of \(n= 100\) residential households. Each agent i is considered a prosumer that acts as a buyer or seller depending on his demand \(d_{it}\) and generation \(g_{it}\) in t. Backup energy for balancing \(d_{it}\) and \(g_{it}\) is provided by an energy provider via the grid g. Therefore, the market has \(I = \{1, 2, 3,\ldots ,n-1, n, g\}\) agents. The agents’ demand is taken from H0-profiles [35]. Generation is taken from PV systems in Germany in 2013. The temporal granularity of consumption data in 15-min slots resembles the discrete nature of our market mechanism. As H0-profiles represent an average household, we adjust them with a randomized error function to fit 1–5 person households. This is a first step to evaluate the market. Real consumption data shall be used in the future.

4.2 Optimization problem

The LEM’s outcome is measured as the sum of electricity costs across all agents. This equals the sum of the electricity amounts \(x_{ijt}\) sold from agent i to another agent j at price \(c_{ijt}\) at time t. The market price’s lower limit is set to the German feed-in tariff \(\underline{c}^g =12.31\,\frac{\text {c}\EUR }{\text {kWh}}\) and the upper limit to the German electricity price \(\overline{c}^g =28.69\,\frac{\text {c} \EUR }{\text {kWh}}\). This ensures that the cost (revenue) for grid transactions is always higher or equal (lower or equal) compared to the respective LEM alternative. The model minimizes the LEM’s total electricity costs and, thus, maximizes the market’s self-consumption by minimizing expensive grid transactions. The following model (1)–(5) shows the optimization problem to be solved per time slot.

$$\begin{aligned}&\min \sum _{i \in I} \sum _{j \in I } c_{ijt} \cdot x_{ijt}, s.t. \end{aligned}$$
(1)
$$\begin{aligned}&g_{it} - d_{it} -\sum _{j \in I }(x_{ijt} - x_{jit}) = 0 \qquad \forall i \in I {\setminus }\{g\} \end{aligned}$$
(2)
$$\begin{aligned}&\sum _{i \in I } (g_{it}-d_{it}) \le \sum _{i \in I } x_{igt} \end{aligned}$$
(3)
$$\begin{aligned}&- \left( \sum _{i \in I } \left( g_{it}-d_{it}\right) \right) \le \sum _{i \in I } x_{git} \end{aligned}$$
(4)
$$\begin{aligned}&x_{ijt} \ge 0 \qquad \forall i,j \in I \end{aligned}$$
(5)

Constraints (2)–(5) are hard constraints. (2) ensures that every agent satisfies his demand \(d_{it}\) and sells his generation \(g_{it}\). (3) and (4) ensure that supply and demand within the LEM are balanced by the grid. Finally, the decision variable \(x_{ijt}\) has to be positive, as only positive amounts of electricity can be traded (5).

4.3 Market mechanism

We implement a closed double auction market with price-time precedence and discrete market closing times that results in a single clearing price per trading period t. In t, each prosumer and consumer sends one bid or ask order to the market to satisfy his trading demand in \(t+1\). The lowest bid price that can still be served given the aggregated supply determines the market clearing price. Any surplus or deficit is balanced by trading electricity with a standard energy provider at prices \(\underline{c}^g\) and \(\overline{c}^g\). The market mechanism is implemented via a smart contract deployed on a private blockchain. Therefore, no central entity is needed once the market is implemented. Besides orders, payment is conducted over the blockchain as well. To ease measurement, we assume financial transactions to take place in a virtual currency that exchanges into Euros (€) at a constant exchange rate of 1 : 1.

4.4 Agent behavior

To test the basic market mechanism, we implement zero-intelligence agent bidding strategies. In every trading period each agent decides his price limit for buying or selling electricity. For now, this price limit is randomly assigned [18] within the boundaries of the market’s lower and upper limits \(\underline{c}^g\) and \(\overline{c}^g\) as prosumers would not accept a price below the feed-in tariff and consumers would not pay more than the grid electricity tariff. This holds true for rational agents that do not consider socio-economic reasons, e.g., a high preference for local RES. Zero-intelligence agents serve as a lower bound of the market efficiency [38]. As explained in Sect. 3, taxes and fees are assumed to be fully scalable. This may result in significantly lower taxes and fees to be paid by LEM agents than in the current energy market. This issue goes beyond our current work but needs to be considered in future studies. Agent behavior is simulated outside the blockchain environment and only the final orders are sent to the market via the agents’ blockchain accounts.

4.5 Software implementation

The presented setup is based on an open source project of a decentralized energy exchange [17]. The market implementation is build on a private Ethereum blockchain, which inherits its technical features, such as block difficulty and PoW as consensus mechanism [15], from the public Ethereum chain. Every agent is associated with a unique address on the chain. Likewise, we consider the grid to be a prosumer with unlimited bid and ask orders. Our market mechanism is implemented by a smart contract written in the scripting language Solidity [14]. Each agent’s address is linked to a checking account on the smart contract that allows to deposit and withdraw money. As agents place bid orders, the money on their accounts is locked-in until the settlement is carried out. This ensures that every bid is sufficiently covered. At the end of each period, all buy and sell orders are settled and account balances are updated. The submission of orders is facilitated by a JavaScript program providing an Application Program Interface (API) handling interactions with the smart contract. We use this API in a client-side JavaScript program obtaining the previously simulated agent behavior from an external data base and submitting orders accordingly. Both programs are executed in a Node.js runtime environment. Miners execute transactions and generate new blocks. Thus, they incur computational costs. Typically, transactions include a fee to reward miners for their work. However, thus far, we use a basic concept without transaction costs and compensation for miners. To accelerate our on-chain simulation, we submit all determined orders for each time slot t (which equals 15 min in the real world) at once, as soon as a new block is created on the chain. In our setup, the standard block creation time equals about 12 s [15]. Therefore, the presented setup allows us to perform an on-chain simulation of one year (i.e. 35,040 blocks) in less than 120 h.

5 Evaluation

5.1 Preliminary results

As first market evaluation, we analyze the impact of PV generation on the LEM prices and the overall electricity prices in a setting of solely PV generation. The LEM prices are calculated as the weighted average of all local transactions. In a LEM, agents will still be trading with the grid at grid prices whenever local generation does not exactly meet local demand. Thus, the overall electricity price will consist of a percentage of local transactions at local prices and a percentage of grid transactions at grid tariff or feed-in tariff. Therefore, the overall electricity price an agent pays differs from the local price. Thus, the overall prices are the weighted averages of the local transactions and any transactions at grid prices. Figure 2 shows the impact of increasing local PV generation on the electricity prices. The amount of PV is measured as the percentage of the yearly sum of PV generation in relation to the yearly sum of demand of all agents. Thus, 100% of PV generation means that the produced sum of PV equals the sum of the consumption of all agents over one year. However, due to temporal discrepancies between PV generation and consumption, 100% PV generation does not mean that all demand is met by this generation. Rather, only the sum of generation amounts to the sum of demand. Figure 2 shows that at first, the local prices fall rather fast with PV generation and even out slowly. The overall price decreases more steadily and gradually converges towards the local price. However, the local price is never reached as a certain amount of the agents’ demand always occurs during low production times. This demand can not be satisfied solely by PV generation without energy storage. The technological evaluation of the blockchain as main ICT still needs to be conducted in terms of computational resources, energy usage, transaction costs, block speeds and scalability. This will be the next step of our work. Additionally, as computational costs of the on-chain matching algorithm depend on the number of submitted orders and can not be determined in advance, a fair mechanism for the allocation of these cost has to be determined.

Fig. 2
figure 2

Influence of PV generation on local and overall electricity prices

Table 1 Advantages and disadvantages of using blockchain technology as ICT in LEM

5.2 Discussion and further research

We identify the decentralized market setup, the advantageous market prices, and the transparent, secure transaction log as the main advantages of blockchain-based LEM. However, blockchain technology is still exposed to a variety of challenges, e.g., scalability issues, that prevent real-time trading. Furthermore, some potential advantages are not realizable on all blockchains. For instance, the energy consumption of an implemented blockchain can be substantial [31] and contradicts the increase of sustainability advocated by LEM. Thus, transactions often have higher transaction costs than intended [32]. We address this issue by using a private blockchain and directly controlling the transaction costs. Besides, blockchains make transactions irreversible once they are conducted. This is an advantage of blockchain technology as the transaction log is unchangeable. However, faulty transactions can not be directly canceled, which may be a disadvantage.

Table 1 presents an overview of the most important advantages and disadvantages of blockchain technology in energy markets derived from the implementation and supported by current literature. While we show that blockchain technology can, technologically, be used as the main ICT for decentralized LEM, its degree of suitability remains to be analyzed.

We provide a preliminary analysis of the simulated market outcome of a LEM with artificial agents in terms of the local and overall electricity prices. We derive that local agents can profit from LEM by decreasing their total electricity costs. For a high level of local autarky, flexibility measures (e.g., storage or demand side management) need to be added to our scenario. Additional forms of energy (e.g., heat), extended trading horizons, multiple bids and bundled bids should be integrated. We will focus on extending the trading horizon and integrating multiple bids. In addition, the assumed scalability of electricity taxes and fees is not easily transferable to real-life applications as regulation needs to be considered. Future research should also integrate the agents’ socio-economic preferences and intelligent bidding strategies (e.g., [29]), as the current assumptions result in simplistic market behavior and deduced evaluations may not be directly transferable. In addition, virtual currencies have significant financial risks and typically rely on intermediaries (currency exchanges) which contradict the omission of central entities.

We also provide the implementation of a private blockchain as market and payment platform for the LEM. The technical evaluation of the blockchain as ICT for LEM is the next step. For now, we provide a conceptual evaluation approach and outline a research agenda regarding the technical evaluation. The currently implemented PoW mechanism uses complex hash-based competitive calculations and requires more computational resources than consensus mechanisms solely based on the verification of the agents’ identification (i.e. PoI). We will implement a PoI mechanism to reduce the required computational resources. As all agents are known and participation is restricted, e.g., agents must be verified before being provided with market access, this more efficient consensus mechanism introduces a reasonable alternative to save computational resources. This will reduce the energy consumption of transactions on the blockchains. In addition, we will evaluate the technical implementation according to the time per submitted order and executed transaction. Furthermore, we plan to conduct test runs to evaluate the private blockchain’s scalability limitations in terms of amount of transactions per time slot. Also note, that the assumption of sufficient mining power without compensation will not hold in real-life implementations. Thus, transaction costs need to be considered and fairly distributed.

6 Conclusion and outlook

This paper presents an initial proof-of-concept of a simple LEM scenario with artificial agents implemented on a private blockchain. This way, we provide a first insight into the economic evaluation of a blockchain-based market design and its technical implementation. We show that LEM can be run in a decentralized fashion on a distributed ICT.

We evaluate the economic market design by showing the potential electricity cost reductions for LEM participants in this simple scenario without transaction costs. Furthermore, we present our research agenda for a technical evaluation of the resource consumption and scalability of a private blockchain for local energy trading. Nevertheless, the suitability of blockchain technology as the main ICT for LEM remains to be investigated. We conclude that the real-life applicability and technological limitations of such blockchain-based market approaches need to be determined by further research and implementation projects. In addition, regulatory changes will play an important role in the future of blockchain-based LEM.