Next Article in Journal
Secondary Science Teachers’ Views on Environmental Citizenship in The Netherlands
Next Article in Special Issue
Characterizing the Theory of Spreading Electric Vehicles in Luxembourg
Previous Article in Journal
Infrastructure Elements for Smart Campuses: A Bibliometric Analysis
Previous Article in Special Issue
An Investigation on the Effects of Input Parameters on the Dynamic and Electric Consumption of Electric Motorcycles
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Blockchain-Based Peer-to-Peer Energy Trading and Charging Payment System for Electric Vehicles

Department of Computer Engineering, Jeju National University, Jeju-si 63243, Korea
*
Author to whom correspondence should be addressed.
Sustainability 2021, 13(14), 7962; https://doi.org/10.3390/su13147962
Submission received: 18 June 2021 / Revised: 7 July 2021 / Accepted: 8 July 2021 / Published: 16 July 2021
(This article belongs to the Collection Sustainable Development of Electric Vehicle)

Abstract

:
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.

1. 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.

2. 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.

2.1. 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 model-based 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.

2.2. 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.

2.3. 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 transportation 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 convex–concave 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.

3. 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.

3.1. 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.

3.2. 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.

3.3. 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.

3.4. 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.

3.5. 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].

4. 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.

4.1. 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.

4.2. 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 c o n represents the confirmation time, N t is the network threshold represented by N t r h , and submission time is represented by T s u b . Transaction latency L t r a can be obtained by multiplying the network threshold with confirmation time and subtracting the submission time [36].
L t r a = T c o n × N t r h T s u b
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 T P t r a , we have used the Equation (2), where V t r a is the total valid transactions and T represents the total time measured in seconds.
T P t r a = ( V t r a ) ( T )
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.

4.3. 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.

5. 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.

Author Contributions

Conceptualization, P.W.K.; formal analysis, P.W.K.; funding acquisition, Y.-C.B.; investigation, Y.-C.B.; methodology, P.W.K.; project administration, Y.-C.B.; supervision, Y.-C.B. All authors have read and agreed to the published version of the manuscript.

Funding

Following are results of a study on the “Leaders in INdustry-university Cooperation +” Project, supported by the Ministry of Education and National Research Foundation of Korea.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
EVElectric vehicles
P2PPeer-to-Peer
UMLUnified Modeling Language
IoVInternet of Vehicles
ITSIntelligent transportation system
IoVInternet of Vehicles
UMLUnified Modeling Language
IoEVInternet of electric vehicles
IOTe Internet of Things
HEVsHybrid Electric vehicles
LIBsLithium-ion batteries
NMCNickel manganese cobalt oxide
LFPLithium iron phosphate
RESTRepresentational State Transfer
APIApplication Programming Interface
CLIcommand-line interface
TPStransactions per second
MSmilliseconds

References

  1. Sajjad, A.; Asmi, F.; Chu, J.; Anwar, M.A. Environmental concerns and switching toward electric vehicles: Geographic and institutional perspectives. Environ. Sci. Pollut. Res. 2020, 27, 1–12. [Google Scholar] [CrossRef]
  2. Shang, Y.; Liu, M.; Shao, Z.; Jian, L. Internet of smart charging points with photovoltaic Integration: A high-efficiency scheme enabling optimal dispatching between electric vehicles and power grids. Appl. Energy 2020, 278, 115640. [Google Scholar] [CrossRef]
  3. Wang, L.; Jiao, S.; Xie, Y.; Mubaarak, S.; Zhang, D.; Liu, J.; Jiang, S.; Zhang, Y.; Li, M. A Permissioned Blockchain-Based Energy Management System for Renewable Energy Microgrids. Sustainability 2021, 13, 1317. [Google Scholar] [CrossRef]
  4. Khan, P.W.; Byun, Y.C. Smart contract centric inference engine for intelligent electric vehicle transportation system. Sensors 2020, 20, 4252. [Google Scholar] [CrossRef]
  5. Huang, X.; Xu, C.; Wang, P.; Liu, H. LNSC: A security model for electric vehicle and charging pile management based on blockchain ecosystem. IEEE Access 2018, 6, 13565–13574. [Google Scholar] [CrossRef]
  6. Zhang, R.; Xue, R.; Liu, L. Security and privacy on blockchain. ACM Comput. Surv. (CSUR) 2019, 52, 1–34. [Google Scholar] [CrossRef] [Green Version]
  7. Martino, R.; Cilardo, A. Designing a SHA-256 processor for blockchain-based IoT applications. Internet Things 2020, 11, 100254. [Google Scholar] [CrossRef]
  8. Androulaki, E.; Barger, A.; Bortnikov, V.; Cachin, C.; Christidis, K.; De Caro, A.; Enyeart, D.; Ferris, C.; Laventman, G.; Manevich, Y.; et al. Hyperledger fabric: A distributed operating system for permissioned blockchains. In Proceedings of the Thirteenth EuroSys Conference, Porto, Portugal, 23–26 April 2018; pp. 1–15. [Google Scholar]
  9. Sato, T.; Himura, Y. Smart-contract based system operations for permissioned blockchain. In Proceedings of the 2018 9th IFIP International Conference on New Technologies, Mobility and Security (NTMS), Paris, France, 26–28 February 2018; pp. 1–6. [Google Scholar]
  10. Jang, H.S.; Bae, K.Y.; Jung, B.C.; Sung, D.K. Apartment-level electric vehicle charging coordination: Peak load reduction and charging payment minimization. Energy Build. 2020, 223, 110155. [Google Scholar] [CrossRef]
  11. Li, Q.; Wang, Y.; Pu, Z.; Wang, S.; Zhang, W. Time series association state analysis method for attacks on the smart Internet of electric vehicle charging network. Transp. Res. Rec. 2019, 2673, 217–228. [Google Scholar] [CrossRef]
  12. Javed, M.U.; Javaid, N. Scheduling charging of electric vehicles in a secured manner using blockchain technology. In Proceedings of the 2019 International Conference on Frontiers of Information Technology (FIT), Islamabad, Pakistan, 16–18 December 2019; pp. 351–3515. [Google Scholar]
  13. Divakaran, A.M.; Minakshi, M.; Bahri, P.A.; Paul, S.; Kumari, P.; Divakaran, A.M.; Manjunatha, K.N. Rational design on materials for developing next generation lithium-ion secondary battery. Prog. Solid State Chem. 2020, 62, 100298. [Google Scholar] [CrossRef]
  14. Divakaran, A.M.; Hamilton, D.; Manjunatha, K.N.; Minakshi, M. Design, development and thermal analysis of reusable Li-ion battery module for future mobile and stationary applications. Energies 2020, 13, 1477. [Google Scholar] [CrossRef] [Green Version]
  15. Xiang, K.; Chen, B.; Lin, H.; Shen, Y.; Du, Y.; Yan, T. Automatic demand response strategy of local pure electric vehicle with battery energy storage system based on blockchain technology. In Proceedings of the 2018 2nd IEEE Conference on Energy Internet and Energy System Integration (EI2), Beijing, China, 20–22 October 2018; pp. 1–6. [Google Scholar]
  16. Pustišek, M.; Kos, A.; Sedlar, U. Blockchain based autonomous selection of electric vehicle charging station. In Proceedings of the 2016 International Conference on Identification, Information and Knowledge in the Internet of Things (IIKI), Beijing, China, 20–21 October 2016; pp. 217–222. [Google Scholar]
  17. Yao, L.; Chen, Y.Q.; Lim, W.H. Internet of things for electric vehicle: An improved decentralized charging scheme. In Proceedings of the 2015 IEEE International Conference on Data Science and Data Intensive Systems, Sydney, NSW, Australia, 11–13 December 2015; pp. 651–658. [Google Scholar]
  18. Duan, B.; Xin, K.; Zhong, Y. Optimal dispatching of electric vehicles based on smart contract and Internet of things. IEEE Access 2019, 8, 9630–9639. [Google Scholar] [CrossRef]
  19. Perez-Diaz, A.; Gerding, E.; McGroarty, F. Coordination and payment mechanisms for electric vehicle aggregators. Appl. Energy 2018, 212, 185–195. [Google Scholar] [CrossRef] [Green Version]
  20. Hu, W.; Hu, Y.; Yao, W.; Li, H. A blockchain-based Byzantine consensus algorithm for information authentication of the Internet of vehicles. IEEE Access 2019, 7, 139703–139711. [Google Scholar] [CrossRef]
  21. Khan, P.W.; Byun, Y.C. Secure transactions management using blockchain as a service software for the internet of things. In Software Engineering in IoT, Big Data, Cloud and Mobile Computing; Springer: Berlin/Heidelberg, Germany, 2021; pp. 117–128. [Google Scholar]
  22. Zhou, Z.; Wang, B.; Guo, Y.; Zhang, Y. Blockchain and computational intelligence inspired incentive-compatible demand response in Internet of electric vehicles. IEEE Trans. Emerg. Top. Comput. Intell. 2019, 3, 205–216. [Google Scholar] [CrossRef]
  23. Gao, D.Q.; Zhang, Y.Y.; Li, X.Z. The Internet of things for electric vehicles: Wide area charging-swap information perception, transmission and application. In Advanced Materials Research; Trans Tech Publications Ltd.: Freienbach, Switzerland, 2013; Volume 608, pp. 1560–1565. [Google Scholar]
  24. Abbas, K.; Afaq, M.; Ahmed Khan, T.; Song, W.C. A blockchain and machine learning-based drug supply chain management and recommendation system for smart pharmaceutical industry. Electronics 2020, 9, 852. [Google Scholar] [CrossRef]
  25. Wilkins, D.J.; Chitchyan, R.; Levine, M. Peer-to-peer energy markets: Understanding the values of collective and community trading. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems, Honolulu, HI, USA, 25–30 April 2020; pp. 1–14. [Google Scholar]
  26. Khan, P.W.; Byun, Y. A Blockchain-Based Secure Image Encryption Scheme for the Industrial Internet of Things. Entropy 2020, 22, 175. [Google Scholar] [CrossRef] [Green Version]
  27. Fabric, H. Developing Applications. 2021. Available online: https://Hyperledger-fabric.readthedocs.io/en/release-2.2/developapps/developing_applications.html (accessed on 25 March 2021).
  28. Shahbazi, Z.; Byun, Y.C. Improving Transactional Data System Based on an Edge Computing–Blockchain–Machine Learning Integrated Framework. Processes 2021, 9, 92. [Google Scholar] [CrossRef]
  29. Xu, G.; Liu, Y.; Khan, P.W. Improvement of the DPoS consensus mechanism in Blockchain based on vague sets. IEEE Trans. Ind. Informatics 2019, 16, 4252–4259. [Google Scholar] [CrossRef]
  30. Caldarelli, G. Real-world blockchain applications under the lens of the oracle problem. A systematic literature review. In Proceedings of the 2020 IEEE International Conference on Technology Management, Operations and Decisions (ICTMOD), Marrakech, Morocco, 24–27 November 2020; pp. 1–6. [Google Scholar]
  31. Caldarelli, G.; Rossignoli, C.; Zardini, A. Overcoming the Blockchain Oracle Problem in the Traceability of Non-Fungible Products. Sustainability 2020, 12, 2391. [Google Scholar] [CrossRef] [Green Version]
  32. Leng, J.; Zhou, M.; Zhao, L.J.; Huang, Y.; Bian, Y. Blockchain security: A survey of techniques and research directions. In IEEE Transactions on Services Computing; IEEE: Piscataway, NJ, USA, 2020. [Google Scholar]
  33. Feng, S.; Wang, W.; Xiong, Z.; Niyato, D.; Wang, P.; Wang, S.S. On cyber risk management of blockchain networks: A game theoretic approach. arXiv 2018, arXiv:1804.10412. [Google Scholar] [CrossRef]
  34. Tosh, D.K.; Shetty, S.; Liang, X.; Kamhoua, C.A.; Kwiat, K.A.; Njilla, L. Security implications of blockchain cloud with analysis of block withholding attack. In Proceedings of the 2017 17th IEEE/ACM International Symposium on Cluster, Cloud and Grid Computing (CCGRID), Madrid, Spain, 14–17 May 2017; pp. 458–467. [Google Scholar]
  35. Sahai, A.; Waters, B. Fuzzy identity-based encryption. In Annual International Conference on the Theory and Applications of Cryptographic Techniques; Springer: Berlin/Heidelberg, Germany, 2005; pp. 457–473. [Google Scholar]
  36. Xu, X.; Sun, G.; Luo, L.; Cao, H.; Yu, H.; Vasilakos, A.V. Latency performance modeling and analysis for Hyperledger fabric blockchain network. Inf. Process. Manag. 2021, 58, 102436. [Google Scholar] [CrossRef]
  37. Iqbal, N.; Jamil, F.; Ahmad, S.; Kim, D. A Novel Blockchain-Based Integrity and Reliable Veterinary Clinic Information Management System Using Predictive Analytics for Provisioning of Quality Health Services. IEEE Access 2021, 9, 8069–8098. [Google Scholar] [CrossRef]
  38. Shahbazi, Z.; Byun, Y.C. Towards a secure thermal-energy aware routing protocol in Wireless Body Area Network based on technology. Sensors 2020, 20, 3604. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Integration scenario for charging and EV data.
Figure 1. Integration scenario for charging and EV data.
Sustainability 13 07962 g001
Figure 2. Block diagram of the proposed blockchain-based P2P system.
Figure 2. Block diagram of the proposed blockchain-based P2P system.
Sustainability 13 07962 g002
Figure 3. System model of the P2P energy trading and charging system.
Figure 3. System model of the P2P energy trading and charging system.
Sustainability 13 07962 g003
Figure 4. Process Flow diagram for Smart Contract.
Figure 4. Process Flow diagram for Smart Contract.
Sustainability 13 07962 g004
Figure 5. Use of certification authority for overcoming the oracle problem.
Figure 5. Use of certification authority for overcoming the oracle problem.
Sustainability 13 07962 g005
Figure 6. Flow diagram for the installation of private blockchain.
Figure 6. Flow diagram for the installation of private blockchain.
Sustainability 13 07962 g006
Figure 7. End user dashboard template.
Figure 7. End user dashboard template.
Sustainability 13 07962 g007
Figure 8. Evaluation of average transaction latency.
Figure 8. Evaluation of average transaction latency.
Sustainability 13 07962 g008
Figure 9. Evaluation of average transaction throughput.
Figure 9. Evaluation of average transaction throughput.
Sustainability 13 07962 g009
Table 1. Test-bed implementation environment.
Table 1. Test-bed implementation environment.
System ComponentDescription
CPUIntel Core (TM) i7-1160G7 Processor at 4.40 GHz
OSLinux Ubuntu 18.04 LTS
Docker-engineV 10.03
CLI-ToolsRest server and Composer-CLI,
Docker-composerV 3.8
RAM64 GB
Hyperledger-Fabricv1.4
Programming-LanguageGo language, JavaScript
Client Web applicationBootstrap, JQuery, Solidity, Node JavaScript, angular
IDE (Platform)VS
Table 2. Resource utilization analysis of proposed system.
Table 2. Resource utilization analysis of proposed system.
TypeNameMemory (avg)CPU(avg)Traffic InTraffic Out
ProcessNode local-client.js105 MB10.5%--
Dockerpeer0.prosumer.com58.7 MB2.21%231.3 KB234.6 KB
Dockerpeer1. station.com83.31 MB4.48%3.2 MB6.1 MB
Dockerpeer0.ev21.3 MB1.00%564 B4 B
Dockerpeer1.ev23.6 MB6.29%4.8 MB5.6 MB
Dockerorg1.station.com121.4 MB14.92%5.8 MB11 MB
Dockerorg1.station.com131 MB10.68%3.24 MB912.6 KB
DockerOrderer.com23.9 MB6.65%6 MB16 MB
DockerCa_peerOrg121.6 MB2.60%0B0B
DockerCa_peerOrg25.4 MB1.30%0B0B
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Khan, P.W.; Byun, Y.-C. Blockchain-Based Peer-to-Peer Energy Trading and Charging Payment System for Electric Vehicles. Sustainability 2021, 13, 7962. https://doi.org/10.3390/su13147962

AMA Style

Khan PW, Byun Y-C. Blockchain-Based Peer-to-Peer Energy Trading and Charging Payment System for Electric Vehicles. Sustainability. 2021; 13(14):7962. https://doi.org/10.3390/su13147962

Chicago/Turabian Style

Khan, Prince Waqas, and Yung-Cheol Byun. 2021. "Blockchain-Based Peer-to-Peer Energy Trading and Charging Payment System for Electric Vehicles" Sustainability 13, no. 14: 7962. https://doi.org/10.3390/su13147962

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop