Research Summary: A Sustainable, Blockchain-Based Peer-to-Peer Energy Trading System


  • Decentralized, peer-to-peer energy trading is growing in popularity due to the development of distributed energy resource (DER) technologies.
  • Achieving optimal energy expenditure within these systems is challenging.
  • This paper proposes a blockchain-based energy platform to maximize the efficiency of distributed energy resources.
  • The proposed energy platform consists of two parts: (1) a blockchain-based trading system and; (2) predictive analytics which inform the trading system using smart contracts and secure decentralized oracles like DECO.
  • Using machine learning to predict energy consumption data, the paper simulates a system that predicts energy consumption a day ahead and schedules energy disbursement to meet grid demand.

Core Research Question

Can a secure, decentralized energy trading system be designed using blockchain technology, smart contracts, and decentralized oracle networks to maximize efficiency and energy output with day-ahead energy scheduling?


Jamil, F., Iqbal, N., Ahmad, S., & Kim, D. (2021). Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning for Sustainable Electrical Power Supply in Smart Grid. IEEE Access, 9, 39193-39217.



  • Renewable energy resources present opportunities for peer-to-peer (P2P) energy trading between homes and buildings.
  • These are made possible by smart grid innovations such as distributed energy resource (DER) technologies.
  • These technologies allow energy distribution to be decentralized by allowing energy transfer between energy users.
  • They also change the dynamics of energy distribution through reconfiguring the roles of utility companies and energy consumers.
  • Utility companies in this system do not distribute the energy from a centralized source, but rather serve as (1) providers of transmission line infrastructure that the energy is transmitted through and; (2) coordinators of automated energy distribution throughout the grid.
  • Utility companies can thus be thought of as crowdsourcing platforms for energy distribution.
  • A highly secure system utilizing blockchain technology, smart contracts, and secure oracles like Chainlink’s DECO are the kind of tools needed to manage the complex transactions required for such a system.
  • The main challenges for such a system are scalability and security, both of which can be handled with hybrid smart contracts and decentralized oracles.

Definitions and Terminology

Table 1: Blockchain characteristics.

  • Permissioned Blockchain – a centrally controlled, privately managed blockchain. This contrasts with decentralized, permissionless blockchains such as Bitcoin and Ethereum. Table 1 above illustrates how Hyperledger Fabric, the blockchain the authors model their system on, differs from Bitcoin and Ethereum.

  • Practical Byzantine Fault Tolerance (PBFT) Consensus Mechanism – while the permissionless blockchains listed in Table 1 rely on Proof of Work (PoW) consensus mechanisms, the authors argue that some of their faults, which include high energy consumption and scalability issues, suggest that another approach is needed in this environment.

The authors recommend a Practical Byzantine Fault Tolerance (PBFT) consensus mechanism to improve scalability and minimize energy consumption. PBFT consensus tolerates byzantine faults, or component failure, in networks that are prone to attack and instability.

  • Smart Contracts – smart contracts are programs hosted on blockchains that trigger outcomes when certain conditions are met. A breakdown of smart contract examples, features, and use cases can be found on the Chanlink blog.

  • Prosumers – prosumers are providers and consumers of energy within decentralized energy systems. In the energy trading mechanism discussed in this paper, all energy consumers are prosumers.


The energy trading system proposed in this paper requires a number of components in order to effectively distribute energy:

  1. Blockchain network: allows for transaction and network management of the system. Modeled on Hyperledger Fabric, a permissioned blockchain.
  2. Smart contracts and oracles: allows for day-ahead scheduling and controllable loads of distributed energy resources (DERs) along with the flexibility to deal with local needs.
  3. Data analytics and machine learning prediction: data mining and machine learning prediction systems are needed to automate decision-making and predict long- and short-term energy needs.

Blockchain network

Table 2: Comparison of proposed decentralized energy trading platforms.

There are several blockchain-based energy trading platforms that use permissioned and permissionless blockchains along with a variety of consensus mechanisms. These are summarized in Table 2 above.

Figure 1: Energy trading platform overview.

Figure 1 provides an overview of the role of the blockchain network in facilitating energy trading. Each node in the blockchain network is a prosumer who receives energy externally and exchanges energy with other individuals in the network via energy trading transactions (ETT in the diagram).

Figure 2: Blockchain-based energy trading platform workflow.

Smart contracts and oracles

Figure 2 provides a more detailed breakdown of the role of the smart contracts and oracles in the energy trading systems. Oracles bring in off-chain, external energy data to smart contracts which are programmed to make predictions about energy consumption on a short- and long-term basis. These predictions are then used to schedule energy disbursement to meet current and next-day conditions.

Data analytics and machine learning prediction

Figure 2 also contains information about the role that machine learning plays in this scheme. Here we see that machine learning predictions, which use off-chain data provided by oracles, are fed into smart contracts that perform each of the essential functions mentioned above.

Figure 3: Energy trading transaction types.

Energy trading transactions

There are two transaction types in this system: Type 1 and Type 2, both illustrated in Figure 3. Type 1 transactions are between the utility provider and households, and Type 2 are between households themselves. Both are facilitated by rewards given to the energy provider.


The authors are able to implement their system using Hyperledger Fabric and simulate the internal performance of their system by feeding hourly energy consumption data from Jeju, South Korea between 2002-2018 into a simulation of the framework discussed in the paper. Simulations using this data were conducted using a framework called Hyperledger Calliper.

Blockchain component performance

Internal performance of the blockchain-based framework was measured by transaction rate and transaction latency to assess scalability as the number of transactions increased.

Machine learning and data analytics performance

The authors used a number of machine learning algorithms to predict energy consumption. Some of these methods include:

Performance for these methods was measured as the MSE or mean squared prediction error between the actual and predicted energy consumption along with other variations of MSE such as mean absolute error (MAE), root mean square error (RMSE), and R2 which measures model fit.


Blockchain component performance

Figure 4: Transaction Latency and Throughput Analysis. Send rate is in transactions per second (TPS). Latency is in milliseconds (ms). Throughput is in TPS.

Machine learning and data analytics performance

Figure 5: Comparison of proposed Bidirectional LSTM approaches with traditional deep learning approach for energy consumption prediction.

Figure 6: Comparison of the proposed approach with other machine learning methods.

Discussion and Key Takeaways

The authors conduct a massive undertaking in this paper. They create a framework for efficient peer-to-peer energy transactions in a decentralized blockchain-based system, design that system using a permissioned blockchain, and simulate how that system would operate using real, hourly energy consumption data from South Korea. They then go on to demonstrate that the system performs well under simulated conditions in terms of its ability to handle transactions and to predict needed energy consumption accurately.

For these reasons alone, the authors should be commended for the contributions they’ve made here toward the future of sustainable energy.

That being said, any energy distribution system must also be judged by how secure it is and the extent to which it reduces pollution. Both of these features seem to be assumed in this paper without any additional proof. An absolutely essential part of such a system would require incorporating decentralized identity systems like CanDID to handle users’ information and privacy-preserving, secure oracles like DECO to help ensure seamless data transfer.

Both of these features should be the focus of similar papers in the future.

Implications and Follow-ups

The authors demonstrate that a blockchain-based peer-to-peer energy trading system is not only possible but also can be scalable and continuously make the accurate predictions needed to maintain such a system.

Thus, they provide a strong foundation for future research in this area and give entrepreneurs as well as city, state, and local governments developing these technologies greater confidence in their ability to successfully transition from the existing, centralized electricity distribution system to a decentralized distributed energy resource (DER).


How would something like this intersect with the other system you recently described which seemed like it was accurately pricing in negative externalities into the environment?


Thats a really good question. I think if such as system were implemented on a large enough scale, it would be easy enough to funnel the data analytics from the decentralized grid into the carbon credit system to generate tradable credits for the utility company.

Something along those lines, I think, would be readily achievable.

1 Like

Would love to hear thoughts on this topic from @Larry_Bates, @eleventh and @valeriespina!


If someone can produce energy locally, they have the option to sell their energy back to the electric company. I am not sure I understand how this system would work without creating an entirely new electrical grid that was not controlled by a single entity. Peer-to-peer electricity trading works when there is a system in which the peers can sell the electricity to another peer, however, this requires a connected grid.

From what I can tell, this approach adds another layer to the already implemented system of selling energy in attempt to give “prosumers” the capacity to sell their energy without going through the utility company.

It just does not seem feasible to me that the utility companies would let individuals use their lines without some form of fee, which might then make this process more expensive to acquire energy than if a consumer just dealt directly with the utility company.

Further, I can see this system creating problems in a situation where power had to be rationed and thus it creates a situation where the price of electricity could snowball out of control.

On the one hand, I understand the impetus to put more power in the hands of prosumers (not to make a pun), but in a real application that is not just testing tracking transactions, it does not seem possible that this system could get electricity to consumers who are not prosumers at a cheaper rate than the utility company providing the power lines. This is not the first attempt I’ve seen at this type of peer-to-peer electricity trade, and almost none of them ever talk about building infrastructure.

I am concerned that this is unrealistic and will not scale, but I am not sure if I am understanding their approach correctly to know if that feeling is valid or not. Do you have any insights into how they approach infrastructure and whether renting infrastructure is the only approach mentioned?


Fully agreed. It is a highly regulated environment in which few players are allowed to act. It’s also not clear to me if the short-term markets would include ancillary services, or if those need to be fulfilled by the existing actors.

Another issue not discussed is the privacy in micro-grids of such prosumer networks.


First off, I love this article. Thanks for posting @jasonanastas !

To respond to Larry’s comment: this is ~sort of~ a new grid. It’s the model of microgrids. That, yes, are currently not supported by utility companies/centralized authorities in every state, but can be installed today without the help or approval of an Independent System Operator (ISO)/Investor-Owner Utility(IOU). That doesn’t mean you’ll be able to transact with your neighbor but it’s a cart before the horse right now, and groups are trying to localize energy creation and become prosumers as the first step in decentralizing energy production from coal and oil. There is a model of this in Brooklyn, work going on in California, and Maine. It’s my opinion that the market will continue to see prosumers in Single-Family dwellings, and some form of community solar/renewables supported by ISOs for Multi-Family. I think only after the market is saturated with renewables that they’ll be this optimization (transacting). So I agree that it seems unrealistic now, or to think we’ll see it in 3 or 5 years, but I say give it a decade. The demand to get off of coal and oil is not only so high but necessary that I don’t think this is unrealistic, we’re just not anywhere close to optimizing current use of renewables. The cost to own and install solar on your home only recently became cost-effective (i.e., again, we’re just early).

I know that utility companies typically do not like any form of distributed energy resources (DERs) because they do not make the utility money in most cases–they are profit oriented :slight_smile: . This has also limited the rollout of DERs, and that is why in places with innovations off-grid they’ve been pushed by grassroots efforts fighting for regulatory and policy change. This is a public policy issue more than, if not equal to, it is technical.

I’m very confident we’re going to see some kind of P2P energy market place though. If we look at Australia, they’re almost a decade ahead of the US (and California), and have had plenty of lessons learned for less progressive energy markets to build off of. Check out Powerledger, Energy Web, and Grid Singularity. This is not an endorsement of the projects, but they’re doing interesting work.

I’ve attached this image below. I recently created a deck outlining all the innovation going on in energy/power blockchain. Again, this says less about the technical capabilities and infrastructure needed to actualize these new models (P2P energy trading; microgrids; etc), but the demand and the innovation is there and the problems to solve aren’t technical, they’re political.


This makes complete sense! Thank you for this detailed and referenced response!


To add a little more detail to @valeriespina’s response:

Like most other innovations, microgrids (more recently known as smart grids) require that various independent technologies become equivalently mature as well as technically aligned. This can be a long (sometimes decades-long) process during which it will seem for years that nothing is happening, and then, as if by magic, “the future is suddenly here.”

Obviously, no magic is involved, just a lot of hard technical work.

Note that the smart grid “does not replace the existing electric system but rather builds on the available infrastructure.” Smart grids are essentially subsets of larger electrical utility grids, the two being linked by a “point of common coupling” that maintains voltage at a constant level until there is a problem on the utility’s grid.

If the utility-provided power starts to fluctuate, the smart grid evens out the flow by bringing in locally produced energy. But smart grids can also operate in island-mode, so if the central utility goes down altogether the smart grid disconnects and uses its own local generating and/or storage capacity. To make this “magic” happen requires sensors sampling the power-flow many times per second, and specialized software to manage selling as well as buying electrical energy from both utilities and peers.

And, as @valeriespina rightly says, a lot of politics is involved at every level. Which of those two things—technology development or politics—slows down the arrival of the future more is a matter of debate.


My comment is not really related to the topic of P2P smart grids, and I don’t want to sound picky but it seems to me that this table comparing blockchains is wrong:

1- For the Smart Contract column: different languages are possible for Hyperledger Fabric and Ethereum so it would be better to describe the compiler (or list the different languages). We could also discuss the presence of smart contracts on Bitcoin but it is ‘touchy’.

2- For the Transactions column, transactions are not anonymous on Bitcoin nor on Hyperledger Fabric in which, on the contrary, nodes are identified (although they can be masked in some way using their Identity Mixer concept). They are both pseudonymous. And I don’t see why Ethereum is different with its public/private…

3- Hyperledger Fabric’s consensus algorithm is not PBFT but has been Kafka and then Raft for the latest versions (illustration of RAFT here: Raft). These algorithms are not BFT (Byzantine Fault Tolerant) but only CFT (Crash Fault Tolerant) because they use a leader/follower system, i.e. they are not tolerant to dishonest nodes but only to a network failure.

4- For the Programming language column, Hyperledger Fabric is coded in Golang (Java and NodeJS are only supported for smart contracts). Bitcoin and Ethereum have several implementations, the most widespread being C++ for Bitcoin (Bitcoin core) and Golang for Ethereum (Geth). I think there was a confusion between the language supported for smart contracts and the client implementation language.

Moreover, I don’t really agree with this sentence (page 3 of the article) that is used when describing the distinction between permissioned and permissionless blockchains:
“Therefore the permissionless blockchain is less transparent, less anonymous, and less secure as it depends on the participants’ integrity. Likewise,the permissioned blockchain is more secure, high customizability, better scalability, and enhanced access control mechanism”

I know it doesn’t change much to the topic and the smart grid model described by the authors but I think it was still important to mention it for the forum.


@Sami_B Some great points here Sami. I would seriously suggest contacting the authors and mentioning some of these points. You would be doing them and those reading the paper a public service!


@rlombreglia Thank you for providing more information about microgrids and smart grids. It is true that the development of these technologies requires the convergence of multiple independent technologies and can take a long time. However, once these technologies become mature and technically aligned, they have the potential to transform the way energy is generated and distributed.

Smart grids can help to improve the reliability and resilience of the power grid by bringing in locally produced energy in the event of fluctuations in utility-provided power, and by being able to operate in island-mode if the central utility goes down. Sensors and specialized software are essential components of a smart grid, as they allow the grid to continuously monitor and manage the flow of power.

As you mentioned, politics can also play a significant role in the development and adoption of new technologies, such as smart grids. Policy and regulatory changes may be necessary to support the deployment and integration of these technologies into the existing power grid.

Hello there, @valeriespina. This is very informative, and I must compliment you on this excellent work.

I agree that the demand for a transition to renewable energy sources is high and necessary. It is also true that the cost of solar power has recently become more cost-effective, which has helped to increase its adoption. However, it is important to note that the transition to renewable energy sources will not be easy and will require significant investment in infrastructure, as well as changes in policy and regulations.

Utility companies may not be enthusiastic about distributed energy resources (DERs) because they do not generate revenue for the utilities in the same way that traditional power plants do. However, DERs can offer a number of benefits, including increased reliability and resilience of the power grid, and reduced greenhouse gas emissions.

It is interesting to see the innovation that is happening in the energy and power sector related to blockchain technology. P2P energy trading and microgrids have the potential to disrupt the traditional energy market and enable more distributed and decentralized forms of energy generation and distribution. However, as you mentioned, there are still political challenges to overcome in order to realize the full potential of these technologies.

1 Like