{'fraction_non_alphanumeric': 0.022439949431099875, 'fraction_numerical': 0.003257804142759895, 'mean_word_length': 5.275057208237986, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Blockchain-Based Peer-to-Peer Energy Trading and Charging Payment System for Electric Vehicles

The world is moving rapidly from carbon-producing vehicles to green transportation systems. Electric vehicles (EV) are a big step towards a friendly mode of transport. With the constant rise in the number of electric vehicles, we need a widespread and seamless charging infrastructure that supports seamless charging and billing. Some users generate electricity using solar panels and charge their electric vehicles. In contrast, some use charging stations, and they pay for vehicle charging. This raises the question of trust and transparency. There are many countries where laws are not strictly enforced to prevent fraud in payment systems. One of the preeminent problems presently existing with any of the trading systems is the lack of transparency. The service provider can overcharge the customer. Blockchain is a modern-day solution that mitigates trust and privacy issues. We have proposed a peer-to-peer energy trading and charging payment system for electric vehicles based on blockchain technology. Users who have excess electricity which they can sell to the charging stations through smart contracts. Electric vehicle users can pay the charging bills through electronic wallets. We have developed the electric vehicle’s automatic-payment system using the open-source platform Hyperledger fabric. The proposed system will reduce human interaction and increase trust, transparency, and privacy among EV participants. We have analyzed the resource utilization and also performed average transaction latency and throughput evaluation. This system can be helpful for the policymakers of smart cities.


Introduction
A large proportion of greenhouse gases consist of the transportation sector. This sector is also one of the leading sources of climate change and negatively affects the air quality index. One possible explication of this dilemma is reducing fossil fuel vehicles' consumption by switching to electric vehicles (EVs) [1]. Peer-to-peer energy trading is generally limited between peers connected to a low level of energy distribution. Such peer-to-peer trading systems have several technical and regular barriers. Technical barriers arise due to the design and the infrastructure work of the physical distribution network. The power grid has a hierarchical structure, which starts with the design to allow electricity to flow in one direction from the power grid to the primary distribution, and finally flow towards the secondary or low-voltage distribution network. Integration of renewable energy sources with the power grids helps in improving their stability [2]. In the low-voltage distribution network, users are connected to the other stages in the system. There are also many regulatory hurdles. It may interfere with Peer-to-Peer (P2P) transactions [3]. In utility-owned power networks, all users must adhere to the regional grid codes and power market regulations. These regulations are generally designed to promote the traditional central power-plant. Some operators and public stations offer free charging facilities for electric vehicles. Such entities are not interested in implementing a payment solution at all. Many have provided custom solutions for proprietary systems that rely on closed digital memberships and operator-specific cards for operators and automakers receiving payments [4]. These methods are somewhat restrictive and do not provide broader market requirements. Payment methods must meet essential requirements, such as security, convenience, and universality in order to ensure an enjoyable experience for all EV owners [5]. Some countries have strong laws to prevent fraud in payment systems, but the number of fraudulent cases is very high in some countries. Moreover, some countries do not accept the laws of other countries. In this regard, modern information technology can help power companies adapt to these innovative changes and meet consumers' needs.
The introduction of blockchain for cryptocurrency has given the world a new direction. It provides a secure ledger that tracks transactions in a secure way [6]. Blockchain is widely known as an application that supports Bitcoin, Ethereum, and other common cryptocurrencies. The blockchain extends beyond the use of cryptocurrency. Blockchain is just one kind of decentralized ledger, and not all decentralized ledgers inevitably use block or chain transactions. A blockchain-based P2P energy transaction and payment solution for electric vehicles are proposed in this article. These results can give considerable time, effort, and resources to go into these tasks today and are much simpler and safer than they are now. The hash value is the most crucial factor in a transaction. All transactions are hash-encrypted. The blockchain uses a hash-mapping formula like SHA 256, which is used to verify the transaction's authenticity [7]. The miner responsible for the proof of block/transaction in the blockchain completes the block process' insertion. The addition of the block process depends on the area's Merkle structure, time-stamps, and so forth. The amount of hash required to create a valid hash value is called a nonce. The nonce may also change upon hashing. Sometimes miners want the number of hash-outs before finding the desired amount of hash. Since each client has a copy of the entire blockchain, safety is paramount here. In the blockchain, this safety is preserved by the immutable blockchain world. Once a block has been added to the blockchain, it cannot be changed. A new block can be created, but the previously added block cannot be changed. This blockchain immutability is received as two properties of the hash. Every peer client within a decentralized system will receive a contiguous copy of the blockchain. Each time a transaction occurs within the system, it will be updated in the same realm (only after confirmation). It must be updated on other peers as well. However, two completely different peers may have different hash values and try to claim that they are both legitimate, in which case the consensus method is used for proof. A smart city is one of the significant beneficiaries of blockchain. Blockchain meets users' trust and privacy issues; hence, it is reliable and highly recommended for use in the modern world. One of the key features of blockchain is a smart contract. The smart contract is the programmable digital form of agreement between two or more parties.
We have proposed a blockchain-based platform for the charging payment system of EVs. The proposed system is economical, as it addresses the issue related to electric vehicles, which are considered sustainable for the environment compared to fossil-fuel-based vehicles. The proposed peer-to-peer energy trading and charging payment system for electric vehicles based on blockchain technology can gain credibility and widespread applicability in real-world transportation conditions due to the secure and trusted decentralized database backed by blockchain. In this system, users can manage their personal information, EV information, and charging consumption. We have used an open-source platform by IBM, Hyperledger fabric. This is an easy-to-use platform for private blockchain [8]. The smart contract feature of Hyperledger fabric allows users to define the set of rules which they want to execute automatically. Once a smart contract is initiated, it will automatically process the rules encoded in it.
The main contributions of this article can be summarized as follows: • Proposing a peer-to-peer energy trading and charging payment system for electric vehicles; • Employing blockchain technology to provide trust between users; • Utilizing smart contracts for the payment of charging bills through electronic wallets.
The rest of the paper is structured as follows. Section 2 manifests the related works and background knowledge related to the suggested blockchain-based peer-to-peer energy trading and charging payment system for electric vehicles. Section 3 introduces the proposed system's methodology, including the system model and principal components of a blockchain. Section 4 presents the simulation environment details and evaluation results. The Section 5 concludes the proposed system, and possible future directions are also discussed in this section.

Related Work
Blockchain is the underlying technology of cryptocurrencies, but they provide many other application areas, such as reliable machine-to-machine automatic transactions, including auctions, bidding, and payments. Nowadays, many researchers use blockchain in different electric vehicles' transportation systems, such as payment systems, charging systems, and energy trading systems.

EV Charging Payment Systems
Main areas of the Electric Vehicles system in which blockchain is used consist of energy trading, smart charging, payment mechanisms, and vehicle-to-vehicle communications. Sato et al. [9] proposed how to perform operations using a smart contract for the permissioned blockchain system. One of the main ideas is defining the process as a smart contract to use the original blockchain functions to efficiently and simultaneously organize tasks. To adapt to blockchain's modern heterogeneous architecture, they designed the proposed method as a hybrid architecture with characteristics for blockchain's internal compatibility and operational instructions based on blockchain's external events. Using Hyperledger Fabric's prototype application, performance evaluation showed that the method could start performing tasks in less than 5 s. It also shows that cost estimation using modelbased estimation can significantly reduce total operating costs compared to traditional manual methods. However, the efficiency of the development of the proposed method can be increased. The high penetration of electric vehicles (EVs) in apartment complexes could significantly increase. At times, the demand for electrical loads and the charging capacity of unregulated electric vehicles can increase dramatically. To efficiently address this issue, Jang et al. [10] proposed an apartment-level charging coordination scheme. The charge modulation scheme reduces the charge load for EV and reduces the charging cost at the apartment level. The ratio of peak determined the performance of the proposed EV load modulation scheme to average power ratio, relative charging duration, and the total amount charged. The proposed coordination scheme manages the electrical network more reliably at the apartment level. It has been shown that owners of electric vehicles on the electrical network at this level of the apartment can coordinate the recharging of electric vehicles to achieve economic benefits.

Decentralized Charging Systems
A robust, integrated, and resilient charging network is essential to the growth and deployment of the Internet of Electic Vehicles (IoEV) [11]. Javed et al. [12] proposed a solution for the secured scheduling of the charging system using blockchain technology. They introduced vehicle-to-vehicle and vehicle-to-grid charging strategies. They also performed simulations to prove the efficiency of the proposed work. Blockchain is a decentralized basic data architecture and decentralized data model, all of which are increasingly recognized with the emergence of digital cryptocurrencies, such as bitcoins. The use of blockchain technology in energy is mainly due to its features and the Internet of Energy's development needs.
Electric vehicles and hybrid electric vehicles (HEVs) used Lithium-ion batteries (LIBs). There are different kinds of battery storage systems used in real-world EVs, such as Lithium nickel manganese cobalt oxide (NMC), Lithium iron phosphate (LFP), and Lithium manganese phosphate (LMP)-based batteries [13,14].
This article by Xiang et al. [15] provides automated demand response solutions for electric vehicles with battery storage systems based on blockchain technology, which first provide compatibility between the blockchain and the system and then configure system node models and pricing. Finally, they set up an automated query response strategy based on blockchain technology.
In the article by Pusti et al. [16], the concept of blockchain-independent negotiation is introduced. This concept is based on selecting the most suitable charging station for electric vehicles. Compared with traditional centralized methods, this solution does not require centralized units and can be fully automated, including energy payments. Based on an example, it can request the planned route, vehicle battery status, real-time traffic information, and driver preferences from the vehicle to charge different charging stations along the way through smart contracts on the blockchain based on these charging stations. It will then select the most suitable one based on the displayed price, but other input parameters can also be considered, such as waiting time, estimated duration, and so forth. The execution of smart contracts can also be extended to discussion and promotion. This article introduced short-term blockchain technology focused on Ethereum and explained the role of smart contracts. They defined the architecture of a simple independent selection system for electric vehicle charging stations and provided a Unified Modeling Language (UML) model to describe participants' activities in these processes and explain the role and requirements of various devices related to the blockchain. Yao et al. [17] also provides a decentralized charging scheme by exploiting the benefits of the Internet of Things. As the number of electric vehicles in use increases, electronic vehicle distribution networks' stability and economics are becoming increasingly important. Duan et al. [18] proposed charging methods for electric vehicles and the Internet of Things (IoT) using smart contracts with uncertain renewable energy output in the distribution chain. Their work studies the maximum load change based on the user's charging demand and main power load level and adjusts the distribution network quality by changing each node's demand response by controlling the charging option according to the power price. A smart contract is an agreement between the user and the charging station to achieve an electricity price update while calculating energy flow. This increases the electricity price design's rationality and reduces the deviation between the expected and actual loads, thus ensuring some of the method's effectiveness. Upon completing the smart contract signed with the charging station, the user will be rewarded or fined, reducing the default frequency. This decentralized transaction process improves transaction security and integrity.

Blockchain-Based Energy-Trading Systems
As the distribution rate of electric vehicles is shortly expected to become high, Perez et al. [19] addressed the participation of large electric vehicles in the electricity market. They proposed a solution for a situation where several days before purchasing energy, several independent and selfish electrical units entered the market to meet customers' driving needs. In such a case, an independent offer may unnecessarily increase prices, thereby raising the price of electricity for all participants. Cooperation between consolidators will help alleviate this situation by creating coordinated bids. Despite this, this is difficult due to the aggregator's selfish character, and the collector may attempt to manipulate the system for personal gain. To address this, they have used mechanism development technology to develop a coordination mechanism that encourages selfish power generators to truly reflect their energy needs to third-party coordinators. The coordinator can then use the daily bidding algorithm to optimize global bidding to extend smart bidding benefits to a set of competing EV aggregators. The suggested coordination mechanism must be easy to execute and does not necessitate supplementary infrastructures.
The article by Hu et al. aims to solve security problems for Internet of Vehicles (IoV) communications and create consensus and authentication nodes for Intelligent transporta-tion system (ITS) vehicles. With the lack of central nodes and the increasing complexity of IoV's services, Blockchain and IoV can be integrated to create a decentralized communication and consensus mechanism. Blockchain-based IoV architecture complements information communication and consensus authentication using Byzantine consensus algorithms based on timeline and rumor protocols. The empirical results prove that the algorithm is superior to traditional authentication techniques in terms of IoV information security and consensus performance. Furthermore, the findings provide a comparative solution to the problem of IoV certification for intelligent transportation [20].
The expeditious growth of the Internet of Vehicles has caused significant hurdles to ample data storage, smart management, and the entire system's information security. The traditional central management approach to handling IoV has problems with real-time response. Blockchain, effective technology for decentralized storage, and decentralized security management has shown significant advantages in embracing bitcoins. In a work by Khan et al. [21], blockchain technology is implemented in vehicle networking applications, especially considering the secure, decentralized storage of big data. They defined different nodes, such as vehicles and road networks, and formed different blockchain subnets. They presented an offshore model of vehicle blockchain data and provided detailed theoretical analysis and numerical results. By leveraging the charging and discharging aptitudes of the Internet of Electric Vehicles (IoEV), demand response can be executed in smart cities to facilitate intelligent energy scheduling and trading. However, IoEV-based systems face several difficulties, such as a deficiency of incentive mechanisms, privacy leakage, and security warnings. This motivated Zhou et al. [22] to exhibit a distributed, privacy-preserved, and incentive-compatible mechanism for IoEV. Mainly, they proposed a consortium blockchain-enabled secure energy-trading structure for electric vehicles with the average expense. A contract-theory-based incentive mechanism is proposed to incentivize more EVs to participate in demand response. Multiple contract details are tailored for the unique features of electric vehicle models. The contract optimization issue befalls into the level of diversity in convex programming and is resolved using the iterative convexconcave system algorithm. Furthermore, they considered the situation where the statistical knowledge of the electric vehicle model is concealed. In such a case, they demonstrated how to determine the probability distribution of the electric vehicle model by exploring the computational intelligence-based state of charge estimation methods, such as Gaussian process regression. Conclusively, the security and efficiency performance of the proposed scheme is analyzed and validated.

Methodology
The world recognizes the importance of transitioning from fossil fuel-based transportation systems to electric vehicles and smart cities. Due to the smaller charging cost as well as the climate and environmental awareness [23], the proposed system based on blockchain and its smart contract facility provides simplicity, safety, legitimacy, automation, trustworthiness, and privacy. The peer-to-peer electricity trading mechanism requires a trusted entity to ensure the proper transactions. Blockchain is the trusted information system that allows users to create transactions and keep data without trusting the middle person or even the person with whom we are doing business. All participants of the EV charging system need a trust-based relationship. We have proposed a smart contract-based electronic wallet for automatic charging payment of electric vehicles. This system minimizes human intervention for the amount of EV charging. Our proposed system uses a hyper ledger-based private blockchain application to deliver value instantly to each other. The consumers who also produce electricity are called prosumers. P2P trading system allows prosumers to sell excessive electricity to the charging stations. They can charge their own electric vehicles and get the benefit of selling extra energy. Many prosumers use solar panels as a source to generate electricity. Our proposed solution is based on the blockchain, which guarantees the trusted and secure transactions for prosumers, charging station owners, and electric vehicle owners. It provides a smart contract-based environment where users can trust the system. The system will automatically deduct the agreed charging rate from wallets.
Blockchain generates transactions and blocks; every block must be authenticated by peer nodes based on a predefined consensus algorithm. Figure 1 shows a visual representation of the integration scenario for charging and EV data. Charging stations have a meter, load switch, controller, and unique node information stores which are authenticated using blockchain. At the same time, the electric vehicle's owner has a digital wallet for payment. Users can assess and check their payment information through a phone application. Electric vehicle applications are a kind of software that provide vehicles and their driving capabilities beyond what is built into the vehicle. The app helps drivers in finding the nearest charging station. Users can also check the charging history through their apps. Processing of blockchain starts with the initialization of a transaction by any peer or node of the chain. The transactions are then combined in a block. The consensus algorithm verifies that block. After the verification of the block, the block becomes part of an immutable chain, where every transaction is time-stamped, and nobody can tamper with these transactions.  Figure 2 shows a Block diagram of the proposed blockchain-based P2P system. The proposed system participants can interact with the blockchain through Representational State Transfer (REST) services. Fabric client helps in the interaction of blockchain and the REST Application Programming Interface (APIs). Participants can access the blockchain through a graphical user interface (GUI)-based application. Prosumers, consumers, and charging station operators all fall under the category of participants. Prosumers produce electricity using renewable energy sources and sell excessive energy after their usage. Prosumers can sell and receive payment through the proposed blockchain-based mechanism. Consumers can bid or contact the seller or Prosumer to buy the electricity. They do not need any intermediaries for transactions. Blockchain provides a trusted environment to trade. Charging station operators can get electricity from both smart grids and prosumers. First, participants need to connect through the Internet, and then they can access the application through mobile or computers. Blockchain consists of different components, and each component works according to the predefined rules. Communication interfaces act as the intermediary between peers and the fabric client. There are different types of peers or nodes within the blockchain, such as endorser peers, orderers, and committers. The admin can define them during the installation phase. Every node contains a copy of the chaincode. Chaincode is the set of rules which automatically executes according to those predefined rules. Finally, the certificate authority issues the certificate to the new nodes. Since this is a permissioned blockchain, no one can join this blockchain without having a certificate. This additional step makes sure that no external entity can join and access the data without admin permission [24]. The off-chain data lake is used to store reports and analytical data. This helps to process the data and extract useful information for decision-making steps. The state of charge is the current charge level from full discharge to fully charged. The effective battery state of charge affects the battery's performance with respect to hourly grid electricity price and P2P delivery price. In the article by Wilkins et al. [25], an analysis was performed to understand the values of collective and community trading for peer-to-peer energy markets. They have explained that P2P energy trading creates a sharing economy that is beneficial for many society participants. Since most prosumers used renewable energy sources, it is also helpful in the decarbonization Process of Energy. The P2P energy trading scheme can help reduce the impact of recharging EVs on the centralized grid.

System Model
Our proposed system consists of three main contributors. The first is the user or owner of the electric vehicle. The second is the charging station operator, and the third one is the Prosumer. All the participants must make an account on the blockchain network. The membership service provider will provide unique private keys to every user. Electric vehicle information will also be stored on the blockchain. Figure 3 shows the proposed system model. Power lines are shown with the dotted line, whereas flow lines are shown with connected arrows. The electric vehicle owner can act as a prosumer if they have a renewable energy setup at their premises. They can not only charge their own electric vehicle, but they can also sell it to charging stations. All billing and charging data can be stored over the blockchain using the smart contract. Prosumers can initiate their selling amount through smart contracts, and the one who needs excessive energy at the fixed rate can contact the Prosumer. Smart meters record the amount of energy consumption, and that information can be stored over the blockchain. The Hyperledger fabric-based system allows users to interact independently through blockchain. The operator and producer can also authenticate the registered user and schedule the payment in case of a post-paid charging option. Prosumers can sell excess energy to the charging stations through smart contracts. Charging stations can store all the charging and billing information on the blockchain, which anyone can verify later. Electric vehicle owners can also pay through digital wallets. Payment will be automatically deducted from their wallet according to the charging time and amount through the smart contract.

Smart Contract Process Flow
Hyperledger fabric provides the functionality to write smart contracts. A smart contract is a digital contract between two or more parties. The code written in a smart contract can execute automatically when certain conditions meet. A smart contract is the electronic form of agreement among different participants [26]. Developers create smart contracts to support existing business processes that can manage financial prices or control conditions and represent them as snippets in the JavaScript programming language. In addition, smart contract auditors practice the legal and technical skills needed to translate legal terms into programming languages. Smart contracts can improve the flow of goods or capital, respectively, by ensuring that billing payments are made within a specified time-frame or that funds are released on predetermined terms. Most importantly, smart contract execution is far more efficient than manual business processes [27]. Figure 4 shows the sequence diagram for the smart charging and payment process flow for peer-to-peer energy trading. If the Prosumer has excessive energy, he can offer this to the charging station through blockchain's smart contract. Suppose the charging stations' owner agrees with the requirements and rates set by the Prosumer. In that case, he can send confirmation through the smart contract. The process of smart payment for electric vehicle charging starts with the initialization of the connection request by the EV owner to the operator. The smart charging station operator forwards the request to the smart contract, which validated the user. After the validation user gets a confirmation notification, and then he requests the producer to transfer energy. After completing the charging process EV owner will get information, and then his system will generate payment requests. He will share the public key with the operator. Finally, the charging station operator will request the producer to make a payment. The producer will transfer the charging amount to the smart contract, whereas as per the agreement, the smart contract will deduct the amount from the electronic wallet of the EV owner. The smart contract contains the predefined set of codes that automatically executes when a certain condition is met [28]. At the end of the transaction, every participant will receive a notification of success.

Consensus Mechanism
In the blockchain, every transaction is confirmed before recording it into the chain. The process of achieving agreement on the correctness of a transaction is called consensus. It assures that no malicious transaction can become a part of the blockchain [29]. Consensus also helps in achieving reliability in the vast network, which involves multiple nodes. Hyperledger Fabric Network's Consensus is the process by which nodes in the network provide a foolproof sequence of transactions and validate which blocks of transactions must adhere to the ledger. All transactions in the proposed block must be validated by consensus according to the guarantee and consensus policy. It is also necessary to agree on the arrangement, accuracy, and implementation results. The consensus is based on a layer of smart contracts to validate the set of required transactions in the block. Consensus in permissioned blockchain depends upon three types of nodes or peers: endorsement nodes, orderers, and committer peers. The client initiates a transaction and sends it to the endorsement nodes. These nodes simulate and execute the transaction; they also sign the endorsed transactions. After receiving the endorsed transaction, the client forwards it to the orderers that verify the endorsement and read-set. If they find it correct, they apply a write-set to it and send it to the committer peer. Finally, the committer peer commits the transition.

Overcoming the Oracle Problem
The oracle manages the interaction between blockchain and the real world; it is essential to address the oracle issue to evaluate the effectiveness of blockchain instability issues [30]. The Oracle issue has been described as a security, reliability, and trust dispute between third-party oracle and unreliable blockchain implementation. This can be prevented by using smart contracts and fabric certification [31]. Figure 5 shows the relationships between the oracle, blockchain, and the certification authority. In a permissioned blockchain, each user has their own unique identity, so Human Oracles can easily be identified. App Oracles can be resolved using smart contracts. Hardware oracle implementation can be solved with Fabric authority. Hardware requested by the customer, such as implementing IoT devices on the blockchain, is authorized by an authorized authority to upload only trusted information to the blockchain.

Blockchain Security
Blockchain is considered a secure platform; however, researchers have identified some prospective issues and presented their solutions. Leng et al. [32] performed a survey to cover the techniques and research directions for blockchain security. The blockchain-based application experiences different kinds of frauds, including objective fraud, subjective fraud, and rating fraud. Therefore, it is needed to enhance the robustness of fraud detection. Feng et al. [33] presented cyber insurance and cyber-risk management approaches to neutralize cyberattacks on the blockchain service network. Data protection in the blockchain can be described by integrity, confidentiality, and availability. It can be improved by applying retrieval techniques on encrypted blockchain data [34] and signature schemes in blockchain [35].

Results
This section provides a discussion of technical constraints, challenges issues, the technological synergies to other digital platforms of pricing and transactions, as well as the future prospects of the research findings in alignment with the specific research. This section also covers details about the test-bed and simulation environment. We have also performed average transaction latency and throughput evaluation. This section also covers the resource utilization analysis.

Simulation Environment
We have used an open-source blockchain platform by IBM, Hyperledger fabric. Table 1 shows the simulation environment for our proposed system. We have used the composer playground by Hyperledger fabric as an integrated development environment (IDE) and composer CLI for the command-line interface (CLI). We have deployed the system on our local environment with a RAM of 64 GB and an Intel Core (TM) i7-1160G7 Processor at 4.40 GHz. We have used the Linux Ubuntu 18.04 LTS operating system. The rest server was used to interact with the client-side web application. Our test-bed was deployed in two separate development environments: the blockchain network and web application. The online version of the Hyperledger composer is deprecated; hence, we installed the offline version. The Hyperledger composer playground for simulation purposes is used on the Ubuntu 18.04 LTS operating system. Figure 6 shows the steps involved in the composer playground's installation process. It includes the prerequisites, installation of the development environment, starting fabric composer, and user interface of the composer playground.  Figure 7 shows the user's dashboard where users can find the nearest charging location. Users can also find out the charging history, billing information, and charging time and set up their profile. Since the proposed system comprises of many participants, the Prosumer, consumers, charging station operators, smart grid operators will have a different interface with different options according to their role. New users can register themselves, and during sign-up, they can choose the role which they want to be. The system will register prosumers and charging stations according to their location and other information, such as the charging terminal, charging power, charger type, and charging rates.

Evaluation and Analysis
We have evaluated the proposed blockchain-based system's performance using average transaction latency and average transaction throughput. Figure 8 shows the bar graph of the average transaction latency. The x-axis shows the send rate in transactions per second (tps). The y-axis depicts the transaction latency in milliseconds (ms). It can be observed through the bar chart that with the increments in send rates, transaction latency also increases; however, it performs better below send rates of 1000 tps. To calculate average transaction latency, we used Equation (1). T con represents the confirmation time, N t is the network threshold represented by N trh , and submission time is represented by T sub . Transaction latency L tra can be obtained by multiplying the network threshold with confirmation time and subtracting the submission time [36].
L tra = T con × N trh − T sub (1) Figure 8. Evaluation of average transaction latency. Figure 9 shows the evaluation of the average transaction throughput. The x-axis shows the send rate in transactions per second (tps), and y-axis depicts the transaction throughput in transactions per second (tps). The throughput steadily increases until the 825 send rate, but a sudden increase at 975 tps is observed. The optimal transmission rate is also known as the best transmission rate [37] The best transmission rate obtained from our proposed system is 825. To calculate the average transaction throughput TP tra , we have used the Equation (2), where V tra is the total valid transactions and T represents the total time measured in seconds. Resource utilization analysis of the proposed system is summarized in Table 2. We have analyzed the resource utilization, including average memory and CPU usage. We have also analyzed the incoming and outgoing traffic rates. Low memory usage and low traffic provided a comfortable and stable user experience [38]. Peer of Certificate authority of two sub-channels uses the shallow resources to make the system faster to issue a new certificate, whereas electric vehicle peers also use low memory. The resource utilization analysis shows that the proposed system can work efficiently without very high resources.

Discussion
The blockchain has the ability to streamline electric vehicle payments. It provides a more efficient charging network for electric vehicles and adjusts the map of charging stations. The range anxiety issue is a significant impediment to the adoption of electric vehicles. Many people are afraid that their batteries will run out on long trips. This is because they cannot expect the charger to be available everywhere. Without the right kind of and widely available infrastructure, potential consumers will be reluctant to switch to electric vehicles. However, the blockchain itself addresses many issues when it comes to challenges, including reputation issues, technical scalability, and difficulty integrating with legacy systems. Moreover, aside from regulatory and cryptocurrency concerns, the electric vehicle market is still in a fictitious stage, and there is no guarantee of when it will be mass-adopted. By integrating the blockchain into the energy system, the EV charging infrastructure can be further improved. Although the blockchain system itself is secure in general, another source of attacks comes from the interconnecting process between other cyber or physical systems and the blockchain system. The solid bonding between the physical system with blockchain is critical for preventing counterfeits, such as a blockchain with a chemical signature for self-organizing processes in social manufacturing.
In the future, such issues can be covered to improve blockchain-based systems. Middleware interfaces for multi-blockchains can be introduced to overcome such issues. Energy trading is essential in the industry. The blockchain-based IoT system could act as an anti-counterfeiting digital twin to ensure that the systems and image data have not been tampered with. In the future, the relationship between the digital twin and the physical system can be established. The combination of blockchain with digital twin technologies is interesting in industrial applications. For instance, blockchain-secured smart manufacturing in industry 4.0, blockchain-empowered sustainable manufacturing and product lifecycle management in industry 4.0 and combining permissioned blockchain with a holistic optimization model as bi-level intelligence for smart manufacturing.

Conclusions
The peer-to-peer energy trading plan is designed to allow network users to interact with their neighbors to balance areas of surplus and energy shortages. Peer-to-peer energy trading improves the use of distribution network assets and the integration of the renewable energy network. This concept aims to start electricity transactions between peers automatically. Electric vehicles are a big step towards a friendly means of transportation. The number of electric vehicles is increasing rapidly compared to carbon-producing vehicles. Some users use solar panels to generate electricity, and some charging stations use electricity. However, they charge electric vehicles and pay for the car. The users who have excessive energy and want to sell it to the charging stations are called prosumers. We have addressed one of the major problems present with current payment systems: the lack of transparency, allowing service providers to bill their customers. Blockchain is a modern solution that reduces trust and privacy. We have proposed a P2P payment and energy trading system for blockchain technology based on electric vehicles. Users with excessive electricity can sell them to charging stations through smart contracts. Electric vehicle users can pay their bills through an e-wallet. We have developed an automatic payment system for electric vehicles using the open-source platform, Hyperledger fabric. The proposed solution reduces human interaction and increases trust, transparency, and privacy among EV participants. We analyzed resource usage, transaction delay, and performance evaluation. Our proposed solution will help overcome the trust and privacy issues in electric car charging. In the future, this work can be extended by using a machine learning approach for better analysis, price prediction, and optimal routes for the nearest charging stations. Cryptocurrency for the payment of EV charging can also be introduced in the future.

Conflicts of Interest:
The authors declare no conflict of interest.