Next Article in Journal
Closed-Form Hyper-Rayleigh Mode Analysis of the Fluctuating Double-Rayleigh with Line-of-Sight Fading Channel
Next Article in Special Issue
Performance Analysis of Harmonic-Reduced Modified PUC Multi-Level Inverter Based on an MPC Algorithm
Previous Article in Journal
Investigative and Usability Findings of the Move-D Orthotic Brace Prototype for Upper Extremity Tremors in Pediatric Patients: An Unblinded, Experimental Study
Previous Article in Special Issue
Robust Control and Active Vibration Suppression in Dynamics of Smart Systems
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

A Decentralized Blockchain-Based Energy Market for Citizen Energy Communities

Faculty of Electrical Engineering, Shahid Beheshti University, Tehran 19839-69411, Iran
Department of Engineering, School of Science and Technology, Nottingham Trent University, Nottingham NG11 8NS, UK
Authors to whom correspondence should be addressed.
Inventions 2023, 8(4), 86;
Original submission received: 19 May 2023 / Revised: 22 June 2023 / Accepted: 24 June 2023 / Published: 30 June 2023
(This article belongs to the Special Issue Recent Advances and Challenges in Emerging Power Systems)


Despite the fact that power grids have been planned and utilized using centralized networks for many years, there are now significant changes occurring as a result of the growing number of distributed energy resources, the development of energy storage systems and devices, and the increased use of electric vehicles. In light of this development, it is pertinent to ask what an efficient approach would be to the operation and management of future distribution grids consisting of millions of distributed and even mobile energy elements. Parallel to this evolution in power grids, there has been rapid growth in decentralized management technology due to the development of relevant technologies such as blockchain networks. Blockchain is an advanced technology that enables us to answer the question raised above. This paper introduces a decentralized blockchain network based on the Hyperledger Fabric framework. The proposed framework enables the formation of local energy markets of future citizen energy communities (CECs) through peer-to-peer transactions. In addition, it is designed to ensure adequate load supply and observe the network’s constraints while running an optimal operation point by consensus among all of the players in a CEC. An open-source tool in Python is used to verify the performance of the proposed framework and compare the results. Through its distributed and layered management structure, the proposed blockchain-based framework proves its superior flexibility and proper functioning. Moreover, the results show that the proposed model increases system performance, reduces costs, and reaches an operating point based on consensus among the microgrid elements.

1. Introduction

Community-led energy systems, also called Citizen Energy Communities (CEC), enable citizens to take action that contributes to a clean energy transition while empowering them. As a result, they make it easier to attract private investment in clean energy projects and to increase public acceptance of renewable energy projects. They can assist citizens in reducing energy bills, create local jobs, and increase energy efficiency. Using energy communities, future energy systems can be reshaped by harnessing energy locally and enhancing quality of life while allowing citizens to participate actively in the transition to renewable energy by providing flexibility services to the electricity system through demand-side response and storage [1].
The CEC approach is part of the activities that are currently ongoing toward a more distributed energy system. Moving towards decentralized management and using blockchain networks reflects developed societies’ inherent tendency to reduce the government’s active involvement and increase flexibility in daily life. Today, microgrids consist of a wide range of distributed energy supply and consumption systems, making the electricity industry a primary field of interest for this technology. Blockchain technology affects this industry in various ways as well [2]. This paper aims to integrate blockchain technology into the operation of local energy networks. The aim is to present a decentralized model for electric microgrid management. Such a management system should be able to operate the microgrid economically while ensuring the adequacy and security of the system. Moreover, it should offer intrinsic flexibility and fast response compared to conventional models, mainly as a result of using smart contracts to push the operating point of the microgrid toward its global optimum point. Providing economic infrastructure and incentives to interest private investors expands the network, and decentralization of system operations leads to more optimal democratic use of the microgrids, making these networks desirable for conventional microgrid operation as well.

1.1. Aim and Scope

Blockchain networks stand out among other technologies due to their distributabilty and decentralized management capability. Low setup costs, diverse environments and setup tools, the ability to manage even small-scale elements of the microgrid, creating a self-sufficient economic cycle, protecting privacy, and emphasizing democratic decisions make this technology thrive and compete with the traditional centralized power grid.
New elements such as electric vehicles with varying locations, energy storage devices, and small renewable energy resources installed in any location have changed the electricity industry’s outlook [3]. Localization of energy supplies and the tremendous increase in the amount of their information brings about new opportunities and challenges to the microgrid. Intel forecasts that each automatic vehicle will generate four hundred gigabytes of average daily data by 2025 [4]. These data will have various uses in intelligent vehicle control, urban traffic, routing, and finding parking places. It is possible that such data will directly or indirectly affect the time and place of the vehicle’s charging and its amount [5]. These elements may be owned by individuals. The intentions and functions of these individuals could be greatly affected by circumstances and uncertainties of time and place, and their priorities might change at any moment [6]. Decentralized networks providing a distributing structure with layered management can be an appropriate solution to these changes. They emphasize the local energy supply while managing energy exchange at the microgrid level. This paper proposes a new decentralized framework for the operation and planning of the power grid of the future that contains millions of small distributed and mobile elements. The proposed framework is shown to have better performance than existing networks, and can represent a stepping stone toward the power grids of the future [7].

1.2. Literature Survey

Research on utilizing decentralized networks in the electricity industry can be categorized as follows.
The first category consists of designs for blockchain microgrids as communication infrastructure. Such papers mainly try to manage the issues around extensive networks with massive data [8]. Inspired by the consensus mechanism in blockchain networks, these papers look for a robust, scalable, and economic dispatch to optimize the significant number of small element transactions according to the computational structure of the microgrid [9]. These studies have proposed decentralized networks based on reputable microgrids such as Ethereum. They try to present an efficient model based on existing blockchain structures [10]. A decentralized microgrid model mainly depends on its consensus mechanism. Costly consensus mechanisms are not good choices for microgrids. The existing literature has tried to replace Proof of Work as a consensus mechanism, e.g., by Proof of Stake by Reputation (POWR), intended to reduce transaction confirmation and block creation delay [11]. Using the Internet of Things (IoT), smart power meters and small producers of renewable energies are of prime significance in microgrid structure design [12]. The transaction structures can be designed to be executable in a different blockchain infrastructure, such as Solidity, without any third-party intervention [13]. Due to the increase in renewable energies and islanding of enormous power grids in the form of small microgrids, several of these studies have addressed the issue of creating decentralized networks to interact between such islands. This increases their reliability along with mutual financial interests [14]. All these papers use the main chain of the blockchain as the pivotal part of their work. However, many processes and decision makings can be done in the layers before this chain. This will improve the microgrid response time substantially. This paper proposes a layered structure for a decentralized method to facilitate decentralized process management.
The second group involves management of the market’s financial settlement tasks through a blockchain system. These financial systems include contracts as well as online and multi-stage settlement systems [15,16]. Papers have focused on P2P trades between electric vehicles or other two players in the microgrid [17]. Others emphasize smart contracts, which can be crucial in a decentralized microgrid’s management [18]. Another group of these papers discusses managing request sending in various algorithms such as iceberg. This prevents price jumps in the microgrid. The microgrid uses algorithms and other settlement systems to avoid very short-term changes in the microgrid [19]. A significant point in this study is evaluating the effect of financial transactions in a decentralized microgrid which is considered a purely-economic market, without considering its technical utilization. This bears more significance in microgrids than in bank and insurance networks. The present paper fixes this issue using a two-stage consensus mechanism that simultaneously considers the economic and technical approaches in a decentralized microgrid. It computes the system’s operating point by considering both mentioned issues simultaneously.
Finally, the third group consists of research that aims to improve the system’s power quality [20] and control the voltage using blockchain infrastructure. These papers present a reward–punishment system based on voltage changes and emphasize the sensitivity matrix of each bus to control the voltage at the end of the radial distribution networks [21]. Most of the performed research tries to improve the performance of the microgrid for central planning and utilization of the system. Their objective function consists of increasing the power quality and a decentralized microgrid management which is more significant in large systems [8]. Others focus on mixing centralized and decentralized approaches to achieve better system performance. They try to dispatch the decentralized loads in the microgrid [22]. The main point is that all these studies try to improve the performance of the decentralized system for financial transactions in the microgrid. On the contrary, the present paper aims to design and present a decentralized system to replace the current centralized utilization microgrid. Such a microgrid improves performance by utilizing the microgrid at its global optimum. A comparison of the references discussed in the literature review is shown in Table 1.

1.3. Contributions

Considering the works reported in the literature and the highlighted research gaps, the main contribution of this paper can be summarized as follows:
  • Proposing a decentralized framework for planning and operation of the future microgrids that takes care of both economical and technical constraints;
  • Providing a two-stage consensus mechanism to maintain adequacy, security, and a global optimal operating point for the microgrid;
  • Designing a layered structure based on contracts and P2P exchanges to increase the microgrid’s response time.

1.4. Organization of the Paper

The rest of the paper is structured as follows. The second section discusses the design of a blockchain-based microgrid according to the Hyperledger model. It presents microgrid layers, definitions, duties, and the interaction of members in each layer. In section three, we offer a decentralized management mechanism consisting of the processes and microgrid rules. These rules lay the foundations for decentralized management and form the microgrid’s consensus model. Section four demonstrates the proposed decentralized microgrid’s performance in facing the challenges. This ensures maintaining adequacy, compliance with the system’s technical requirements, and global optimal utilization of the microgrid. Section five compares the performance of the proposed decentralized microgrid with its centralized peer using an open-source program. The performance was challenged by introducing uncertain electrical vehicle and small renewable energy sources to prove the model’s performance and show its advantages over its peers. Finally, the last section ends the paper by analyzing the performance result for the microgrid.

2. Designing a Blockchain Network

Designing a decentralized microgrid requires an infrastructure where all authorized users can access the latest operating point of the system and basic network information. This enables members to work on the same operating point at any moment. We use a private blockchain [2] infrastructure for this purpose. A chain of confirmed blocks supports this distributed ledger. Such a network records all the information of the microgrid, the last operating point in the distributed ledger, and the last confirmed blocks. This enables all members to access the latest microgrid information and work on the same operating point. People with access to the microgrid information receive a license for their access from the representative of the network independent entity, and have layered access to the information [23]. Their real identity is not published in all layers to protect the customers’ privacy. We used Hyperledger Fabric [24], one of IBM’s most reputable blockchain platforms, to design our microgrid [25]. It is defined as a multi-layer microgrid where each layer has a specific duty and role. This increases the efficiency and performance of the microgrid and makes managing large systems possible. The platform has been used in the banking, insurance, and social services industries [26]. Here, we redefine its concepts according to the different nature of energy. This paper proposes a Hyperledger blockchain model based on the definitions in Figure 1 for decentralized management of microgrids.
  • Client: Clients are the first layer in the microgrid, consisting of microgrid players [26]. The microgrid players might consist of a wide range of load or energy producers. Considering the progress in IoT, every kilowatt hour of energy shortly contains the identity and personal details of the producer and end consumer. However, major players such as electric vehicles and small energy sources such as renewable energy, for which performance is always highly uncertain, are the largest loads. Blockchain, a private microgrid, is not accessible to all. Any player needs an endorsement to access it. Endorsers are companies that provide identity certificates to the microgrid players and review violations of rules and complaints. They are licensed by the organization supervising the microgrid. These companies can assign identity tokens to approved players. The player can use that token to participate in the microgrid directly or by proxy. This microgrid defines gas fee concepts used in all layers. In the blockchain, the gas fee is the fee each player suggests for performing the intended process. Each layer receives part of this fee according to the definitions of the microgrid. The higher the gas of an order is, the quicker it is considered in the subsequent layers. Gas has a significant impact on the market direction.
  • Committer: As in the case of trading stocks on financial markets, each actor must use a brokerage firm to connect to the network and use its services [26]. However, because most network actors are ordinary citizens who are not interested in complicated energy purchase systems, committers provide a set of different smart contracts to their clients. Smart vehicles can perform more optimally based on these smart contracts. A new concept is added to the network called “GAS” as the request-to-request fee, determined by contract type or the direct offer by the requestor.
  • Anchor: Anchor’s particular advantage of using blockchain in a microgrid is the P2P process. This advantage is crucial over the life of the microgrid. Anchors [26] are specialized companies that manage P2P in the microgrid. Committers’ orders must be forwarded to them before being presented to the main chain of the blockchain. Each anchor has a unique area of activity in the microgrid. Each bus can be precisely in one anchor’s scope of activity. Committers forwarded their request to the relevant anchor based on the microgrid bus it belongs to. This way, all the orders tradable as P2P are received and settled before being offered to the main chain, making for a fast response time and less working load on the main chain. An anchor must run its simple optimization program according to the objective function and constraints (Equation 1). The optimization result should maximize the charge of all units capable of P2P trade and the company’s earnings in these exchanges.
    M a x C V h T ( P c ( V , B u s , T ) + P d ( V , B u s , T ) ) × G a s V , T
    T P c ( V , B u s , T ) C h a r g e ( V , B u s )
    T P d ( V , B u s , T ) D i s C h a r g e ( V , B u s )
    B u s P c ( V , B u s , T ) B u s P d ( V , B u s , T )
    Here, P c ( V , B u s , T ) is the energy ordering vehicle’s charge, P d ( V , B u s , T ) is the ordering vehicle’s discharge, C h a r g e ( V , B u s ) is the total charge ordered by each vehicle for that bus, and D i s C h a r g e ( V , B u s ) is the proposed discharge per bus per vehicle variable. All other orders not settled in the P2P mechanism are shared as a recommended package in a block pool.
  • Orderer: In Hyperledger, orderers play the role of miners in a standard blockchain [26]. They are the most critical layer of the network. In addition to the market supervision entity, they are the only blockchain members with access to the last operating point and the main chain. These companies’ function is the main difference between blockchains in the electricity industry and in other organizations. Orderers receive the orders by connecting to the block pool. To register a new order on the microgrid’s main chain, these companies must provide a new operating point based on the last operating point while observing all system constraints. These companies must provide an economic dispatch according to the last operating point by adding new orders. The new operating point is confirmed by the consensus mechanism of the microgrid. If the operating point is confirmed by consensus, they receive a part of the gas for the recommended package. Receiving the other part of the gas depends on the confirmation of the optimality of the operating point. This optimality is determined in the second phase of the consensus mechanism. Orderers are advanced algorithms on powerful servers that perform a high number of computations in the least possible time. They earn money by registering other players’ orders in the chain while observing the microgrid constraints.

3. Designing a Decentralized Microgrid

A decentralized microgrid management system should maintain system adequacy and utilize the microgrid at its global optimal point while observing all system constraints. The rules and processes employed in this paper ensure fast system response, system adequacy, and optimal utilization. These processes are defined as follows:
  • The time interval of the main chain is one day. The market supervision entity registers the chain’s first block, the genesis block, which means the initiation of the chain. This block consists of the market’s daily initial operating point and the microgrid’s complete information. The decentralized microgrid can begin daytime activity based on this operating point.
  • Each new block with a new microgrid operating point, microgrid consensus token, and the security code of hash of the last block in the main chain can be registered as a new block.
  • If two blocks contain the main chain’s last security code, the block with a lower utilization cost for the rest of the microgrid is considered the main chain block. Otherwise, if the utilization costs are the same, the block registered earlier is regarded as the main chain block.
One of the critical features of decentralized networks is information transparency, which enhances network efficiency. However, various methods consider the network participants’ privacy concerns where it can be observed in the different cryptocurrencies in which they have used multiple approaches to preserve privacy of the users. These processes are defined as follows:
  • The Hyperledger Fabric blockchain framework used in this paper provides a secure and private network for transactions. Using Hyperledger Fabric, access to data is limited to authorized parties, who participate in a permissioned network. In this way, the confidentiality of user information and the security of transaction data are ensured.
  • In this network, private participants such as electric vehicles and smart homes can adopt anonymous identities to ensure that their information remains confidential. This feature applies to major cryptocurrencies such as Bitcoin as well, where although one can observe all participants’ transactions in the distributed ledger, their identities cannot be uncovered.
  • Private participation is arduous for major and legal participants because they occupy a specific point in the network and exist uniquely. Even if they possess anonymous identities, the possibility of identification remains. However, it is crucial to consider which participant information is made public and which is accessible to specifically authorized entities. In this model, only selected representatives, namely, the committers, have access to all the details of the participants’ proposals as well as their smart and financial contracts. In practice, upon network approval orderers gain access solely to the limited information received from the committers. Consequently, all their information is be discernible to all network participants or to their competitors.

4. Consensus Algorithm

Consensus algorithms realize decentralized management of a microgrid. They are categorized according to their function, e.g., Proof of Stake, Delegated Proof of Stake, Proof of Work, and Proof of Vote [27]. The first three consensus types are better suited for public distributed networks. Due to their high block formation latency, they cannot be used in the energy industry.

4.1. Proof of Work Algorithm (POW)

The proof of work algorithm is regarded as one of the most prevalent blockchain network consensus algorithms. Bitcoin utilizes this algorithm to demonstrate the validity of its transactions. One of the most significant benefits of this algorithm is the remarkable scalability and decentralization it affords the network. This has resulted in the widespread adoption of Bitcoin globally. This algorithm has devised a competitive computation to solve an objective function whereby the fastest solver among all groups can generate a new block. Other participants in this computing network pause their computations and validate the resulting outcome [28]. If the outcome is correct, the block is stored in their network and they tackle a new one. Otherwise, they persist with their computation to acquire the correct solution. In Bitcoin mining, the objective function is used to find a hashed array with a particular structure from an input array. This array is generated by introducing a parameter named Nonce to the block input data and implementing an iterative algorithm. The initial group that uncovers this array adds the solution and the nonce value to authenticate its accuracy and incorporate all other groups in the network. Resolving this issue is considered time-intensive and takes over ten minutes. This delay is attributed to the network s enhanced resilience against attackers [29]. As the network’s processing power increases, the objective function’s constraints become more complex, not to solve the issue in a shorter time. This is referred to as an increase in network difficulty. In practice, this objective function can vary for each network. As in Bitcoin, solving a mathematical problem involves an array; in the power network, it can entail providing network operator constraints and quality control indicators as well as maintaining network security.

4.2. Proof of Stake Algorithm (POS)

Unlike the proof of work algorithm, there are no objective functions to solve in the proof of stake algorithm, and network members are not on the same level. Additionally, in this algorithm, each member is valued based on an index indicating their share in the network [30]. Those with greater power in the network play critical roles. The network also determines the power index. This index can be interpreted as network ownership percentage, processing power, or technical and probabilistic indicators. In a more common type, the proof of stake algorithm is delegated. In other words, influential network members select some individuals to generate a new block. Then, voting takes place, and votes are weighted to the extent of shared values. Ultimately, the selected members can generate a new block [31]. This process substantially reduces the algorithm’s costs and enhances the efficiency of the proof-of-work algorithm. In power networks, members’ valuation can be conducted using technical indicators. This fact empowers the leading members of the traditional network to play productive roles in guiding the new decentralized network. This permits the responsibility of generating a new block to be assigned to individuals who do not compromise the security and efficiency of the network.

4.3. Proof of Vote-Based Algorithm (POV)

The vote-based algorithm represents the third consensus algorithm employed in blockchain networks. Under this algorithm, all members must undergo identity verification before joining the network and contribute to validating new blocks. In this respect, safeguarding the network against attackers and sabotage is paramount. This algorithm is well-suited for private networks and is classified into Byzantine Fault Tolerance (BFT) and resilience against failure [32]. One of the powerful algorithms within the vote-based algorithm subset is the Ripple algorithm, which is utilized in Ripple. The algorithm’s structure, which functions based on two-step verification, is open-source [33]. In this algorithm, each validated network member examines the information of the new block. Then based on the network constraints, each member votes for it and sends it to another validated member for feedback. When more than %50 of the network members validate the block, it chis confirmed in an open ledger. However, to achieve final confirmation and entry into a distributed public ledger, validation from %80 of the members is necessary [34]. A comparison of the performance of consensus algorithms is shown in Table 2.
This study uses the practical byzantine method, which has different variants itself. Networks based on Hyperledger usually use Proof of Vote Fault Tolerance [30]. This algorithm does not suit the electricity industry due to its technical approval requirements [33]. We used the Ripple algorithm used in Ripple cryptocurrency, as shown in Figure 2. Ripple is a two-stage algorithm, consisting of an open distributed ledger and a closed one [35]. In our proposed model, every orderer takes the last operating point of the last chain to confirm and register the order package, which can be multiple orders from several anchors. It registers a new microgrid operating point complying with the main system constraints as the new block in the chain. After the block is registered, all orderers should comment on the correctness of this operating point. Orderers receive rewards or penalties for such commenting or not commenting. If fifty-one percent of the companies confirm the block, the block becomes part of the chain and is added to the open ledger. This means confirming the initial order. Each member should confirm whether the main rules of the microgrid are observed in their comment.
The microgrid rules in our design are as follows:
The new operating point is a correct power flow
S ¯ i = P i + j Q i = V i e j θ i j Y i j V j e j θ j + δ i j
The allowable voltage interval of the bus and production range of the energy sources are observed:
V m i n i V i V m a x i | P m i n i P i P m a x i
The cost of the rest of the system is declared accurately:
C o s t r e s = t ( λ o P o + λ i m p P I m p λ E x p P e x p λ c h a r g e P c h a r g e )
Here, C o s t r e s t means the cost of the rest of the system, i.e., the total microgrid cost minus the new load cost. This is based on the internal cost λ 0 , P 0 , the cost of imported energy λ i m p , P i m p , the cost of exported energy λ e x p , P e x p , and the cost of a new order λ c h a r g e , P c h a r g e . In the above, P and λ represent energy and price, respectively. Confirming or rejecting the correctness of a block takes seconds. Each company can verify it through a simple algorithm. After the block is initially confirmed, the offering orderer receives fifty percent of the recommended package gas as the reward. In the second phase of consensus certification, all orderers can replace this new operating point block by registering a less costly one.
If another orderer manages to do so within the intended interval, the other fifty percent of gas fee is assigned. Otherwise, the first orderer receives the reward at the end of the interval. This can be achieved by combining several blocks into one block. The main chain continues from that block. At the end of the time interval, the last block containing the recommended package is registered in the closed ledger, and the order is finalized. Orders are reviewed and confirmed much faster in this two-stage confirmation. The order is finalized, probably with changes, at the global optimal operating point of the microgrid. Those open ledge blocks which have a utilization cost less than or equal to the last block registered in the closed ledger are automatically sent to the closed ledger, as adding orders on that block has not increased the cost of the system.

4.4. How the Proposed Decentralized Microgrid Works

  • The independent operation loads the genesis block in the daily interval. It indicates an economic dispatch based on the latest load and microgrid generation.
  • Smart load approved by endorsers can connect to the decentralized microgrid and forward their order to it through committers.
  • Committers try to minimize energy costs by offering various offers and smart contracts according to the customers’ consumption. They manage the orders and forward them to anchors to be supplied by the microgrid.
  • Anchors manage all internal P2P trades inside the microgrid. They transfer orders that cannot be supplied through local trading to the block pool.
  • Orderers remove the new orders from the block pool according to the last operating point of the microgrid in the main chain using simple and fast, economic dispatch algorithms. They apply such orders to present a new operating point for registering in the main chain subject to the microgrid’s technical constraints.
  • The Ripple two-stage consensus mechanism confirms this new operating point’s correctness and global optimality. In this consensus model, all the primary microgrid beneficiaries review the correctness of the new operating point according to the approved technical constraints. This review is carried out in a split second using a simple power flow algorithms subject to the microgrid constraints. The block is registered if approved by more than fifty-one percent of the microgrid.
  • The final registering of the block is performed in the second stage of the Ripple consensus algorithm. If any orderer can provide a better operating point, then the previous block becomes a minor one and the new block continues the main chain. The new block can consist of several blocks. However, all previous orders must be considered, and the new block’s cost should be less. If a replacement block is not offered and the chain continues, the previous block registration is finalized in the chain.
  • The microgrid is utilized based on the last confirmed operating point in the main chain. The process of the decentralized microgrid is shown in Figure 2.

5. Case Study and Discussion

The proposed decentralized microgrid’s performance was tested on standard systems with known centralized management results. We used the IEEE 13-bus test system [36] shown in the microgrid diagram of Figure 3. This is a three-phase power distribution system. A commercial parking lot contains 80 electric vehicles with a 6.6 kWh charging capacity and 36 kW battery capacity. The vehicles can be charged from 6 in the morning and from 9 in the afternoon. The case study parameters are shown in Table 3 [37].
The microgrid has five solar energy sources, each with a 200 kW capacity. The cost of importing and exporting electricity from the slack bus is 0.15 and 0.5 GBP/kWh, and the demand charge is 0.1 GBP/kWh. To compare the random performance of the decentralized microgrid. We planned 30 electric vehicles with the proposed decentralized microgrid. We assume an initial configuration of fifty vehicles has finalized registration. Here, ten vehicles ordered a change of plan, and thirty others ordered a new connection to the microgrid. Ten out of the thirty vehicles have a charge-at-will smart contract. The gas fee for electric vehicles is GBP1, and for modeling the smart contract with committers is GBP2.
In this paper, the PGOxford of [37] (which is an open-source platform developed in Python) is utilized to model the economic dispatch. The EMS module in this tool forecasts loads using time series and solar power-generating sources. The optimization solvers included open loop solver and MCP solver. Open Loop Solver has shorter optimization times. However, the results in the reference paper indicate that it violates the allowable voltage range. MCP Solver has a longer optimization time but observes all the microgrid constraints in the final configuration.
PGoxford software models the network and distributes the load, including a three-phase model for each line in the network. Three-phase unbalanced distribution systems can be accurately modeled with this software. Using dataframes containing the characteristics of lines, transformers, and capacitor banks, this software method updates the network admittance matrix. We assume a three-phase network with phases a, b, and c, a slack bus voltage and N load buses [37]. In PGoxford software, the solutions were compared with the solutions from OpenDSS [38]. More details about how to model the three phases of the network in this software are provided in detail in the reference appendix C of this software [37], which we refrain from repeating in this article.
In this modeling, we assume the microgrid has five committers, each with six electric vehicle orders. The model has an anchor in charge of P2P transactions and two orderers. Each orderer uses one of the solvers. In each transaction, five vehicles are selected, sorted by the gas fee. Orderer A (OA) uses the Open loop optimization algorithm, and Orderer B (OB) uses the MCP optimization algorithm. They are defined in parallel and different servers and are only connected through the main chain file in the blockchain shown in Figure 4. The objective function and constraints of the microgrid and eclectic vehicle are as in [37].

Simulation Results

Decentralized management enables individuals to solve their problems discretely using simultaneous parallel algorithms. Furthermore, by comparing their results and the consensus network, they can determine which result is more accurate and optimal. This possibility allows various algorithms with different capabilities to be combined, such as for speed and accuracy. Further, the possibility serves to allow faster algorithms for obtaining initial solutions and more accurate algorithms for achieving the final optimal solution. Simulation results indicate that the anchor has P2P replaced all ten vehicles’ move orders, i.e., removing their previous order from the initial configuration, with new orders. Seven out of ten orders were vehicles with smart contracts with more gas fees, and three others were other vehicles with timing conflicts. The P2P objective function maximizes the anchor gas fee earnings, and the plan’s constraints were the maximum battery charge capacity in the remaining time and time conflict between the orders. The anchor referred the remaining twenty orders to the pool block after settling ten orders. This simulation was carried out connecting two computers together in parallel. Each computer was defined as an order. Figure 4 represents seven blocks registered during the computations: a genesis block, three blocks for OA, and three blocks for OB. However, the end chain consists of one block from OA and three blocks from OB. Block 3 from OA was declared invalid due to a lack of consensus on the correctness of this block, as it violates the bus voltage limitation. Block 2 was replaced by Block 5, As OB offered a block with a lower value cost function. In the end, the orderers registered twenty vehicles. OB received more gas fees by registration, registering fifteen final and ten initial vehicles, compared to OA, which registered five initial request and five final request vehicles. As the first block contains three vehicles with smart contracts, OA and OB’s incomes are GBP10.5 and GBP12.5. The results are shown in Table 4.
In this article, the central problem is initially solved using two different algorithms. The results are presented in Figure 5, following reference [37]. The results indicate that the network constraints were violated in an open-loop concentrated algorithm. In addition, a decentralized program was carried out using a couple of two-stage Ripple consensus parallel algorithms. The Ripple consensus algorithm ensures compliance with technical constraints in the first stage, as depicted in Figure 2. In fact, this confidence is achieved by the vote of more than half of the network. The decentralized results are presented in Figure 6, and it is evident that the voltage threshold was not violated. The decentralized network has prevented it by implementing its consensus mechanism. This demonstrates that instability and violations of the algorithms can be prevented by managing algorithms in a decentralized manner and employing a transparent consensus mechanism at the final point of the network.
Comparing the minimum allowable voltage threshold in our results and those of the centralized management in [37] shows that combining several optimization algorithms in a decentralized system eliminates the shortcomings of each model and optimizes the result. It indicates that combining several optimization algorithms in the decentralized network in Figure 6 eliminates the allowable voltage range violation issue of the open loop centralized model in Figure 5 while observing acceptable voltage band constraints. This indicates that a discrete combination of several planning and optimization algorithms provides better results than a single one by combining their speed and accuracy advantages.
When charging electric cars, local decentralized P2P exchange networks play a crucial role in providing energy. However, the present article focuses on the non-local provision of decentralized energy, which alters the network’s operating point. As observed, by eliminating states that violate technical constraints, the decentralized consensus algorithm optimizes the allocation of charge in the Tb interval. It prevents a breach of the allowable voltage threshold. This algorithm minimizes the cost of network operation by analyzing various states.
Regarding the charging plan of the electric vehicles, Figure 5 shows the timing plan of the electric vehicles in the centralized management system for the models presented in reference [37], while Figure 7 shows the timing obtained from combining the decentralized management of these two models. Dividing the charging interval of the vehicles into three smaller intervals, T a , T b , and T c , shows the most significant change due to decentralized management in the results for interval T b . This change prevents voltage violation at the end of the interval, which is achieved without increasing the microgrid’s cost or violating its other constraints. This means that optimizing the decentralized management was a move in the right direction. The existence of smart contracts for vehicles, planning vehicles charging time using P2P, and presumably differences in the order of receiving orders make these two scenarios inevitably different. Importantly, however, all vehicles have received their intended charge within the due time interval. The average vehicle charge is not changed, and the system’s total cost is not increased.
Finally, examining the results of the decentralized management of power supply shows that microgrid utilization maintains power generation adequacy and observes all system constraints without adding to the total cost of the microgrid. Figure 8 illustrates the method of providing energy using the base load, receiving energy from the primary grid, and the average charging of electric vehicles. The ultimate criterion for verifying each chain is the cost optimization of the system compared to all the states presented in a block. Even if it cannot be proven that the final solution presented in the algorithm is the most optimal global point of the network, it can be claimed that the solution is the most optimal among the proposals of the decentralized network’s point of work. In fact, this solution is equal to the most optimal cost of the centralized network. Figure 8 shows no change in the energy imported into the microgrid compared to the value in the reference paper. Considering the difference in the energy price inside and outside the microgrid, the total microgrid cost has not changed.
Comparing the results of modeling the decentralized microgrid management and its centralized peer shows that:
  • Decentralized management of a microgrid can utilize it at its optimal operating point while maintaining adequacy and observing its technical constraints.
  • A decentralized combination of several optimization models based on Ripple’s two-stage consensus algorithm eliminates each model’s disadvantages and reaches a globally optimized solution.
  • Smart contracts and P2P trades play an essential role in microgrid planning by improving response time, and can be used as an effective tool to direct the microgrid.
The results of comparing the centralized solution in reference [37] with the decentralized solution presented in this paper are provided in Table 5. These results show that the decentralized solution can play a vital role in the rapid and localized network strategy, particularly in electric car charging, by providing an initial solution. Furthermore, this approach ensures the minimum network cost among all available states. As this article is centered on the intra-day period and specifically aimed at addressing load variations from the initial plan, it could serve as a suitable alternative for small-scale intelligent networks, ultimately leading to democratic energy allocation.

6. Conclusions

This paper aims to design and propose a blockchain-based decentralized energy market to support the development and establishment of citizen energy communities. The proposed framework is an appropriate solution for small-scale energy transactions sourced by demand-response resources, electric vehicles, and small renewable power sources with high uncertainty. In essence, this article proposes that rather than solving a centralized optimization problem, a decentralized problem can be solved using various algorithms. With this in mind, a decision can be reached on which solution is optimal and most accurate for a given problem by implementing a consensus mechanism. The solution can be selected and announced to all. This perspective can be generally applicable and is not contingent on the power grid or the electrical industry. Comparing the results of the proposed decentralized system with the conventional centralized systems shows that:
  • Using several parallel algorithms in a decentralized system makes it much more efficient than a centralized one.
  • The two-stage consensus model proposed in this paper ensures adequacy while observing local system constraints and achieves optimality of the final operating point of the system.
  • The layered design makes the response time faster than its centralized peer and provides it with more flexibility, particularly in supplying local energy.
This work aims to open up discussion in this direction and pave the way for the future development of the tools and methods required for small-scale energy transactions, including vehicle-to-vehicle, vehicle-to-building, building-to-vehicle, building-to-building, and other forms of peer-to-peer transactions as the main elements of the citizen energy communities of the future.

6.1. Challenges

One of the most critical challenges in implementing decentralized networks in power systems is concern about the network’s security and stability. How the network responds in critical moments, resistance against attackers, and alignment with long-term operational strategies are key challenges for this network. However, because this network is an open platform and tools such as smart contracts are used, these challenges cannot pose a severe threat to the development of the networks in the electrical industry.

6.2. Future Work

As discussed in the challenges of decentralized networks, improving reliability, stability, strategic management, and network performance is crucial. Smart contracts play a vital role in controlling and guiding these networks. Thus, by expanding these contracts, we can empower the main network participants to lead the network without exerting direct power and ensure network stability. Therefore, developing smart contracts is a key aspect of network advancement alongside enhancing the decentralized network structure.

Author Contributions

Conceptualization, P.M. and V.V.; Methodology, P.M. and V.V.; Software, P.M.; Validation, P.M., M.S.G. and V.V.; Formal analysis, V.V. and M.S.G.; Investigation, P.M. and V.V.; Resources, V.V.; Data curation, P.M. and V.V.; Writing—original draft, P.M.; Writing—review & editing, V.V. and M.S.G.; Visualization, P.M. and V.V.; Supervision, M.S.G. and V.V.; Project administration, M.S.G. and V.V. All authors have read and agreed to the published version of the manuscript.


This research received no external funding.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.


  1. Energy Communities. 2022. Available online: (accessed on 22 June 2023).
  2. Attaran, M.; Gunasekaran, A. Applications of Blockchain Technology in Business: Challenges and Opportunities; Springer: Berlin/Heidelberg, Germany, 2019. [Google Scholar]
  3. Capuano, L. International Energy Outlook 2018 (IEO2018); US Energy Information Administration (EIA): Washington, DC, USA, 2018; Volume 2018, p. 21.
  4. Wang, Q.; Ji, T.; Guo, Y.; Yu, L.; Chen, X.; Li, P. TrafficChain: A Blockchain-Based Secure and Privacy-Preserving Traffic Map. IEEE Access 2020, 8, 60598–60612. [Google Scholar] [CrossRef]
  5. Zhou, Z.; Gong, J.; He, Y.; Zhang, Y. Software defined machine-to-machine communication for smart energy management. IEEE Commun. Mag. 2017, 55, 52–60. [Google Scholar] [CrossRef]
  6. Xiao, H.; Huimei, Y.; Chen, W.; Hongjun, L. A survey of influence of electrics vehicle charging on power grid. In Proceedings of the 2014 9th IEEE Conference on Industrial Electronics and Applications, Hangzhou, China, 9–11 June 2014; pp. 121–126. [Google Scholar]
  7. Vahidinasab, V.; Mohammadi-Ivatloo, B. Electric Vehicle Integration via Smart Charging: Technology, Standards, Implementation, and Applications; Springer: Berlin/Heidelberg, Germany, 2022. [Google Scholar]
  8. Fu, X.; Wang, H.; Wang, Z. Research on block-chain-based intelligent transaction and collaborative scheduling strategies for large grid. IEEE Access 2020, 8, 151866–151877. [Google Scholar] [CrossRef]
  9. Hassija, V.; Chamola, V.; Garg, S.; Krishna, D.N.G.; Kaddoum, G.; Jayakody, D.N.K. A blockchain-based framework for lightweight data sharing and energy trading in V2G network. IEEE Trans. Veh. Technol. 2020, 69, 5799–5812. [Google Scholar] [CrossRef]
  10. Liu, H.; Zhang, Y.; Zheng, S.; Li, Y. Electric vehicle power trading mechanism based on blockchain and smart contract in V2G network. IEEE Access 2019, 7, 160546–160558. [Google Scholar] [CrossRef]
  11. Yahaya, A.S.; Javaid, N.; Javed, M.U.; Shafiq, M.; Khan, W.Z.; Aalsalem, M.Y. Blockchain-based energy trading and load balancing using contract theory and reputation in a smart community. IEEE Access 2020, 8, 222168–222186. [Google Scholar] [CrossRef]
  12. Cohn, J.M.; Finn, P.G.; Nair, S.P.; Panikkar, S.B.; Pureswaran, V.S. Autonomous Decentralized Peer-to-Peer Telemetry. U.S. Patent 10,257,270, 9 April 2019. [Google Scholar]
  13. Afzal, M.; Huang, Q.; Amin, W.; Umer, K.; Raza, A.; Naeem, M. Blockchain enabled distributed demand side management in community energy system with smart homes. IEEE Access 2020, 8, 37428–37439. [Google Scholar] [CrossRef]
  14. Masaud, T.M.; Warner, J.; El-Saadany, E.F. A blockchain-enabled decentralized energy trading mechanism for islanded networked microgrids. IEEE Access 2020, 8, 211291–211302. [Google Scholar] [CrossRef]
  15. 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]
  16. Hassija, V.; Saxena, V.; Chamola, V.; Yu, F.R. A parking slot allocation framework based on virtual voting and adaptive pricing algorithm. IEEE Trans. Veh. Technol. 2020, 69, 5945–5957. [Google Scholar] [CrossRef]
  17. Chen, X.; Zhang, X. Secure electricity trading and incentive contract model for electric vehicle based on energy blockchain. IEEE Access 2019, 7, 178763–178778. [Google Scholar] [CrossRef]
  18. 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]
  19. Liu, C.; Chai, K.K.; Zhang, X.; Lau, E.T.; Chen, Y. Adaptive blockchain-based electric vehicle participation scheme in smart grid platform. IEEE Access 2018, 6, 25657–25665. [Google Scholar] [CrossRef]
  20. Shen, J.; Chen, L.; Zhou, B.; Zhang, M.; Zhou, S.L.; Sun, J.P.; Hou, Z. Intelligent energy scheduling model based on block chain technology. In Proceedings of the 2018 5th International Conference on Information Science and Control Engineering (ICISCE), Zhengzhou, China, 20–22 July 2018; pp. 811–817. [Google Scholar]
  21. Danzi, P.; Angjelichinoski, M.; Stefanović, Č.; Popovski, P. Distributed proportional-fairness control in microgrids via blockchain smart contracts. In Proceedings of the 2017 IEEE International Conference on Smart Grid Communications (SmartGridComm), Dresden, Germany, 23–27 October 2017; pp. 45–51. [Google Scholar]
  22. Duan, B.; Xin, K.; Zhong, Y. Optimal dispatching of electric vehicles based on smart contract and internet of things. IEEE Access 2019, 8, 9630–9639. [Google Scholar] [CrossRef]
  23. Blockchain Network. 2023. Available online: (accessed on 22 June 2023).
  24. Cachin, C. Architecture of the hyperledger blockchain fabric. In Proceedings of the Workshop on Distributed Cryptocurrencies and Consensus Ledgers, Chicago, IL, USA, 15 July 2016; Volume 310, pp. 1–4. [Google Scholar]
  25. Blockchain Hyperledger Fabric. 2023. Available online: (accessed on 22 June 2023).
  26. Hyperledger Fabric Workflow. 2023. Available online: (accessed on 22 June 2023).
  27. Shahbazi, M.; Kazem Pourian, S.; Taghva, M. An applied investigation of Consensus Algorithms Used in Blockchain Networks. Sci. Technol. Policy Lett. 2020, 10, 35–54. [Google Scholar]
  28. Sompolinsky, Y.; Zohar, A. Accelerating Bitcoin’s Transaction Processing. Fast Money Grows on Trees, Not Chains. Cryptology ePrint Archive. 2013. Available online: (accessed on 22 June 2023).
  29. Yaga, D.; Mell, P.; Roby, N.; Scarfone, K. Blockchain Technology Overview. arXiv 2019, arXiv:1906.11078. [Google Scholar] [CrossRef]
  30. Yang, R.; Yu, F.R.; Si, P.; Yang, Z.; Zhang, Y. Integrated blockchain and edge computing systems: A survey, some research issues and challenges. IEEE Commun. Surv. Tutor. 2019, 21, 1508–1532. [Google Scholar] [CrossRef]
  31. Vasin, P. Blackcoin’s Proof-of-Stake Protocol v2. 2014. Volume 71. Available online: https://blackcoin.Co/blackcoin-PosPdf (accessed on 22 June 2023).
  32. Indrakumari, R.; Poongodi, T.; Saini, K.; Balamurugan, B. Consensus algorithms—A survey. In Blockchain Technology and Applications; Auerbach Publications: New York, NY, USA, 2020; pp. 65–78. [Google Scholar]
  33. Schwartz, D.; Youngs, N.; Britto, A. The Ripple Protocol Consensus Algorithm. 2014. Available online: (accessed on 22 June 2023).
  34. Armknecht, F.; Karame, G.O.; Mandal, A.; Youssef, F.; Zenner, E. Ripple: Overview and outlook. In Proceedings of the International Conference on Trust and Trustworthy Computing, Heraklion, Greece, 24–26 August 2015; Springer: Berlin/Heidelberg, Germany, 2015; pp. 163–180. [Google Scholar]
  35. Yu, F.R.; Liu, J.; He, Y.; Si, P.; Zhang, Y. Virtualization for distributed ledger technology (vDLT). IEEE Access 2018, 6, 25019–25028. [Google Scholar] [CrossRef]
  36. Schneider, K.P.; Mather, B.; Pal, B.; Ten, C.W.; Shirek, G.J.; Zhu, H.; Fuller, J.C.; Pereira, J.L.R.; Ochoa, L.F.; de Araujo, L.R.; et al. Analytic considerations and design basis for the IEEE distribution test feeders. IEEE Trans. Power Syst. 2017, 33, 3181–3188. [Google Scholar] [CrossRef]
  37. Morstyn, T.; Collett, K.A.; Vijay, A.; Deakin, M.; Wheeler, S.; Bhagavathy, S.M.; Fele, F.; McCulloch, M.D. OPEN: An open-source platform for developing smart local energy system applications. Appl. Energy 2020, 275, 115397. [Google Scholar] [CrossRef]
  38. Dugan, R.C.; McDermott, T.E. An open source platform for collaborating on smart grid research. In Proceedings of the 2011 IEEE Power and Energy Society General Meeting, Detroit, MI, USA, 24–28 July 2011; pp. 1–7. [Google Scholar]
Figure 1. The microgrid graph for the proposed decentralized microgrid.
Figure 1. The microgrid graph for the proposed decentralized microgrid.
Inventions 08 00086 g001
Figure 2. The consensus graph for the proposed decentralized microgrid.
Figure 2. The consensus graph for the proposed decentralized microgrid.
Inventions 08 00086 g002
Figure 3. The IEEE 13-bus microgrid adjusted for the electric vehicle case study.
Figure 3. The IEEE 13-bus microgrid adjusted for the electric vehicle case study.
Inventions 08 00086 g003
Figure 4. Main chain diagram of decentralized blockchain microgrid.
Figure 4. Main chain diagram of decentralized blockchain microgrid.
Inventions 08 00086 g004
Figure 5. Minimum voltage and charging time of EVs in each phase according to Open Loop and MCP optimization in PGOxford software [37]).
Figure 5. Minimum voltage and charging time of EVs in each phase according to Open Loop and MCP optimization in PGOxford software [37]).
Inventions 08 00086 g006
Figure 6. Minimum voltage of each phase in the decentralized optimization.
Figure 6. Minimum voltage of each phase in the decentralized optimization.
Inventions 08 00086 g007
Figure 7. Time for charging EVs in the decentralized optimization.
Figure 7. Time for charging EVs in the decentralized optimization.
Inventions 08 00086 g005
Figure 8. Energy imported into the microgrid.
Figure 8. Energy imported into the microgrid.
Inventions 08 00086 g008
Table 1. Comparison of references in the literature.
Table 1. Comparison of references in the literature.
[8]InfrastructureManage the issues of extensive networks with massive data
[9]InfrastructureLook for a robust, scalable mechanism in V2G network
[10]InfrastructureA model based on existing blockchain structures
[11]InfrastructureA model mainly depends on its consensus mechanism
[12]InfrastructureUsing the Internet of Things and small producers of renewable energies
[13]InfrastructureThe transaction structures are designed to be executable such as Solidity
[14]InfrastructureDecentralized networks to interact between such islands
[15]FinancialBlockchain multi settlement base Peer-to-peer trading framework
[16]FinancialFinancial systems include contracts, online, and multi stage settlement
[17]FinancialContract model for electric vehicle base peer to peer
[18]FinancialSmart contracts managea decentralized microgrid
[19]FinancialManaging request sending in various algorithms such as iceberg
[20]Power QualityControl the voltage using blockchain infrastructure
[21]Power QualityA reward-punishment system based on voltage changes
[22]Power QualityFocus on mixing centralized and decentralized approaches
Table 2. Comparison of consensus algorithms.
Table 2. Comparison of consensus algorithms.
Energy consumptionHighMediumLow
Resilience against attacks%50%50%20
Average response time10 T/s10–1000 T/s1000 T/s
Table 3. The parameters of the microgrid adjusted for the case study [37].
Table 3. The parameters of the microgrid adjusted for the case study [37].
Number of electric vehicles80
Electric vehicle battery sizes36 kWh
Electric vehicle charger capacities6.6 kW
PV generation capacities200 kWp
Phase voltage magnitude limits0.95 to 1.05 pu
Import price£0.15/kWh
Export price£0.05/kWh
Demand charge£0.10/kW
EMS time-series resolution30 min
Simulation time-series resolution5 min
Table 4. Management of vehicles according to decentralized method.
Table 4. Management of vehicles according to decentralized method.
Smart contractNOYESNONO
Gas (£)1211
Anchor (£)1000
Orderer-A (£)0200.5
Orderer-B (£)0010.5
Initial BlockB1B1B5B2
Final BlockB1B1B5B4
Table 5. Comparison between centralized and decentralized modeling.
Table 5. Comparison between centralized and decentralized modeling.
AlgorithmMCPOpen Loop(MCP-OpenLoop)
Initial ResultNONOHigh-Speed
Final ResultLow-SpeedHigh-SpeedMedium-Speed
Verify ConstraintsOkNOOK
Final Cost System3345 $3352 $3345 $
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Mousavi, P.; Ghazizadeh, M.S.; Vahidinasab, V. A Decentralized Blockchain-Based Energy Market for Citizen Energy Communities. Inventions 2023, 8, 86.

AMA Style

Mousavi P, Ghazizadeh MS, Vahidinasab V. A Decentralized Blockchain-Based Energy Market for Citizen Energy Communities. Inventions. 2023; 8(4):86.

Chicago/Turabian Style

Mousavi, Peyman, Mohammad Sadegh Ghazizadeh, and Vahid Vahidinasab. 2023. "A Decentralized Blockchain-Based Energy Market for Citizen Energy Communities" Inventions 8, no. 4: 86.

Article Metrics

Back to TopTop