**2. Related Work and Motivation**

The energy-sharing method is not new, yet the popularity of using EVs has unlocked a vast area of research. In this section, we will present some previously published energysharing-related methods.

In [18], Zhang et al. depicted a typical incentive-based approach in the smart grid environment and explored vehicle-to-vehicle (V2V) scenarios. This is a cloud-based energy trading process with a contract theory approach. Tushar et al. introduced an incentive gamebased mechanism for distributed renewable energy management in a smart community [19] to improve the operator's profit and minimize total energy trading cost. Bera et al. [20] introduced a novel cooperative energy consumption system within communities in the smart grid to mitigate energy consumption costs for users and reduce the peak-to-average ratio. In [21], a global control scheme is proposed for electric energy micro-storage systems in smart communities to improve the local power quality of demanded and current power consumption globally.

Sharing energy between two peers requires ensuring the security services, including authenticity, privacy, integrity, attack prevention capability, etc. To provide these, in [22], a token-based decentralized energy trading system was shown that enables peers to perform transactions anonymously and securely. The system was developed by using multi-signature and anonymous encryption methods. Li, Z. et al. [23] provided a secure distributed energy trading market and designed a novel energy blockchain system in the industrial Internet of things (IIoT) environment. They implemented the system by using a consortium blockchain. Li, L. et al. [24] presented a novel announcement network named credit-coin that uses blockchain technology to protect vehicles' privacy and motivate users to broadcast traffic information. In [25], a pragmatic blockchain utilization case is introduced for machine-to-machine (M2M) transactions of energy within the housing society environment. Based on the lightning network and smart contract in the energy blockchain ecosystem, Huang et al. presented a decentralized security model for the enhancement of the security of trading between EVs and charging piles in the peer-to-peer (P2P) network [26].

A secure way to pay and proper pricing need to be ensured for a P2P EV charging system. To do that, Zou et al. designed a progressive second-price auction game mechanism for resolving large-scale EV charging cooperation problems. They have ensured incentive compatibility over a finite horizon in their work [27]. Mohammadi et al. depicts a distributed cooperative charging scheme for plug-in electric vehicles (PEVs) to minimize

the charging cost for PEV fleets with the integration of a receding horizon method [28]. Liu et al. [29] proposed a novel renewable energy pricing scheme for smart communities to reduce the total electricity bill of the residential users utilizing an advanced cross-entropy optimization method in smart home energy scheduling. A contract game-based directenergy trading system is proposed by Zhang et al. [30] for modeling the decision-making process of electricity operators and consumers in vehicular edge computing networks. Yang et al. [31] presented a coordinate EV charging mechanism in a microgrid-powered setting via wind-powered generators through a Markov decision process (MDP) approach. Utilizing stochastic dynamic programming methods, Wu et al. [32] proposed smart-home energy management integrated with PEVs (plug-in electric vehicles) to address the problem of intermittent renewable energy supplies to minimize the electricity cost.

With the popularity of blockchains, some other projects have been found where a blockchain is primarily utilized for EV charging. For example, in [33], a blockchain was proposed to ensure a secure and trusted electricity trading solution. The authors of [34] utilized blockchain to create a trusted distributed environment for charge sharing. In [26], a blockchain was used for charging management, and in [7], it was used to store the trading records between EVs and charging stations.

A two-stage autonomous EV charging coordination method implemented on blockchain was shown by Ping et al. [35] to enable dependable EV charging coordination in the absence of a third-party coordinator. This mechanism also preserves the privacy of the users. Wang et al. developed an optimization model on a blockchain framework to manage the operation of crowdsourced energy systems (CESs) with peer-to-peer (P2P) energy trading transactions (ETTs) [36]. One of the new paradigms created by the decarbonization, decentralization, and digitalization of the energy supply chain (that enables direct exchange between energy users and producers) is depicted in [37]. Chen et al. proposed an energy trading framework that marries a blockchain and distributed optimization; the blockchain enables checks and balances among the participants and disables dishonesty [38].

Consider the above-mentioned papers. Our take is that they provide partial solutions in terms of P2P charge-sharing systems. A model is required where there will be secure communication and management, easy and time-saving payment facilities, and reliable quality of service. Hence, a complete solution is proposed where all the required features are available for the users. Additionally, in almost all of these previous work, there was no implementation to show the compatibility and validity of their approaches. Hence, there is indeed a gap in the existing literature. We brought forth a real-world implementation by using Ethereum blockchain to show our system's compatibility, to understand the behavior of the components and responses, and to collect important data from the system. The motivations for this work are presented in the next section.
