## 1 Introduction  
Decentralization and digitalization have been chosen as the main factors in the evolution of the global electricity system [1]. Decarbonization aims to reduce the sensitivity of climate change to the effects of manufactured carbon emissions. An energy supply that does not produce carbon dioxide emissions implies using decarbonized resources and technologies, such as variable renewable energies (VRE), energy storage in batteries, and demand flexibility [2]. Prosumers, or communities of prosumers, are groups of many small energy producers who create and self-consume electricity from dispersed energy resources through decentralization. Changes in consumption have an impact on energy resource management and revenue losses for utilities [3]. According to the European Union's Horizon 2020 research and innovation program, digitization is leading to the creation of new technologies and market solutions in the energy sector. These market solutions are known as peer-to-peer (P2P) energy exchange concepts [4]. The peer-to-peer (P2P) energy exchange concept represents an evolution of future transactive energy trends. It involves the creation of a horizontal platform for sharing,transferring, exchanging, and trading energy between peers who are either consumers or prosumers [5]. This poses a challenge to the traditional vertical structure of the energy value chain. From a legal and regulatory perspective, \"P2P energy sharing\" is considered a broad term, according to the Council of European Energy Regulators. It considers all possible interactions between the individuals making up a self-consumption system (individual, collective, and community self-consumption). In addition, as part of the \"Clean Energy\" package, the European Commission is working on legalizing private individuals buying and selling electricity [6]. This involves \"selling renewable energy between market players utilizing a contract whose terms are predetermined\", according to the P2P concepts. Whether directly between market players or indirectly via a certified third party, such as an aggregator, the contract controls the automated execution and settlement of the transaction [7]. This can be achieved directly or indirectly. The increasing number of large certified prosumers in the electricity market has necessitated a reevaluation. In the current centralized electricity market, prosumers who produce more electricity than they need have two choices for what to do with their extra power: either they may sell it to the primary grid following a feed-in tariff (FIT) regulation, or they can store it in a battery energy storage device [8]. However, feed-in tariffs have decreased in most nations as many governments have lowered subsidies for renewable energy, which calls the feasibility of renewable energy projects into question. In addition, battery energy storage systems for most stand-alone renewable energy sources, such as residences, must be far more efficient. In addition, the laws and regulations that support the energy market for renewable energy sources held by residents need to be more effective [9]. As a result, the P2P (\"peer-to-peer\") energy trading mechanism for distributed energy resources (DER) in microgrids has emerged as the strategy that is being considered for the development of a future energy trading system [10]. The peer-to-peer energy exchange mechanism, which involves a direct energy exchange between prosumers, may also support an equity model that enables prosumers to earn money from their surplus power through net metering [11]. This model allows prosumers to make money from their excess electricity. Microgrid technology enables the integration of small modular multi-energy generating technologies, such as renewable energy sources; these multi-energy systems may be connected to new power networks. Microgrids are a type of distributed energy resource (DER) [12]. Developing peer-to-peer energy trading is an essential step in the growth of microgrids, which is one of the most critical phases.