{'fraction_non_alphanumeric': 0.026557270862571522, 'fraction_numerical': 0.008402605347439635, 'mean_word_length': 5.2427271706166465, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
State-Of-The-Art and Prospects for Peer-To-Peer Transaction-Based Energy System

: Transaction-based energy (TE) management and control has become an increasingly relevant topic, attracting considerable attention from industry and the research community alike. As a result, new techniques are emerging for its development and actualization. This paper presents a comprehensive review of TE involving peer-to-peer (P2P) energy trading and also covering the concept, enabling technologies, frameworks, active research efforts and the prospects of TE. The formulation of a common approach for TE management modelling is challenging given the diversity of circumstances of prosumers in terms of capacity, proﬁles and objectives. This has resulted in divergent opinions in the literature. The idea of this paper is therefore to explore these viewpoints and provide some perspectives on this burgeoning topic on P2P TE systems. This study identiﬁed that most of the techniques in the literature exclusively formulate energy trade problems as a game, an optimization problem or a variational inequality problem. It was also observed that none of the existing works has considered a uniﬁed messaging framework. This is a potential area for further investigation.


Introduction
The current transition of power infrastructure to sustainable and efficient systems is redefining the roles of stakeholders within the energy value chain. In particular, the proliferation of distributed energy resources (DERs) [1] at the grid edge has accelerated the development of a local grid where a small-scale local production of energy is at the community or household levels [2], which harnesses DERs to form an energy network [3] within the consumer domain.
This phenomenon, in effect, balances the power requirement, minimizes energy loss and reduces electricity costs. In a bid to improve the power reliability by reducing dependency on the main grid and to reduce environmental hazard, some countries are encouraging local generation and consumption [4,5] of energy. Such characteristics empower energy prosumers [6,7] to use, share, exchange [8,9] or trade their excess generated energy; thus turning prosumers into proactive prosumers by actively participating in the growing economy [10].
Proactive prosumers are energy producers and consumers that want to be in control of their energy generation and usage. They are always seeking ways to reduce dependence on the main grid and to optimize their energy usage and minimize their energy cost. They are actively engaged in producing more energy than they would utilize in order to trade/share the excess to other prosumers.

Energy Trading and Sharing Concept
Energy trading between large producers and utility companies is well known; however, energy trading and sharing between households or prosumers is a trending topic within the industry and research community. Bilateral energy transactions between prosumers will not only help to better harness the output of distributed generation (DG) systems [14], but also promote effective energy management at the edge of the network. This section analyses the energy trading and sharing concepts reported in the literature.
To trade, share or buy energy, various 'actors' are involved in the exchange process in addition to prosumers that supply and consume energy [15][16][17]. These actors include a trader or local-grid operator that buys energy to trade at a margin [18][19][20], a producer that generates energy for sale in large quantities and consumers that rely on those media to meet their energy demand. The actors are equipped with smart meters that will be used to record details of their energy profiles and facilitate bidirectional communication during energy trading and sharing. Based on the structure given in [10], the literature on energy trading and sharing is classified into one of three coverage areas as shown in Figure 1. These areas are briefly discussed as follows: • Desired outcome: First, the actors decide on what they want to achieve in the trading and sharing of energy. This could be cost optimization [13,21], to reduce dependence on the main-grid [21], to reduce environmental impact or to improve energy management.

•
Enabling technologies: Then, the actors select from available resources the pieces of technologies needed to accomplish their desired outcome. Enabling technologies for prosumer energy trading mainly include a source of energy generation, an energy storage system (ESS) [22] and an ICT [23] for communication among the various sub-systems and for actor-to-actor communication.

•
Required framework: Lastly, the TE framework needs to be carefully considered. This includes deciding the appropriate structure to use for the trade, as well as the supporting control mechanisms to adopt. In this regards, one of the key questions is whether the trading structure should be distributed/P2P [24][25][26][27][28] or centralized through a platform/energy market [29][30][31][32] operation. Likewise, the form of control to be adopted to route information among the actors, whether distributed or central control, needs to be harmonized. Finally, the operational mechanism and operation optimization (for instance, game theory method [33]) must be defined.

Motivation/Desired Outcome of Transaction-Based Energy
The realization of TE is advantageous in many ways. This includes economic benefits to asset owners, operational gain to the utilities and social benefits to the community at large. This section presents some more benefits of TE discussed in the literature.

Improved Network Agility
TE can reduce dependency on the main grid by creating a platform for the numerous distributed energy producers to transact energy, thus increasing grid reliability. Furthermore, TE reduces requirements for capacities to address energy generation/load uncertainties, and it creates a platform for all actors to transact energy, thereby balancing the intermittent supply and uncertainty in demands [34].

Improved System Efficiency
A sustained growth in adoption of energy sharing/trading in a transactive manner can effectively improve network efficiency [11], because energy is used up at or close to the point of production, which drastically reduces distance-related transmission losses. The rise in the use of DERs and ESSs enables diverse distributed generation of energy, which reduces dependency on the main grid; thus enabling the utility companies to provide other ancillary services, thereby improving the power grid efficiency. Moreover, with the integration of TE, consumers' demand will be met locally, and congestions on transmission lines will be reduced drastically, and in parallel, leading to a corresponding reduction in energy losses. TE has potential to optimize the use of DER [34] and reduce system operation cost [10]. For instance, utility companies dispatch more generators to meet the growing demand of consumers in peak periods; however, with TE, the demand ratio will reduce during peak periods, thus relieving the utilities of the additional cost and effort to meet peak demand.

Cost Optimization and Economics
According to [35], one of the promises of power grid modernization is the possibility to optimally deploy DERs for the benefit of asset owners. From the perspective of prosumers, cost optimization is widely reported as a major motivation for bilateral TE among peers [36][37][38][39][40][41][42]. Cost optimization can be achieved through reductions in generation costs, transport costs, energy demand or through profit maximization. In addition, minimized losses and energy cost in distributed micro-grid (MG) have been considered as a motivation for prosumers' participation in MG and TE [43]. The optimization mechanism is further discussed in Section 5.3.

Social Factor
Excess energy produced can be shared, traded or freely supplied to another consumer in need. By delivering energy as a resource that can be given away as a social capital by individuals to a target party, the values derived from such gestures can be used as a strategic tool to promote social cohesion and improve the sense of community.

Enabling Technologies for Transaction-Based Energy
These are the infrastructures that would enable energy production, storage and trading/sharing among prosumers. They broadly cover DERs, ESSs and ICT. This section discusses the ESS, DER, communication technologies and the current mode of communication adopted in the literature for energy trading/sharing networks.

Distributed Energy Resources
There has been a growing effort in the U.K. and the world at large to encourage the integration of DER into the existing power generation grid. With the right amount of control, this system has the potential to balance energy demand and supply and, thus, increase the reliability of the power grid. DERs mostly include photovoltaic arrays, wind turbines, fuel cells, etc. [44]. These sources are micro-power generators in the form of MGs that can provide energy for small communities or households. They are distributed with close proximity to where energy is produced and used and do not depend on the power grid because it can be operated in an isolated mode. This control ensures continuous energy availability with or without the main power grid. The closeness characteristics of DER to the community reduces energy wastage to the surroundings [45] due to the short range of energy transmission, thereby reducing the greenhouse effect. An example of MG with interconnection of DER, ESS and connected loads is illustrated in Figure 2.
To participate in energy trading and sharing, a prosumer should be able to either generate, consume or be willing to trade or share energy. Thus, DERs are an attractive technology for P2P energy trading and sharing. Components of a microgrid [46] showing both energy and information flows. MG: micro-grid; DER: distributed energy resources.

Energy Storage Systems
Apart from DER, ESSs are considered an essential element in balancing micro-generation of energy from renewable resources [22]. Energy storage systems are a great way to support renewable energy generation, by offering their capability to absorb unused or excess energy and release the energy when required. They offer flexibility during periods of high intermittent and fluctuating energy production. The energy system technology can therefore support the grid reliability and electricity supply, as well as help to de-carbonize the energy supply. Therefore, the importance of ESS has been researched in the literature. For instance, Ref. [22] argues that the users with storage systems are able to reduce their monetary expenses to a greater extent than consumers without storage systems. In addition, Ref. [47] highlighted the importance of ESS in shaving peak energy demands and filling valleys in system load. With ESS, a reduction in energy cost is guaranteed.

Information Communication Technologies
Communication is essential in MG to facilitate the information exchange needed for the MG coordination. The presence of a communication system also helps the system operator to pro-actively detect anomalies before they result in disruptions or outages by making system-level information accessible. The communication infrastructure embodies protocols, networks and technologies that enable the distribution of measurements and commands within the power system and subsystems [48] supporting TE. The MG ICT infrastructure needs to be reliable, scalable, secure, available and easy to manage. The authors in [48,49] discussed the role of communication in the smart grid, while a survey of communication infrastructure in MG is presented in [23].

Communication Technologies in the Microgrid
Feasible communication technologies in MGs include wireless and wireline technologies. The rest of this section provides a brief summary of the communication technologies that can be adopted for MG control and communication [23,[44][45][46]50,51]. In addition, Table 1  Fifth Generation (5G): This is a proposed future telecommunication technology with higher capacity than the present 4G. The 5G standard should support data rates of tens of megabits per seconds for tens of thousands of multiple users. The latency should be significantly reduced as compared to 4G networks.

Smart-Grid Subsystem Communication Network
Communication networks in smart MGs connect energy-generating sources, distribution networks and consumer systems to the management system (MG control centre). In MG communication networks, the following communication architectures are found [50,51].
• Home area networks (HANs): a low bandwidth network providing two-way communication between the customer's home appliance and power equipment such as smart meters. The data exchanged are voltage, current, power and frequency ratings. These data can be altered in demand response (DR) and demand side management.

Multi-Agent System For Inter-Prosumer Communication
The realization of the TE concept between prosumers depends on the availability of the essential communication infrastructures to guarantee reliable information dissemination [10]. This is because actors need to update their energy profiles including their availability and demand requirements and communicate them to other actors via two-way communication systems. In addition, communication technologies will enable each actor to monitor its energy profile, as well as the energy available in the market. Communication technologies that can be adopted for MG communication have been discussed in Section 4.3.1. Furthermore, this work examines some control and communication strategies adopted in the literature during energy exchange.
One major approach to integrating distributed communication among prosumers is through multi-agent system (MAS) technology, where each actor can be modelled as an autonomous agent capable of interacting through messaging. An example of MAS interaction is shown in Figure 3, where each prosumer represents an agent. Each agent communicates in its local grid and can also communicates with other agents outside its local neighbourhood. MAS has been used in the literature to model communication in MG control [3,8,54]. Agents' communication can be categorized as P2P or non-P2P [55]. Non-P2P is synonymous with centralized control, where there is no direct information flow between agents; instead, a central entity exists for information sharing. For example, the model in [54] used a central database as information storage. Each agent acquires information about other agents, as well as updates its own status using the database. Furthermore, Ref. [32] implemented energy markets in DR program-based open automated demand response (OpenADR) programs. Conversely, agents communicate directly in the P2P model, for instance using a distributed P2P multi-agent framework to manage power sharing in MG [56]. The proposed algorithm is based on graph theory, in particular the Ziegler-Nichols method, which was applied to electric vehicles (EV). The performance analysis of the framework shows that information exchange improves the system performance. The study in [58] modelled agents' communication using the round robin (RR) technique; however, the major setback of the RR technique is an increase in communication steps with increasing numbers of agents, i.e., it is not scalable. Alternatively, researchers in [59] implemented agent-based communication using a minimum spanning tree (MST) algorithm for MG control. In MST, communication steps between agents to disseminate information are a function of the minimum path formation. However, the drawback here is that communication between the agents can only start after the formation of the tree; in addition, with every additional agent, the MST has to be reconstructed. In view of this, Ref. [55] proposed a new communication algorithm based on a foundation of intelligent physical agents (FIPA) for MAS P2P communication. The proposed algorithm has fewer communication steps, faster response and reduced complexity compared to other existing P2P architectures such as RR and MST. One disadvantage of their proposed architecture is that the agents must always be even in number when, in some cases, an odd number of communicating agents can exist.
Another important aspect of prosumer communication is control. MAS have been studied in the literature for MG managements [8,56]. MAS can treat the MG as a cluster of energy markets; for instance, Ref. [3] modelled each agent to perform various functions such as scheduling, market clearing and coordination. The agents are assigned different objectives with the aim to maximize energy generation or reduce the load/demand. The study illustrated in [60] presented an approach to control multiple DG based on MAS to reduce network cost and emissions.
Apart from MAS for prosumer communication, it can also be used alongside auction models (based on game theory) in dealing with MG problems emanating from internal trading. In addition, Ref. [8] studied non-cooperative strategies between multi-agent systems for energy-trading in a competitive market between MGs. They used an auction algorithm to formulate a matching game where buyers are matched with sellers. However, in this approach, there must be an equal number of buyers and sellers in the energy market. The authors of [39] developed a particle swarm optimization-based negotiating agent for energy trading. For a full review on MAS for MG control and optimization, interested readers can refer to [61]. In general, lack of well-controlled communication between MG sub-systems can affect the generated energy. In addition, a well-defined communication mechanism is desired among different MG/actors trading energy for the participant to update their energy demand and supply profile and to monitor their energy generation and storage capacity.

Frameworks for TE
The framework for energy trading and sharing to achieve the desired outcome can be described in terms of structure, operation mechanism and operation optimization. The structure of energy trading and sharing reported in the literature can be categorized into two major groups: distributed control and centralized control. Distributed energy sharing and trading involves prosumers that trade energy directly with each other in a P2P manner, while the centralized structure requires the prosumers to exchange energy through a central entity.

Classification Based on Energy Trading Structure
The classifications that inform the energy framework desired in the deployment of TE models are surveyed. It involves the energy trading structure, which could be distributed energy generation, scheduling, time-slotting and common control.

Classification Based on Distributed Structure
Until recently, energy trading has been a wholesale business, mostly among big corporations. However, recent advancements in the use of DER have inspired the trials of small and medium-scale P2P trading systems in different parts of the globe such as The Netherlands [62], sonnenCommunity [63] in Germany, Piclo [64] in the U.K. and Energy Internet [65] in China. Additionally, some energy traders are inspired by blockchains as in EnerChain [66] in Europe and Brooklyn P2P energy trade [67]. The authors in [68] proposed a distributed energy trading structure in a competitive market, while [69] reported a framework for energy sharing and coordination in a time-slotted P2P fashion. The authors developed a model of bilateral energy sharing and coordination by assuming that prosumers that are directly linked with each other are neighbouring partners. If the directly connected neighbour cannot satisfy an energy demand, the demand and/or supply will be requested from the utility company. The work in [26] presented a P2P energy trading system among EVs. In this case, the energy trading system is based on an activity model to predict the daily activity of drivers in Belgium in particular. This reduces the impact of the charging process on the power system during business hours.
Various distributed trading mechanisms for energy networks were also proposed in [8,[70][71][72]; in particular, Ref. [8,[72][73][74] considered energy market design and studied the behaviour of the actors and their impacts on the market operation. Interestingly, Ref. [24] provides an analytical solution for distributed energy trading without a central coordinator to allow several MGs to interact during energy exchange in order to minimize the network operation cost. Furthermore, Ref. [36] addressed P2P energy trading among smart grid households with the aim of optimizing cost by considering components with a significant impact on cost such as storage and renewable resources. The smart homes in their model are connected through a bi-directional distribution network. Energy generation and consumption data are processed through a cloud-based control system. In addition, Ref. [7] reported distributed P2P energy trading as a way to reduce the total cost emanating from energy generation and transportation. In [25], energy trading in grid-connected MG was studied, and a customer-to-customer business model was introduced based on the generalized architectural model for P2P energy trading. Their test results however showed that P2P energy trading can balance local energy demand with generation and reduce the chances of overloading the distribution lines [75].
Of course, interconnecting MG with the marketplace comes with additional monitoring and control complexities. In this regard, a recent survey on control techniques for MG in [76,77] reported that as MGs become sophisticated, each of them will deliver new energy services that could be of mutual interest among MGs or clusters of MGs. In [30], a description of a marketplace for P2P electricity sharing is presented. This resource-sharing network enables electricity access in off-grid areas. With the use of power management units, the overall system is less expensive and more scalable than conventional MG, thus providing more affordable and scalable electricity access.
It follows that distributed energy exchange including P2P energy trading and sharing provides some optimization benefits in terms of cost reduction from transportation and direct transaction between neighbours. In addition, it can balance local energy demand and generation. However, given the peculiarity of electricity, this approach lacks control. For instance, there is no assurance that a buyer will get the right amount of energy purchased, just as there is no known medium for energy transaction management. This and some other challenges posed by a P2P structure to TE foster further discussion of centralized structure as discussed in the next subsection.

Classification Based on Centralized Control
With centralized control, prosumers may not be in full control of sharing, trading and usage of the energy they generate. Some authors believe that some form of coordination with control is required to minimize energy loss. Therefore, an energy sharing provider (ESP) [78] will be needed to manage prosumer transactions and ensure energy transfer. Hence, centralized control systems for energy exchange are discussed.
The authors in [78] proposed an energy sharing model using price-based DR. In such systems, there exists an ESP platform in the zone that coordinates the energy sharing. Here, the prosumers do not interact directly with the utility provider and with each other, but interact through the ESP. Although the ESP provides some form of coordination and transaction management, a major drawback of this approach is the increase in electricity cost for each participating prosumer and utility company. This is because the ESP purchases electricity from the prosumers and/or utility provider with net power export, then sells to the prosumers and/or the utility provider with some margin. In addition, communication delay is also a disadvantage because of the dependence on the ESP. Furthermore, Ref. [29] described NOBEL (Neighbourhood Oriented Brokerage Electricity and monitoring system) 2013, an energy market to evaluate market-driven DR of electricity trading. The NOBEL market is based on a stock exchange model, except that each day is subdivided into trading periods with discrete time-slots.
In [21], two actors were considered; traditional electricity users that depend solely on the utilities and those with some DER and/or energy storage capacities. Their operation is regulated through an independent central unit. The aim of the electricity users is to reduce their monetary expense. The authors of [14] developed a pricing mechanism based on game theory for smart MG (SMG). They studied the benefits of an open market where multiple suppliers and prosumers coexist and considered groups of distributed consumers with an aggregate demand that can be met by a group of suppliers through a broker. For such systems, Ref. [13] proposed cloud-based control to manage energy generation and demand profiles of the prosumers.
An example of the centralized system is the federated power plant (FPP), also known as the virtual power plant (VPP). Throughout this paper, both terms are used interchangeably.

Federated Power Plant
FPP offers a unique way to connect a wide range of distributed energy sources and controllable loads to form an integrated self-healing network of energy resources. Away from traditional electricity infrastructure, FPP represents a paradigm shift in which independent and distributed energy generation and storage assets are integrated to form a network of energy resources logically managed as a "single" plant. The rich diversity of such energy sources and their cooperative mode of operation enable FPP to reliably deliver energy whenever needed; this is in tandem with the sustainability agenda of the smart grid vision. From a utility perspective, these distributed generation components imply that FPP inherently holds some DR capabilities that not only reduce dependence on the main grid during energy shortfalls due to peak demand or maintenance activities, but can also improve network resilience. FPP is particularly suitable for small communities, educational campuses and small-to-mid-sized industrial facilities. The FPP may be equipped with a controller to enforce reactive demand regulation by disconnecting household loads or choosing from available generation sources to meet the current load of the community according to the aggregate load profiles of the houses [79]. In such cases, the controller determines from which generator company to purchase power based on the current shortfall and the price. It is necessary at this point to clarify some common misconceptions about MG and FPP. Whereas the former can be deployed per household to serve local loads within its geographical boundaries, following grid events, the latter pushes those boundaries by interconnecting various assets (including MGs) to form a single network of energy resources. In other words, an MG is made up of at least one energy source and load, while FPP aggregates geographically-dispersed DERs of various types and sizes into a single portfolio that can be administered as a single power plant. FPP operators are therefore known as aggregators, and FPP and MG can co-exist in a TE system.

Classification Based on the Operation Mechanism
The operation mechanism is highly related to the energy trading structure mentioned in the previous section. Most P2P energy trading and sharing (ETSs) markets deal with energy as the product. Therefore, real-time issues such as balancing are not covered in the P2P ETS operation mechanism so long as the ETS is not implemented for a microgrid. Even if the system is made for a microgrid, energy transaction and real-time operation should be handled separately by the grid operator. In effect, the main operation interest for P2P ETS for both the microgrid and non-microgrid is energy trading, although the trading period and lead time could be differently defined depending on the situation. The operation mechanism in the pilot study presented in [62] is a long-term-based operation: buyers select a provider from a list of possible providers, and the settlement is performed monthly. On the other hand, hourly-based (or shorter period) matching and transaction with short lead times are preferred in other cases (e.g., see [64]). So long as the buyer can respond to the changing price and there is a communication infrastructure support, the transaction period and lead time could be easily reduced.
Energy transactions could be initiated by either buyers, suppliers or ESP and could occur by using various matching methods. Therefore, the operation mechanisms for P2P ETS are classified into four groups as follows: • Buyer selection from amongst supplier products, • ESP-centered trading, • Buyer prioritization and ESP-matching and • Double auction-based energy trading.
Buyers select the preferred specific provider from a list of energy products posted by suppliers in the case of the buyers' selection approach. The suppliers provide the types of generation and the selling price to the selling list, and the buyers pick from available and preferable providers [62]. In ESP-centered trading, suppliers and buyers make contracts with ESP. ESP forms a big energy pool to trade with utilities or the power market. In the model, participating prosumers do not know how the resources are operated since they are directly controlled by ESP [63]. Therefore, in a strict sense, it is not a P2P ETS, but one of the realistic solutions for prosumers. In the buyers' prioritization and ESP-matching mechanism, a buyer provides the preference of the energy type and/or providers instead of selecting specific providers; then, ESP matches providers and products to buyers considering buyers' preferences and real generation amount. In this way, buyers can increase use choice even though they may not know the exact matching mechanism [64]. Double auction-based P2P energy trading models without the intervention of ESP are proposed in research or pilot projects [29,68,69]. It, however, would take a longer time for these models to come to market because of their operation complexity. Furthermore, the basic mechanism of ideal P2P energy trading models would be similar to a conventional power market mechanism except for the existence of a larger external market that is usually an existing power market. The last stage of the transaction is one of the most important roles of ESP: transaction settlement. Once production and consumption occur after the transaction matches, then the settlement should be performed by ESP considering the participants' performance. Mostly the settlement is made up of money in the real-world system [62][63][64], but credits or virtual money could also be used for trial projects [29].

Classification Based on Optimization Techniques
In energy trading, the main goal is to optimize cost either through reduction in generation cost, transport cost, energy demand or profit maximization. Targets of optimization could also be the reliability and availability of energy, the minimization of losses, economic aspects, risk and stability criteria or various economic or ecological interests. Therefore, this section provides several optimization techniques adopted in the literature for prosumer energy trading and sharing.
Optimization problems consist of selecting the best possible solution subject to some constraints from sets of available alternatives. It basically involves maximizing or minimizing some objective function by selecting some input value from a set of allowed function values [80]. The choice of optimization technique to apply at a particular time depends on the objective function.
To minimize energy cost, some researchers used convex optimization [37,38], stochastic optimization [81,82] and/or particle swarm optimization [39]. In addition, linear programming (LP) was used to optimize energy cost in [40], although [41] proposed a multi-objective optimization model for annual cost and [42] used mixed integer linear programming (MILP). In [43], optimization was achieved by minimizing energy sharing losses and energy costs in distributed MGs. Furthermore, to reduce the total cost emanating from energy generation and transportation, Ref. [7] proposed distributed P2P energy trading where each peer must solve a local optimization problem.
One of the implementation methods for optimization is game theory, amongst many algorithms. Therefore, a brief introduction and classification of game theory techniques whilst analysing different pieces of work that propose game theory to drive energy trading and sharing is provided.

Game Theory
Energy trading algorithms are becoming increasingly important in the development of the smart grid due to the need to meet energy demand considering the intermittent supply of DER. Recently, game theory has emerged as an analytical tool for smart MG energy trading. This is because it provides an analytical and conceptual framework with a set of mathematical tools to analyse optimization problems with several objective functions [83]. The study in [84] provides a comprehensive overview, discussion and future applications of game theory in smart grid (SG) and SMGs. While [21,27,47,85] also proposed a game theory approach to energy trading and sharing, in particular, Ref. [22,86,87] used a game theory approach for cost optimization in DERs. Figure 4 shows the game theory approach and some optimization solution techniques used in the literature for energy trading and sharing. There are two basic types of game theory: cooperative and non-cooperative games [84]. Players in non-cooperative game theory make decisions independently by using several frameworks to optimize and devise pricing strategies that adapt to the nature of their requirements, while players in cooperative game collaborate to achieve a common goal. Some form of incentive is provided to aid participation in the game. Based on an energy pricing model, the grid optimization problem was formulated in [21] in terms of cooperative and non-cooperative games. This also involved iterative and distributed algorithms to optimize the energy production and storage capabilities of users to reduce their monetary expenses.
From the literature studied, classical game theory can be represented as either a non-cooperative (strategy) or cooperative (coalition) game to find a solution of equilibrium or incentive (Nash equilibrium, Shapley value). Then, the solution can be analysed for efficiency or uniqueness. Finally, a solution algorithm (best response dynamic) can be proposed to solve the initial problem ( Figure 4).
Another important aspect of game theory is auction theory. Auction theory is an analytical framework to study the interaction between a number of sellers and buyers to optimize their objectives. Outcomes of the auction theory model are the prices at which a trade takes place and goods are exchanged with each buyer. A generic auction mechanism is presented by [89] for energy trading in local markets. The works in [29,31,85] presented a double auction mechanism for energy trading amongst distributed energy storage units. More specifically, [31] formulated a double auction mechanism for energy trading among EV and the main grid.

Classification Based on Cooperative Game Theory
In a cooperative game, players with similar objective functions are able to communicate amongst themselves to form a coalition. The benefit of such cooperation is shared among themselves. A known problem of DG is its intermittent supply of energy [28,68]. However, it was shown in [28] that with cooperation among renewable energy sources (RESs) and ESSs owners, the problem could be alleviated. This will further reduce the need for large energy storage systems and provide cost savings for the prosumers participating in the cooperation. In that regard, energy trading through cooperation among microgrids [24,[90][91][92][93][94][95] can be motivated through Nash bargaining theory [27]. Furthermore, Ref. [47] proposed a cooperative game theory to reduce customer loads, while [28] investigated a model based on coalition game theory to optimize energy demand and supply of prosumers within a community. In their work, they considered households in different modes; some owned RESs and ESSs; some owned ESSs only; whilst other households were pure consumers.
From a similar perspective, Ref. [7] proposed a cooperative strategy for MG with the aim to minimize the total cost (generation and transport) whilst each MG satisfied its energy demand. In [84], a coalition algorithm for cooperative strategies for exchanging energy between MGs is studied. The proposed algorithm also allows the MGs to adapt to changes in environmental conditions in order to not affect their energy generation. In addition, by incorporating the algorithms or by using cooperative strategies, MGs can alleviate the dependence of load on the main grid and minimize the costs of power losses associated with distribution lines. Furthermore, Ref. [96] analysed the cooperation between small-scale electricity suppliers and energy users in direct trading based on coalitional game theory. Proceeds are divided following an asymptotic Shapley value to serve as an incentive to remain in the coalition.
In [69], the energy sharing problem follows a convex optimization problem. The objective is to minimize the prosumer cost function with options to purchase/trade energy with direct neighbours and/or utility companies. In addition, they proposed a distributed algorithm based on the alternating direction method of multipliers (ADMM) for the energy sharing and coordination. The authors in [24] designed an algorithm based on dual decomposition that solves the energy trading problem in a distributed manner following a distributed convex optimization framework for energy trading among MGs in an arbitrary topology. These MGs interact to exchange energy to minimize the network operational cost. In terms of privacy, each MG only shares its local energy bid with potential sellers, thereby keeping the local cost function and consumption private.

Classification Based on Non-Cooperative Game Theory
In a non-cooperative game, players make decisions independently where each player focuses on predicting the actions and strategies of other players. In energy trading, players use a non-cooperative game to calculate the amount of energy to be sold using the Nash equilibrium. In studying non-cooperative game for storage units among prosumers, Ref. [85] formulated a non-cooperative problem for MGs to trade their stored energy with MGs in other geographical locations. A non-cooperative game is also proposed by [21] using a Nash equilibrium game where each player competes with other players using different strategies. In addition, Ref. [97,98] used a non-cooperative game to solve the optimal amount of energy exchange among EVs. Furthermore, Ref. [25] proposed a bidding system: Elecbay based on game theory using Nash Equilibrium for energy trading.
The studies in [68,83] considered the interaction between all parties involved including utility companies, MGs and customers to propose a distributed algorithm as a two-stage Stackelberg game. The first stage involves the utility companies and MGs as game leaders setting electricity price as a function of the generation cost, power loss and electricity sales income. In the second stage, the consumers are modelled as the game follower adjusting their demand based on the set price. Interestingly, Ref. [99] used this game as an incentive for customers to trade their energy surplus during peak hours, while [100] modelled a leader-follower strategy that considers the competitive situations between ESP and a large central production unit. The leader-follower approach was also applied in [101] for energy exchange in vehicle to grid applications, and the game converged to a socially optimal point. Table 2 presents literature classification based on the framework used and the desired outcome.

Classification Based on Variational Inequality Theory
While optimization models are useful in the study of TE, game theory may be viewed as an integration of a set of optimization problems. Sometimes, both optimization models and game theory models may fail. Thus, a more robust and general technique for nonlinear analysis when classical game theory may fail is the variational inequality (VI) theory. VI-theory finds applications in typical convex optimization problems and delves strongly into game theory [102].

Grid Constraints and Network Visibility
There are several identifiable constraints that facilitate the electrical grid network, its design and also its management. In this section, these constraints that modulate the grid network and its visibility are described.

Grid Constraints
There is an increasing variety of motivations driving the power industry. In the U.K. for example, this drive for competition was accelerated in 1988 when the British government announced plans to privatize the electricity supply in England and Wales [103]. Thereafter, the Nordic electricity market (comprised of Sweden, Finland and Denmark) and U.S followed. This suggests that regulators in different jurisdictions forecasted that new values could be created by liberalizing electricity generation and supply. In these and other markets, the optimal price (the marginal cost of generation, when there is no risk of rationing) largely depends on the bidding behaviour in the wholesale market [103].
In bilateral trades, apart from the freedom of the prosumers to set price, it also allows them to make decisions to fulfil non-economic goals such as the use of energy as social capital in which the transactions are characterized by trust, goodwill and cooperation instead of pure economic motives. As the sector continues to reform, different market designs are evolving to accommodate TE services, especially among players at the grid edge elements. A key design consideration is the ability of the transactive agents or actors to respond to economic incentive or feedback signals in such a way that aligns with the operational situation of the local distribution network and the grid generally [104]. In particular, as distribution system constraints are reached or exceeded, prices associated with culprit transactions increase (exponentially in some cases) [104]. Alternatively, the system or market operator may issue reference prices based on the hard limits of the distribution constraints. Similar methods have previously been deployed in some wholesale markets whereby the operators deployed locational marginal prices (LMPs) instead of dispatch instructions. In such cases, the asset owners were allowed to determine their generation output or usage in response to the LMPs [104]. This approach usurps the power of the local market operators, which may not be adequate to address the local system constraints. The mechanisms for accommodating distribution-level transactions in the face of system realities may be based on operational and technical constraints of the distribution grid, priorities established by the distribution system operator (DSO) based on operating guidelines, implicit economic values expressed in bids and offers from transactive parties or a combination of these. These same mechanisms could be used to offer new options for customers to lower energy costs, increase the use of renewable energy and better monitor and control electricity usage [105]. These are possible within the TE framework.
In addition, the platform operator in conjunction with the DSO also needs to deal with prioritization as a way of managing congestion. For example, following the proliferation of plug-in-electric vehicles (PEVs) abbreviation , a distribution circuit may be unable to serve all PEVs in the neighbourhood at the same time. To resolve this, the TE platform operator may request the PEV owners to submit bids and offers among themselves to utilize the limited capacity provided by PEVs with a higher state-of-charge (SoC). Another approach is for the DSO to apply capacity reservation based on different conditions at a fee [104].

Network Visibility
The DSO needs clear visibility of assets and their operation within the grid to help address issues such as congestion. The prosumers, on the other hand, require guarantees that transport capacity is always available as they trade with one another or offer energy in support of grid reliability. In such cases, the DSO needs to know the electrical and geographical location of all DER and DR assets in its domain [104]. With such visibility, the DSO may rely on the grid-edge capabilities to address local flow constraints and voltage violations [104]. To achieve this, one of the hurdles to cross is the development of new tools. Traditional analytic tools such as state estimation and power flow require detailed electrical modelling of the grid using the network topology information. Since most of the DER and DR devices are on the customer side of the meter, sometimes connected through secondary transformers, the traditional method must give way to data-driven modelling techniques. Apart from the electrical characteristics of the network, other crucial information such as DR program, contractual constraints and prosumer preference may not be readily available. Therefore, a structured platform is required to harness these pieces of data from various sources and provide consolidated information to the DSO from which the system state can be evaluated. This implies that all TE actors and assets must be capable of exchanging information with the TE platform.

Prospects of TE and Recommendation
From the preceding discussion, the prospects of TE management, especially in smart MGs, are obvious. The recommendations made are based on the potentials, merits and demerits of the subtending techniques, algorithms and technologies contributing to a dynamic and sustainable TE management system and are given in this section.
As seen in the previous sections, coordination and transaction management are required by actors trading and sharing energy. Prosumers therefore require a platform where they can actively engage to share or trade energy with one another. The proactive communication platform should be able to support real-time information exchange, should manage transactions among prosumers, should be scalable to accommodate an increasing number of prosumers and should manage the prosumers' energy profiles. In the following paragraphs, some recommendations on proactive prosumer energy trading platforms integrating both distributed and centralized control are provided. Figure 5 shows actors' interaction with the trading platform [105]. On the proactive prosumer trading platform, prosumers can list their energy profile including, energy generation capacity, location, quantity of energy to trade and the energy offer price. The location of energy generation is paramount as this would help in facilitating neighbourhood energy trading and minimise the environmental impact caused by energy loss due to long transmission distance. Energy offer price can be determined by each actor by solving a local optimization problem [7] to determine the equilibrium price to trade/buy energy as a function of the total cost of production/transportation including energy losses. For instance, each actor pursuing selfish or altruistic goals can model the optimum energy price as a non-cooperative game with each actor defining its objective function and different pricing strategies to optimize profit.
Subsequently, each actor would register its details including some basic information on the platform after determining the energy offer price. The information is stored on the platform database, and non-sensitive information is published on the platform (including trading profile, trading position relative to others and energy location). After registering on the platform, a prosumer wanting to buy energy will enquire from the database energy listings and positions and can decide from whom to buy using different metrics. The metrics are not limited to distance, cost and reliability. A potential seller can be matched to a potential buyer by the platform using matching or an auction game. When a suitable provider is found, the buyer queries the platform for the provider details to establish direct communication with the seller. This implies that each actor is able to query the platform to locate/discover a suitable provider, but communication is directly between actors in a P2P fashion. To establish communication between the seller and the buyer, a cooperative game, e.g., a coalition game can be modelled, which will be subject to some defined objective function.
Once a potential buyer has been matched to a potential supplier, the platform will handle the transaction management process. For instance, after a buyer communicates with a possible provider and both parties agree to the terms and conditions of trade, they trade energy directly. The platform will manage the transaction by applying an optimization model [69] to manage a dispute if one arises among the prosumers. The TE platform will also ensure that the energy gets to the buyer whilst the credit get to the seller. The optimization technique applied on the platform would determine the optimal power transmission path to reduce transmission loss [106]. Refer to Figure 6.
The proposed transaction-based algorithm is summarized as follows: • Non-cooperative game models would be modelled for each actor to determine its energy offer and bid price. Each actor would optimize its individual objective functions using different game theory tactics and different pricing strategies to optimize profit. The objective of each player is to determine the optimal quantity and price at which it wants to trade energy to maximize profit. • The platform would implement auction theory (double auction) and matching game from game theory to match a potential buyer to a seller. • Communication amongst buyers and sellers would be implemented by using distributed algorithm based on graph theory subject to some defined objective functions and some constraints, e.g., transmission link capacity and actor data processing capacity. • The platform would determine the optimal path for the energy transmission using a distributed algorithm and would also determine how the seller will be reimbursed.

Challenges Facing Energy Trading and Sharing and Future Directions
From the review conducted, this paper argues that it is paramount to have enabling technologies and required frameworks before energy trading and sharing among proactive prosumers can be realized. In this section, some gaps in the literature deterring the achievement of optimal energy exchange among prosumers are identified. These gaps are briefly discussed below. In addition, Table 3 presents some drawbacks to some methods used in the literature for TE. Uses static parameters not dynamic, i.e., with every change in the parameters, the optimization model would be re-run to reflect the changes. This is not computationally efficient.
1. As reported in [10], existing literature works assume perfect communication between prosumers exchanging energy [10]. The research community needs to further investigate scalable architectures for the trading network. The enabling communication system must not only be ubiquitous, but also deliver low latency and support coexistence with different generations of power and ICT systems. Actualization of 5G wireless systems may provide a giant leap in this direction. In addition, network formation games can be applied to enable information coordination between prosumers [84]. Furthermore, to achieve prosumer communication within the communication infrastructure, a unified messaging framework is required. The OpenADR (open automated demand response) is a potential model to fill this gap. The OpenADR provides a standardized interface that allows electricity providers and DSOs to communicate demand response events to their customers over IP-based communication networks [32,108]. Moreover, additional optimization techniques such as advanced linear programming, nonlinear convex optimization, Lagrange duality, the KKT (Karush-Kuhn-Tucker) optimality condition, the gradient algorithm, the interior point algorithm, geometric programming, semidefinite programming, robust optimization and dynamic programming need to be investigated. 2. Most research tends not to consider pricing mechanisms during energy trading. Advanced techniques can be employed for generating the electricity prices as the impact of the generated price on the energy profiles of the prosumers is also of interest. 3. In matching buyers to sellers, strategies based on auction theory are commonly used. However, their efficiency can be improved by incorporating a prediction algorithm to forecast energy demand and price in the MG [109]. Furthermore, future game theory applications in prosumer energy trading could involve several types of games such as facility-location games, Stackelberg games, advanced hash games, and others. 4. Another prominent research gap in the literature is security and privacy of prosumers' data.
More research is required to investigate optimal ways of ensuring privacy and security in protecting prosumers' data during and after energy exchange. 5. More research on robust and lightweight distributed algorithms that can efficiently represent different energy trading scenarios (competitive or collaborative) is desired. 6. Scalability is a prominent issue in distributed energy trading; however, a big question is whether the platform scales well enough to accommodate increases in the number of connected smart devices and prosumers [110].

Conclusions
The ambition to harness DER and trade energy between prosumers is uncovering new possibilities. In actualizing TE between prosumers, one of the key considerations is how to manage the interactions among the TE platform, DSO, prosumers and other system operators. Existing trading methods are mostly driven by different applications of game theory. Generally, it is established that coordination between the actors is necessary; however, the modality differs between researchers. In this article, the existing literature on TE frameworks was reviewed and classified based on structures, controls, trading methods, optimization techniques and communication models. Important issues such as grid constraints and visibility are also covered. On the prospects of TE, it was identified that employing a common language between system components is vital to the realization of TE. To this end, investigation of OpenADR is recommended as a viable interface for exchanging data between prosumers, the utilities and platform operators. Most existing works focus on actualization of the energy exchange itself without much consideration of security. Prosumer privacy, data protection and controlled access to the trading platform need to be considered in future work. Lastly, robust and lightweight distributed algorithms that can efficiently implement and deliver different energy trading scenarios (competitive or collaborative) need to be actively investigated.