1. Introduction
Over the past decade, Distributed Energy Resources (DER) have experienced a substantial global proliferation [
1,
2,
3,
4]. These resources have revolutionized the dynamics of energy generation and distribution within the energy sector by enabling consumers and prosumers (individuals who both generate and consume electricity) to engage in direct energy sharing without the necessity of intermediaries. This paradigm shift is exemplified by peer-to-peer (P2P) energy systems, which facilitate surplus energy exchange among prosumers and other network participants, including consumers and prosumers.
Trading electricity in a P2P manner caters to the requirements of both consumers and prosumers while simultaneously reducing transmission losses. Nonetheless, the inherent fluctuations in the supply and demand of energy might introduce instability, potentially impacting its reliability. The “energy trilemma” encapsulates the central challenges that confront the energy industry, characterized by the conflicting imperatives of energy security, equity, and environmental sustainability.
DERs present localized energy solutions, which are different compared to standard unidirectional energy systems. In the traditional model, power is generated at centralized power stations, distributed through expansive distribution networks, and subsequently transmitted to consumers. Conversely, DERs facilitate energy exchange within a P2P network, classifying end-users into consumers and prosumers, both of whom can engage in reciprocal energy sharing, referred to as energy trading.
A cutting-edge use of blockchain technology that is profoundly altering the energy area is peer-to-peer energy trading. This innovative approach enables prosumers—individuals who produce and consume electricity—to sell their surplus energy to nearby customers directly by bypassing conventional middlemen like utility corporations. The way we generate and use power might be revolutionized by this move toward decentralized, transparent, and secure energy markets. Prosumers who use renewable energy sources (RES) to produce their electricity, such as solar panels, have the chance to sell any surplus to other customers through P2P energy trading. In making these transactions possible, the blockchain becomes essential because it offers a safe and transparent platform for tracking each trade of energy. These transactions are smooth and automatic because smart contracts are self-executing agreements with established rules. The advantages of this approach are manifold. Firstly, it empowers prosumers, allowing them to monetize their surplus energy at a fair market price. This incentive encourages further investments in renewable energy sources, contributing to a more sustainable energy ecosystem.
Furthermore, the blockchain’s role in streamlining transactions leads to reduced costs, making P2P trading economically viable. It also ensures the security and transparency of transactions, reducing the risk of fraud and enhancing trust among participants. The decentralization inherent in P2P energy trading reduces the dependence on central utilities, thus promoting a more distributed and resilient energy grid. As P2P energy trading gains momentum, several startups, including LO3 Energy (LO3 Energy—Start Up Energy Transition (
https://www.startup-energy-transition.com, accessed on 18 November 2022)), have pioneered platforms for these transactions. Established utilities are also exploring blockchain-based solutions. P2P energy trading has the ability to transform the energy landscape, making it more sustainable, effective, and available to all. Renewable energy sources are being adopted at an increasing rate. Blockchain stands at the forefront of this energy revolution, offering a secure and transparent foundation for transactions that benefit both producers and consumers alike.
Businesses are starting to acknowledge the extensive application of blockchain technology in P2P energy trades, which is prompting them to change their business strategy. The blockchain revolution is fostering innovation and steering the energy sector toward more intelligent grids. Nevertheless, the realization of blockchain’s full potential in P2P energy trading is an ongoing journey, marked by proof-of-concept and adoption phases. Existing limitations related to blockchain performance, scalability, and interoperability continue to be subjects of discussion. Implementing blockchains at a large scale remains a challenge, with the lack of communication and interoperability between different blockchain networks hindering scalability.
This research paper is guided by three key objectives, which include looking into P2P energy trades and evaluating how the blockchain plays a part, suggesting a flexible, reliable, and safe framework that facilitates efficient and frequent energy exchange; finally, assessing the feasibility of the suggested model by conducting a practical test of peer-to-peer energy trading as a real-life example. The parts that follow will provide a thorough analysis of the literature, examine multiple energy trading models that utilize blockchain technology for peer-to-peer transactions, present a case study, and address potential future research areas. The terminologies utilized in this paper are outlined in
Table 1.
3. Systems for P2P Energy Trading Based on Blockchain Technology
A novel blockchain-based architecture that overcomes the hurdles of expansiveness, safety, and dispersion within the energy trading domain is instigating a revolution in P2P energy commerce [
17]. This model’s core aim is to create a scalable, secure, and efficient environment for rapid and frequent energy trading. This is achieved through a second-layer solution built on a robust blockchain foundation.
In the world of blockchain P2P energy trading, there are two main participant types: “Energy network participants” encompass “prosumers” (those who both consume and produce energy) and “traditional consumers”. These participants use the blockchain network to handle shared renewable energy transactions. Some also serve as blockchain miners, contributing computational power to maintain transaction accuracy. Block producers, responsible for processing transactions and creating blocks, fall under the miner category as stewards to the blockchain network [
16,
18].
Participants in P2P energy trades can draw energy depending on their production and consumption balance or send excess energy to the grid. Renewable energy contributions from prosumers are rewarded with remuneration, sometimes in the form of cryptocurrencies or crypto-utility tokens. Consumers benefit from competitive rates when purchasing energy using the same cryptocurrency [
19]. Pricing is determined by market conditions or a fixed token supply with variable renewable energy availability and is dependent on the dynamics of demand and supply for renewable energy that is currently available [
20,
21].
Figure 1 provides a visual representation of the distributed P2P connections, encompassing consumers, prosumers, and agents entrusted with three primary objectives: (i) equitable profit distribution among prosumers, (ii) collaborative contract deployment with prosumers, and (iii) optimization of energy trading bids [
22].
The proposed methodology for P2P energy trading consists of four main components: home miners, smart meters, storage devices, and an energy blockchain. Each of these components works together to create a seamless and efficient energy trading framework. Firstly, home miners refer to individuals or households that have their own renewable energy sources, such as solar panels or wind turbines. These home miners can generate their own electricity and can also store excess energy in their storage devices. This allows them to become energy producers rather than just consumers, which is a key aspect of P2P energy trading. Next, smart meters are used to measure and record the energy production and consumption of each home miner. These digital meters provide real-time data that can be accessed by both producers and consumers, allowing for accurate and transparent energy trading. Storage devices play a crucial role in the proposed methodology as they enable home miners to store their excess energy for later use. This is especially important for renewable energy sources, which are not always able to generate energy consistently. By using storage devices, home miners can ensure a steady supply of energy for themselves and have the option to sell their excess energy to other consumers. The final component of the proposed methodology is the energy blockchain. This is a digital ledger that records and verifies all energy transactions between home miners. The use of blockchain technology ensures secure and transparent transactions, as well as eliminates the need for intermediaries such as utility companies. This decentralized approach allows for a more efficient and cost-effective energy market.
Overall, the proposed methodology for P2P energy trading is a holistic approach that involves the active participation of individual energy producers and consumers. By utilizing renewable energy sources, smart meters, storage devices, and an energy blockchain, this framework has the potential to revolutionize the traditional energy market and create a more sustainable and resilient system. The adopted system architecture includes several key components that work together to achieve this scalability. The first component is the main blockchain network, which serves as the foundation for the entire system. This is where all the transactions are recorded and verified by the network participants. The second component is the scalability layer, which acts as a bridge between the main network and the applications. It is responsible for handling a higher volume of transactions and ensuring smooth and timely processing. One of the key features of the scalability layer is its ability to process transactions off-chain. This means that instead of every transaction being recorded on the main blockchain, it can be processed and verified on the scalability layer. This significantly reduces the burden on the main network, allowing it to handle more transactions without compromising its speed or security. Moreover, this approach also reduces the transaction fees as the transactions on the scalability layer are processed at a lower cost compared to the main network. Another important component of our system architecture is the use of smart contracts. These are self-executing contracts that are built on top of the blockchain network and can automate the execution of specific tasks. By leveraging smart contracts, we can further improve the efficiency and scalability of our approach. For instance, we can use smart contracts to batch multiple transactions together, reducing the overall transaction fees and increasing the network’s throughput. In addition to scalability, our approach also offers increased security. By separating the high-volume transactions from the main network, we are able to mitigate the risk of network congestion and potential attacks. This is because the scalability layer operates independently and is not affected by any disruptions on the main network. Furthermore, the use of blockchain technology ensures that all transactions are immutable and tamper-proof, providing an added layer of security to the entire system.
In the proposed use case study, we assume that Kahramaa (Qatar General Electricity & Water Corporation) employs specific pricing tariffs (see
Table 3). Energy wholesalers provide energy at higher costs (e.g., USD 0.073 during peak hours and USD 0.0364 during off-peak periods) when energy demand exceeds network capacity. This incentivizes surplus renewable energy production, reducing energy prices and rewarding prosumers. Prosumers set their buying and selling prices, with trades occurring when prices align. Payment transactions in P2P energy trading are facilitated by blockchain. Transactions record the payer, payee, and payment amount. These are securely stored on a decentralized ledger using smart contracts. Smart contracts enforce rules for payment calculations based on energy tariff spot prices and consumption or production data from energy smart meters. They are programmable code segments acting as autonomous agents, eliminating the need for intermediaries or central authorities.
Transaction processing in P2P energy trading involves several crucial steps, as shown in
Figure 2. It starts with P2P energy sharing between prosumers and consumers. Smart contracts then initiate payment transactions, utilizing tariff and energy data to calculate the payment amount. To ensure security, they are encrypted with methods like homomorphic encryption and grouped into a block.
Blockchain miners validate these transaction blocks and broadcast a candidate block to network nodes. Nodes collectively validate transactions through a consensus mechanism, ensuring that funds are available before authentication. The blockchain forms a linked list of blocks through hashing and common signatures, maintaining a comprehensive transaction history. Given blockchain’s current limitations, second-layer solutions are explored to enhance transaction speed and capacity without compromising security. These solutions hold promise in addressing the blockchain trilemma. The study proposes a use case for second-layer solutions, sidechain processing of off-chain transactions, and network transaction fees as incentives for autonomous operation in blockchain-based P2P energy trading (see
Figure 3). The pairing can occur between a prosumer and a consumer, and it can also be between two prosumers.
Participants deposit a payment to commit an operation fee into a wallet with multiple signatories that acts as the contract’s repository to start a smart contract. Let us say that A and B each contribute USD 300. Both parties sign the transaction digitally before it is uploaded to the blockchain for validation. These digital signatures authorize the transaction, verified through the participants’ public keys. As long as they retain control over their private keys, no one else can sign on their behalf. The transaction block is stored in a sidechain, becoming its root.
Figure 2 illustrates a payment limit of USD 1000, which the smart contract utilizes to calculate energy prices and ensure that the total transaction does not exceed this amount.
Participants in this system agree to transactions beforehand, guaranteeing that all parties can complete many transactions as long as they have enough money in the payment channel. The commitment bond, a proof-of-stake consensus technique, is used to store off-chain transactions on a sidechain. Transaction fees serve as compensation for sidechain consensus. Within the sidechain, these transactions are arranged into a tree structure, with the depth of the tree growing as more users conduct trade. By enforcing state changes inside chain hierarchies, this architecture creates a system that is resistant to fraud. The parties concerned must work together to close the channel or settle the dispute. According to the final amount following the previous transaction, reimbursements are distributed upon settlement. Participant A receives a USD 200 refund, and Participant B receives a USD 500 refund in
Figure 2, which serves as an illustration of the final settlement. These settlements often take place at the conclusion of a predefined billing cycle, enabling participants to start new contracts for ongoing involvement.
The wholesaler or municipal authorities may need a comprehensive, auditable transaction record for legal and auditing reasons. In these circumstances, authenticated and recorded sidechain transactions might be encoded using cutting-edge techniques like zero-knowledge proofs [
22]. The electrical grid authority may securely maintain the most recent version of the whole sidechain ledger. P2P electrical transactions may be logged and invoiced on the blockchain at specified intervals, maybe in a span of five seconds or every 15 min. Second-layer recorded transactions provide efficient and quick procedures [
23]. This strategy permits rapid micropayments that can also pay transaction costs, unlike conventional bimonthly payments.
Off-chain transactions [
24] remain off the blockchain, relying on bonded fraud proofs for enforcement, ensuring reliable autonomous network operation with minimal downtime. Penalties are imposed on fraudulent behavior. For final settlement transaction timing, a number of tactics can be used, such as predetermined time frames or based on the volume of trading transactions [
25,
26]. The energy trading network could perform the same functions as the blockchain network, but it does not offer the same level of security advantages. Although simultaneous contract exits might overburden the network, the second-layer method lowers transaction fees and simplifies smart contract execution [
27]. In such cases, participants receive refunds, presenting a challenge for energy trading. Policies may need to impose fees or higher tariffs by the wholesale producer if smart contracts are not funded adequately.
4. Case Study of a P2P Energy Trade
Using information from the Education City Community Housing (ECCH) compound reported in
Figure 4, this research seeks to estimate the volume of transactions and related costs in participant energy trading, considering both blockchain models and the cost reductions made possible by the second-layer solution. Using Hyperledger Fabric’s smart contract, we’ve created a smart grid in which prosumers and consumers trade energy. The private blockchain network is established from GUI provided by Hyperledger Fabric and Solidity for writing smart contracts. Our model covers eight nodes in this study, with transactions taking place between a consumer and a prosumer.
The balance of energy between prosumers (energy producers and consumers) that is formed by the dynamics of demand and supply of energy, determines the number of transactions. Energy demand occurs when energy import surpasses export, while an energy surplus results from the reverse scenario.
Figure 5 illustrates the process of matching demand with supply to determine the number of transactions. Energy demand is rated and coupled with supply when there is a greater demand for energy than there is supply. While decreasing demand ranking produces the fewest transactions, ascending demand ranking produces the greatest number of deals. In contrast, supply is rated and matched with demand when supply is greater than demand. Transactions are maximized by a falling supply ranking, whereas they are minimized by an ascending ranking (see
Figure 6).
The number of transactions (TX) over a two-month period is determined by computing Equation (1) for the lowest number of transactions and Equation (2) for the greatest amount.
where,
: Entire energy consumption;
: Total energy demand;
: Nb of transactions.
: Hours per day. For instance, “
t” would be equal to 288 slots each day with 5 min settlements, whereas “
t” would be equal to 48 slots per day with 30 min settlements;
: Day’s value, which in this case is 82 days;
: Prosumer;
: Prosumers;
: Microgrids;
: Change in load;
: Change in price;
: Elasticity factor;
: Supply–Demand Ratio.
The consideration of horizons in energy trading mechanisms is crucial in ensuring efficient and effective energy markets (refer to
Figure 7). One way in which horizons are being considered in energy trading mechanisms is through the use of different market products. The consideration of horizons in energy trading mechanisms also affects the way bids are accounted for. Bids refer to the offers made by market participants to buy or sell energy. In a single product market, all bids are considered for the same time horizon. This means that bids for both short-term and long-term contracts are accounted for in the same market, which may lead to inefficiencies and mispricing. Some energy markets have adopted a continuous product approach to address this issue, where bids for different time horizons are accounted for separately. This allows for more accurate pricing and better matching of supply and demand.
In a single-product scenario, bids are accounted for in a straightforward manner. When a buyer places a bid for a product, it is recorded on the blockchain and can be seen by all participants in the marketplace. The seller can then choose to accept or reject the bid, and if accepted, the transaction is completed and recorded on the blockchain. This ensures that there is a clear and transparent record of the bidding process and the final sale of the product.
In a continuous product scenario, bids are accounted for in a more dynamic manner. The blockchain marketplace allows for real-time bidding on a product that is continuously available for sale. This means that multiple buyers can place bids on the product simultaneously, and the seller can choose to accept the highest bid at any given time. The bids are recorded on the blockchain, and the seller can see the current highest bid and the bidding history for the product. This creates a competitive and fair environment for buyers and sellers, as all bids are visible and cannot be tampered with.
The studied wholesale power market now has a 30-min settlement time. A 5-min settlement period will be implemented. The energy statistics for both minute settlements (30 and 15 min) are employed to determine the minimal and maximal transactions. The daily average of transactions is shown in
Figure 8 for both the 5-min and 30-min time frames. Five-minute settlements varied from 260 to 1780 transactions in the ECCH experiment, and thirty-minute settlements ranged from 40 to 460 transactions. The red and blue curves stand in for these transactions. The blue curve representing the 30-min settlements shows a relatively steady and consistent level of transactions throughout the day, with a slight dip during the early morning hours. On the other hand, the red curve representing the 5-min settlements has a more volatile pattern, with peaks and dips throughout the day. This suggests that the 5-min settlement period will allow for more flexibility in trading, as there will be more opportunities to buy and sell power at different price points throughout the day. This could potentially lead to more efficient and competitive pricing in the wholesale power market. Additionally, the implementation of a 5-min settlement period could also lead to more accurate and timely settlement of transactions, as it would reduce the time lag between the time of trade and the time of settlement. This could help to reduce the risk and uncertainty for market participants, as they would have a more accurate and up-to-date understanding of their financial positions. However, there may also be challenges in implementing a 5-min settlement period, such as the need for updated and advanced technology to handle the increased frequency of settlements. Overall, the shift toward a 5-min settlement period in the wholesale power market shows a commitment to continuously improving and modernizing the energy sector in order to meet the evolving needs and demands of the market. This change has the potential to bring about positive changes in the market, and it will be interesting to see how it affects the overall dynamics of the wholesale power market in the future.
When evaluating the costs of blockchain fees on the Hyperledger Fabric (HF) blockchain, it is important to consider the additional fees associated with the blockchain technology. These fees can vary depending on the type of blockchain network being used and the type of transactions being made. For example, the fees associated with transactions on the public Ethereum blockchain are typically higher than those associated with the private HF blockchain. For example, transactions that involve smart contracts may incur additional fees due to the complexity of the execution logic. Additionally, the fees associated with deploying and running a smart contract may be higher than the fees associated with a regular transaction. Furthermore, the fees associated with deploying and running a dApp on the HF blockchain may be higher than the fees associated with a normal transaction. Additionally, the fees associated with running a permissioned network may be higher than those associated with a public blockchain. Finally, the fees associated with running a private network may be higher than those associated with a public blockchain [
18].
The cost of using Hyperledger Fabric (HF) to process transactions in USD depends on a variety of factors, such as the particular blockchain network size and the number of nodes, the number of transactions per second, the complexity of the transaction, and the amount of data stored in the chain. In general, the cost per transaction in Hyperledger Fabric is lower compared to other distributed ledger technologies since its permissioned and private architecture allows for more efficient data processing and storage. Moreover, the use of smart contracts and other features, such as consensus algorithms, enable the network to run more efficiently, reducing the cost per transaction. Since Hyperledger Fabric is an open-source platform, the cost of running the network is determined by the cost of setting up and running the nodes and is dependent on the resources required to run the network. Additionally, there are certain fees associated with the use of the network, such as transaction fees and gas fees, which can be paid in USD or other currencies. Overall, the cost of using Hyperledger Fabric to process transactions in USD is relatively low compared to other blockchain networks.
Equation (3) outlines the calculation for HF blockchain transaction costs, which are based on the size of the transaction in bytes and the transaction fee rate set by the network. The equation is as follows:
For example, if the size of a transaction is 150 bytes and the fee rate is 0.001 ETH, the cost of the transaction would be 0.15 EneToken (Native currency created with chaincode for HF). When a customer makes a purchase using EneToken, the value of the transaction is first converted to US dollars based on the current exchange rate. The customer’s EneToken wallet is then debited the equivalent amount in EneToken, while the merchant’s account is credited with the converted US dollar amount. This process ensures that both parties are aware of the exact amount being transacted and eliminates any confusion or discrepancies. The fee rate is determined by the network, and it can vary depending on the current network load and the specific blockchain protocol. As a general rule, larger transactions tend to have higher fees, and if the fee rate is too low, the transaction may not be accepted by the network. It is important to research the fee rate of the network before submitting a transaction in order to ensure that the cost of the transaction is not too high and that it will be accepted by the network. Additionally, some networks allow users to set their own fee rate, which can be a useful tool for controlling the cost of transactions.
Figure 9 displays the daily average cost per transaction over the course of two months. Equation (4) provides the computation of the overall blockchain costs.
For 50 properties over a period of two months,
Figure 10 shows the lowest and maximum number of transactions and related expenditures. By utilizing a second-layer method, the block finality time—the length of time it takes for transactions to be recorded on the blockchain—can be configured to lower computational costs for each transaction. This has a significant impact on cost reductions. The maximum transaction cost was determined by the cost that occurred on 8 August 2019, while the minimum cost was calculated using the cost noted on 8 September 2019. Equations (5) and (6) illustrate the computation for the minimum and maximum costs of the second-layer solution:
Here, tmin corresponds to 8 September, and tmax corresponds to 8 August 2019.
Figure 11 compares the costs of blockchain solutions with and without implementations at the second layer, as well as the total and % of money saved. Savings vary from 95% to 98% when comparing the cost of employing the second-layer technique to the cost of registering each transaction on the blockchain.
The proposed two-layer blockchain has the potential to revolutionize the way we use and interact with technology. One of the biggest benefits of this new system is its applicability. Unlike traditional blockchains, which are limited to specific use cases, the two-layer blockchain can be used in a diverse range of industries and applications. This opens up a world of possibilities for businesses and individuals alike, as they can now leverage the power of blockchain technology in ways that were previously unavailable to them. In addition to its applicability, the two-layer blockchain also offers a unique advantage in terms of renewable energy. The system is designed to maximize the use of renewable energy sources within the community. This means that the energy used to power the blockchain is sourced from sustainable sources, such as solar, wind, or hydropower. Not only does this benefit the environment by reducing our reliance on fossil fuels, but it also has a positive impact on the local community by promoting the use of clean energy sources.
Furthermore, the two-layer blockchain has the potential to significantly reduce the cost of transactions. This is due to the fact that the system operates on two separate layers—the main layer and a secondary layer. The main layer is responsible for processing and verifying transactions, while the secondary layer handles more complex tasks, such as smart contracts. By separating these tasks, the system is able to process transactions at a much faster and more efficient rate, resulting in lower transaction fees. This is a huge advantage for businesses and individuals who are looking to save on transaction costs and increase their profit margins. Overall, the proposed two-layer blockchain offers a multitude of benefits that have the potential to greatly impact our society. From its wide applicability to its focus on renewable energy and cost efficiency, this new system has the potential to revolutionize the way we interact with technology and conduct transactions. As we continue to move toward a more digital and sustainable future, the two-layer blockchain has the potential to play a key role in shaping the way we live and do business.
5. Conclusions
Within the framework of the energy trading blockchain trilemma, the objective of this research is to provide a comprehensive evaluation of the status of scaling solutions. Even though peer-to-peer (P2P) energy trading is still in its infancy, blockchain technology has recently attracted more interest since it offers great promise for revolutionizing the way that energy is distributed. The industry has also witnessed the emergence of numerous startups. The success of energy trading depends on several important aspects, including technical improvements as well as regulatory, legal and economic, legal, and regulatory issues. For instance, transaction processing costs are far lower than the existing coordination costs, enabling more frequent energy trading that can fully realize the promise of renewable energy. While maintaining the security of P2P trading against participant misbehavior, criminal activity, and fraud is essential, competitive pricing for energy providers and prosumers can further encourage the renewable energy market.
While these solutions show promise in improving scalability, they also bring their own set of challenges. For instance, layer two solutions require more complex smart contracts and can potentially compromise the decentralization and security of the network. Sharding and sidechains also require significant changes to the existing blockchain infrastructure, making them more difficult to implement. Apart from technical solutions, there are also regulatory and legal barriers that need to be addressed for the successful adoption of blockchain-based energy trading. The lack of regulatory frameworks and standards for energy trading on the blockchain can hinder its growth and adoption. Additionally, legal issues such as data privacy and protection of consumer rights need to be addressed to build trust in technology. Furthermore, the economic aspect of blockchain-based energy trading is also crucial. The success of P2P trading relies on competitive pricing for both energy providers and prosumers. However, the current volatility of cryptocurrency prices and the lack of stable pricing mechanisms can make it challenging to achieve this goal. To overcome these challenges, collaboration between stakeholders, including energy companies, regulators, and technology providers, is essential. Regulatory frameworks need to be developed to ensure the security and transparency of energy trading on the blockchain. Moreover, partnerships between energy companies and blockchain startups can help in the development of more efficient and scalable solutions.
In conclusion, while blockchain technology holds great potential for revolutionizing the energy distribution industry, its widespread adoption and success depend on addressing the trilemma of scalability, security, and decentralization. The current status of scaling solutions shows promise, but further research and development are necessary to overcome the technical, regulatory, and economic challenges. Collaboration and partnerships between stakeholders will be crucial in shaping the future of energy trading on the blockchain.