Blockchain-Based Peer-to-Peer Energy Trading: Design and Implementation of the Tokenized Decentralized Energy Management System (DEMS) | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Blockchain-Based Peer-to-Peer Energy Trading: Design and Implementation of the Tokenized Decentralized Energy Management System (DEMS) Demiral AKBAR, Mert ÜNAL, Recep AKKAYA, Orkun BALCI This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6787257/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract This study presents a decentralized energy management system (DEMS) designed to enable secure, transparent, and efficient peer-to-peer (P2P) energy trading using blockchain technology. The platform utilizes energy tokenization through ENRTokens and employs smart contracts to automate trustless transactions among users. Built on a permissioned blockchain infrastructure, the system enhances transparency, auditability, and data integrity while minimizing reliance on centralized intermediaries. The implementation, evaluated on a four-node validator network, features a modular smart contract architecture and is designed with a microservices-based structure to support scalability and adaptability across various smart meter manufacturers and blockchain networks. Experimental results demonstrate the successful execution of token-based energy trades, robust system performance, and secure integration with real-time smart meter data. In addition to enabling dynamic pricing mechanisms, the platform supports multilingual capabilities and energy data classification by country, facilitating broader international adoption. The ENRToken framework also shows potential for diverse applications beyond energy trading, such as micro-payments, carbon credit exchanges, and incentive-driven energy conservation programs. Future work will focus on extending the system to public blockchain networks like Ethereum or Polygon to enhance scalability, interoperability, and global transparency. Overall, the proposed platform provides a robust, extensible foundation for next-generation decentralized energy markets. Blockchain Peer-to-Peer Energy Trading Energy Tokenization Smart Contracts Energy Markets Decentralized Systems Smart grid. Figures Figure 1 Figure 2 Figure 3 1. Introduction Contemporary energy systems are undergoing a major transformation towards more flexible and user-centered structures, particularly due to the widespread adoption of distributed generation technologies. This evolution reveals the limitations of conventional centralized energy management models, especially in terms of flexibility, transparency, and stakeholder participation. In this context, blockchain technology offers innovative applications in the energy sector, with its features such as transaction security, data integrity, and the elimination of intermediaries [ 1 ]. In this study, we propose a blockchain-based infrastructure designed to facilitate secure, transparent, and decentralized energy exchange among producers, consumers, and prosumers within the context of positive energy districts. The proposed model enables direct peer-to-peer trading of digitized energy units while incorporating permissioned blockchain layers and smart contract mechanisms for transaction verification and accountability. This work aligns with the objectives of Positive Energy Districts (PEDs), which aim to produce more energy than they consume by integrating local renewable sources, active users, and intelligent energy management systems. The proposed blockchain infrastructure supports this vision by enabling direct energy transactions and data exchange among local actors [ 2 ]. The study also aims to securely collect and verify energy data, while enhancing user engagement through Web3-compatible authentication mechanisms. Traditional energy markets are predominantly controlled by centralized actors. This structure gives rise to several challenges, including high transaction costs, limited market transparency, and the exclusion of end users from decision-making processes. Traditional energy markets are predominantly controlled by centralized actors [ 3 ]. This structure gives rise to several challenges, including high transaction costs, limited market transparency, and the exclusion of end users from decision-making processes. The increasing deployment of renewable energy sources at the individual and local levels has led to the emergence of prosumers energy users who also produce energy highlighting a set of new demands that centralized systems struggle to meet. Blockchain technology addresses these structural shortcomings by offering decentralized data recording, auditable transaction histories, and secure peer-to-peer (P2P) interactions [ 4 ]. By eliminating intermediaries, it not only reduces transaction costs but also enables more active participation of users in energy markets [ 5 ]. The proposed platform aims to translate this potential into practice by establishing a reliable and auditable system for direct energy exchange between users. The potential of blockchain technology in energy trading has been extensively discussed in both academic literature and industrial implementations in recent years. P2P trading models, token-based payment systems, and smart contract-driven platforms reduce dependency on centralized entities, paving the way for more transparent and equitable market structures. However, many of these systems have shown limited success due to high transaction costs, scalability challenges [ 6 ], and constraints in real-time data management. In this regard, Okwuibe et al. [ 7 ] proposed a matching model operating on an Ethereum-based infrastructure using a double auction mechanism, enabling direct energy exchange among prosumers in microgrids and automating pricing and payment processes. This approach enhances transaction security and traceability in a P2P energy market. Similarly, a game theory-based model proposed by Doan, Cho, and Kim [ 8 ] utilizes a Stackelberg equilibrium to structure the auction process, allowing buyers to optimize their consumption strategies based on price while ensuring bid confidentiality through a private blockchain infrastructure. Baig et al. [ 9 ] introduced a more cost-effective system employing ESP32-S3 microcontrollers and Raspberry Pi devices to develop an IoT-integrated P2P trading architecture capable of operating without internet access in rural areas. This study provides concrete insights into the field applicability of blockchain-based energy trading[ 10 ]. In this study, we present a framework that not only incorporates the established benefits of blockchain, such as security and transparency, but also addresses existing limitations through a carefully designed architecture that incorporates permissioned blockchain layers and optimized smart contract mechanisms. The architecture aims to minimize transaction costs and enhance the efficiency of energy exchange within positive energy districts, and promote scalability and real-time responsiveness, essential for effective energy management and distribution. By combining these elements, this research contributes a robust solution to the evolving needs of decentralized energy networks, establishing a foundation for further advancements in the field. The proposed system distinguishes itself from existing models by incorporating a permissioned blockchain for enhanced security and control, while simultaneously leveraging smart contracts to automate transaction verification and ensure accountability. Building upon these earlier works, the current study proposes a dedicated permissioned blockchain infrastructure for direct energy trading. The network, built on Hyperledger Besu, aims to offer a practical solution for energy trading with low latency, high transaction verification capacity, and role-based security layers. Additionally, with an ENRToken structure and a smart contract-based architecture, energy units are digitally represented, and transactions are executed in a decentralized yet auditable environment. This approach ensures that all transactions are transparent, secure, and compliant with regulatory requirements, fostering trust and encouraging greater participation from all stakeholders. In conventional energy systems, small-scale producers often lack the means to directly sell their generated energy on the market, and consumers are generally unable to obtain energy directly from producers [ 11 ]. This poses a significant limitation on the flexibility of the system, particularly in local renewable generation scenarios, where active participation of market players is essential. The proposed platform seeks to address this structural limitation. The developed blockchain-based infrastructure enables direct, secure, and transparent energy exchange among producers, consumers, and prosumers. Through the platform, users can initiate smart contracts to buy or sell their renewable energy with just a single touch. Furthermore, they are empowered to modify their preferences at any time during the day, offering real-time flexibility. By facilitating dynamic, user-centric, and decentralized energy transactions (DEMS) enhance transparency, trust, and interaction within the renewable energy marketplace. This infrastructure also aims to securely collect energy data and integrate it into the blockchain network, while supporting user interactions through Web3-compatible authentication mechanisms. As a result of this process, the development of the project's Web3-compliant authentication infrastructure can be successfully completed. Energy units are digitized and represented through an ENRToken structure, allowing users to perform transactions directly via digital wallets such as Metamask. The envisioned architecture aims to tackle the issues of data protection, security, and privacy while also improving transaction efficiency[ 12 ]. This study centers on the secure transfer of digital energy units, the execution of transaction processes via smart contracts, and the management of a permissioned blockchain network. It emphasizes Web3-based authentication and the secure integration of energy data. To achieve this, the development of Web3-compatible services for integrating data into the PED blockchain network was prioritized. Hardware-related topics such as energy transmission, physical infrastructure planning, and energy storage systems fall outside the scope of this work. 2. Materials and Methods This section outlines the architectural design of the Decentralized Energy Management System (DEMS) platform, providing a detailed description of its software components, blockchain network architecture, token model, authentication mechanisms, data collection and integration services, as well as user interaction functionalities. The design and implementation steps of the system developed on a dedicated blockchain infrastructure for digital energy trading are explained by considering the interrelationships between components. 2.1 System Architecture As in Fig. 1 , the DEMS platform is structured around two main components: a blockchain infrastructure, smart contracts, a Web3-compatible authentication module, energy data collection APIs, and bridge services that securely transfer this data to the blockchain. The platform is designed to facilitate secure and decentralized energy exchange, anchored on a private, permissioned network based on Hyperledger Besu [ 13 ]. Consensus across the network is maintained through validator nodes operating under the IBFT 2.0 protocol [ 14 ]. At the application layer, two core smart contracts form the backbone of the system: an ENRToken contract developed in compliance with the ERC-20 standard [ 15 ], and a business logic contract that governs energy trading activities. The ENRToken represents digital energy units within the system, while the business logic contract facilitates and validates trading transactions. Both contracts were developed and deployed on a test network using the Foundry framework [ 16 ]. The platform’s other critical component is the Web3-compatible authentication infrastructure. This system allows users to log in not only with traditional username-password credentials but also by using their Ethereum wallets. During the wallet login process, Ethereum’s standard message signing format (prefixed hashing) is applied, and the recovered address is matched with the user. This verification is performed on the backend using methods such as WalletUtil.recoverAddress(). Users’ wallet addresses are stored uniquely in a database table and linked to their accounts. Upon successful authentication, secure session management is provided through JWT (JSON Web Token)-based tokens. These JWT tokens are cryptographically signed on the server side and are valid for one hour. This hybrid authentication model enables Web2 and Web3 user identities to securely coexist on the same platform. A nonce (unique number) system, planned for future implementation, will eliminate replay attack risks during wallet login by issuing a nonce for each session and verifying the signed message against it. To collect data on energy production and consumption, a centralized RESTful API infrastructure has been developed. This module allows companies to report their production and consumption data in JSON format via the HTTP endpoints POST /energy/insert/production and POST /energy/insert/consumption. The received data is stored in a MariaDB database. All API modules and authentication services are developed within the Jakarta RESTful Web Services (JAX-RS) framework. Thanks to CORS (Cross-Origin Resource Sharing) configurations, frontend clients can securely access these APIs from different domains. Web3-compatible bridge services are developed to securely integrate the collected and verified energy data into the PED blockchain network. These services not only retrieve data but also transmit it in a cryptographically signable, auditable, and verifiable manner. One early target is to create an infrastructure where device identities are linked to wallet addresses, ensuring that only authorized and verified smart meters provide data to the network. In this scope, device-specific Ethereum addresses and signed messages are used for verification of the devices supplying control panel data. During data transmission, every message is signed according to Ethereum standards—for example, using ECDSA signatures separated into R, S, and V components and SHA3 hashing with the "Ethereum Signed Message" prefix format (as implemented in web3j)—and address verification is performed on the backend. Since the data comes from authorized and verified sources, it can be securely written onto the blockchain network. Additionally, these bridge services facilitate the transmission of information such as the “Proof of Origin” certificate for energy data, enabling retrospective auditing of the data’s source. The business logic contract supports two primary trading scenarios: (i) direct peer-to-peer (P2P) agreements and (ii) an auction-based matching model. In the P2P scenario, users negotiate fixed energy transfers for defined time slots. All transaction parameters (date, period, quantity) are encoded within the contract, enabling automated execution. In the auction-based model, buyers submit requests based on desired price or quantity. A matching algorithm scans active sell offers and executes matches accordingly. Upon a successful match, ENRTokens are transferred and the transaction is immutably recorded on the blockchain. Users interact with the platform via Metamask wallets, while transactions are executed through the Remix IDE [ 17 ]. Core functionalities such as purchasing ENRTokens, trading energy, and querying balances are handled directly through smart contracts. This multi-layered and hybrid architecture enables the digital tokenization of energy, its reliable transfer, and proof of source authenticity. The design is structured according to the principles of transparency and decentralization, specifically catering to local energy communities. The developed interface software is made Web3-compatible to ensure data integrity and source verification; thus, the goal is not only to transmit control panel data but also to validate it within the system and prove that it originates from authenticated devices. This framework is especially critical for the secure sharing of energy production data in decentralized systems, particularly in distributed generation facilities. 2.2 Blockchain Network Configuration The blockchain network underlying the DEMS platform is designed using Hyperledger Besu, configured as a private and permissioned network. The consensus mechanism employed in the network is the Istanbul Byzantine Fault Tolerance 2.0 (IBFT 2.0) algorithm [ 14 ]. In accordance with this protocol, four validator nodes and three non-validator user nodes have been set up. All nodes are run locally on the same physical machine, configured to communicate with each other through designated P2P ports. Nodes can interact with external systems through a JSON-RPC HTTP interface, enabling direct access to the blockchain network via command-line tools, web applications, and the developed bridge services [ 18 ]. Network traffic is monitored in real-time via log tracking, and system behavior is closely observed. Due to the permissioned nature of the network, only pre-defined validator and user nodes are permitted to perform transactions. This authorization is based on accountAllowlist and nodeAllowlist structures, with relevant definitions specified under the accountPermissionsConfig and nodePermissionsConfig sections of the genesis file. Additionally, the genesis block used to initialize the network contains essential parameters such as chainId, gasLimit, difficulty, and alloc. To ensure smooth testing, certain user addresses are pre-assigned token balances. Under the IBFT 2.0 configuration, the block creation time is set to 2 seconds, the epoch length is 30,000 blocks, and the transaction timeout is 4 seconds. Two smart contracts have been integrated into the blockchain network, as in Fig. 2 . The first is the ENRToken contract, developed according to the ERC-20 standard, which provides a digital representation of energy units. The second contract is a business logic contract that handles energy trading between users, verifying production amounts and token balances. These contracts are also designed to interact with verified energy data transmitted through the bridge services. Both contracts are written in Solidity, tested using the Foundry framework, and deployed to the relevant node network. User interaction is facilitated through the Metamask extension in the browser [ 19 ]. Permissioned and unpermissioned user addresses are imported into Metamask wallets, with only permissioned users authorized to perform transactions in the test environment. Furthermore, the ENRToken is integrated into Metamask, and contract functions are successfully executed, confirming the system's integration with the external client. The authentication module, which provides Web3 wallet integration, operates compatibly with this architecture, enabling users to log into the system by verifying signatures with their Ethereum wallets. 2.3 Smart Contract Module 2.3.1 ENRToken Contract The ENRtoken serves as the core digital asset facilitating energy trading within the DEMS platform. Designed in accordance with the ERC-20 token standard, it is implemented using the Solidity programming language and leverages the OpenZeppelin library, a widely trusted framework for developing Ethereum-based smart contracts [ 20 ]. The contract inherits from both the ERC20 and Ownable base contracts, thereby offering all standard token functionalities along with administrative control by a designated contract owner. Upon deployment, the ENRtoken is initialized with a fixed total supply, all of which is allocated to the contract owner. Two primary functions are provided for user interaction: deposit() and withdraw(). The deposit() function allows users to acquire ENRTokens by sending a specified amount of ETH to the contract, while the withdraw() function enables users to redeem their ENRTokens in exchange for ETH, thus providing a bidirectional exchange mechanism. The deposit algorithm governs the conversion of ETH to ENRTokens under a fixed exchange rule. When a user invokes the deposit() function, the contract checks whether the transaction value (msg.value) is exactly 0.001 ETH. If the condition is not met, the transaction is rejected with the error message: "Deposit must be exactly 0.001 ETH." This fixed value ensures a predictable and uniform exchange rate, whereby each successful deposit of 0.001 ETH results in the transfer of one ENRToken from the contract owner's balance to the user's wallet. Conversely, the withdraw algorithm manages the process of converting ENRTokens back into ETH. A user specifies the number of tokens to be withdrawn, and the contract first verifies that the user possesses a sufficient balance. If the user's token balance is less than the requested amount, the transaction is halted with the error message: "Insufficient ENRTokens." Next, the contract calculates the corresponding ETH amount by multiplying the number of tokens by a predefined token price. Before completing the transaction, the contract verifies that it has enough ETH liquidity to honor the withdrawal. If the contract’s ETH balance is insufficient, the operation fails with the message: "Contract does not have enough ETH." If all checks pass, the specified amount of ENRTokens is transferred from the user back to the contract owner, and the equivalent ETH amount is sent to the user's wallet. This token contract establishes a secure and transparent foundation for value exchange within the DEMS ecosystem, enabling reliable token-based energy transactions while maintaining a clear audit trail on the blockchain. Algorithm Deposit Input: msg.value (sent ETH amount) Output: Transfer 1 ENRToken to the user 1. If msg.value ≠ 0.001 ETH then Throw error: "Deposit must be exactly 0.001 ETH" 2. Else Transfer 1 ENRToken from owner to msg.sender ENRToken Deposit algorithms Algorithm Withdraw Input: amount (number of ENRTokens to withdraw) Output: Transfer ETH to the user, return tokens to the owner 1. If balanceOf(msg.sender) < amount then Throw error: "Insufficient ENRTokens" 2. Set ethAmount ← amount × tokenPrice 3. If contract ETH balance < ethAmount then Throw error: "Contract does not have enough ETH" 4. Transfer 'amount' ENRTokens from user to owner 5. Transfer ethAmount (ETH) from contract to user ENRToken Withdraw Algorithms 2.3.2 EnergyTransaction Contract The EnergyTransaction contract is a critical component within the DEMS system, specifically developed to manage the dynamic and secure trading of energy. It is designed to support both peer-to-peer (P2P) and auction-based energy trading mechanisms between users. This smart contract is responsible not only for executing transactions but also for embedding essential control mechanisms, such as ensuring transaction integrity, verifying token balances, and validating all relevant conditions before any trade is processed. In the future, this contract is planned to interact directly with source-verified smart meter data (production/consumption amounts) transmitted to the blockchain via bridge services, enabling more effective validation of energy bids and purchases. The contract's functionality is structured around three main operations: energy sale, energy purchase, and offer matching[ 21 ]. In the energy sale process, energy-producing users can generate offers to sell their surplus energy. Each sale offer includes key parameters such as the quantity of energy available for sale, the ENRToken price per unit of energy, and a designated valid time for the offer to remain open. These offers are permanently stored on the blockchain, allowing them to be accessed and reviewed by all users. To initiate an energy sale, the user invokes the CreateEnergyOffer function, which begins by validating that both the energy amount and price per unit are greater than zero. It then confirms that the seller (identified by msg.sender) has a sufficient energy supply, typically verified through data provided by a smart meter. Once validated, the offer is created by assigning the seller’s address, energy amount, unit price, and transfer time. This offer is then stored in the smart contract’s on-chain data structure and an OfferCreated event is emitted to notify the network, ensuring visibility and transparency for all participants. The energy purchase function allows buyers to either select a specific offer from the list of available sale offers or rely on an automated matching mechanism to identify a suitable offer. When a buyer chooses to purchase energy, they invoke the PurchaseEnergy function, providing the identifier (offerId) of the desired offer. The contract retrieves the offer details, verifies that the offer is still valid and unfulfilled, and calculates the total ENRToken price as the product of the energy amount and the unit price. The buyer’s token balance is then checked to ensure they have enough ENRTokens to cover the total cost. If sufficient, the contract transfers the required tokens from the buyer to the seller, marks the offer as completed to prevent further purchases, and emits an EnergyPurchased event to update the network and record the successful transaction. In the offer matching scenario, the system supports an auction-based model where buyers can declare their demand by specifying the desired energy amount and the maximum price they are willing to pay. The contract then scans the pool of active sale offers to find the first offer that satisfies both criteria: an energy amount equal to or greater than the buyer’s request and a unit price less than or equal to the buyer’s maximum price. If such a matching offer is found, the system proceeds to finalize the transaction automatically by calling the PurchaseEnergy function with the corresponding offer ID. If no suitable match is found, the contract returns a message indicating that no match is currently available. Through these mechanisms, the EnergyTransaction contract ensures an automated, secure, and transparent energy trading process within the DEMS platform, effectively enabling decentralized energy markets driven by real-time supply and demand. 2.4 User Integration User interaction with the DEMS system has been facilitated through the MetaMask wallet and the Remix IDE. Users can log into the system using their Ethereum wallets (e.g., MetaMask) through signature verification enabled by the Web3 authentication module; authorization is managed via JWT-based session handling. Authorized user addresses were imported into MetaMask, enabling direct interaction with deployed smart contracts via Remix. Through this setup, users were able to call contract functions and execute various operations within the system[ 22 ]. Corporate users, such as energy companies, can submit their energy production and consumption data to the system in JSON format via the developed RESTful API endpoints (POST /energy/insert/production, POST /energy/insert/consumption). For example, prosumer-level smart contracts can automate bid and offer registration and monitor energy generation and demand [ 23 ]. This ongoing research effort aims to test the proof-of-concept implementation of such an energy market in selected micro-grids in the coming months. In Web3 Authentication, users can securely log into the system using their Ethereum wallets. This process involves signing a message with the wallet and verifying the signature on the server side. One key user operation involved acquiring ENRtokens through the deposit() function. By sending a fixed amount of ETH, users received an equivalent amount of ENRTokens, which were then automatically credited to their MetaMask wallets. For energy purchasing, two models were supported: direct peer-to-peer (P2P) transactions and an auction-based mechanism. In the direct model, users negotiated transaction parameters such as quantity, price, and delivery time, then executed a smart contract that facilitated automatic token transfers at the specified intervals. In the auction-based model, users submitted energy purchase requests by specifying the desired energy amount and maximum price. The system then matched these requests with available sell offers using an automated matching algorithm. Upon a successful match, ENRtokens were transferred, and the transaction was permanently recorded on-chain. These examples illustrate the user's operational flow within the DEMS system, highlighting the practical aspects of user engagement with decentralized energy trading platforms. Through the MetaMask wallet, users managed their tokens and executed trades, while Remix IDE provided the interface for interacting with the smart contracts that govern the energy market. Energy producers were also able to actively participate by listing their excess energy for sale through open offers. These offers could be purchased either directly by other users or through the system’s automatic matching functionality. Additionally, users holding ENRTokens had the option to convert them back to ETH by invoking the withdraw() function. This function returned the tokens to the contract owner and transferred the corresponding ETH amount to the user's wallet. The use of blockchain technology in energy markets facilitates secure and transparent transactions and enhances the efficiency and scalability of microgrids [ 24 ] [ 25 ]. By enabling direct energy transactions and data exchange among local actors, blockchain infrastructures can support the vision of positive energy districts [ 12 ]. Blockchain technology addresses structural shortcomings in traditional energy markets by offering decentralized data recording and auditable transactions. Smart contracts can eliminate intermediaries, curb monetary budgets, and support multi-signature accounts to distribute funds agreed upon in the agreement [ 26 ]. This user integration model supports both flexible, user-driven P2P agreements and a dynamic marketplace architecture. All interactions and transactions are managed through smart contracts, ensuring transparency, traceability, and security via permanent blockchain records. The infrastructure is scalable and inclusive, enabling participation not only from individual users but also from larger-scale energy producers. The traditional energy transaction is carried out in auditing, bidding, clearing, and settlement, which are now streamlined by blockchain[ 26 ]. Blockchain ensures tamper-proof, scalable, and autonomous energy systems without third-party mediation by recording and verifying all energy transactions[ 27 ]. 3. Performance Metrics and Evaluation This section presents key performance and reliability metrics of the DEMS platform. Evaluations were conducted on a private local test network, focusing on the system’s functionality, transaction execution times, and smart contract efficiency[ 28 ]. These results were obtained in a controlled environment with a limited number of nodes. In future stages, as the system is integrated into public blockchain infrastructures, changes in network dynamics may affect performance metrics. 3.1 Smart Contract Efficiency Tests performed on the ENRToken smart contract measured the average gas consumption per function call [ 29 ]. The measurements were conducted using the Foundry framework, with smart contracts tested in synchronization across validator nodes operating on a Hyperledger Besu network. The system, operating with the IBFT 2.0 consensus algorithm, completed transactions within an average block time of 2 to 4 seconds. These durations were recorded in a latency-free local test environment. Although view functions such as getContractBalance() do not consume gas on a live blockchain, their theoretical gas values were estimated and included in the analysis for completeness [ 30 ]. The results indicate that the smart contract operates efficiently in terms of gas consumption, while transaction processing times remain consistently low and responsive, as in Fig. 3 . These findings demonstrate the contract's suitability for scalable and cost-effective deployment within the DEMS energy trading ecosystem. 3.2 Network Throughput and Scalability The transaction throughput of the DEMS platform was assessed in a controlled environment using Hyperledger Besu with four validator nodes. The block production interval was configured to two seconds under the IBFT 2.0 consensus algorithm. The results demonstrated an average transaction rate of 5 to 7 transactions per second (TPS). During stress tests involving the simultaneous submission of 50 transactions, the network maintained stability without any errors or observable delays. Furthermore, no significant degradation was detected in node processing capacity or block generation time under increased load. These findings indicate that the system operates with low latency and consistent performance, rendering it a practical solution for small- to medium-scale energy communities. Nevertheless, it is important to acknowledge that performance may vary in public blockchain environments due to dynamic network conditions. [ 28 ]. 3.3 Token Transfer Integrity The integrity of token transfers was validated by testing the deposit() and withdraw() functions of the ENRToken smart contract. The tests focused on verifying the accuracy and reliability of token-to-ETH conversion processes. When users sent exactly 0.001 ETH, the contract accurately credited the expected amount of ENRTokens to their accounts. Transactions involving invalid ETH amounts were automatically reverted by the contract, and any attempts to withdraw more ENRTokens than the user’s balance were effectively blocked. Upon successful withdrawal, users’ ETH balances were correctly updated, and ENRToken balances were correspondingly reduced. These results confirm that the conversion mechanism between ENRTokens and ETH operates with precision and robustness, ensuring traceable and fault-tolerant value exchange within the platform[ 21 ]. 3.4 Security and Permission The DEMS platform is implemented on a private and permissioned Hyperledger Besu network, with security mechanisms tailored to restrict access and ensure transaction integrity. Security testing revealed that only users included in a predefined whitelist were authorized to submit transactions. Any unauthorized users or nodes attempting to join the network were successfully rejected by the system. Additionally, all transaction signatures were validated in accordance with the IBFT 2.0 consensus protocol. It should be noted that these evaluations were conducted in a controlled environment; therefore, deployment on public blockchain networks will necessitate additional security measures. Overall, the results indicate that DEMS offers strong protection against unauthorized access and ensures secure transaction execution[ 31 ]. It is important to mention that the EnergyTransaction smart contract has been designed at a conceptual level in this study, and its underlying algorithms have been defined. However, full-scale functional testing of this contract depends on the integration of smart meter data and supporting hardware infrastructure. As such, the current performance evaluation is limited to the ENRToken contract. Similarly, detailed performance analyses (e.g., API response times, authentication delays, data transfer speeds of bridge services) and stress tests of the newly developed Web3 authentication, API, and bridge service modules will be conducted after the full integration of the system. Future work will focus on deploying the smart metering system and conducting comprehensive tests and performance analyses of the EnergyTransaction contract following complete system integration. 4. Results and Discussion This section evaluates the current implementation outcomes of the DEMS platform, discussing the benefits it offers, the technical limitations identified during development, and potential directions for future enhancements. Blockchain technology is widely recognized in the literature for its transformative potential in reshaping the centralized structures of traditional energy markets [ 32 ]. Within the scope of the DEMS platform, energy units are represented as digital tokens and transacted via smart contracts. This approach minimizes the need for intermediaries and enables direct peer-to-peer trading among users. In addition, the development of Web3-compatible authentication, standardized data collection via APIs, and bridge services that cryptographically verify and transmit energy data to the blockchain has significantly enhanced the platform's reliability and functionality. Thanks to these advancements, both centralized and decentralized user interactions have become possible in energy tokenization-based processes, and an innovative model for identity verification and data management has been successfully implemented within the scope of the project. The use of a permissioned blockchain architecture ensures that all transaction histories are recorded in a transparent and auditable manner, significantly enhancing the system’s reliability, data integrity, and security. The current configuration of the platform provides a cost-effective and traceable energy trading solution suitable for local energy communities. Mechanisms such as linking device identity to wallet addresses and verifying data through signed messages play a critical role in ensuring the integrity and reliability of data originating from distributed energy resources. Looking ahead, the architecture is designed to be extendable toward public blockchain infrastructures, with the ultimate goal of establishing accessible and scalable energy markets on a national and international level. The implemented system successfully demonstrated several core functionalities essential for blockchain-based peer-to-peer energy trading. A real-time transaction mechanism was validated in a controlled test environment, enabling users to seamlessly buy and sell ENRTokens through secure smart contracts deployed on the Ethereum blockchain. These contracts were executed with consistent reliability and without significant latency, confirming the feasibility of token-based energy value exchange. The module developed for collecting energy production and consumption data through a centralized RESTful API infrastructure is also nearing completion. This module enables the reception of data in JSON format and its storage in a MariaDB database. The platform architecture has been developed with the capability to interface with smart meter data. Although full-scale integration with live energy data is scheduled in a subsequent deployment phase, the foundational data acquisition modules and relevant APIs have already been incorporated and tested in a simulated environment. These modules are designed to facilitate secure, bidirectional communication with metering devices, forming the basis for real-time energy accounting. The developed bridge services aim to transmit energy data to the blockchain network in a cryptographically signed and verifiable format. A key component of this integration involves assigning dedicated Ethereum addresses to the devices providing control panel data and validating their transmissions through signed messages. While the platform currently enables digital representation and transfer of energy credits, the physical integration with energy infrastructure components (e.g., smart inverters, gateways) is not yet complete. However, corresponding interface protocols and data validation mechanisms have been embedded into the system and will become operational once hardware deployment is finalized. Scalability was assessed using a permissioned blockchain setup comprising four validator nodes. The system maintained stable performance under increasing transaction loads, with average block confirmation times remaining within acceptable thresholds (< 2 seconds). These results indicate the system’s potential for scaling in microgrid or community-level energy networks. Furthermore, compatibility with public blockchain infrastructures was explored through architectural modeling, identifying the key parameters to address in future iterations namely, transaction costs, latency optimization, and network security. Collectively, these results establish a robust proof-of-concept platform for decentralized energy trading. The system forms a solid foundation for subsequent optimization efforts and large-scale pilot deployments in real-world energy communities. The authentication module supporting Web3 wallet integration has been successfully developed and tested. Users can securely log into the system using their Ethereum wallets through signature verification, and authorization processes are managed via JWT-based session management. In the course of system development and testing, several critical insights have been gained, contributing not only to the refinement of the DEMS platform but also to the broader domain of decentralized energy management systems. The ENRToken smart contract exhibited robustness in security, operational efficiency, and ease of integration, thereby validating its design in a real-world blockchain environment. Furthermore, the blockchain network’s configuration including validator node setup, role-based access control, and transaction verification mechanisms was successfully implemented, establishing a reliable operational baseline for both private and potentially public blockchain scenarios. A hybrid architecture that combines the traditional username-password system with Ethereum wallet-based Web3 authentication has been successfully developed. This approach has provided a valuable experience in addressing diverse user profiles and facilitating the transition from Web2 to Web3. API and Bridge Service Development: The design and implementation of RESTful APIs using Jakarta JAX-RS, along with bridge services that securely transfer data from these APIs to the blockchain, have offered significant expertise in data integration and security. In particular, topics such as cryptographic data signing, proof of origin, and device identity management have been central to this development process. In anticipation of full hardware deployment, the software stack was architected to seamlessly incorporate real-time smart meter data. Validation logic and security filters have been pre-integrated, enabling future interoperability with energy hardware and facilitating rapid system expansion. Performance tuning efforts have also yielded measurable benefits, such as reduced gas consumption per transaction and minimized latency in smart contract execution, which together enhance user interaction and system responsiveness. These experiences have provided valuable contributions not only to the success of the current study but also to the future development of blockchain-based energy systems. All these functionalities have enabled the work to evolve beyond a purely technical blockchain network into a Web3-enabled, user-oriented, and data-driven energy tokenization platform. Collectively, the lessons learned contribute to a more scalable, secure, and efficient model for digital energy exchange. 5. Conclusion This study has presented and validated the DEMS platform, a blockchain-enabled peer-to-peer (P2P) energy trading system that leverages tokenization and smart contracts to enable secure, transparent, and decentralized energy exchanges within local energy communities. The implementation effectively demonstrates that energy units can be digitally represented through ENRTokens, facilitating low-cost, traceable transactions with enhanced trust and autonomy. Operating on a permissioned blockchain framework, the platform ensures transparency, auditability, and operational reliability within a controlled environment. Key achievements include the deployment of a modular smart contract architecture, secure P2P token transfers, and foundational support for real-time integration of smart meter data. Technical milestones such as validator node configuration, gas consumption optimization, and robust transaction governance further underscore the system’s architectural robustness. Designed with extensibility in mind, the platform anticipates future integration with diverse hardware interfaces and the automation of energy data workflows. The development process yielded valuable insights into smart contract design, network security, and seamless interoperability between software components and energy infrastructure, laying a strong foundation for continuous improvement. Planned enhancements encompass dynamic pricing algorithms, flexible marketplace features, and automated matching mechanisms to boost market efficiency and user engagement. Beyond energy trading, the ENRToken framework is poised to support applications such as micro-payments, carbon credit exchanges, and incentive-driven energy conservation programs. To accommodate a global user base, the system plans to implement multilingual support and enable classification and filtering of energy data by country. Future capabilities include converting individual energy production records into blockchain-based tokens, making them transferable between users. Transitioning to public blockchain networks like Ethereum or Polygon is expected to enhance scalability, accessibility, and global transparency. In summary, DEMS offers a versatile and forward-looking model in the evolving decentralized energy ecosystem by integrating blockchain security, real-time data processing, and digital asset management. Its modular microservices-based architecture supports scalable adaptation across different smart meter manufacturers and blockchain networks, positioning the platform for deployment in both local and international energy markets. Declarations Link to supporting data: https://github.com/merdunal/DEM4PED Author Contribution D.A. (Demiral Akbar) conceptualized the project, supervised the overall research, and contributed to the manuscript writing. M.Ü. (Mert Ünal) developed the blockchain infrastructure and implemented the smart contract architecture. R.A. (Recep Akkaya) carried out experimental validation and performance analysis. O.B. (Orkun Balcı) managed the integration with smart meters and supported multilingual module development. D.A. and M.Ü. wrote the main manuscript text. All authors reviewed and approved the final manuscript. Acknowledgement This work was supported by JPP ERA-Net SES, EnerDigit and carried out with the financial assistance of TÜBİTAK under project code 124N032. References Ul Hassan, N., Yuen, C., Niyato, D.: Blockchain Technologies for Smart Energy Systems: Fundamentals, Challenges, and Solutions, in IEEE Industrial Electronics Magazine , vol. 13, no. 4, pp. 106–118, Dec. (2019). 10.1109/MIE.2019.2940335 M. R. A T et al., Intelligent Energy Management across Smart Grids Deploying 6G IoT, AI, and Blockchain in Sustainable Smart Cities, IoT , vol. 5, no. 3, Art. no. 3, (2024). 10.3390/iot5030025 Arias, S., Santa-Alvarado, A.M., Salazar, H.: The Impact of a Market Maker in an Electricity Market, Energies , vol. 17, no. 16, Art. no. 16, Jan. (2024). 10.3390/en17164042 Nazreen Junaidi, M.P., Abdullah, B., Alharbi, M., Shaaban: Blockchain-based management of demand response in electric energy grids: A systematic review, Energy Reports, 9 , Pages 5075–5100, ISSN 2352–4847, (2023). https://doi.org/10.1016/j.egyr.2023.04.020 Cioara, T., Antal, M., Mihailescu, V.T., Antal, C.D., Anghel, I.M., Mitrea, D.: Blockchain-Based Decentralized Virtual Power Plants of Small Prosumers, in IEEE Access , vol. 9, pp. 29490–29504, (2021). 10.1109/ACCESS.2021.3059106 Teng, F., Zhang, Q., Wang, G., Liu, J., Li, H.: A comprehensive review of energy blockchain: Application scenarios and development trends. Int. J. Energy Res. 45 (12), 17515–17531 (2021). https://doi.org/10.1002/er.7109 Okwuibe, G.C., Zade, M., Tzscheutschler, P., Hamacher, T., Wagner, U.: A Blockchain-based Double-sided Auction Peer-to-peer Electricity Market Framework, 2020 IEEE Electric Power and Energy Conference (EPEC) , Edmonton, AB, Canada, pp. 1–8, (2020). 10.1109/EPEC48502.2020.9320030 Doan, H.T., Cho, J., Kim, D.: Peer-to-Peer Energy Trading in Smart Grid Through Blockchain: A Double Auction-Based Game Theoretic Approach, in IEEE Access , vol. 9, pp. 49206–49218, (2021). 10.1109/ACCESS.2021.3068730 Baig, M.J.A., Iqbal, M.T., Jamil, M., Khan, J.: Blockchain-Based Peer-to-Peer Energy Trading System Using Open-Source Angular Framework and Hypertext Transfer Protocol. Electronics. 12 , 287 (2023). https://doi.org/10.3390/electronics12020287 Zedan, M., Nour, M., Shabib, G., Nasrat, L., Ali, A.-A.: Review of peer-to-peer energy trading: Advances and challenges. E-Prime - Adv. Electr. Eng. Electron. Energy. 10 , 100778 (Dec. 2024). 10.1016/j.prime.2024.100778 Victor Ahlqvist, P., Holmberg, T., Tangerås: A survey comparing centralized and decentralized electricity markets. Energy Strategy Reviews, 40, 2022, 100812, ISSN 2211-467X, https://doi.org/10.1016/j.esr.2022.100812 Zhao, S., Wang, B., Li, Y., Li, Y.: Integrated Energy Transaction Mechanisms Based on Blockchain Technology. Energies. 11 (Sep. 2018). 9, Art. 9 10.3390/en11092412 Besu, H.: Private Networks Documentation , [Online]. (2025). Available: https://besu.hyperledger.org/private-networks . Accessed: May 6 Hyperledger, Besu: IBFT 2.0 Consensus Protocol Documentation , [Online]. (2025). Available: https://besu.hyperledger.org/private-networks/how-to/configure/consensus/ibft . Accessed: May 6 Ethereum Foundation: ERC-20 Token Standard , [Online]. (2025). Available: https://ethereum.org/en/developers/docs/standards/tokens/erc-20/ . Accessed: May 6 Foundry, F., Book: Documentation for Ethereum Application Development with Foundry, [Online]. (2025). Available: https://book.getfoundry.sh . Accessed: May 6 MetaMask: MetaMask Documentation , [Online]. (2025). Available: https://docs.metamask.io/ . Accessed: May 6 Setup a RPC Node | Documentation: Accessed: May 18, 2025. [Online]. Available: https://docs.vanarchain.com/nodes-and-validators/setup-a-rpc-node Kirli, D.: desenk/energy-smart-contract Nov. 01,. Python. Accessed: May 18, 2025. [Online]. (2024). Available: https://github.com/desenk/energy-smart-contract OpenZeppelin: OpenZeppelin Contracts: ERC-20 API Reference , [Online]. (2025). Available: https://docs.openzeppelin.com/contracts/4.x/api/token/erc20 . Accessed: May 6 Liu, J., Cai, Z., Liu, D., Jin, T.: Research on Distributed Energy Transaction Technology Based on Blockchain, E3S Web Conf. , vol. 236, p. 02011, (2021). 10.1051/e3sconf/202123602011 Olatunji, M.: (@web3MIO), Solidity Tutorial: How to Use Remix IDE for Solidity Smart Contract Development., Coinmonks. Accessed: May 19, 2025. [Online]. Available: https://medium.com/coinmonks/solidity-tutorial-how-to-use-remix-ide-for-solidity-smart-contract-development-d0d2ce6da051 TRADING ENERGY AS A DIGITAL ASSET -: Cryptocurrencies and Blockchain Technology Applications - Wiley Online Library. Accessed: May 19, 2025. [Online]. Available: https://onlinelibrary.wiley.com/doi/ 10.1002/9781119621201.ch14 Yang, Q., Wang, H.: Exploring Blockchain for The Coordination of Distributed Energy Resources, in 55th Annual Conference on Information Sciences and Systems (CISS) , Mar. 2021, pp. 1–6. (2021). 10.1109/CISS50987.2021.9400211 Yu, Q., Meeuw, A., Wortmann, F.: Design and implementation of a blockchain multi-energy system. Energy Inf. 1 (1) (Oct. 2018). 10.1186/s42162-018-0040-4 Bhadange, A., Doshi, R., Karmarkar, T., Shintre, S.: Blockchain based solution design for Energy Exchange Platform, Nov. 25, 2022, arXiv : arXiv:2211.13907. 10.48550/arXiv.2211.13907 Ledwaba, L.P.I., Hancke, G.P., Isaac, S.J., Venter, H.S.: Electronics. 10 (Jan. 2021). 6, Art. 6 10.3390/electronics10060714 Smart Microgrid Energy Market: Evaluating Distributed Ledger Technologies for Remote and Constrained Microgrid Deployments Smart Contract-Based, A.: P2P Energy Trading System with Dynamic Pricing on Ethereum Blockchain. Accessed: May 19, 2025. [Online]. Available: https://www.mdpi.com/1424-8220/21/6/1985 Foundation, E.: Gas and Fees Documentation , [Online]. (2025). Available: https://ethereum.org/en/developers/docs/gas/ . Accessed: May 6 Documentation, S.: View and Pure Functions , [Online]. (2025). Available: https://docs.soliditylang.org/en/latest/contracts.html#view-functions . Accessed: May 6 Dhall, S., Ved, C., Khetarpaul, S., Deswal, S., Dhingra, A.: Decentralize energy network system(den) in assimilation with blockchain, Int. J. Tech. Res. Sci. , vol. Special, no. 3, pp. 100–107, Aug. (2020) Merlinda Andoni, V., Robu, D., Flynn, S., Abram, D., Geach, D., Jenkins, P., McCallum, A., Peacock: Blockchain technology in the energy sector: A systematic review of challenges and opportunities, Renewable and Sustainable Energy Reviews, 100 , Pages 143–174, ISSN 1364 – 0321, (2019). https://doi.org/10.1016/j.rser.2018.10.014 Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6787257","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":472604613,"identity":"36fb3cf1-1b52-4404-8216-5c6332744bcf","order_by":0,"name":"Demiral AKBAR","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABRElEQVRIie3SMUvDQBTA8VcC6eBru95RiV/hpFAsFvJVLIU6FdcIHS4EuhjqqlD8DClCZ8NBu9zZNWJBXZwUKkJRKOKZimhNnR3uT8IjBz94IQEwmf5jF+m1A4Conzx9W8tjJHqQ9YR8EqmnBTn+jbAsAl8k19UTlgTWkeL4qCG8DoFSqOLnw7O66+Y39m9ncrpJuRVfIywOVgiVKorliABRvSZVw1YjtAoD/yS5xzLYzV0EVuM/CUvaUcxtvcAEGfWHYg81CXAm0AGsljVZ3YzdPGryRmBrgpVXvy/clCxSUppnkqQQxX6XAFNhlfpc5D4WCyARejG0swiVejG/R3BbXrZqfKTfRRQGp6EUSAO7UuuzyiopjtX5E5/XHUe2xRXv1N38sYpmLyPhknFwlzx4zu8PswwzztLfYB0wmUwm01+9AyxqcvuldmLuAAAAAElFTkSuQmCC","orcid":"","institution":"OSTİM Technical University","correspondingAuthor":true,"prefix":"","firstName":"Demiral","middleName":"","lastName":"AKBAR","suffix":""},{"id":472604614,"identity":"0bbe801f-80d0-415b-8d21-8eca6e857a0d","order_by":1,"name":"Mert ÜNAL","email":"","orcid":"","institution":"OSTİM Technical University","correspondingAuthor":false,"prefix":"","firstName":"Mert","middleName":"","lastName":"ÜNAL","suffix":""},{"id":472604615,"identity":"554dea18-cc0d-4605-8ed0-d6dfe764288c","order_by":2,"name":"Recep AKKAYA","email":"","orcid":"","institution":"OSTİM Technical University","correspondingAuthor":false,"prefix":"","firstName":"Recep","middleName":"","lastName":"AKKAYA","suffix":""},{"id":472604616,"identity":"23036bc0-1de6-452f-84e9-35eb0b041009","order_by":3,"name":"Orkun BALCI","email":"","orcid":"","institution":"World Trade Business Development Council, Software Development Manager","correspondingAuthor":false,"prefix":"","firstName":"Orkun","middleName":"","lastName":"BALCI","suffix":""}],"badges":[],"createdAt":"2025-05-30 19:38:17","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6787257/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6787257/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":84981543,"identity":"dd15f4d8-298a-4829-9125-0d5354e4d67a","added_by":"auto","created_at":"2025-06-19 13:23:54","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":12155,"visible":true,"origin":"","legend":"\u003cp\u003eConceptual View of the Components in DEMS System Architecture\u003c/p\u003e","description":"","filename":"1.png","url":"https://assets-eu.researchsquare.com/files/rs-6787257/v1/1a24ec0c9d7b6ba5485a1127.png"},{"id":84981530,"identity":"db3796ba-f293-46c8-9f1c-fdbdde17b7d5","added_by":"auto","created_at":"2025-06-19 13:23:53","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":192056,"visible":true,"origin":"","legend":"\u003cp\u003eThe evolution of energy distribution and transaction systems using blockchain\u003c/p\u003e","description":"","filename":"2.png","url":"https://assets-eu.researchsquare.com/files/rs-6787257/v1/e4ea1fc18e0b6e8218b18da1.png"},{"id":84981537,"identity":"4a71cc9b-46a7-4465-81c1-d99db58db738","added_by":"auto","created_at":"2025-06-19 13:23:53","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":46586,"visible":true,"origin":"","legend":"\u003cp\u003eENERToken Gas Costs\u003c/p\u003e","description":"","filename":"3.png","url":"https://assets-eu.researchsquare.com/files/rs-6787257/v1/7254ba18809186ad81da5642.png"},{"id":102296700,"identity":"34e1f088-8241-4f0c-9004-5eca116dcd89","added_by":"auto","created_at":"2026-02-10 10:20:51","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":909355,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6787257/v1/c3dd319a-9700-4af0-8c6b-7b08a9f299b3.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Blockchain-Based Peer-to-Peer Energy Trading: Design and Implementation of the Tokenized Decentralized Energy Management System (DEMS)","fulltext":[{"header":"1. Introduction","content":"\u003cp\u003eContemporary energy systems are undergoing a major transformation towards more flexible and user-centered structures, particularly due to the widespread adoption of distributed generation technologies. This evolution reveals the limitations of conventional centralized energy management models, especially in terms of flexibility, transparency, and stakeholder participation. In this context, blockchain technology offers innovative applications in the energy sector, with its features such as transaction security, data integrity, and the elimination of intermediaries [\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eIn this study, we propose a blockchain-based infrastructure designed to facilitate secure, transparent, and decentralized energy exchange among producers, consumers, and prosumers within the context of positive energy districts. The proposed model enables direct peer-to-peer trading of digitized energy units while incorporating permissioned blockchain layers and smart contract mechanisms for transaction verification and accountability. This work aligns with the objectives of Positive Energy Districts (PEDs), which aim to produce more energy than they consume by integrating local renewable sources, active users, and intelligent energy management systems. The proposed blockchain infrastructure supports this vision by enabling direct energy transactions and data exchange among local actors [\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e]. The study also aims to securely collect and verify energy data, while enhancing user engagement through Web3-compatible authentication mechanisms.\u003c/p\u003e \u003cp\u003eTraditional energy markets are predominantly controlled by centralized actors. This structure gives rise to several challenges, including high transaction costs, limited market transparency, and the exclusion of end users from decision-making processes. Traditional energy markets are predominantly controlled by centralized actors [\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e]. This structure gives rise to several challenges, including high transaction costs, limited market transparency, and the exclusion of end users from decision-making processes. The increasing deployment of renewable energy sources at the individual and local levels has led to the emergence of prosumers energy users who also produce energy highlighting a set of new demands that centralized systems struggle to meet. Blockchain technology addresses these structural shortcomings by offering decentralized data recording, auditable transaction histories, and secure peer-to-peer (P2P) interactions [\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e]. By eliminating intermediaries, it not only reduces transaction costs but also enables more active participation of users in energy markets [\u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e]. The proposed platform aims to translate this potential into practice by establishing a reliable and auditable system for direct energy exchange between users.\u003c/p\u003e \u003cp\u003eThe potential of blockchain technology in energy trading has been extensively discussed in both academic literature and industrial implementations in recent years. P2P trading models, token-based payment systems, and smart contract-driven platforms reduce dependency on centralized entities, paving the way for more transparent and equitable market structures. However, many of these systems have shown limited success due to high transaction costs, scalability challenges [\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e6\u003c/span\u003e], and constraints in real-time data management. In this regard, Okwuibe et al. [\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e] proposed a matching model operating on an Ethereum-based infrastructure using a double auction mechanism, enabling direct energy exchange among prosumers in microgrids and automating pricing and payment processes. This approach enhances transaction security and traceability in a P2P energy market. Similarly, a game theory-based model proposed by Doan, Cho, and Kim [\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e] utilizes a Stackelberg equilibrium to structure the auction process, allowing buyers to optimize their consumption strategies based on price while ensuring bid confidentiality through a private blockchain infrastructure. Baig et al. [\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e] introduced a more cost-effective system employing ESP32-S3 microcontrollers and Raspberry Pi devices to develop an IoT-integrated P2P trading architecture capable of operating without internet access in rural areas. This study provides concrete insights into the field applicability of blockchain-based energy trading[\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eIn this study, we present a framework that not only incorporates the established benefits of blockchain, such as security and transparency, but also addresses existing limitations through a carefully designed architecture that incorporates permissioned blockchain layers and optimized smart contract mechanisms. The architecture aims to minimize transaction costs and enhance the efficiency of energy exchange within positive energy districts, and promote scalability and real-time responsiveness, essential for effective energy management and distribution. By combining these elements, this research contributes a robust solution to the evolving needs of decentralized energy networks, establishing a foundation for further advancements in the field. The proposed system distinguishes itself from existing models by incorporating a permissioned blockchain for enhanced security and control, while simultaneously leveraging smart contracts to automate transaction verification and ensure accountability.\u003c/p\u003e \u003cp\u003eBuilding upon these earlier works, the current study proposes a dedicated permissioned blockchain infrastructure for direct energy trading. The network, built on Hyperledger Besu, aims to offer a practical solution for energy trading with low latency, high transaction verification capacity, and role-based security layers. Additionally, with an ENRToken structure and a smart contract-based architecture, energy units are digitally represented, and transactions are executed in a decentralized yet auditable environment. This approach ensures that all transactions are transparent, secure, and compliant with regulatory requirements, fostering trust and encouraging greater participation from all stakeholders.\u003c/p\u003e \u003cp\u003eIn conventional energy systems, small-scale producers often lack the means to directly sell their generated energy on the market, and consumers are generally unable to obtain energy directly from producers [\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e]. This poses a significant limitation on the flexibility of the system, particularly in local renewable generation scenarios, where active participation of market players is essential. The proposed platform seeks to address this structural limitation. The developed blockchain-based infrastructure enables direct, secure, and transparent energy exchange among producers, consumers, and prosumers. Through the platform, users can initiate smart contracts to buy or sell their renewable energy with just a single touch. Furthermore, they are empowered to modify their preferences at any time during the day, offering real-time flexibility. By facilitating dynamic, user-centric, and decentralized energy transactions (DEMS) enhance transparency, trust, and interaction within the renewable energy marketplace. This infrastructure also aims to securely collect energy data and integrate it into the blockchain network, while supporting user interactions through Web3-compatible authentication mechanisms. As a result of this process, the development of the project's Web3-compliant authentication infrastructure can be successfully completed. Energy units are digitized and represented through an ENRToken structure, allowing users to perform transactions directly via digital wallets such as Metamask. The envisioned architecture aims to tackle the issues of data protection, security, and privacy while also improving transaction efficiency[\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eThis study centers on the secure transfer of digital energy units, the execution of transaction processes via smart contracts, and the management of a permissioned blockchain network. It emphasizes Web3-based authentication and the secure integration of energy data. To achieve this, the development of Web3-compatible services for integrating data into the PED blockchain network was prioritized. Hardware-related topics such as energy transmission, physical infrastructure planning, and energy storage systems fall outside the scope of this work.\u003c/p\u003e"},{"header":"2. Materials and Methods","content":"\u003cp\u003eThis section outlines the architectural design of the Decentralized Energy Management System (DEMS) platform, providing a detailed description of its software components, blockchain network architecture, token model, authentication mechanisms, data collection and integration services, as well as user interaction functionalities. The design and implementation steps of the system developed on a dedicated blockchain infrastructure for digital energy trading are explained by considering the interrelationships between components.\u003c/p\u003e\n\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e\n \u003ch2\u003e2.1 System Architecture\u003c/h2\u003e\n \u003cp\u003eAs in Fig. \u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003e, the DEMS platform is structured around two main components: a blockchain infrastructure, smart contracts, a Web3-compatible authentication module, energy data collection APIs, and bridge services that securely transfer this data to the blockchain. The platform is designed to facilitate secure and decentralized energy exchange, anchored on a private, permissioned network based on Hyperledger Besu [\u003cspan class=\"CitationRef\"\u003e13\u003c/span\u003e]. Consensus across the network is maintained through validator nodes operating under the IBFT 2.0 protocol [\u003cspan class=\"CitationRef\"\u003e14\u003c/span\u003e]. At the application layer, two core smart contracts form the backbone of the system: an ENRToken contract developed in compliance with the ERC-20 standard [\u003cspan class=\"CitationRef\"\u003e15\u003c/span\u003e], and a business logic contract that governs energy trading activities. The ENRToken represents digital energy units within the system, while the business logic contract facilitates and validates trading transactions. Both contracts were developed and deployed on a test network using the Foundry framework [\u003cspan class=\"CitationRef\"\u003e16\u003c/span\u003e].\u003c/p\u003e\n \u003cp\u003eThe platform\u0026rsquo;s other critical component is the Web3-compatible authentication infrastructure. This system allows users to log in not only with traditional username-password credentials but also by using their Ethereum wallets. During the wallet login process, Ethereum\u0026rsquo;s standard message signing format (prefixed hashing) is applied, and the recovered address is matched with the user. This verification is performed on the backend using methods such as WalletUtil.recoverAddress(). Users\u0026rsquo; wallet addresses are stored uniquely in a database table and linked to their accounts. Upon successful authentication, secure session management is provided through JWT (JSON Web Token)-based tokens. These JWT tokens are cryptographically signed on the server side and are valid for one hour. This hybrid authentication model enables Web2 and Web3 user identities to securely coexist on the same platform. A nonce (unique number) system, planned for future implementation, will eliminate replay attack risks during wallet login by issuing a nonce for each session and verifying the signed message against it.\u003c/p\u003e\n \u003cp\u003eTo collect data on energy production and consumption, a centralized RESTful API infrastructure has been developed. This module allows companies to report their production and consumption data in JSON format via the HTTP endpoints POST /energy/insert/production and POST /energy/insert/consumption. The received data is stored in a MariaDB database. All API modules and authentication services are developed within the Jakarta RESTful Web Services (JAX-RS) framework. Thanks to CORS (Cross-Origin Resource Sharing) configurations, frontend clients can securely access these APIs from different domains. Web3-compatible bridge services are developed to securely integrate the collected and verified energy data into the PED blockchain network. These services not only retrieve data but also transmit it in a cryptographically signable, auditable, and verifiable manner. One early target is to create an infrastructure where device identities are linked to wallet addresses, ensuring that only authorized and verified smart meters provide data to the network. In this scope, device-specific Ethereum addresses and signed messages are used for verification of the devices supplying control panel data. During data transmission, every message is signed according to Ethereum standards\u0026mdash;for example, using ECDSA signatures separated into R, S, and V components and SHA3 hashing with the \u0026quot;Ethereum Signed Message\u0026quot; prefix format (as implemented in web3j)\u0026mdash;and address verification is performed on the backend. Since the data comes from authorized and verified sources, it can be securely written onto the blockchain network. Additionally, these bridge services facilitate the transmission of information such as the \u0026ldquo;Proof of Origin\u0026rdquo; certificate for energy data, enabling retrospective auditing of the data\u0026rsquo;s source. The business logic contract supports two primary trading scenarios: (i) direct peer-to-peer (P2P) agreements and (ii) an auction-based matching model. In the P2P scenario, users negotiate fixed energy transfers for defined time slots. All transaction parameters (date, period, quantity) are encoded within the contract, enabling automated execution.\u003c/p\u003e\n \u003cp\u003eIn the auction-based model, buyers submit requests based on desired price or quantity. A matching algorithm scans active sell offers and executes matches accordingly. Upon a successful match, ENRTokens are transferred and the transaction is immutably recorded on the blockchain. Users interact with the platform via Metamask wallets, while transactions are executed through the Remix IDE [\u003cspan class=\"CitationRef\"\u003e17\u003c/span\u003e]. Core functionalities such as purchasing ENRTokens, trading energy, and querying balances are handled directly through smart contracts. This multi-layered and hybrid architecture enables the digital tokenization of energy, its reliable transfer, and proof of source authenticity. The design is structured according to the principles of transparency and decentralization, specifically catering to local energy communities. The developed interface software is made Web3-compatible to ensure data integrity and source verification; thus, the goal is not only to transmit control panel data but also to validate it within the system and prove that it originates from authenticated devices. This framework is especially critical for the secure sharing of energy production data in decentralized systems, particularly in distributed generation facilities.\u003c/p\u003e\n \u003cp\u003e\u003cbr\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"Sec4\" class=\"Section2\"\u003e\n \u003ch2\u003e2.2 Blockchain Network Configuration\u003c/h2\u003e\n \u003cp\u003eThe blockchain network underlying the DEMS platform is designed using Hyperledger Besu, configured as a private and permissioned network. The consensus mechanism employed in the network is the Istanbul Byzantine Fault Tolerance 2.0 (IBFT 2.0) algorithm [\u003cspan class=\"CitationRef\"\u003e14\u003c/span\u003e]. In accordance with this protocol, four validator nodes and three non-validator user nodes have been set up. All nodes are run locally on the same physical machine, configured to communicate with each other through designated P2P ports. Nodes can interact with external systems through a JSON-RPC HTTP interface, enabling direct access to the blockchain network via command-line tools, web applications, and the developed bridge services [\u003cspan class=\"CitationRef\"\u003e18\u003c/span\u003e]. Network traffic is monitored in real-time via log tracking, and system behavior is closely observed. Due to the permissioned nature of the network, only pre-defined validator and user nodes are permitted to perform transactions. This authorization is based on accountAllowlist and nodeAllowlist structures, with relevant definitions specified under the accountPermissionsConfig and nodePermissionsConfig sections of the genesis file. Additionally, the genesis block used to initialize the network contains essential parameters such as chainId, gasLimit, difficulty, and alloc. To ensure smooth testing, certain user addresses are pre-assigned token balances. Under the IBFT 2.0 configuration, the block creation time is set to 2 seconds, the epoch length is 30,000 blocks, and the transaction timeout is 4 seconds.\u003c/p\u003e\n \u003cp\u003eTwo smart contracts have been integrated into the blockchain network, as in Fig. \u003cspan class=\"InternalRef\"\u003e2\u003c/span\u003e. The first is the ENRToken contract, developed according to the ERC-20 standard, which provides a digital representation of energy units. The second contract is a business logic contract that handles energy trading between users, verifying production amounts and token balances. These contracts are also designed to interact with verified energy data transmitted through the bridge services. Both contracts are written in Solidity, tested using the Foundry framework, and deployed to the relevant node network. User interaction is facilitated through the Metamask extension in the browser [\u003cspan class=\"CitationRef\"\u003e19\u003c/span\u003e]. Permissioned and unpermissioned user addresses are imported into Metamask wallets, with only permissioned users authorized to perform transactions in the test environment. Furthermore, the ENRToken is integrated into Metamask, and contract functions are successfully executed, confirming the system\u0026apos;s integration with the external client. The authentication module, which provides Web3 wallet integration, operates compatibly with this architecture, enabling users to log into the system by verifying signatures with their Ethereum wallets.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"Sec5\" class=\"Section2\"\u003e\n \u003ch2\u003e2.3 Smart Contract Module\u003c/h2\u003e\n \u003cdiv id=\"Sec6\" class=\"Section3\"\u003e\n \u003ch2\u003e2.3.1 ENRToken Contract\u003c/h2\u003e\n \u003cp\u003eThe ENRtoken serves as the core digital asset facilitating energy trading within the DEMS platform. Designed in accordance with the ERC-20 token standard, it is implemented using the Solidity programming language and leverages the OpenZeppelin library, a widely trusted framework for developing Ethereum-based smart contracts [\u003cspan class=\"CitationRef\"\u003e20\u003c/span\u003e]. The contract inherits from both the ERC20 and Ownable base contracts, thereby offering all standard token functionalities along with administrative control by a designated contract owner.\u003c/p\u003e\n \u003cp\u003eUpon deployment, the ENRtoken is initialized with a fixed total supply, all of which is allocated to the contract owner. Two primary functions are provided for user interaction: deposit() and withdraw(). The deposit() function allows users to acquire ENRTokens by sending a specified amount of ETH to the contract, while the withdraw() function enables users to redeem their ENRTokens in exchange for ETH, thus providing a bidirectional exchange mechanism.\u003c/p\u003e\n \u003cp\u003eThe \u003cstrong\u003edeposit algorithm\u003c/strong\u003e governs the conversion of ETH to ENRTokens under a fixed exchange rule. When a user invokes the deposit() function, the contract checks whether the transaction value (msg.value) is exactly 0.001 ETH. If the condition is not met, the transaction is rejected with the error message: \u0026quot;Deposit must be exactly 0.001 ETH.\u0026quot; This fixed value ensures a predictable and uniform exchange rate, whereby each successful deposit of 0.001 ETH results in the transfer of one ENRToken from the contract owner\u0026apos;s balance to the user\u0026apos;s wallet.\u003c/p\u003e\n \u003cp\u003eConversely, the \u003cstrong\u003ewithdraw algorithm\u003c/strong\u003e manages the process of converting ENRTokens back into ETH. A user specifies the number of tokens to be withdrawn, and the contract first verifies that the user possesses a sufficient balance. If the user\u0026apos;s token balance is less than the requested amount, the transaction is halted with the error message: \u0026quot;Insufficient ENRTokens.\u0026quot; Next, the contract calculates the corresponding ETH amount by multiplying the number of tokens by a predefined token price. Before completing the transaction, the contract verifies that it has enough ETH liquidity to honor the withdrawal. If the contract\u0026rsquo;s ETH balance is insufficient, the operation fails with the message: \u0026quot;Contract does not have enough ETH.\u0026quot; If all checks pass, the specified amount of ENRTokens is transferred from the user back to the contract owner, and the equivalent ETH amount is sent to the user\u0026apos;s wallet.\u003c/p\u003e\n \u003cp\u003eThis token contract establishes a secure and transparent foundation for value exchange within the DEMS ecosystem, enabling reliable token-based energy transactions while maintaining a clear audit trail on the blockchain.\u003c/p\u003e\n \u003cdiv class=\"gridtable\"\u003e\u0026nbsp;\u003ctable id=\"Taba\" border=\"1\"\u003e\n \u003ccolgroup cols=\"1\"\u003e\u003c/colgroup\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eAlgorithm Deposit\u003c/p\u003e\n \u003cp\u003eInput: msg.value (sent ETH amount)\u003c/p\u003e\n \u003cp\u003eOutput: Transfer 1 ENRToken to the user\u003c/p\u003e\n \u003cp\u003e1. If msg.value\u0026thinsp;\u0026ne;\u0026thinsp;0.001 ETH then\u003c/p\u003e\n \u003cp\u003eThrow error: \u0026quot;Deposit must be exactly 0.001 ETH\u0026quot;\u003c/p\u003e\n \u003cp\u003e2. Else\u003c/p\u003e\n \u003cp\u003eTransfer 1 ENRToken from owner to msg.sender\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003ctfoot\u003e\n \u003ctr\u003e\n \u003ctd colspan=\"1\"\u003e\u003cem\u003eENRToken Deposit algorithms\u003c/em\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tfoot\u003e\n \u003c/table\u003e\n \u003c/div\u003e\n \u003cp\u003e\u0026nbsp;\u003c/p\u003e\n \u003ctable id=\"Tabb\" border=\"1\"\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eAlgorithm Withdraw\u003c/p\u003e\n \u003cp\u003eInput: amount (number of ENRTokens to withdraw)\u003c/p\u003e\n \u003cp\u003eOutput: Transfer ETH to the user, return tokens to the owner\u003c/p\u003e\n \u003cp\u003e1. If balanceOf(msg.sender)\u0026thinsp;\u0026lt;\u0026thinsp;amount then\u003c/p\u003e\n \u003cp\u003eThrow error: \u0026quot;Insufficient ENRTokens\u0026quot;\u003c/p\u003e\n \u003cp\u003e2. Set ethAmount \u0026larr; amount \u0026times; tokenPrice\u003c/p\u003e\n \u003cp\u003e3. If contract ETH balance\u0026thinsp;\u0026lt;\u0026thinsp;ethAmount then\u003c/p\u003e\n \u003cp\u003eThrow error: \u0026quot;Contract does not have enough ETH\u0026quot;\u003c/p\u003e\n \u003cp\u003e4. Transfer \u0026apos;amount\u0026apos; ENRTokens from user to owner\u003c/p\u003e\n \u003cp\u003e5. Transfer ethAmount (ETH) from contract to user\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003ctfoot\u003e\n \u003ctr\u003e\n \u003ctd colspan=\"1\"\u003e\u003cem\u003eENRToken Withdraw Algorithms\u003c/em\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tfoot\u003e\n \u003c/table\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003cp\u003e\u003cbr\u003e\u003c/p\u003e\n \u003c/div\u003e\n \u003cdiv id=\"Sec7\" class=\"Section3\"\u003e\n \u003ch2\u003e2.3.2 EnergyTransaction Contract\u003c/h2\u003e\n \u003cp\u003eThe EnergyTransaction contract is a critical component within the DEMS system, specifically developed to manage the dynamic and secure trading of energy. It is designed to support both peer-to-peer (P2P) and auction-based energy trading mechanisms between users. This smart contract is responsible not only for executing transactions but also for embedding essential control mechanisms, such as ensuring transaction integrity, verifying token balances, and validating all relevant conditions before any trade is processed. In the future, this contract is planned to interact directly with source-verified smart meter data (production/consumption amounts) transmitted to the blockchain via bridge services, enabling more effective validation of energy bids and purchases. The contract\u0026apos;s functionality is structured around three main operations: energy sale, energy purchase, and offer matching[\u003cspan class=\"CitationRef\"\u003e21\u003c/span\u003e].\u003c/p\u003e\n \u003cp\u003eIn the \u003cstrong\u003eenergy sale\u003c/strong\u003e process, energy-producing users can generate offers to sell their surplus energy. Each sale offer includes key parameters such as the quantity of energy available for sale, the ENRToken price per unit of energy, and a designated valid time for the offer to remain open. These offers are permanently stored on the blockchain, allowing them to be accessed and reviewed by all users. To initiate an energy sale, the user invokes the CreateEnergyOffer function, which begins by validating that both the energy amount and price per unit are greater than zero. It then confirms that the seller (identified by msg.sender) has a sufficient energy supply, typically verified through data provided by a smart meter. Once validated, the offer is created by assigning the seller\u0026rsquo;s address, energy amount, unit price, and transfer time. This offer is then stored in the smart contract\u0026rsquo;s on-chain data structure and an OfferCreated event is emitted to notify the network, ensuring visibility and transparency for all participants.\u003c/p\u003e\n \u003cp\u003eThe \u003cstrong\u003eenergy purchase\u003c/strong\u003e function allows buyers to either select a specific offer from the list of available sale offers or rely on an automated matching mechanism to identify a suitable offer. When a buyer chooses to purchase energy, they invoke the PurchaseEnergy function, providing the identifier (offerId) of the desired offer. The contract retrieves the offer details, verifies that the offer is still valid and unfulfilled, and calculates the total ENRToken price as the product of the energy amount and the unit price. The buyer\u0026rsquo;s token balance is then checked to ensure they have enough ENRTokens to cover the total cost. If sufficient, the contract transfers the required tokens from the buyer to the seller, marks the offer as completed to prevent further purchases, and emits an EnergyPurchased event to update the network and record the successful transaction.\u003c/p\u003e\n \u003cp\u003eIn the \u003cstrong\u003eoffer matching\u003c/strong\u003e scenario, the system supports an auction-based model where buyers can declare their demand by specifying the desired energy amount and the maximum price they are willing to pay. The contract then scans the pool of active sale offers to find the first offer that satisfies both criteria: an energy amount equal to or greater than the buyer\u0026rsquo;s request and a unit price less than or equal to the buyer\u0026rsquo;s maximum price. If such a matching offer is found, the system proceeds to finalize the transaction automatically by calling the PurchaseEnergy function with the corresponding offer ID. If no suitable match is found, the contract returns a message indicating that no match is currently available.\u003c/p\u003e\n \u003cp\u003eThrough these mechanisms, the EnergyTransaction contract ensures an automated, secure, and transparent energy trading process within the DEMS platform, effectively enabling decentralized energy markets driven by real-time supply and demand.\u003c/p\u003e\n \u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"Sec8\" class=\"Section2\"\u003e\n \u003ch2\u003e2.4 User Integration\u003c/h2\u003e\n \u003cp\u003eUser interaction with the DEMS system has been facilitated through the MetaMask wallet and the Remix IDE. Users can log into the system using their Ethereum wallets (e.g., MetaMask) through signature verification enabled by the Web3 authentication module; authorization is managed via JWT-based session handling. Authorized user addresses were imported into MetaMask, enabling direct interaction with deployed smart contracts via Remix. Through this setup, users were able to call contract functions and execute various operations within the system[\u003cspan class=\"CitationRef\"\u003e22\u003c/span\u003e]. Corporate users, such as energy companies, can submit their energy production and consumption data to the system in JSON format via the developed RESTful API endpoints (POST /energy/insert/production, POST /energy/insert/consumption). For example, prosumer-level smart contracts can automate bid and offer registration and monitor energy generation and demand [\u003cspan class=\"CitationRef\"\u003e23\u003c/span\u003e]. This ongoing research effort aims to test the proof-of-concept implementation of such an energy market in selected micro-grids in the coming months.\u003c/p\u003e\n \u003cp\u003eIn Web3 Authentication, users can securely log into the system using their Ethereum wallets. This process involves signing a message with the wallet and verifying the signature on the server side. One key user operation involved acquiring ENRtokens through the \u003cstrong\u003edeposit()\u003c/strong\u003e function. By sending a fixed amount of ETH, users received an equivalent amount of ENRTokens, which were then automatically credited to their MetaMask wallets. For energy purchasing, two models were supported: direct peer-to-peer (P2P) transactions and an auction-based mechanism. In the direct model, users negotiated transaction parameters such as quantity, price, and delivery time, then executed a smart contract that facilitated automatic token transfers at the specified intervals. In the auction-based model, users submitted energy purchase requests by specifying the desired energy amount and maximum price. The system then matched these requests with available sell offers using an automated matching algorithm. Upon a successful match, ENRtokens were transferred, and the transaction was permanently recorded on-chain. These examples illustrate the user\u0026apos;s operational flow within the DEMS system, highlighting the practical aspects of user engagement with decentralized energy trading platforms. Through the MetaMask wallet, users managed their tokens and executed trades, while Remix IDE provided the interface for interacting with the smart contracts that govern the energy market.\u003c/p\u003e\n \u003cp\u003eEnergy producers were also able to actively participate by listing their excess energy for sale through open offers. These offers could be purchased either directly by other users or through the system\u0026rsquo;s automatic matching functionality. Additionally, users holding ENRTokens had the option to convert them back to ETH by invoking the \u003cstrong\u003ewithdraw()\u003c/strong\u003e function. This function returned the tokens to the contract owner and transferred the corresponding ETH amount to the user\u0026apos;s wallet. The use of blockchain technology in energy markets facilitates secure and transparent transactions and enhances the efficiency and scalability of microgrids [\u003cspan class=\"CitationRef\"\u003e24\u003c/span\u003e] [\u003cspan class=\"CitationRef\"\u003e25\u003c/span\u003e]. By enabling direct energy transactions and data exchange among local actors, blockchain infrastructures can support the vision of positive energy districts [\u003cspan class=\"CitationRef\"\u003e12\u003c/span\u003e].\u003c/p\u003e\n \u003cp\u003eBlockchain technology addresses structural shortcomings in traditional energy markets by offering decentralized data recording and auditable transactions. Smart contracts can eliminate intermediaries, curb monetary budgets, and support multi-signature accounts to distribute funds agreed upon in the agreement [\u003cspan class=\"CitationRef\"\u003e26\u003c/span\u003e].\u003c/p\u003e\n \u003cp\u003eThis user integration model supports both flexible, user-driven P2P agreements and a dynamic marketplace architecture. All interactions and transactions are managed through smart contracts, ensuring transparency, traceability, and security via permanent blockchain records. The infrastructure is scalable and inclusive, enabling participation not only from individual users but also from larger-scale energy producers. The traditional energy transaction is carried out in auditing, bidding, clearing, and settlement, which are now streamlined by blockchain[\u003cspan class=\"CitationRef\"\u003e26\u003c/span\u003e]. Blockchain ensures tamper-proof, scalable, and autonomous energy systems without third-party mediation by recording and verifying all energy transactions[\u003cspan class=\"CitationRef\"\u003e27\u003c/span\u003e].\u003c/p\u003e\n\u003c/div\u003e"},{"header":"3. Performance Metrics and Evaluation","content":"\u003cp\u003eThis section presents key performance and reliability metrics of the DEMS platform. Evaluations were conducted on a private local test network, focusing on the system\u0026rsquo;s functionality, transaction execution times, and smart contract efficiency[\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e]. These results were obtained in a controlled environment with a limited number of nodes. In future stages, as the system is integrated into public blockchain infrastructures, changes in network dynamics may affect performance metrics.\u003c/p\u003e \u003cdiv id=\"Sec10\" class=\"Section2\"\u003e \u003ch2\u003e3.1 Smart Contract Efficiency\u003c/h2\u003e \u003cp\u003eTests performed on the ENRToken smart contract measured the average gas consumption per function call [\u003cspan citationid=\"CR29\" class=\"CitationRef\"\u003e29\u003c/span\u003e]. The measurements were conducted using the Foundry framework, with smart contracts tested in synchronization across validator nodes operating on a Hyperledger Besu network. The system, operating with the IBFT 2.0 consensus algorithm, completed transactions within an average block time of 2 to 4 seconds. These durations were recorded in a latency-free local test environment. Although view functions such as getContractBalance() do not consume gas on a live blockchain, their theoretical gas values were estimated and included in the analysis for completeness [\u003cspan citationid=\"CR30\" class=\"CitationRef\"\u003e30\u003c/span\u003e].\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eThe results indicate that the smart contract operates efficiently in terms of gas consumption, while transaction processing times remain consistently low and responsive, as in Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e. These findings demonstrate the contract's suitability for scalable and cost-effective deployment within the DEMS energy trading ecosystem.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec11\" class=\"Section2\"\u003e \u003ch2\u003e3.2 Network Throughput and Scalability\u003c/h2\u003e \u003cp\u003eThe transaction throughput of the DEMS platform was assessed in a controlled environment using Hyperledger Besu with four validator nodes. The block production interval was configured to two seconds under the IBFT 2.0 consensus algorithm. The results demonstrated an average transaction rate of 5 to 7 transactions per second (TPS). During stress tests involving the simultaneous submission of 50 transactions, the network maintained stability without any errors or observable delays. Furthermore, no significant degradation was detected in node processing capacity or block generation time under increased load. These findings indicate that the system operates with low latency and consistent performance, rendering it a practical solution for small- to medium-scale energy communities. Nevertheless, it is important to acknowledge that performance may vary in public blockchain environments due to dynamic network conditions. [\u003cspan citationid=\"CR28\" class=\"CitationRef\"\u003e28\u003c/span\u003e].\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec12\" class=\"Section2\"\u003e \u003ch2\u003e3.3 Token Transfer Integrity\u003c/h2\u003e \u003cp\u003eThe integrity of token transfers was validated by testing the deposit() and withdraw() functions of the ENRToken smart contract. The tests focused on verifying the accuracy and reliability of token-to-ETH conversion processes. When users sent exactly 0.001 ETH, the contract accurately credited the expected amount of ENRTokens to their accounts. Transactions involving invalid ETH amounts were automatically reverted by the contract, and any attempts to withdraw more ENRTokens than the user\u0026rsquo;s balance were effectively blocked. Upon successful withdrawal, users\u0026rsquo; ETH balances were correctly updated, and ENRToken balances were correspondingly reduced. These results confirm that the conversion mechanism between ENRTokens and ETH operates with precision and robustness, ensuring traceable and fault-tolerant value exchange within the platform[\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e].\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec13\" class=\"Section2\"\u003e \u003ch2\u003e3.4 Security and Permission\u003c/h2\u003e \u003cp\u003eThe DEMS platform is implemented on a private and permissioned Hyperledger Besu network, with security mechanisms tailored to restrict access and ensure transaction integrity. Security testing revealed that only users included in a predefined whitelist were authorized to submit transactions. Any unauthorized users or nodes attempting to join the network were successfully rejected by the system. Additionally, all transaction signatures were validated in accordance with the IBFT 2.0 consensus protocol. It should be noted that these evaluations were conducted in a controlled environment; therefore, deployment on public blockchain networks will necessitate additional security measures. Overall, the results indicate that DEMS offers strong protection against unauthorized access and ensures secure transaction execution[\u003cspan citationid=\"CR31\" class=\"CitationRef\"\u003e31\u003c/span\u003e].\u003c/p\u003e \u003cp\u003eIt is important to mention that the EnergyTransaction smart contract has been designed at a conceptual level in this study, and its underlying algorithms have been defined. However, full-scale functional testing of this contract depends on the integration of smart meter data and supporting hardware infrastructure. As such, the current performance evaluation is limited to the ENRToken contract. Similarly, detailed performance analyses (e.g., API response times, authentication delays, data transfer speeds of bridge services) and stress tests of the newly developed Web3 authentication, API, and bridge service modules will be conducted after the full integration of the system. Future work will focus on deploying the smart metering system and conducting comprehensive tests and performance analyses of the EnergyTransaction contract following complete system integration.\u003c/p\u003e \u003c/div\u003e"},{"header":"4. Results and Discussion","content":"\u003cp\u003eThis section evaluates the current implementation outcomes of the DEMS platform, discussing the benefits it offers, the technical limitations identified during development, and potential directions for future enhancements. Blockchain technology is widely recognized in the literature for its transformative potential in reshaping the centralized structures of traditional energy markets [\u003cspan citationid=\"CR32\" class=\"CitationRef\"\u003e32\u003c/span\u003e]. Within the scope of the DEMS platform, energy units are represented as digital tokens and transacted via smart contracts. This approach minimizes the need for intermediaries and enables direct peer-to-peer trading among users. In addition, the development of Web3-compatible authentication, standardized data collection via APIs, and bridge services that cryptographically verify and transmit energy data to the blockchain has significantly enhanced the platform's reliability and functionality. Thanks to these advancements, both centralized and decentralized user interactions have become possible in energy tokenization-based processes, and an innovative model for identity verification and data management has been successfully implemented within the scope of the project. The use of a permissioned blockchain architecture ensures that all transaction histories are recorded in a transparent and auditable manner, significantly enhancing the system\u0026rsquo;s reliability, data integrity, and security. The current configuration of the platform provides a cost-effective and traceable energy trading solution suitable for local energy communities. Mechanisms such as linking device identity to wallet addresses and verifying data through signed messages play a critical role in ensuring the integrity and reliability of data originating from distributed energy resources. Looking ahead, the architecture is designed to be extendable toward public blockchain infrastructures, with the ultimate goal of establishing accessible and scalable energy markets on a national and international level.\u003c/p\u003e \u003cp\u003eThe implemented system successfully demonstrated several core functionalities essential for blockchain-based peer-to-peer energy trading. A real-time transaction mechanism was validated in a controlled test environment, enabling users to seamlessly buy and sell ENRTokens through secure smart contracts deployed on the Ethereum blockchain. These contracts were executed with consistent reliability and without significant latency, confirming the feasibility of token-based energy value exchange. The module developed for collecting energy production and consumption data through a centralized RESTful API infrastructure is also nearing completion. This module enables the reception of data in JSON format and its storage in a MariaDB database.\u003c/p\u003e \u003cp\u003eThe platform architecture has been developed with the capability to interface with smart meter data. Although full-scale integration with live energy data is scheduled in a subsequent deployment phase, the foundational data acquisition modules and relevant APIs have already been incorporated and tested in a simulated environment. These modules are designed to facilitate secure, bidirectional communication with metering devices, forming the basis for real-time energy accounting. The developed bridge services aim to transmit energy data to the blockchain network in a cryptographically signed and verifiable format. A key component of this integration involves assigning dedicated Ethereum addresses to the devices providing control panel data and validating their transmissions through signed messages. While the platform currently enables digital representation and transfer of energy credits, the physical integration with energy infrastructure components (e.g., smart inverters, gateways) is not yet complete. However, corresponding interface protocols and data validation mechanisms have been embedded into the system and will become operational once hardware deployment is finalized. Scalability was assessed using a permissioned blockchain setup comprising four validator nodes. The system maintained stable performance under increasing transaction loads, with average block confirmation times remaining within acceptable thresholds (\u0026lt;\u0026thinsp;2 seconds). These results indicate the system\u0026rsquo;s potential for scaling in microgrid or community-level energy networks. Furthermore, compatibility with public blockchain infrastructures was explored through architectural modeling, identifying the key parameters to address in future iterations namely, transaction costs, latency optimization, and network security. Collectively, these results establish a robust proof-of-concept platform for decentralized energy trading. The system forms a solid foundation for subsequent optimization efforts and large-scale pilot deployments in real-world energy communities. The authentication module supporting Web3 wallet integration has been successfully developed and tested. Users can securely log into the system using their Ethereum wallets through signature verification, and authorization processes are managed via JWT-based session management.\u003c/p\u003e \u003cp\u003eIn the course of system development and testing, several critical insights have been gained, contributing not only to the refinement of the DEMS platform but also to the broader domain of decentralized energy management systems. The ENRToken smart contract exhibited robustness in security, operational efficiency, and ease of integration, thereby validating its design in a real-world blockchain environment. Furthermore, the blockchain network\u0026rsquo;s configuration including validator node setup, role-based access control, and transaction verification mechanisms was successfully implemented, establishing a reliable operational baseline for both private and potentially public blockchain scenarios.\u003c/p\u003e \u003cp\u003eA hybrid architecture that combines the traditional username-password system with Ethereum wallet-based Web3 authentication has been successfully developed. This approach has provided a valuable experience in addressing diverse user profiles and facilitating the transition from Web2 to Web3. API and Bridge Service Development: The design and implementation of RESTful APIs using Jakarta JAX-RS, along with bridge services that securely transfer data from these APIs to the blockchain, have offered significant expertise in data integration and security. In particular, topics such as cryptographic data signing, proof of origin, and device identity management have been central to this development process.\u003c/p\u003e \u003cp\u003eIn anticipation of full hardware deployment, the software stack was architected to seamlessly incorporate real-time smart meter data. Validation logic and security filters have been pre-integrated, enabling future interoperability with energy hardware and facilitating rapid system expansion. Performance tuning efforts have also yielded measurable benefits, such as reduced gas consumption per transaction and minimized latency in smart contract execution, which together enhance user interaction and system responsiveness.\u003c/p\u003e \u003cp\u003eThese experiences have provided valuable contributions not only to the success of the current study but also to the future development of blockchain-based energy systems. All these functionalities have enabled the work to evolve beyond a purely technical blockchain network into a Web3-enabled, user-oriented, and data-driven energy tokenization platform. Collectively, the lessons learned contribute to a more scalable, secure, and efficient model for digital energy exchange.\u003c/p\u003e"},{"header":"5. Conclusion","content":"\u003cp\u003eThis study has presented and validated the DEMS platform, a blockchain-enabled peer-to-peer (P2P) energy trading system that leverages tokenization and smart contracts to enable secure, transparent, and decentralized energy exchanges within local energy communities. The implementation effectively demonstrates that energy units can be digitally represented through ENRTokens, facilitating low-cost, traceable transactions with enhanced trust and autonomy. Operating on a permissioned blockchain framework, the platform ensures transparency, auditability, and operational reliability within a controlled environment. Key achievements include the deployment of a modular smart contract architecture, secure P2P token transfers, and foundational support for real-time integration of smart meter data. Technical milestones such as validator node configuration, gas consumption optimization, and robust transaction governance further underscore the system\u0026rsquo;s architectural robustness. Designed with extensibility in mind, the platform anticipates future integration with diverse hardware interfaces and the automation of energy data workflows. The development process yielded valuable insights into smart contract design, network security, and seamless interoperability between software components and energy infrastructure, laying a strong foundation for continuous improvement. Planned enhancements encompass dynamic pricing algorithms, flexible marketplace features, and automated matching mechanisms to boost market efficiency and user engagement. Beyond energy trading, the ENRToken framework is poised to support applications such as micro-payments, carbon credit exchanges, and incentive-driven energy conservation programs. To accommodate a global user base, the system plans to implement multilingual support and enable classification and filtering of energy data by country. Future capabilities include converting individual energy production records into blockchain-based tokens, making them transferable between users. Transitioning to public blockchain networks like Ethereum or Polygon is expected to enhance scalability, accessibility, and global transparency.\u003c/p\u003e \u003cp\u003eIn summary, DEMS offers a versatile and forward-looking model in the evolving decentralized energy ecosystem by integrating blockchain security, real-time data processing, and digital asset management. Its modular microservices-based architecture supports scalable adaptation across different smart meter manufacturers and blockchain networks, positioning the platform for deployment in both local and international energy markets.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e \u003ch2\u003eLink to supporting data:\u003c/h2\u003e \u003cp\u003e \u003cspan class=\"ExternalRef\"\u003e \u003cspan class=\"RefSource\"\u003ehttps://github.com/merdunal/DEM4PED\u003c/span\u003e \u003cspan address=\"https://github.com/merdunal/DEM4PED\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e \u003c/span\u003e \u003c/p\u003e \u003c/p\u003e\u003ch2\u003eAuthor Contribution\u003c/h2\u003e\u003cp\u003eD.A. (Demiral Akbar) conceptualized the project, supervised the overall research, and contributed to the manuscript writing. M.\u0026Uuml;. (Mert \u0026Uuml;nal) developed the blockchain infrastructure and implemented the smart contract architecture. R.A. (Recep Akkaya) carried out experimental validation and performance analysis. O.B. (Orkun Balcı) managed the integration with smart meters and supported multilingual module development. D.A. and M.\u0026Uuml;. wrote the main manuscript text. All authors reviewed and approved the final manuscript.\u003c/p\u003e\u003ch2\u003eAcknowledgement\u003c/h2\u003e\u003cp\u003eThis work was supported by JPP ERA-Net SES, EnerDigit and carried out with the financial assistance of T\u0026Uuml;BİTAK under project code 124N032.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eUl Hassan, N., Yuen, C., Niyato, D.: Blockchain Technologies for Smart Energy Systems: Fundamentals, Challenges, and Solutions, in \u003cem\u003eIEEE Industrial Electronics Magazine\u003c/em\u003e, vol. 13, no. 4, pp. 106\u0026ndash;118, Dec. (2019). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1109/MIE.2019.2940335\u003c/span\u003e\u003cspan address=\"10.1109/MIE.2019.2940335\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eM. R. A T et al., Intelligent Energy Management across Smart Grids Deploying 6G IoT, AI, and Blockchain in Sustainable Smart Cities, \u003cem\u003eIoT\u003c/em\u003e, vol. 5, no. 3, Art. no. 3, (2024). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.3390/iot5030025\u003c/span\u003e\u003cspan address=\"10.3390/iot5030025\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eArias, S., Santa-Alvarado, A.M., Salazar, H.: The Impact of a Market Maker in an Electricity Market, \u003cem\u003eEnergies\u003c/em\u003e, vol. 17, no. 16, Art. no. 16, Jan. (2024). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.3390/en17164042\u003c/span\u003e\u003cspan address=\"10.3390/en17164042\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eNazreen Junaidi, M.P., Abdullah, B., Alharbi, M., Shaaban: Blockchain-based management of demand response in electric energy grids: A systematic review, Energy Reports, \u003cb\u003e9\u003c/b\u003e, Pages 5075\u0026ndash;5100, ISSN 2352\u0026ndash;4847, (2023). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1016/j.egyr.2023.04.020\u003c/span\u003e\u003cspan address=\"10.1016/j.egyr.2023.04.020\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eCioara, T., Antal, M., Mihailescu, V.T., Antal, C.D., Anghel, I.M., Mitrea, D.: Blockchain-Based Decentralized Virtual Power Plants of Small Prosumers, in \u003cem\u003eIEEE Access\u003c/em\u003e, vol. 9, pp. 29490\u0026ndash;29504, (2021). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1109/ACCESS.2021.3059106\u003c/span\u003e\u003cspan address=\"10.1109/ACCESS.2021.3059106\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eTeng, F., Zhang, Q., Wang, G., Liu, J., Li, H.: A comprehensive review of energy blockchain: Application scenarios and development trends. Int. J. Energy Res. \u003cb\u003e45\u003c/b\u003e(12), 17515\u0026ndash;17531 (2021). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1002/er.7109\u003c/span\u003e\u003cspan address=\"10.1002/er.7109\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOkwuibe, G.C., Zade, M., Tzscheutschler, P., Hamacher, T., Wagner, U.: A Blockchain-based Double-sided Auction Peer-to-peer Electricity Market Framework, \u003cem\u003e2020 IEEE Electric Power and Energy\u003c/em\u003e Conference \u003cem\u003e(EPEC)\u003c/em\u003e, Edmonton, AB, Canada, pp. 1\u0026ndash;8, (2020). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1109/EPEC48502.2020.9320030\u003c/span\u003e\u003cspan address=\"10.1109/EPEC48502.2020.9320030\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDoan, H.T., Cho, J., Kim, D.: Peer-to-Peer Energy Trading in Smart Grid Through Blockchain: A Double Auction-Based Game Theoretic Approach, in \u003cem\u003eIEEE Access\u003c/em\u003e, vol. 9, pp. 49206\u0026ndash;49218, (2021). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1109/ACCESS.2021.3068730\u003c/span\u003e\u003cspan address=\"10.1109/ACCESS.2021.3068730\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBaig, M.J.A., Iqbal, M.T., Jamil, M., Khan, J.: Blockchain-Based Peer-to-Peer Energy Trading System Using Open-Source Angular Framework and Hypertext Transfer Protocol. Electronics. \u003cb\u003e12\u003c/b\u003e, 287 (2023). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.3390/electronics12020287\u003c/span\u003e\u003cspan address=\"10.3390/electronics12020287\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eZedan, M., Nour, M., Shabib, G., Nasrat, L., Ali, A.-A.: Review of peer-to-peer energy trading: Advances and challenges. E-Prime - Adv. Electr. Eng. Electron. Energy. \u003cb\u003e10\u003c/b\u003e, 100778 (Dec. 2024). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1016/j.prime.2024.100778\u003c/span\u003e\u003cspan address=\"10.1016/j.prime.2024.100778\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eVictor Ahlqvist, P., Holmberg, T., Tanger\u0026aring;s: A survey comparing centralized and decentralized electricity markets. Energy Strategy Reviews, 40, 2022, 100812, ISSN 2211-467X, \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1016/j.esr.2022.100812\u003c/span\u003e\u003cspan address=\"10.1016/j.esr.2022.100812\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eZhao, S., Wang, B., Li, Y., Li, Y.: Integrated Energy Transaction Mechanisms Based on Blockchain Technology. Energies. \u003cb\u003e11\u003c/b\u003e (Sep. 2018). 9, Art. 9 \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.3390/en11092412\u003c/span\u003e\u003cspan address=\"10.3390/en11092412\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBesu, H.: \u003cem\u003ePrivate Networks Documentation\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://besu.hyperledger.org/private-networks\u003c/span\u003e\u003cspan address=\"https://besu.hyperledger.org/private-networks\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHyperledger, Besu: \u003cem\u003eIBFT 2.0 Consensus Protocol Documentation\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://besu.hyperledger.org/private-networks/how-to/configure/consensus/ibft\u003c/span\u003e\u003cspan address=\"https://besu.hyperledger.org/private-networks/how-to/configure/consensus/ibft\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eEthereum Foundation: \u003cem\u003eERC-20 Token Standard\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://ethereum.org/en/developers/docs/standards/tokens/erc-20/\u003c/span\u003e\u003cspan address=\"https://ethereum.org/en/developers/docs/standards/tokens/erc-20/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFoundry, F., Book: Documentation for Ethereum Application Development with Foundry, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://book.getfoundry.sh\u003c/span\u003e\u003cspan address=\"https://book.getfoundry.sh\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMetaMask: \u003cem\u003eMetaMask Documentation\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://docs.metamask.io/\u003c/span\u003e\u003cspan address=\"https://docs.metamask.io/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSetup a RPC Node | Documentation: Accessed: May 18, 2025. [Online]. Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://docs.vanarchain.com/nodes-and-validators/setup-a-rpc-node\u003c/span\u003e\u003cspan address=\"https://docs.vanarchain.com/nodes-and-validators/setup-a-rpc-node\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eKirli, D.: \u003cem\u003edesenk/energy-smart-contract\u003c/em\u003eNov. 01,. Python. Accessed: May 18, 2025. [Online]. (2024). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://github.com/desenk/energy-smart-contract\u003c/span\u003e\u003cspan address=\"https://github.com/desenk/energy-smart-contract\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOpenZeppelin: \u003cem\u003eOpenZeppelin Contracts: ERC-20 API Reference\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://docs.openzeppelin.com/contracts/4.x/api/token/erc20\u003c/span\u003e\u003cspan address=\"https://docs.openzeppelin.com/contracts/4.x/api/token/erc20\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLiu, J., Cai, Z., Liu, D., Jin, T.: Research on Distributed Energy Transaction Technology Based on Blockchain, \u003cem\u003eE3S Web Conf.\u003c/em\u003e, vol. 236, p. 02011, (2021). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1051/e3sconf/202123602011\u003c/span\u003e\u003cspan address=\"10.1051/e3sconf/202123602011\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eOlatunji, M.: (@web3MIO), Solidity Tutorial: How to Use Remix IDE for Solidity Smart Contract Development., Coinmonks. Accessed: May 19, 2025. [Online]. Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://medium.com/coinmonks/solidity-tutorial-how-to-use-remix-ide-for-solidity-smart-contract-development-d0d2ce6da051\u003c/span\u003e\u003cspan address=\"https://medium.com/coinmonks/solidity-tutorial-how-to-use-remix-ide-for-solidity-smart-contract-development-d0d2ce6da051\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eTRADING ENERGY AS A DIGITAL ASSET -: Cryptocurrencies and Blockchain Technology Applications - Wiley Online Library. Accessed: May 19, 2025. [Online]. Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://onlinelibrary.wiley.com/doi/\u003c/span\u003e\u003cspan address=\"https://onlinelibrary.wiley.com/doi/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1002/9781119621201.ch14\u003c/span\u003e\u003cspan address=\"10.1002/9781119621201.ch14\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eYang, Q., Wang, H.: Exploring Blockchain for The Coordination of Distributed Energy Resources, in \u003cem\u003e55th Annual Conference on Information Sciences and Systems (CISS)\u003c/em\u003e, Mar. 2021, pp. 1\u0026ndash;6. (2021). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1109/CISS50987.2021.9400211\u003c/span\u003e\u003cspan address=\"10.1109/CISS50987.2021.9400211\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eYu, Q., Meeuw, A., Wortmann, F.: Design and implementation of a blockchain multi-energy system. Energy Inf. \u003cb\u003e1\u003c/b\u003e(1) (Oct. 2018). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.1186/s42162-018-0040-4\u003c/span\u003e\u003cspan address=\"10.1186/s42162-018-0040-4\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eBhadange, A., Doshi, R., Karmarkar, T., Shintre, S.: Blockchain based solution design for Energy Exchange Platform, Nov. 25, 2022, \u003cem\u003earXiv\u003c/em\u003e: arXiv:2211.13907. \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.48550/arXiv.2211.13907\u003c/span\u003e\u003cspan address=\"10.48550/arXiv.2211.13907\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLedwaba, L.P.I., Hancke, G.P., Isaac, S.J., Venter, H.S.: Electronics. \u003cb\u003e10\u003c/b\u003e (Jan. 2021). 6, Art. 6 \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003e10.3390/electronics10060714\u003c/span\u003e\u003cspan address=\"10.3390/electronics10060714\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e Smart Microgrid Energy Market: Evaluating Distributed Ledger Technologies for Remote and Constrained Microgrid Deployments\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSmart Contract-Based, A.: P2P Energy Trading System with Dynamic Pricing on Ethereum Blockchain. Accessed: May 19, 2025. [Online]. Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://www.mdpi.com/1424-8220/21/6/1985\u003c/span\u003e\u003cspan address=\"https://www.mdpi.com/1424-8220/21/6/1985\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eFoundation, E.: \u003cem\u003eGas and Fees Documentation\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://ethereum.org/en/developers/docs/gas/\u003c/span\u003e\u003cspan address=\"https://ethereum.org/en/developers/docs/gas/\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDocumentation, S.: \u003cem\u003eView and Pure Functions\u003c/em\u003e, [Online]. (2025). Available: \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://docs.soliditylang.org/en/latest/contracts.html#view-functions\u003c/span\u003e\u003cspan address=\"https://docs.soliditylang.org/en/latest/contracts.html#view-functions\" targettype=\"URL\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e. Accessed: May 6\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eDhall, S., Ved, C., Khetarpaul, S., Deswal, S., Dhingra, A.: Decentralize energy network system(den) in assimilation with blockchain, \u003cem\u003eInt. J. Tech. Res. Sci.\u003c/em\u003e, vol. Special, no. 3, pp. 100\u0026ndash;107, Aug. (2020)\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eMerlinda Andoni, V., Robu, D., Flynn, S., Abram, D., Geach, D., Jenkins, P., McCallum, A., Peacock: Blockchain technology in the energy sector: A systematic review of challenges and opportunities, Renewable and Sustainable Energy Reviews, \u003cb\u003e100\u003c/b\u003e, Pages 143\u0026ndash;174, ISSN 1364\u0026thinsp;\u0026ndash;\u0026thinsp;0321, (2019). \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.1016/j.rser.2018.10.014\u003c/span\u003e\u003cspan address=\"10.1016/j.rser.2018.10.014\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Blockchain, Peer-to-Peer Energy Trading, Energy Tokenization, Smart Contracts, Energy Markets, Decentralized Systems, Smart grid.","lastPublishedDoi":"10.21203/rs.3.rs-6787257/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6787257/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eThis study presents a decentralized energy management system (DEMS) designed to enable secure, transparent, and efficient peer-to-peer (P2P) energy trading using blockchain technology. The platform utilizes energy tokenization through ENRTokens and employs smart contracts to automate trustless transactions among users. Built on a permissioned blockchain infrastructure, the system enhances transparency, auditability, and data integrity while minimizing reliance on centralized intermediaries. The implementation, evaluated on a four-node validator network, features a modular smart contract architecture and is designed with a microservices-based structure to support scalability and adaptability across various smart meter manufacturers and blockchain networks. Experimental results demonstrate the successful execution of token-based energy trades, robust system performance, and secure integration with real-time smart meter data. In addition to enabling dynamic pricing mechanisms, the platform supports multilingual capabilities and energy data classification by country, facilitating broader international adoption. The ENRToken framework also shows potential for diverse applications beyond energy trading, such as micro-payments, carbon credit exchanges, and incentive-driven energy conservation programs. Future work will focus on extending the system to public blockchain networks like Ethereum or Polygon to enhance scalability, interoperability, and global transparency. Overall, the proposed platform provides a robust, extensible foundation for next-generation decentralized energy markets.\u003c/p\u003e","manuscriptTitle":"Blockchain-Based Peer-to-Peer Energy Trading: Design and Implementation of the Tokenized Decentralized Energy Management System (DEMS)","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-06-19 13:23:48","doi":"10.21203/rs.3.rs-6787257/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"00d4e6bb-dc5b-47d1-8f7d-2bc65ff3fbc5","owner":[],"postedDate":"June 19th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2026-02-08T00:08:29+00:00","versionOfRecord":[],"versionCreatedAt":"2025-06-19 13:23:48","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6787257","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6787257","identity":"rs-6787257","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.