Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6, 5894-5918 2024 Publisher: Learning Gate DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate © 2024 by the authors; licensee Learning Gate * Correspondence: minlibex622@gmail.com Efficiency and transparency in the management of energy transactions of a smart grid Lamboni Minlibe1*, Palanga Eyouléki Tcheyi Gnadi2 1,2Centre Excellence Régional pour la Maîtrise de l'Electricité (CERME), Université de Lomé, B.P. 1515 Lomé-TOGO Bld Gnassingbé Eyadema, Togo; minlibex622@gmail.com (L.M.) vpalanga@gmail.com (P.E.T.G.). Abstract: Smart grids are developing rapidly, offering significant benefits but also major challenges. Among the main issues are trust between network players, transparency of energy transactions and data confidentiality. To address this, it is crucial to create energy transaction systems that ensure transparency, trust, and minimization of energy losses, while preserving the confidentiality of the information exchanged. An in-depth study led to the design of an innovative architecture in 7 layers, including a specific layer for energy transfer in order to accurately monitor consumption in smart grids. The division of smart grids into geographical areas aims to optimize energy transmission and reduce losses. In this article, a smart contract-based mechanism was developed, deployed on an Ethereum testnet to manage financial and energy transactions, to ensure transparency and build trust. A decentralized application (Dapp) has also been created to facilitate the management of these transactions. This architecture has been validated by comparative simulations between our market model and the one based on the double auction mechanism. The results show that our system, using energy consumption tokens on the Ethereum Virtual Machine (EVM) of the Sepolia testnet, reduces transaction losses, stabilizes prices, and maintains a high level of satisfaction through transparent and reliable transaction management and consumption tracking. Keywords: Bidding system, Blockchain, Energy transaction system, Ethereum, Peer-to-peer (P2P) energy trading, Smart contract. 1. Introduction In smart grids, smart meters act as interfaces between homes and the power grid. Their role is to ensure two-way communication between the actors and the network operator, they provide information and indicators related to energy use by time intervals[1]. One of their advantages is that they make it possible to transform previously passive actors into active actors, leading to the evolution towards a new form of so-called decentralized management. The emergence of blockchain as a decentralized management system facilitates this management while guaranteeing the anonymity of participants and the security of the information shared. Each player can thus participate serenely in the management of the energy system [2] , assuming well- defined roles as consumer, producer, or both (prosumers). Consumers express their demands, while producers offer their surplus energy for peer-to-peer exchange [3]. In practice, blockchain-based peer-to-peer (P2P) energy trading allows producers to sell their surplus electricity directly to local consumers, eliminating the need for a central player and promoting win-win transactions[4]. To foster better collaboration among stakeholders, it is essential to establish a strong, fair and transparent link between members. To this end, each system operator must ensure that the measured data respects four fundamental properties: accuracy, traceability, security and confidentiality. This means that it must allow all members to track the origin of transactions, ensure the anonymity of exchange participants, and protect personal data from unauthorized access or tampering[5]. mailto:minlibex622@gmail.com mailto:vpalanga@gmail.com 5895 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate The layered explanation of the Energy Transaction Systems (ETS) presented in [6][7][8][9], lacks precision and detail, in particular with regard to energy exchange mechanisms and the management of energy transfers. These gaps create grey areas that complicate the understanding and effective implementation of ETS. It is interesting Develop a new, more tailored layered architecture that meets the needs for accurate and transparent management of energy transactions while effectively integrating regulatory and operational requirements. In addition, in energy transaction systems, smart meters play a vital role in measuring and recording energy consumption. However, their potential to improve transparency and trust in transactions is not fully exploited. In particular, the ability of smart meters to interact directly with a blockchain, allowing for immutable and verifiable recording of consumption data, is an issue that is rarely addressed. This lack of integration is a key challenge. There is a need to ensure that information on energy flows, collected by smart meters, is reliably and securely transmitted to a blockchain that is accessible to all stakeholders. Such an approach would not only increase transparency, but also build greater trust between energy market participants. It is relevant to develop a mechanism that would allow smart meters to directly transfer energy consumption data to a blockchain system. This system would be open to all market participants, thus ensuring mutual trust and better management of energy transactions. To this end, we propose a zone-based energy trading system and a mechanism for monitoring energy transactions, while guaranteeing the anonymity of the players. The main contributions are summarized as follows: • Proposal of a layered architecture of the energy transaction system taking into account the energy transfer process offering a much clearer view and understanding. • Proposal of a consensus model for the energy market allowing a reduction in energy losses and a gain in consumer satisfaction. • Proposal of a model for monitoring energy transactions for better transparency in exchanges. • The smart contract for financial transactions on the market and that of consumption monitoring transactions have been implemented. • An energy transaction flow was proposed highlighting the role of smart meters in the entire process. 2. Literature Review Blockchain as a decentralized management system, starting especially from generation 2.0 with the introduction of smart contracts, thus producing a significant impact on many sectors of activity [10]. It was used for the first time in 2014 in energy market management [11]. In 2015, thanks to the version of BLOCKCHAIN 3.0 that integrates decentralized applications, researchers explored the use of BLOCKCHAIN for the decentralization of the management of an IoT E-business model[12]. Some work on the decentralized management of smart grids by blockchain is summarized in Table 1. According to the data presented in Table 1, blockchain is used in smart grids to transform each participant in smart grids into a proactive actor, rather than just a passive one. This management model gives each stakeholder the ability to interact with their counterparts, thus fostering a collaborative dynamic. The decentralized aspect of the blockchain allows all participants to have instant access to all energy purchase or sale transactions carried out in the energy market. This new management approach is attracting growing interest in the research community, prompting some authors to explain the functioning of energy transaction systems (ETS) through a layered structure. [6] offers an explanation of ETS in two layers, a physical layer that represents the physical network that facilitates the transfer of electricity once the transaction has taken place between the seller and the buyer. It consists of the physical interconnection system that connects the different actors, and a smart meter that allows them to interact with the energy market and a communication infrastructure that allows them to exchange information. The virtual layer allows each player to enter their energy sales and purchase parameters. It ensures equitable participation between the actors and defines the mechanism in the market. It is 5896 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate composed of an information system that allows communication between the different players, the market operations that defines the rules of transactions and the price mechanism. This division does not give only a summary description of the energy transaction system and an idea of the functional organization but no details on the energy exchange mechanism and the management of energy transfers. [7] offers a 3-layer slicing, the user layer, represented by the systems transaction control systems whose mission is to control energy stocks and execute the Request Response DR algorithms and carry out all communications with the IT infrastructure. The communication layer, made up of all the components necessary to allow the actors to communicate with each other. The data center owned by the aggregator, where the virtual energy exchange takes place, The main components of this layer are the publish-subscribe servers, the smart meter database, and the analytics component. This description offers an idea of the broad outlines of the structural organization of the STE. The details regarding the decentralized management system remain The data center owned by the aggregator, where the virtual energy exchange takes place, The main components of this layer are the publisher-subscription servers, the smart meter database, and the analytics component. This description offers an idea of the broad outlines of the structural organization of the STE. The details of the decentralized management system remain unclear. The concept and principle of operation of the market is poorly illustrated, as well as the data collection mechanism. Similarly, the creation and follow-up of energy transactions are not taken into account. Unlike the previous two, [8] explains the operation of the STE by a structure in 5 layers, The user layer which brings together all the actors of the system and the domestic consumption management devices that evaluate and transmit the needs and offers of users to the energy market. The Energy Management/Microgrid Operator (MGO) layer, it collects information on the supply and demand of grid players while promoting grid balance and stability. The market layer centralizes the energy proposals of the participants to establish the market equilibrium price. It ensures a fair and transparent approach. The communication layer, it allows secure data exchanges between participants with good communication technology offering a good speed at an acceptable cost. Table 1. Use of blockchain in decentralized smart grid management. Years References Road repairs 2017 [11] Propose a photovoltaic energy exchange market model using a private blockchain as a platform allowing each partner to offer its price and the amount of energy available in a decentralized way. 2018 [13] The Ethereum blockchain is used to decentralize demand-to-answer management in a smart power grid. The smart contract is used to verify compliance with the participation criteria and to ensure the balance between demand and supply in the market. 2019 [14] [15] Based on the principle of forming a smart electricity grid through the association of microgrids, Zhiyi Lia et al. propose a model for the exchange of information of inter-microgrid transactions in a decentralized way via the blockchain. Suhail et al. Uses the blockchain to store information from the transactions of an energy exchange between two entities in a network in a decentralized way. 2020 [16] Rabiya Khalid et al. proposed a two-tier energy exchange system. Blockchain has been used to make this system functional in a decentralized way. The first level takes into account the peer-to-peer exchange of energy within the smart grid and the second level an exchange between peers and the power grid itself. 5897 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate 2021 [17] [18] The decentralized management of energy and service sales on a virtual power plant by the blockchain has been studied by Qing Yanga et al. Subin Kwak and Joohyung Lee have created an energy exchange platform using the ethereum blockchain, the smart contract is used for the validation of energy sales conditions. 2022 [19] They propose the development of blockchain-compatible smart microgrids (BSMG). This proposed BSMG configuration uses the Ethereum, Tendermint, and HyperLedger Fabric platforms. It introduces a semi-decentralized system for three-tier energy transactions. BSMGs thus transform electrical systems from centralized grids to distributed grids. The regulatory layer, it is responsible for developing the legal framework and regulatory policies for energy transactions. It determines the market structure, tax regulations, and the integration of the microgrid into the traditional energy market. In addition, it ensures the governance and regulation of the ERS, putting in place procedures and policies to promote smooth and transparent energy exchanges between participants. However, this representation does not highlight the electricity grid layer or a layer that would better explain the mechanism of energy transfer between the actors. In addition, the distributed database layer needs to be defined to discuss the architecture of DLTs, smart contracts, and their implementation in the context of STS. [9] Explained from a 7-layer structure, the user layer brings together all the actors of the system and the equipment used for the exchange of information between actors. The network layer represents the microgrid with all the physical electrical infrastructure and communication network. The system operator layer is responsible for storing and analyzing data for grid management and monitoring during energy transactions. It offers a statistical report on the participants. The market layer is responsible for collecting proposals from participants' offers, aggregating them to determine a market price for transactions. It also defines the mechanism for penalties for members who attempt to defraud. The distributed database layer is responsible for making transaction management decentralized while providing a means of information exchange for each participant. It uses smart contracts and consensus protocols. The communication layer represents the communication infrastructures used to update the information in the distributed database. And finally The regulation layer takes into account the policies and regulations that set the framework to enable the evolution of the traditional electricity system to a decentralized electricity system. It is noticeable that this representation does not clearly show how the monitoring of energy transfers is carried out after the validation of exchanges on the energy market. The regulatory layer does not participate directly in energy transactions; rather, it establishes the necessary framework for the creation of a decentralized management system. Policies and regulations precede the energy transaction system. We are seeing confusion between the network layer and the communication layer. The communication layer, which includes technologies such as fiber optics, DSL, and 3G/4G/5G networks, could be integrated into or clearly distinguished from the network layer to better represent the separation between the power grid and communications. The following remarks emerge: segmentation into two layers, as presented in[6], lack of precision regarding energy exchange mechanisms and the management of energy transfers. Similarly, the reference [7]is considered simplistic, offering a summary view of the structural organization of an energy transaction system (ETS). Although [8]seems to provide more information, details about the power grid layer and the distributed database layer are lacking, making it difficult to fully understand how the ERS works. The seven-layer representation proposed by [9]provides a detailed view of how an ETS works, but has some nuances. In addition [9] does not sufficiently clarify how energy transfers are monitored after the validation of exchanges on the energy market. Therefore, we propose a new seven- layer architecture. The energy market, managed via a blockchain system, uses a price consensus mechanism that varies according to the researchers' approaches to achieve several social objectives. According to Table 2, the objectives include achieving common goals, optimizing negotiations to maximize profits, meeting 5898 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate consumer preferences, promoting renewable energy, reducing costs and losses, and improving well- being and privacy in the energy sector. Table 2 illustrates some of the approaches. An analysis of this table shows that most of the work focuses more on commercial mechanisms and the management of the energy market. However, the use of smart meters and blockchain for the management and monitoring of energy transactions remains an issue that is not often addressed in the literature. It is therefore relevant to develop a mechanism that allows smart electricity meters to transfer information on the flow of energy consumed to a blockchain system that is accessible and open to all stakeholders, thus ensuring trust between stakeholders. Table 2. Market consensus mechanism and social impact. Mechanism Descriptive Summary Social objectives [20] - multi-agent coalition: is a fundamental concept of multi- agent systems (MAS) where several autonomous agents collaborate to achieve a common goal that none of them can achieve individually. In this system, autonomous agents collaborate by forming coalitions to achieve common goals, such as electricity negotiation, where they submit proposals, evaluate offers, make counteroffers, and finalize agreements. Achieve a goal that only a collective effort can achieve. [21] bilateral contractual networks as a new, scalable market design for P2P energy trading. This system offers a two-tier market: real-time markets and futures markets. Real-time markets are for immediate energy transactions, while futures markets are used to negotiate contracts for future deliveries. The process of price adjustment ends when agents agree on a set of contracts from which none wishes to turn away. To allow bilateral negotiation between market participants in order to enable them to maximize their profit. [22] Mechanism based on the Relaxed Consensus and Innovation (RCI) method. This mechanism relies on the common agreement of stakeholders to make a decision, providing a more flexible approach to consensus. It allows us to accept a solution that, although not optimal for each party, is satisfactory enough for the majority. Respect for preferences and maximization of consumer well-being [23] new decentralized digital currency, called NRGcoin. The system aims to encourage the transition to sustainable energy sources and maintain an economic balance in the energy sector by introducing NRGcoins, which are awarded to renewable energy producers as an incentive to increase production. To encourage energy production, thus increasing supply and reducing the purchase cost of consumers. [24] Discrete-time bidding models for energy price determination The system allows market participants to submit bids, followed by elimination based on specific criteria, and allows the operator to cancel a transfer for a better bid. This is intended to achieve the theoretical market equilibrium price and protect reduce the costs of purchasing on the market, 5899 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate proactive buyers from suboptimal trades. [25] Two-step energy sharing strategy with distributed transaction technology This system enables efficient sharing of energy and transactions between interconnected buildings. Buildings can develop energy programs based on predictive values, such as daily renewable energy production profiles and baseloads. Facilitates exchange between close neighbours and therefore avoids energy loss, allows players to plan their supply and demand in advance. [26] Theoretical approach to games based on double bidding for the optimization of energy trading. This double-auction game system optimizes energy trading by matching buyers and sellers to adjust prices, while ensuring the confidentiality of bids for fair competition. Iterative optimization aims to achieve an efficient balance between supply and demand. Improving profits, privacy and social well-being in the energy sector. [4] Double bidding process. The proposed system allows people who produce and consume electricity (prosumers) to directly exchange electricity using a private blockchain network through a dual auction process. To enable an exchange of energy between network players while allowing consumers to reduce their electricity bills. To demonstrate the management mechanism of our ETS market system, we simulated and compared our model with that of the double auction, in order to highlight the relevance of our method. We also implemented a Dapp and ran tests on an Ethereum test blockchain for the generation and tracking of consumer tokens. 3. Seven-Layer Architecture and Interaction Flows 3.1. Architecture a Sept Couches The proposed architecture responds to the inadequacies noted in the previous development. In this proposal, we replace in the [9] the regulation layer by the energy transaction layer. Our architecture is as follows: The User Layer, The Power Grid Layer, The Communication Layer, The Market Layer, The Energy Transaction Layer, The System Operators Layer, The Distributed Database Layer. • The user layer This layer represents all the actors and equipment that exchange data with all the other elements of the system. Each actor must have a communication account, as well as a HEMSThe HEMS consists of a EMS Coupled with a smart electricity meter[27]. The EMS is a technology platform comprising hardware and software[28], designed to measure and control the state of the house's loads, thus making it possible to define the user's profile. The communication account is the main element for accessing energy market operations and energy transactions. All transactions are signed using the initiator's private key and verified by the other actors using the public key[29]. The user layer is directly interfaced with the power grid layer, the communication layer, and the distributed database layer. • Power grid layer It refers to the electrical physical grid, which can be the traditional distribution grid provided and managed by the independent system operator, or an additional, separate physical microgrid network, in addition to the traditional grid. Its role is to facilitate the transfer of electricity from sellers to buyers once financial settlements between the two parties have been finalized on the energy market 5900 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate platform[6]. It includes all production systems (domestic and industrial energy, solar energy, wind energy, generator energy) including the distribution network. This layer is interfaced only with the user layer. • The communication layer It serves as a channel for the transmission of information between the different players and is the means of communication with the market layers, energy transactions and distributed databases. It consists of a set of communication technologies, including wired technologies such as DSL, PLC, and fiber optics, as well as wireless technologies such as Zigbee, Z-wave, GSM, and Wi-Fi, among others [9], [30]. The choice of a communication architecture must comply with the performance criteria recommended by IEEE 1547.3-2007 [6]. • The market layer This layer establishes the operations and pricing mechanisms in the P2P network, allowing for near real-time negotiation and adjusting rates as fluctuations. It sets payment rules and a clear offer format for participants. Its objective is to ensure efficient negotiation and optimal energy allocation[6]. She can be implemented on a blockchain system, recording bids and requests, and recording completed transactions, including payer, payee, and amount. Payments are secured via smart contracts[4]. This layer interacts with the user layer to receive offers, requests and stakeholder profiles via the communication layer, and interferes with the energy transaction layer to transmit information related to energy transactions. The energy transaction layer. • The Energy Transaction Layer The energy transaction layer manages the exchange of energy between network participants, ensuring transparency, security, and efficiency. Distinct from the market layer, it focuses solely on the traceability of energy consumption. For each consumption, a transaction is issued to a blockchain for recording and verification, ensuring the integrity of the data. Smart contracts automate the execution of transactions according to predefined conditions, such as the equivalence between kWh and tokens recorded by smart meters. This layer facilitates the traceability of energy flows, maintains user trust and ensures decentralized and reliable energy management. • System Operator Layer This layer interacts with the market layer and the energy transfer layer, playing a critical role in monitoring and readjusting the energy market to maintain grid balance and stability. By accessing aggregate supply and demand data in real-time, it analyzes and stores this information to ensure the necessary energy supply for participants while meeting their goals. Thanks to its interface with the mentioned layers, it monitors the operation of the power system during transactions. In short, this layer is the backbone of the system, ensuring its transparency and promoting greater social acceptance.[9]. • The distributed database layer. It represents all the transactions carried out on the market layer and the energy transfer transaction layer that have been validated and stored in blocks, linked together and distributed among all the nodes of the network. It traces the history of transactions using the blockchain's timestamp system. 3.2. Interaction Flow Between Layers (1): User layer interface directly with the power grid layer (2): User layer interface with the communication layer (3): User layer interface with the market network layer 5901 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate USER LAYER COMMUNICA TION LAYER ELECTRICITY NETWORK LAYER MARKET LAYER ENERGY TRANSACTION LAYER OPERATION SYSTEM LAYER DLT LAYER (1) (5) (2) (4) (3) (12) (7) (6) (11) (9) (8) (10) Figure 1. Interaction between layers. (4): User layer interface directly with the energy transfer transaction layer (5): User layer interface directly with the distributed database layer (6): The communication layer interfaces directly with the market layer. (7): The communication layer interfaces directly with the energy transfer transaction layer (8): the market layer interfaces directly with the distributed database layer(9): the market layer interfaces directly with the energy transfer transaction layer (10): The power transfer transaction layer interfaces directly with the distributed database layer (11): The operating system layer interfaces with the energy transfer transaction layer (12): the operating system layer interfaces with the market layer (3)= (2) + (6): user layer interface with the network layer market via the communication layer (4)= (2) + (7): user layer interface with the energy transfer transaction layer via the communication layer. 4. Modele Du Systeme Our model consists of a participant, an electricity grid, an energy exchange market and a space for managing energy transfer transactions as presented in Fig 2. 4.1. Participants As considered in[31], a participant is an actor who has above all a communication account that is full of a private/public key pair[32]. There is a relationship between these two keys, where the private key cannot be easily inferred from the knowledge of the public key alone[33]. It is also equipped with a EMS and a smart meter. The role of theEMS is to collect all the participant's energy consumption information in real time. This data allows the system to determine the consumption profile and the amount of energy needed for its well-being or available for sale. The smart meter connects the participant to their peers on the grid, allowing an interface with the power grid and the communication network. It receives information from theEMS and transmits them to the energy market via the communication layer. It also has an internet communication system, allowing it to send information about its needs and receive information from the exchange network. Producers can represent energy 5902 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate producing companies, prosumers are households with means and an energy production system such as solar energy, wind [17] example of large factories and others. Consumers are households that demand electricity. The operation of each participant is governed by algorithms 1, 2. EMS S MART M ETER EMS S MART M ETER Marché énergétique Réseau de validation transaction énergétique Réseau de distribution Figure 2. Model architecture. Algorithm 1 : customer 1: Store energy required en threshold energy emin 2: Measures energy et at a date t3: Calcul Δe = et- en 4: If Δe < emin go to 5 else return to 25: Send demand6: Receive information from market7: Accept the transaction8: Call smart contract fonction ‘BuyerEnergy’ 9: Receive tokens9: Measure consumption ec 10: While ec < ea (ea energy buy) call Smart contract function ‘debitEnergy ‘ 11: Return to 2 Algorithm 2 : prosumer 1: Store energy required en threshold energy emin 2: Measures energy et at a date t3: Calcul Δe = et- en 4: If Δe < emin requester take status = buyer else status=seller5: Send demand or offer6: Receive information from market 7: Accept the transaction 8:If status =buyer go to 9 else go to 109: Call smart contract fonction ‘BuyerEnergy’ and go to 11 10: Received Ether and go to 211: Measure consumption ec 12: While ec < ea (ea energy buy) call smart contract function ‘debitEnergy ‘ 13: Return to 2 4.2. Energy Trading Market The layered structure of the energy transaction system presented above shows that the market layer interacts directly with the user layer. In the energy market, players directly exchange their offers for energy transfer, with a guarantee of security, resilience, scalability, adaptability and trust [18]. 4.2.1. Proposed Market Exchange Model 4.2.1.1. Input Data And Constraint Unlike the market mechanism proposed by the other authors presented in Table 3, our mechanism takes into account three constraints: market price, quantity of energy and distance. We start from the principle that on the market we can have only two profiles of actors: V = {V1, V2,........ Vn} and A= {A1, A2,........ Am}. Consumers participate with profile A and producers with profile V. Prosumers can have both profiles V and A. The total number of market participants is then estimated at N=n+m. On each date t all participants N sending: ID_Blockchain, code_zone, the Vi complete the information with Qd, Pv 5903 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate and Aj with Qb, Pa. ID_Blockchain is used to maintain anonymity, code_zone assigned when joining the network for the participant's geo-location in order to plan participation lists to minimize losses during energy transfers. ∆𝑃 = 3 ( 𝑆 𝑈𝑛√3 )2R (8) ∆𝑃 = 3𝐼2𝑅 (9) 𝑅 = 𝜌𝐿 𝐴 (10) To satisfy the social objectives of the actors, as indicated in the table above, we set the condition the selling price to the Pvg network < Pvm sales price on the market as[34]. Market M groups bids by Zone Z and by list L = {L1, L2,........ Lz} . The organization by zone aims to limit losses in the transmission and distribution of electricity, which become important with distance. This loss can be estimated from formulas (8), (9) presented by [35] : 𝑆 is the transmitted power measured in kVa, One is the nominal voltage of the power line in kV , 𝑅 the resistance of a phase in Ω and 𝐼- the current flowing in А. Equations (9) and (10) indicate that the increase in the distance between the actors leads to an increase in resistance, which leads to considerable losses and justifies the zoning adopted. 4.2.1.2. How our Model Works Table 3 presents the modeling of the operating principle of our model. 4.2.1.3. Double Auction Model The double bidding model used by [26]is an adaptation of Vickrey's auction method, a sealed auction where bidders submit their prices without knowing those of the other participants. In this model, buyers participate with the objective of optimizing their profit. Sellers, on the other hand, seek to make a profit on the market rather than selling this energy to the main grid. The bidder acts as coordinator. The rule for determining the winners starts as soon as the bidding process is initiated. The bidder sorts buyers in descending order of their reservation price and sellers in ascending order of their reservation request price. The A's are therefore ordered as A1 > A2> ...... > Am and the Vs for V1 < V1 < ............. < Vn 5904 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Table 3. Modelling the mechanism of energy market transactions. 1. Initializing active buyer and seller lists: buyers = { p ∈participants ∣ p.role = 'Acheteur' ∧ p.quantity > 0 } sellers = {p∈ participants ∣ p.role=’Vendeur’∧p.quantity>0 } 2. Sort Buyers by Descending Purchase Price: Buyers = sort( buyers, key=p.price, reverse=True) 3. Sort sellers by ascending selling price: Sellers = sort( sellers, key=p.price) 4. For each buyer b ∈buyers: remaining_quantityb=b.quantity accumulated_quantityb=0 accumulated_costb=0 Browse nearby locations: Zonesb={z ∣ max(0, b.zone−1) ≤ z ≤ min (zones−1, b.zone+1)} For each z-zone ∈ zonesb: valid_offersz = { s ∈ zone_listsz ∣ s.role=’Vendeur’∧ s.quantity > 0 } Selection of the optimal offer: best_offerz = arg s∈valid_offersmin (s.price ∣ s.price < transmission_capacity_mt) Si best_offerz existe et best_offerz.price ≤ b.price : Distance=∣ b.zone − best_of ferz.zone∣ Si distance ≤ max_distance : transaction_quantity = min (best_offerz.quantity, remaining_quantityb) current = transaction_quantity / transmission_capacity_mt loss = calculate_loss (distance, current) actual_quantity = transaction_quantity – loss You actual_quantity > 0: accumulated_quantityb += a ctual_quantity accumulated_costb += actual_quantity × best_offerz.price remaining_quantityb −= transaction_quantity best_offerz.quantity −= transaction_quantity transactions. Append (( b.id, best_offerz.id, actual_quantity, loss)) Si remaining_quantityb ≤ 0 : break Update the remaining quantity for buyer b: b.quantity −= accumulated_quantityb 5.Wait for a time frame: yield  env.timeout(1) 6.Repeat the process for the following simulation period: while True : After sorting the buyers and sellers, the bidder generates the aggregated supply and demand curves. These curves are used to determine the number of buyers K and sellers J who satisfy condition aK > vJ . The point of intersection of the two curves, obtained via standard numerical methods, makes it possible to determine this number. Comparative study between our model and the double auction model proposed by[26]. 4.3. Management of the Energy Transaction Considering three types of participants as in [16], representing consumers by a set C with an index i ∈ C = {1,...,C}, the producers by a set P with an index j ∈ P = {1,...,P} and the prosumers by a set S. with an index s∈ S = {1,...,S}. It is assumed that producers produce to resell, prosumers produce and consume their energy produced[19] and can only sell the remaining surplus energy. All of them can trade energy on the electricity market at every time interval t ∈ T = {1,...,T} with the same duration. By laying no , e.g. , es respectively l’Total energy of i , j and s , We obtain the energy exchange equation (1), (2), (3) . 𝑒𝑖 = 𝐴𝑖 𝐺 + ∑ 𝐴𝑖𝑗 𝑃 + ∑ 𝐴𝑖𝑠 𝑆 (1) 𝑒𝑗 = 𝑉𝑗 𝐺 + ∑ 𝑉𝑗𝑖 𝐶 + ∑ 𝑉𝑗𝑠 𝑆 (2) 𝑒𝑠 = 𝑉𝑠 𝐺 + ∑ 𝑉𝑠𝑖 𝐶 + 𝐴𝑠 𝐺 + ∑ 𝐴𝑠𝑗 𝑃 (3) Balance constraint: 𝐴𝑖 𝐺 + 𝐴𝑠 𝐺 + ∑ 𝐴𝑖𝑗 𝑃 + ∑ 𝐴𝑖𝑠 𝑆 + ∑ 𝐴𝑠𝑗 𝑃 = 𝑉𝑗 𝐺 + 𝑉𝑠 𝐺 + ∑ 𝑉𝑗𝑖 𝐶 + ∑ 𝑉𝑗𝑠 𝑆 + ∑ 𝑉𝑠𝑖 𝐶 (4) ∑ 𝑉𝑗𝑖 𝐶 = ∑ 𝐴𝑖𝑗 𝑃 (5) 5905 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate ∑ 𝑉𝑗𝑠 𝑆 = ∑ 𝐴𝑠𝑗 𝑃 (6) ∑ 𝑉𝑠𝑖 𝐶 = ∑ 𝐴𝑖𝑠 𝑆 (7) In order to strengthen trust between actors, beyond the security measures offered by the blockchain, it is necessary to implement a decentralized mechanism to monitor the effectiveness of transactions carried out on the energy market respecting equations (5), (6) and (7). For these equations to be satisfied, the constraint of minimizing energy losses during exchanges must be respected. 4.3.1. Working Principle Once the financial transaction has been concluded between the seller Vj and the buyer Ai, the system operator (GR) orders Vj to transfer the energy to the grid and Ai to transfer the funds to Vj's account. In return, GR funds Ai's account with an amount of EGM tokens equivalent to Qa. Unlike the work of[36] and [37] To avoid the forking problems that can arise, for example, when a malicious individual decides to sign and forge blocks to create a sidechain, the producer does not generate tokens. Only the network operator generates the EGM corresponding to the amount of energy injected into the grid, which are then sent to the buyer by calling the creditEnergy. An equivalence is established between EGM and the quantity of energy. Thus, for each consumption of x kWh, the nodes initiate a transaction by calling the debitEnergy of the smart contract. Each time Ai uses electricity, the EGM corresponding to the value of this consumption is transferred to a grid account [30] Figure 3 summarizes the B&C. 4.3.2. Energy Purchase Once a transaction is concluded between the seller Vj and the buyer Ai, the buyer sends Ether to the seller. This triggers the buyEnergy feature. The amount of energy (in kilowatt hours, kWh) purchased is then calculated by dividing the amount of Ether sent by the price of energy agreed in Ether per kWh. Then, the internal creditEnergy function is called to credit the user with the amount of energy purchased in EGM tokens (1 EGM = 1 kWh * 10^18). Thus The user becomes a "buyer" recognized by the contract, and their energy balance is updated. 4.3.3. Energy Credit The creditEnergy function assigns EGM tokens to the buyer corresponding to the amount of energy purchased. It updates the user's energy balance and records the total amount of energy purchased. 4.3.4. Energy Flow Users can spend their energy using the debitEnergy feature. This function first checks that the user has purchased energy and that their balance is sufficient for the amount they want to spend according to algorithm 1. Then, the user's balance is reduced by the amount of energy debited in EGM tokens. 4.3.5. Purchasing Consultation Users can check the total amount of energy they have purchased by calling the getBuyerInfo function. This function returns the total amount of energy (in kWh) purchased by the user and the tokens consumed. 4.3.6. Modeling the Operating Mechanism Table 4 gives a mathematical expression of the principle of operation. 5. Implementation Figure 4 provides an overview of the functional architecture of the mechanism of our entire system. It gives us a global view of the functions to be highlighted. On the figure, 5906 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate (1) Represents the sending of the data collected by EMS to the smart electricity meter. (2) Represents the mechanism in the trading market (3) Represents the initialization of transactions once the agreement has been reached in the market (4) Represents the mechanism for monitoring consumption on the blockchain For all of our simulations, we used a laptop with the following configurations: Windows 11, 16GB RAM, 8th Gen Core i5 processor, and a 256GB SSD hard drive. Table 4. Mathematical modelling of energy transactions. Variable reporting Energy purchase/Credit Energy Flow / Consultation Ej: Amount of energy (in kWh) purchased by the buyer Ai from the seller Vj. Peth : Ether energy price per kWh. Meth: The amount of Ether sent by the buyer. EGM : Amount of energy tokens, where 1 EGM = 1 kWh * 10^18. If: Ai user's energy balance. Energy Purchase: When the transaction is concluded, the amount of energy purchased Ej is calculated as follows: Ej = Meth/ Peth Next, the 'creditEnergy' function is called to credit the user Ai with the amount of energy purchased in EGM tokens: Tokens EGM = Ej x 10^18 User Ai becomes a buyer and their energy balance is updated: If = If + Ej Energy Credit: The 'creditEnergy' function updates the energy balance of the user Ai and records the total amount of energy purchased: If = If + Ej Energy Flow: When user Ai spends his energy, the 'debitEnergy' function checks that the balance is sufficient: If >Ej Then, the user's balance is reduced by the amount of energy debited in EGM tokens: Si = Si - Ej Purchasing Consultation: Users can check the total amount of energy purchased by calling the 'getBuyerInfo' function, which returns the total amount of energy purchased Etotal: Etotal = ∑ Ej𝑛 𝑘=1 Where n is the total number of purchases made by the user. Figure 3. 5907 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Functional architecture of the model. Figure 4. Different functional branches of the model and the role of the smart meter. 5.1. Simulation of the Mechanism of Our Market Model vs Double Bidding Model This simulation was carried out with the python language. Here is a detailed description of the process: -Import of several essential Python modules: simpy for process-based simulation, random for random number generation, matplotlib.pyplot for graphing, networkx for graph manipulation and visualization, numpy for numerical calculations, and 'pandas' for structured data management and analysis. • Calculate_loss(distance, current): Calculates losses based on distance and current. • Get_participant_coords(participants, participant_id): Returns a participant's contact information (area and price) from their ID. • Ourmodel(env, participants, zone_lists, transactions): Implements a model where each buyer searches for the best sellers in their area to make transactions based on price criteria and quantity. 5908 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate • Double_auction(approx, participants, transactions): A model where buyers and sellers submit competitive bids and transactions are made when prices match. • Plot_transactions(transactions, participants, title): Plots the network of transactions between participants on a chart. • Plot_satisfaction_comparison(time_steps, satisfaction_our_model, satisfaction_double_auction): • Compares the satisfaction rates between the two models over a timeline. • Plot_market_balance(satisfaction_our_model, satisfaction_double_auction): Displays the overall market balance in terms of total satisfaction. • Plot_loss_by_distance(transactions_our_model, transactions_double_auction, participants): Visualize the losses based on the distance traveled for each transaction in both models. 5.1.1. Satisfaction Rate The satisfaction formula can be defined as: Si= Wq(Qf/Qi) + Wp(Pf/Pi) , avec Wq + Wp = 1 This formula calculates Si of participant i by combining two criteria: Quantity: Qf/Qi represents the proportion of the final quantity obtained in relation to the quantity initially requested. A result of 1 means that the participant has obtained all the requested quantity. Price: Pf/Pi represents the proportion of the initial price that the participant was willing to pay compared to the price actually paid. A result of 1 means that the participant paid exactly the price they were willing to pay or less. 5.2. Simulation of the Energy Transaction Mechanism We wrote a smart contract in Solidity, in line with the mathematical modeling of energy transactions presented in Table 6, and deployed it on the Ethereum Sepolia testnet. Next, we developed a decentralized application (Dapp) with the Next.js framework and the Shadcn library for component management. To automate transaction and consumption tracking by plotting transaction graphs, we installed a MySQL database and used Prisma.io to interconnect the Dapp and MySQL database. The Next.js API was used to insert and retrieve the data into the graph database. Finally, we used Ethers.js to interact with the Ethereum blockchain. Figure 5. Simulation methodology of the energy transaction mechanis. 6. Results 6.1. Mechanism For the Accumulation of Requests and Interactions Between Actors In this section, we present the cumulative aspect of the amount of energy required by applicants to meet their needs, as well as the interactions of these players in the market. 5909 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Figure 6 illustrates the principle of cumulation of consumers to meet their energy demand, as well as the number of tokens received in equivalence to the amount of energy purchased from each seller. . It can be seen that the User_5 user satisfied his energy demand in transactions 1 and 2: he acquired 47 kWh from Seller_2 in transaction 1 and completed the remaining 11 kWh in transaction 2 from Seller_5, receiving 18.8 and 4.4 tokens, respectively. Similarly, user User_7 satisfied their request in transactions 3 and 4. Figure 7 illustrates the interactions between the different players in the market according to our model. The blue dots marked with an 'A' represent the buyers, i.e. the consumers. The red dots marked with a 'V' indicate the sellers, who can be both prosumers with a surplus of energy and producers. The arrows between the dots represent the exchange transactions, indicating the amount of energy exchanged. Figure 6. Principle of energy purchase accumulation to meet their needs. 5910 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Figure 7. Interaction between buyer and seller. 6.2. Comparison of Our Model and the Double Auction Model 6.2.1. Impact of the Multiplication of Zones For this study, we varied the number of zones from 1 to 15 in order to test the behavior of the two models. We consider the following data constant: max_distance: 20km, Participants = 500 and the transmission capacity 100 Kwh. For the calculation of the satisfaction rate we have Wq and Wp = 0.5 , the quantity of offers and demand randomly selected from [10, 50] and the prices between [0.20, 0.55] per kwh. The variables measured include average losses, average satisfaction rate, and average cost of energy purchase as shown in Table 7 and Figure 8. Average losses represent the amount of energy lost during transmission. Our model shows significantly lower average losses (around 0.00047) compared to the Double Auction model (around 0.00106) for all participant configurations. This suggests that our model is more efficient in terms of minimizing energy losses, which is crucial for optimized energy distribution management. Average satisfaction appears to be an indicator of the overall performance of the system in terms of participant satisfaction. The satisfaction values for both models appear to be extremely high (in the range of 10^16 to 10^33). However, it seems that for participants ranging from 100 to 1500, our model tends to show a higher average satisfaction. On the other hand, for configurations with more participants (2000 and 3000), the values are comparable. The average purchase price reflects the average cost of energy for participants. Our model has a slightly lower average purchase price (around 0.0284) than the Double Auction model (around 0.0290). This difference, while small, could indicate better profitability or greater attractiveness for participants in our model. Our model shows superior energy efficiency with significantly reduced losses compared to the Double Auction model. Satisfaction levels, calculated as a weighted average of the quantity of energy obtained and the price paid, are high for both models. In addition, our model seems to offer slightly more of energy obtained and the price paid, are high for both models. In addition, our model seems to offer slightly more advantageous prices, which can be beneficial for the attractiveness of 5911 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate the system. In conclusion, our model seems to have significant advantages in terms of energy efficiency and cost for participants, while maintaining a comparable or even higher level of satisfaction depending on the configuration. These results can be used to argue for the adoption of our model in practical energy network management scenarios. Table 7. Model No. of zone Average losses Average satisfaction Prix Moyne d'Achat Our model 1 0 0.408268 0.301693 Double auction 0 0.452342 0.306571 Our model 3 0.000473 7.06E+22 0.299796 Double auction 0.001016 3.63E+22 0.310712 Our model 5 0.000445 1.58E+27 0.296288 Double auction 0.001338 1.11E+27 0.310781 Our model 8 0.000427 7.20E+29 0.294146 Double auction 0.00157 4.37E+29 0.299752 Our model 10 0.000424 2.19E+25 0.291592 Double auction 0.001676 1.43E+25 0.290567 Our model 15 0.000424 8.97E+18 0.291119 Double auction 0.001861 9.19E+18 0.276095 Our model 20 0.000416 2.38E+18 0.290877 Double auction 0.001872 1.71E+18 0.264146 Our model 25 0.000413 8.89E+13 0.290228 Double auction 0.001913 1.09E+14 0.25408 Our model 30 0.000411 3.97E+13 0.290309 Double auction 0.002039 1.51E+13 0.24982 Figure 8. Impact of increasing the number of zones on our model and the double auction model. 6.2.2. Impact of Population Increase in an Area Table 8 presents simulation data for two energy transaction management models, using fixed parameters: a maximum distance of 20 km, three zones, and a transmission of 500 kW. The indicators compared include the number of participants, average losses, average satisfaction and the average purchase price Average losses represent the amount of energy lost during transmission. Our model shows considerably lower average losses, around 0.00047, compared to the Double Auction model, which shows average losses of around 0.00106, regardless of the configuration of the participants. This 5912 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate difference suggests that our model is more efficient at minimizing energy losses, a crucial factor for optimized energy distribution management. Table 8. Model Participants Average Losses Average satisfaction Prix moyne d'achat Our model 100 0.000471 2.52E+16 0.028355 Double auction 0.001106 1.12E+16 0.029018 Our model 150 0.000477 3.82E+17 0.028809 Double auction 0.00108 4.88E+17 0.028999 Our model 200 0.000487 5.19E+30 0.028474 Double auction 0.001021 5.11E+30 0.029054 Our model 500 0.000473 7.06E+22 0.028554 Double auction 0.001016 3.63E+22 0.02949 Our model 800 0.000467 2.43E+32 0.028492 Double auction 0.001061 3.18E+32 0.028981 Our model 1000 0.000474 5.49E+33 0.028488 Double auction 0.001087 3.28E+33 0.029119 Our model 1500 0.000466 7.16E+32 0.028411 Double auction 0.001002 1.37E+33 0.028979 Our model 2000 0.000462 4.45E+29 0.028353 Double auction 0.001014 4.63E+29 0.029167 Our model 3000 0.000479 1.47E+32 0.02838 Double auction 0.000975 1.36E+32 0.028886 Figure 9. Impact of increasing the population in a zone on both models. The average satisfaction, calculated as a weighted average of the amount of energy obtained and the price paid, is extremely high for both models. For participants ranging from 100 to 1500, our model tends to show a higher average satisfaction. On the other hand, for configurations with more participants (2000 and 3000), the satisfaction values between the two models are comparable. This trend indicates that our model can offer better participant satisfaction in certain configurations. The average purchase price reflects the average cost of energy for participants. Our model shows a slightly lower average purchase price of around 0.0284 compared to the Double Enchères model, which shows an average price of around 0.0290. While the difference is small, it could indicate better profitability or attractiveness for participants in our model. In summary, this study highlights the advantages of the proposed energy transaction management model compared to the Double Auction model. By taking into account geographical distance and 5913 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate transmission capacity, the proposed model allows for better optimization of energy losses, which is crucial for efficient power grid management, especially when distance plays an important role. In addition, it ensures higher participant satisfaction, especially in various configurations, which is a testament to its robustness. The comparison table indicates that our approach is particularly suitable for environments where proximity is essential, as it minimizes distance-related losses. On the other hand, the Double Auction model, although it is simpler to implement, shows a lower performance in terms of loss reduction and satisfaction. Thus, our model stands out for its ability to optimize energy losses while maintaining high satisfaction and favorable economic conditions, making it particularly effective for the management of smart grids. Table 5. Comparison table of the two models. Feature criterion Our model: Distance aware transaction Double bidding with no distance constraint Main approach Sequential: Shoppers are actively looking for the best deals available in their region. Competitive: Buyers and sellers submit their bids simultaneously, transactions concluded when a buyer's price meets a seller's. Objective Geographic realism: Suitable for modeling environments where proximity and transmission play a crucial role. Market price determination: more suitable for evaluating the direct interaction of supply and demand to achieve market equilibrium. Sorting Participants Buyers by descending price, sellers by ascending price. Buyers by descending price, sellers by ascending price. Selection Criteria Buyer's price ≥ seller's price, geographical distance, transmission capacity. Buyer's price ≥ seller's price, transmission capacity. Calculation of Losses Energy losses calculated as a function of distance and current. Energy losses calculated solely as a function of current. Optimization Individual: Each buyer seeks to maximize the quantity purchased by minimizing losses due to distance and current. Market equilibrium: aims to achieve an equilibrium price where supply and demand meet naturally. Less focused on individual optimization. Performances Potential optimization of energy losses. - Increased complexity due to managing geographical distances. Simplicity of implementation. - Adaptability to environments where distance is not critical. Applications Environments where geographic distance significantly affects energy costs and losses. Environments where speed and simplicity of execution are prioritized over geographic optimization. 6.3. Mechanism For Monitoring Energy Consumption Transactions • Simulate an energy purchase (A Transfer the Ether to B for the amount of energy purchased) 5914 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Figure 10. (A). Energy purchase. Figure 10 illustrates an energy purchase where A transfers 0.00112 ETH to B via Metamask to purchase 20 kW of energy, equivalent to 20 Energium tokens (1 kW = 1 EGM), and a confirmation of receipt of the EGM. • Having seen details of the power purchase transaction on Sepolia Testnet Figure 10. (b). Energy purchase transaction details. Viewing and tracking transactions on Spelio ethereum.scan. 5915 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Figure 10. (c) Energy purchase and consumption transactions. For each energy consumption, A sends a transaction to the address of the network operator with the equivalent amount of EGM. The Buynergy transaction represents the power purchase transactions and the DébitEnergy represents the energy consumption transactions. This result highlights the preservation of the anonymity of the various actors. • Visualization and monitoring of consumption in July on the Dapps interface . Figure 10 (d). Energy transactions for the month of July. Figure 10 (e) shows the energy transactions of a consumer in the month of July, he bought 83 Kw on the market and consumed only 70 Kwh. 5916 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Figure 10. (e) Tracking of energy purchases and consumption for the month of July. Figures 10 (a), (b), (d), and (e) illustrate solutions to the equations essential to smart grid management, including equations (4), (5), (6), and (7). These solutions highlight the mechanism for monitoring energy consumption by each player in the network, in direct correlation with their financial transactions on the market layer. This real-time monitoring helps to maintain a balance between the amount of energy purchased and that consumed, while ensuring total transparency of operations. Transparency is crucial because it builds trust between participants, ensuring that all transactions are fair and compliant with the established rules. In short, these results demonstrate that the proposed model is not only theoretically valid, but also applicable in practice to ensure optimized, transparent, and equitable energy management. This approach is essential for the future of smart grids, as it allows for effective cooperation between the different actors, while ensuring optimal use of energy resources. 7. Conclusion In this work, we proposed a seven-layer architecture of ETS, integrating a specific layer for energy transactions. This layer makes it possible to manage the monitoring of energy transfers independently of the transactions of the market layer. We have also set up a sales and purchasing management mechanism by zone, aimed at limiting energy losses while guaranteeing an acceptable satisfaction rate for the players. Finally, we have created a token called Energium and developed a Dapp for monitoring energy consumption, in order to promote a climate of trust between stakeholders. The results highlighted the importance of the energy transfer layer in monitoring compliance in energy purchases and consumption, and that our energy transaction management model is characterised by superior energy efficiency. It has significantly lower average losses compared to the Double Auction model. In addition, it maintains high levels of participant satisfaction, especially for configurations of up to 1500 participants, while displaying a slightly lower average purchase price. These results demonstrate that our model offers advantages in terms of reduced energy losses, attractive purchase cost and participant satisfaction, making it more competitive and efficient for the management of energy transactions in smart grids. 5917 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Nomenclature Qd Qb Qi Qf Pi Pf Wq Wp Pv Pa EGM Vj To Yes 𝜌 𝐿 S HEMS EMS Amount of energy available. Amount of energy required. Initial quantity requested by participant i. Final quantity obtained by the participant i .Initial price that participant i is willing to pay Final price that participant i has paid. Weight of quantity in satisfaction The weight of price in satisfaction Sale price. Purchasing power. Tokens energium Energy Seller Energy Buyer Buyer satisfaction i Specific Conductor Resistance Conductor length. Virtual Machine Conductor Section Home Energy Management System Energy Management System AiG Asg VjG VsG AijP AsjP AisS VjiC VjsS VsiC code_zone ID_Blockchain Participants remaining_quantity b accumulated_quan tityb accumulated_costb Energy purchased by the consumer i from the grid. Energy purchased by the prosumer from the grid. Energy sold by producer j to the grid Energy sold by the prosumer s to the grid. Energy purchased by consumer i from producer j. Energy purchased by the prosumer from the producer j. Energy purchased by the consumer i from the prosumer s. Energy sold by producer j to consumer i. Energy sold by producer j to prosumer s. Energy sold by the prosumer to the consumer i. Geolocation area code Blockchain address List of all participants Quantity remaining to be purchased for buyer b. Copyright: © 2024 by the authors. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). References [1] G. C. Lazaroiu and M. Roscia, “Blockchain and smart metering towards sustainable prosumers,” SPEEDAM 2018 - Proc. Int. Symp. Power Electron. Electr. Drives, Autom. Motion, pp. 550–555, 2018, doi: 10.1109/SPEEDAM.2018.8445384. [2] T. Cioara, M. Antal, V. T. Mihailescu, C. D. Antal, I. M. Anghel, and D. Mitrea, “Blockchain-Based Decentralized Virtual Power Plants of Small Prosumers,” IEEE Access, vol. 9, pp. 29490–29504, 2021, doi: 10.1109/ACCESS.2021.3059106. [3] J. Guerrero, A. C. Chapman, and G. Verbič, “Decentralized P2P Energy Trading Under Network Constraints in a Low- Voltage Network,” IEEE Trans. Smart Grid, vol. 10, no. 5, pp. 5163–5173, 2018, doi: 10.1109/TSG.2018.2878445. [4] P. Wongthongtham, D. Marrable, B. Abu-Salih, X. Liu, and G. Morrison, “Blockchain-enabled Peer-to-Peer energy trading,” Comput. Electr. Eng., vol. 94, no. June, p. 107299, 2021, doi: 10.1016/j.compeleceng.2021.107299. [5] D. Vangulick, B. Cornelusse, and D. Ernst, “Blockchain for peer-to-peer energy exchanges: Design and recommendations,” 20th Power Syst. Comput. Conf. PSCC 2018, 2018, doi: 10.23919/PSCC.2018.8443042. [6] W. Tushar, T. K. Saha, C. Yuen, D. Smith, and H. V. Poor, “Peer-to-Peer Trading in Electricity Networks: An Overview,” IEEE Trans. Smart Grid, vol. 11, no. 4, pp. 3185–3200, 2020, doi: 10.1109/TSG.2020.2969657. [7] P. Siano, S. Member, G. De Marco, and A. Rol, “A Survey and Evaluation of the Potentials of Distributed Ledger Technology for Peer-to-Peer Transactive Energy Exchanges in Local Energy Markets,” pp. 1–13, 2019. [8] M. F. Zia, E. Elbouchikhi, M. Benbouzid, and J. M. Guerrero, “Microgrid Transactive Energy Systems: A Perspective on Design, Technologies, and Energy Markets,” IECON Proc. (Industrial Electron. Conf., vol. 2019-Octob, pp. 5795–5800, 2019, doi: 10.1109/IECON.2019.8926947. [9] M. F. Zia, M. Benbouzid, E. Elbouchikhi, S. M. Muyeen, K. Techato, and J. M. Guerrero, “Microgrid transactive energy: Review, architectures, distributed ledger technologies, and market analysis,” IEEE Access, vol. 8, pp. 19410–19432, 2020, doi: 10.1109/ACCESS.2020.2968402. [10] A. S. Musleh, G. Yao, and S. M. Muyeen, “Blockchain Applications in Smart Grid-Review and Frameworks,” IEEE https://creativecommons.org/licenses/by/4.0/ 5918 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 5894-5918, 2024 DOI: 10.55214/25768484.v8i6.3273 © 2024 by the authors; licensee Learning Gate Access, vol. 7, pp. 86746–86757, 2019, doi: 10.1109/ACCESS.2019.2920682. [11] E. Mengelkamp, B. Notheisen, C. Beer, D. Dauer, and C. Weinhardt, “A blockchain-based smart grid: towards sustainable local energy markets,” in Computer Science - Research and Development, Springer Verlag, Feb. 2018, pp. 207– 214. doi: 10.1007/s00450-017-0360-9. [12] Y. Zhang and J. Wen, “An IoT electric business model based on the protocol of bitcoin,” 2015 18th Int. Conf. Intell. Next Gener. Networks, ICIN 2015, pp. 184–191, 2015, doi: 10.1109/ICIN.2015.7073830. [13] C. Pop, T. Cioara, M. Antal, I. Anghel, I. Salomie, and M. Bertoncini, “Blockchain based decentralized management of demand response programs in smart energy grids,” Sensors (Switzerland), vol. 18, no. 1, 2018, doi: 10.3390/s18010162. [14] Z. Li, S. Bahramirad, A. Paaso, M. Yan, and M. Shahidehpour, “Blockchain for decentralized transactive energy management system in networked microgrids,” Electr. J., vol. 32, no. 4, pp. 58–72, May 2019, doi: 10.1016/j.tej.2019.03.008. [15] S. M. S. Hussain, S. M. Farooq, and T. S. Ustun, “Implementation of Blockchain technology for Energy Trading with Smart Meters,” 2019 Innov. Power Adv. Comput. Technol. i-PACT 2019, 2019, doi: 10.1109/i-PACT44901.2019.8960243. [16] R. Khalid, N. Javaid, S. Javaid, M. Imran, and N. Naseer, “A blockchain-based decentralized energy management in a P2P trading system,” IEEE Int. Conf. Commun., vol. 2020-June, 2020, doi: 10.1109/ICC40277.2020.9149062. [17] Q. Yang, H. Wang, T. Wang, S. Zhang, X. Wu, and H. Wang, “Blockchain-based decentralized energy management platform for residential distributed energy resources in a virtual power plant,” Appl. Energy, vol. 294, 2021, doi: 10.1016/j.apenergy.2021.117026. [18] S. Kwak and J. Lee, “Implementation of Blockchain based P2P Energy Trading Platform,” Int. Conf. Inf. Netw., vol. 2021- Janua, pp. 755–757, 2021, doi: 10.1109/ICOIN50884.2021.9333876. [19] D. L. Dinesha and P. Balachandra, “Conceptualization of blockchain enabled interconnected smart microgrids,” Renew. Sustain. Energy Rev., vol. 168, no. May, p. 112848, 2022, doi: 10.1016/j.rser.2022.112848. [20] F. Luo, Z. Y. Dong, G. Liang, J. Murata, and Z. Xu, “A Distributed Electricity Trading System in Active Distribution Networks Based on Multi-Agent Coalition and Blockchain,” IEEE Trans. Power Syst., vol. 34, no. 5, pp. 4097–4108, 2019, doi: 10.1109/TPWRS.2018.2876612. [21] T. Morstyn, A. Teytelboym, and M. D. McCulloch, “Bilateral contract networks for peer-to-peer energy trading,” IEEE Trans. Smart Grid, vol. 10, no. 2, pp. 2026–2035, 2019, doi: 10.1109/TSG.2017.2786668. [22] E. Sorin, L. Bobo, and P. Pinson, “Consensus-Based Approach to Peer-to-Peer Electricity Markets with Product Differentiation,” IEEE Trans. Power Syst., vol. 34, no. 2, pp. 994–1004, 2019, doi: 10.1109/TPWRS.2018.2872880. [23] M. Mihaylov, S. Jurado, N. Avellana, K. Van Moffaert, I. Magrans De Abril, and A. Nowé, “NRGcoin: Virtual Currency for Trading of Renewable Energy in Smart Grids.” [24] P. Baez-Gonzalez, E. Rodriguez-Diaz, J. C. Vasquez, and J. M. Guerrero, “Peer-to-peer energy market for community microgrids,” IEEE Electrif. Mag., vol. 6, no. 4, pp. 102–107, 2018, doi: 10.1109/MELE.2018.2871326. [25] S. Cui, Y. W. Wang, and J. W. Xiao, “Peer-to-peer energy sharing among smart energy buildings by distributed transaction,” IEEE Trans. Smart Grid, vol. 10, no. 6, pp. 6491–6501, 2019, doi: 10.1109/TSG.2019.2906059. [26] H. T. Doan, J. Cho, and D. Kim, “Peer-to-peer energy trading in smart grid through blockchain: A double auction-based game theoretic approach,” IEEE Access, vol. 9, pp. 49206–49218, 2021, doi: 10.1109/ACCESS.2021.3068730. [27] O. Jogunola et al., “Comparative analysis of P2P architectures for energy trading and sharing,” Energies, vol. 11, no. 1, pp. 1–20, 2018, doi: 10.3390/en11010062. [28] S. K. Rathor and D. Saxena, “Energy management system for smart grid: An overview and key issues,” Int. J. Energy Res., vol. 44, no. 6, pp. 4067–4109, 2020, doi: 10.1002/er.4883. [29] J. Gao et al., “GridMonitoring: Secured Sovereign Blockchain Based Monitoring on Smart Grid,” IEEE Access, vol. 6, pp. 9917–9925, 2018, doi: 10.1109/ACCESS.2018.2806303. [30] M. Fahad Zia, E. Elbouchikhi, and M. Benbouzid, “MICROGRIDS ENERGY MANAGEMENT SYSTEMS: A CRITICAL REVIEW ON METHODS, SOLUTIONS, AND PROSPECTS Energy management system ESS Energy storage system EV Electric vehicle GA Genetic algorithm GHG Greenhouse gas LC Local controller LP Linear programming MAS Multi,” 2018. [31] A. Paudel, K. Chaudhari, C. Long, and H. B. Gooi, “Peer-to-peer energy trading in a prosumer-based community microgrid: A game-theoretic model,” IEEE Trans. Ind. Electron., vol. 66, no. 8, pp. 6087–6097, 2019, doi: 10.1109/TIE.2018.2874578. [32] S. S. Sabry, N. M. Kaittan, and I. M. Ali, “The road to the blockchain technology: Concept and types,” Period. Eng. Nat. Sci., vol. 7, no. 4, pp. 1821–1832, 2019, doi: 10.21533/pen.v7i4.935. [33] A. Gorkhali, L. Li, and A. Shrestha, “Blockchain: a literature review,” J. Manag. Anal., vol. 7, no. 3, pp. 321–343, 2020, doi: 10.1080/23270012.2020.1801529. [34] Z. Zhao et al., “Energy Transaction for Multi-Microgrids and Internal Microgrid Based on Blockchain,” IEEE Access, vol. 8, pp. 144362–144372, 2020, doi: 10.1109/ACCESS.2020.3014520. [35] K. Yotov, E. Hadzhikolev, and S. Hadzhikoleva, “Model for forecasting of electricity losses during transmission and distribution in an electricity system,” Int. J. Eng. Trends Technol., vol. 69, no. 6, pp. 93–98, 2021, doi: 10.14445/22315381/IJETT-V69I6P213. [36] A. A. G. Agung and R. Handayani, “Blockchain for smart grid,” J. King Saud Univ. - Comput. Inf. Sci., vol. 34, no. 3, pp. 666–675, Mar. 2022, doi: 10.1016/j.jksuci.2020.01.002. [37] S. Kwak and J. Lee, “Implementation of Blockchain based P2P Energy Trading Platform,” in International Conference on Information Networking, IEEE Computer Society, Jan. 2021, pp. 755–757. doi: 10.1109/ICOIN50884.2021.9333876.