Next Article in Journal
Nested Shallow Geothermal Systems
Next Article in Special Issue
New Market Model with Social and Commercial Tiers for Improved Prosumer Trading in Microgrids
Previous Article in Journal
Evaluating Environmental Impact in Foundations and Structures through Disaggregated Models: Towards the Decarbonisation of the Construction Sector
Previous Article in Special Issue
Blockchain of Carbon Trading for UN Sustainable Development Goals
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

Scheduling Charging of Electric Vehicles in a Secured Manner by Emphasizing Cost Minimization Using Blockchain Technology and IPFS

Department of Computer Science, COMSATS University Islamabad, Islamabad 44000, Pakistan
Traffic Safety Technologies Chair, Urban Planning Department, College of Architecture and Planning, King Saud University, Riyadh 11574, Saudi Arabia
Biomedical Technology Department, College of Applied Medical Sciences, King Saud University, Riyadh 11633, Saudi Arabia
College of Computer Science and Engineering (CCSE), University of Jeddah, Jeddah 21959, Saudi Arabia
Department of Computer Science and IT, University of Sargodha, Sargodha 40100, Pakistan
School of Systems and Technology, University of Management and Technology, Lahore 54000, Pakistan
Author to whom correspondence should be addressed.
Sustainability 2020, 12(12), 5151;
Received: 2 April 2020 / Revised: 13 June 2020 / Accepted: 16 June 2020 / Published: 24 June 2020


In this work, Electric Vehicles (EVs) are charged using a new and improved charging mechanism called the Mobile-Vehicle-to-Vehicle (M2V) charging strategy. It is further compared with conventional Vehicle-to-Vehicle (V2V) and Grid-to-Vehicle (G2V) charging strategies. In the proposed work, the charging of vehicles is done in a Peer-to-Peer (P2P) manner; the vehicles are charged using Charging Stations (CSs) or Mobile Vehicles (MVs) in the absence of a central entity. CSs are fixed entities situated at certain locations and act as charge suppliers, whereas MVs act as prosumers, which have the capability of charging themselves and also other vehicles. In the proposed system, blockchain technology is used to tackle the issues related with existing systems, such as privacy, security, lack of trust, etc., and also to promote transparency, data immutability, and a tamper-proof nature. Moreover, to store the data related to traffic, roads, and weather conditions, a centralized entity, i.e., Transport System Information Unit (TSIU), is used. It helps in reducing the road congestion and avoids roadside accidents. In the TSIU, an Inter-Planetary File System (IPFS) is used to store the data in a secured manner after removing the data’s redundancy through data filtration. Furthermore, four different types of costs are calculated mathematically, which ultimately contribute towards calculating the total charging cost. The shortest distance between a vehicle and the charging entities is calculated using the Great-Circle Distance formula. Moving on, both the time taken to traverse this shortest distance and the time to charge the vehicles are calculated using real-time data of four EVs. Location privacy is also proposed in this work to provide privacy to vehicle users. The power flow and the related energy losses for the above-mentioned charging strategies are also discussed in this work. An incentive provisioning mechanism is also proposed on the basis of timely delivery of credible messages, which further promotes users’ participation. In the end, simulations are performed and results are obtained that prove the efficiency of the proposed work, as compared to conventional techniques, in minimizing the EVs’ charging cost, time, and distance.

1. Introduction

With the huge increase in both population and urbanization, issues such as drastic climate changes, increased gas emissions, and depletion of fossil fuels arise. Rapid progress has been made in the vehicle industry over the past few years, leading to an increase in the number of vehicles. For this reason, road congestion has also increased drastically. This has created huge amounts of environmental pollution, which includes noise pollution, air pollution, land pollution, etc. These factors disturb the global economy and community to a greater extent. This disturbance further leads to the need for new revolutions for mitigating the previously mentioned problems [1]. To reduce the huge amount of energy required by the vehicles, the scientific and research communities have joined hands and started focusing on Electric Vehicles (EVs) as sources of clean energy. EVs have the ability of reducing fuel demands and gas emissions. Autonomous EVs are a cutting-edge technology of the modern era, which includes self-driving cars as well as services like ride-sharing and smart-pay. EVs also act as environment friendly and green energy sources, as they help in de-carbonization owing to the above-mentioned factors. Conventional combustion engines, which used fossil fuels, are replaced by electric motors that run on Renewable Energy Sources (RESs). EVs can be powered either from Charging Stations (CSs) or from the batteries installed within [2]. The EVs that are emerging drastically in the local market aim to make the power grid into a beneficial entity by introducing the concept of the Grid-to-Vehicle (G2V) charging strategy [3].
With immense developments being made in the Information and Communication Technologies (ICT) sector, bi-directional communication and trading are becoming a reality. In Smart Grids (SGs), EVs play major roles in transportation management. EVs can be charged both from RESs and even from other vehicles via a bi-directional trading mechanism.
In recent times, vehicle manufacturers have not only been competing in terms of providing the latest and most modern infrastructures, but also in terms of providing the latest functionalities and services to drivers. It is expected that conventional vehicles will be replaced with autonomous vehicles, and the entire transportation sector will be taken over by EVs in the near future. The reason is because of the immense amount of research being done in this sector, which enables the vehicular industries to manufacture efficient and highly capable vehicles. Moreover, the battery manufacturing industries also aim at manufacturing batteries with long lifetimes and that are capable of storing more charge. Even now, some conventional vehicles are equipped with the latest technologies for making them semi-autonomous. The increasing number of EVs also poses some problems, like the range anxiety problem, the lack of charging spots, and privacy and security issues. The range anxiety problem is the fear of running out of battery power when going on long distances and being unsure of the availability of CSs. Therefore, batteries with large energy storage capabilities are required when going on long travels, which will, in turn, increase the weight of the car, hindering its performance [4].
In conventional energy trading systems, vehicles have to buy energy from the grid, i.e., a central entity, which makes G2V a centralized system. The involvement of a centralized third party means that there exist single-point failure and privacy leakage issues. The entire system is not optimal and inherits great security risks, as the data residing in the central body are quite easily accessible by hackers. To overcome these issues, a Peer-to-Peer (P2P) system is the optimal solution. A P2P system involves energy trading between EVs, i.e., a Vehicle-to-Vehicle (V2V) trading system. This system has the advantage that the centralized body is eliminated, along with the problems associated with it. However, this decentralized system has some problems. EVs with surplus electricity are hesitant to trade energy with other vehicles due to the privacy and security concerns. Users do not trust each other, as the system is not transparent [5].
To overcome the above-mentioned problems, it is the need of the hour that such a decentralized system is introduced that ensures security, privacy, and data immutability. For this, blockchain technology is introduced and incorporated into various fields of life, like Wireless Sensor Networks (WSNs), Internet of Things (IoT) [6,7], energy [8,9,10], healthcare, agriculture [11], etc. Blockchain is a decentralized technology that eliminates the need for the centralized party and promotes privacy and trust among entities. In blockchain technology, the transactions are saved in a distributed ledger; copies are available with every node, ensuring transparency. The transaction data are first stored in a block with a unique hash. Then, these blocks are linked together in a chronological manner. For data verification, consensus algorithms, like Proof of Work (PoW), Proof of Stake (PoS), etc., are used in a blockchain network. Agreement of 51% between nodes is required for any action to take place, e.g., the addition of a new vehicle, sharing of a service, etc., in a blockchain network [12].
A number of problems are associated with the charging of EVs, like limited battery capacities, lower numbers of CSs, trust issues, etc. The cost of charging also plays a vital role in charging of EVs. The vehicle users are reluctant to have their vehicles charged at higher costs. The charging behavior of EVs also affects the grids and the CSs. Therefore, the primary focus of the current research is on the scheduling strategies of EVs. The problem of the limited number of CSs can also be resolved using blockchain technology. It will promote trust between users, which will lead to users’ willingness to trade energy amongst themselves. The state information of an EV is collected in the first step, and if the battery level is low, i.e., if the charge stored in the battery is less, then a charging request will be broadcasted to the network. Meanwhile, using a Global Positioning System (GPS), the location information of the EV can be traced and sent to the other vehicles of the network. Then, the shortest driving path is calculated from information obtained through the GPS [13]. The remainder of the paper is organized as follows. Section 2 presents an overview of the related work along with a critical analysis. Section 3 put forwards the problem statement of the proposed work. Section 4 covers the discussion of our proposed system models. The proposed charging schedule is given in Section 5. Section 6 is dedicated to the mathematical formulation of the cost functions and the objective function. Section 7 discusses the power flow and the formulation of the associated energy losses in different charging strategies. The incentive provisioning to the users is presented in Section 8. Furthermore, Section 9 discusses the simulation results in a comprehensive manner. Finally, conclusions and directions for future work are given in Section 10.
After reviewing the work done by several authors in [12,14,15], the motivations for the proposed work are summarized as follows:
  • There is a need for a charging scenario other than the conventional scenarios, i.e., G2V and V2V, where vehicles are charged using other vehicles, termed Mobile Vehicles (MVs), which act as prosumers;
  • A charging schedule should be devised to charge the vehicles efficiently and also to reduce the charging load on the CSs;
  • The data storage issue should be tackled by removing redundancy from the data;
  • Blockchain technology should be implemented to promote transparency and to ensure security in a P2P trading scenario;
  • Such algorithms should be proposed that will reduce the charging cost and time appreciably;
  • Users’ participation in the proposed model should be increased by giving incentives.
This work is the extended version of [16]. The major contributions made in this paper are as follows:
  • All new incoming vehicles are first authorized by a central entity and then added to the network;
  • Scheduling algorithms for the charging of EVs are introduced,
  • Mobile-Vehicle-to-Vehicle (M2V) communication between vehicles is done and compared with existing V2V and G2V communications;
  • The information related to roads and weather conditions is stored after filtration in a centralized entity using the Inter-Planetary File System (IPFS);
  • The shortest distance between charging entities is calculated using the Great-Circle Distance formula. Furthermore, both the times taken to traverse this distance and to charge the vehicles are calculated;
  • The location of the vehicles is preserved using an encryption technique to promote vehicles’ participation;
  • Mathematical formulation is done for achieving the reduction in total charging cost;
  • The energy losses associated with the power flow in different charging strategies are discussed;
  • Both the number of hashes generated and the mining time required are calculated using different difficulty levels;
  • Incentives are given to vehicles on the basis of timely responses of credible messages to increase participation rate.

2. Related Work

Nowadays, the Vehicular Network (VN) is getting smarter with every coming day, and research is aiming towards making it an integral part of the smart city infrastructure. EVs play vital roles in distributed RES transportation and management in SGs. EVs are able to get energy both from the CSs as well as from other EVs using V2V trading. In the near future, the traffic sector will be comprised of a huge number of intelligent EVs. To ensure the security and cost reduction, blockchain will surely play a major role. Several research organizations are currently working on integration of blockchain in the vehicular sector. The blockchain technology promises the advantages of decentralization, security, and trust among EVs. The authors of [5] proposed a system using blockchain along with multisignatures to address transaction security issues. However, the proposed model lacks in providing an efficient system, as it is quite expensive to implement. The authors of [14] proposed a blockchain-based system that makes use of consortium blockchain in order to establish a distributed ledger with nominal cost. In the proposed method, Local Aggregators (LAGs) were introduced to audit and verify the transactions.
In [17], the authors used blockchain technology for creating a decentralized, secured, and trusted ecosystem. The proposed ecosystem consisted of a seven-layer blockchain model. The relationship between the Blockchain-based Intelligent Transport System (B 2 ITS) and Parallel transportation Management Systems (PtMS) was also studied. It was proved that B 2 ITS along with PtMS can be used for building better future transportation management systems. In [18], the authors proposed that blockchain technology be integrated into Vehicular Ad-hoc Networks. The proposed system was termed VANET. It consisted of two applications: Mandatory applications and optional applications. Mandatory applications consisted of traffic regulation, vehicle taxation, and vehicle insurance, whereas optional applications consisted of weather information and information about roads, traffic jams, etc. The authors of [19] proposed a blockchain model that ensured that users’ data remain secure and private. However, it created trust issues. Services associated with wireless softwares and the respective updates were used to illustrate the efficiency of the proposed model. The authors of [20] described the methods for making the EV communication secure by using cryptographic keys and establishing a public key infrastructure. The proposed model used visible light and acoustic side-channel techniques for minimizing the throughput requirement and providing device independence.
In [21], the authors compared different mechanisms employed in the SG for provisioning of incentives to users. Moreover, they also comprehensively considered the cloud-based V2V energy trading process. Comparison between different existing incentive-based trading schemes was done in order to establish an optimized scheme, which will increase the profit. The authors of [22] presented a decentralized security model that ensured that the trading security is enhanced in the P2P network. The scheduling of vehicle charging was also presented and was supported by a realistic infrastructure. A novel RES pricing scheme in smart cities was brought under consideration by the authors of [23] to achieve domestic electricity bill reduction. The charging schedule was performed using an advanced cross-entropy optimization technique. The proposed system was able to cut down the energy cost at both the community level and the individual level. A game-based energy trading model was proposed in [24] to work out the decision-making processes of electricity operators and consumers in VNs. Small Energy Suppliers (SESs) and Energy Consumers (ECs) were incorporated into the proposed system, and such strategies were designed that made the proposed system beneficial for both the SESs and ECs. By implementing various stochastic dynamic programming methods, the authors of [25] investigated the energy management in a Smart Home (SH) equipped with Plug-in EVs (PEVs) to address the issue of volatility of RES supply while considering the electricity cost.
The uncontrolled EV charging and discharging created problems for the grid and the CSs, e.g., amplifying the voltage peak, reducing the system’s stability, and creating voltage dips. Authors discussed the effects of EVs on energy demand and supply, stability, and reliability in [26]. Two different scenarios were discussed: Vehicle-to-Grid (V2G) and G2V. The authors of [27] proposed a double-layered model and tried to properly allocate the EV charging lots. In the first stage, lots were properly allocated, whereas, in the second stage, integration of RESs in the charging lots was studied. The authors of [28,29] studied the user response behavior, multi-resource coordination strategies, and hierarchies of the electricity markets to model incentive programs. Similarly, the authors of [30,31] proposed Micro-Grid (MG) scheduling for EV charging, and also discussed the algorithms that could make EV charging and discharging an easy and efficient task. Ways to reduce the operational costs and environmental pollution were also discussed.
Integrating RESs in EVs can prove to be a beneficial task and can overcome the hazards of environmental pollution. The authors of [32] proposed an MG architecture running on RESs. It is equipped with a charging lot and aggregated EVs. The main objective is to reduce charging cost and also to provide incentives to those EV users who took part in Demand Response (DR) strategies. The authors of [33] proposed a secure service-provisioning mechanism for lightweight clients. Blockchain technology is used to provide security and privacy to the network. In [34], the authors proposed the PageRank mechanism to assign reputation values to the customers. The customer with the highest reputation value is then authorized to add blocks in the blockchain network. Three different types of attacks were addressed using the modified form of Proof of Authority (PoA).
Conventionally, data are stored in a centralized server, which is vulnerable to attacks. The authors of [35] proposed a secure online storage scheme to store the data provided by users in a P2P manner. The users’ information is stored in the form of chunks, which protects it from attacks by malicious entities. All of the data and the metadata are stored online, which means that nothing is stored in the user node. The data are not compromised with the passage of time because they are accessed only by the authorized nodes. The proposed work ensures security provision to the users’ data. Similarly, to provide security for the medical data of the users, an attribute-based signature scheme with multiple authorities is proposed by the authors of [36]. In the proposed work, the medical data are attested by the respective patients to avoid disclosure of information to untrusted entities. The proposed work is compared with existing works, which further validates its performance. The authors of [37] proposed a blockchain-based data-sharing platform integrated with the IPFS. In the proposed model, the metadata are uploaded to the IPFS and then divided into a number of sectors. The users are assigned roles and are authenticated using digital signatures. The users are asked to give reviews of the data uploaded to IPFS. Upon successful data delivery, users are awarded with incentives. In this way, maximum honest reviews are uploaded against each file. The authors of [38] proposed a blockchain-based framework for document sharing and version control. The proposed work facilitated multi-user collaboration and change tracking in a secured and trusted environment. The documents are stored in the IPFS, which promotes security. In [39], the authors used the IPFS along with blockchain technology to provide a trusted data traceability and authorization protection mechanism. It also provides a transparent auditing track to trace the data delivery from the sender to the receiver. The proposed model is termed BlockIPFS, in which the metadata is stored in the IPFS and the respective hashes in the blockchain network. Table 1 gives a summary of the related work being studied.

2.1. Critical Analysis

In this subsection, different papers used in the related work (see Section 2) are critically analyzed and evaluated on the bases of three different factors, i.e., scalability, privacy, and resource utilization.

2.1.1. Scalability

Scalability is defined as the change in a system’s response with the change in hardware components or dataset size. The scalability of a system makes it efficient, competitive, and reputable. From all the papers discussed, References [14,19,21,33] considered scalability. However, some limitations still exist in these papers. For example, in [14], scalability is achieved at the expense of temporal complexity. With the increase in the number of iterations, the computational time also increases. In [19], hardware components’ scalability is achieved with the increase in number of blocks generated by EVs. This increase in number of blocks requires enhanced privacy provisioning. However, the proposed work lacks in providing the necessary privacy.

2.1.2. Privacy

Privacy is defined as the ability of an individual or a group of individuals to protect themselves from external interferences. It is of vital importance in any network, especially in blockchain technology, which removes the third party and helps in ensuring the privacy of the network users. Security, encryption, authentication, authorization, etc. all come under the umbrella of privacy. Different papers addressed privacy provisioning in blockchain-based models in different ways and for different purposes, like secure P2P energy trading [14], secure energy trading between EVs [22], and fair data sharing in deregulated SGs [34]. Encryption in the proposed networks of different papers also contributes towards privacy provisioning. The aforementioned three papers, along with Reference [19], used different encryption techniques to encrypt the data and promote data security. However, some limitations still exist; e.g., in [19], an asymmetric encryption technique is used, which fails when encrypting bulk transactions.

2.1.3. Resource Utilization

Resource utilization refers to the achievement of maximum output using minimum resources. This is in relation with the consensus mechanisms used in blockchain-based networks. The work done in References [33,34] is efficient in terms of resource utilization because they both use the PoA consensus mechanism. However, other papers mostly used the PoW consensus mechanism, which has the limitations of excessive power consumption and increased resource utilization.

3. Problem Statement

With the rapid advancements made in various fields of life, a huge shift from conventional forms to the latest and most advanced forms is observed. For instance, traditional grids have been transformed into SGs, which solve the issues of load mismanagement and users’ participation using two-way communication methods and advanced infrastructures. Previously, the centralized systems were being used to handle various tasks like sharing of data, energy trading, resource sharing, etc. These systems performed well in their respective domains. However, they have the issues of lack of security, trust, and privacy, along with increased costs and a single point of failure. These problems arise due to the vulnerability of the centralized systems to the malicious entities. To tackle these issues, centralized systems are being changed into decentralized systems, which further ensure reduction of vehicles’ charging costs, removal of the single point of failure, and minimization of charging time in the vehicular sector. Without a doubt, the decentralized systems have helped a great deal in solving the above-mentioned issues. Still, they face a number of issues, such as lack of increased security or enhanced privacy, absence of trustworthiness, and lack of users’ willingness to participate in the VNs, which need to be tackled. The causes of these issues are reliance on intermediate parties, usage of inefficient security protocols, involvement of inexperienced personel, etc. To tackle these issues, blockchain technology is introduced, which has some highly fascinating features like immutability, resistance to tampering, and security.
The concept of the smart city is not new; however, it still requires much work to transform the simpler cities into the smarter ones. A VN is also a major part of a smart city, which is to be made smart, intelligent, and to be powered using RESs. In modern times, vehicles are getting smarter, throttling is getting faster, and infrastructure is becoming more complex. To fully aid the movement of EVs on the roads and to enhance security of the VNs, the first and foremost requirement is the authentication of the vehicles [12]. The vehicles must be authorized before they become part of the network. Once the vehicles are authenticated, they are free to move in the VN without the fear of legal disobedience.
With the drastic increase in the number of vehicles, the issue of data storage also arises. The mobile vehicles communicate with the surrounding vehicles, Roadside Units (RSUs), and CSs, hence generating and sharing a huge amount of data continuously. As a result of this continuous data sharing, issues such as improper data storage and delayed timely response arise, which lead to mismanagement in VNs. The huge and ever-growing increase in the number of vehicles on the roads leads to further issues, such as road congestion and frequent traffic jams. Due to these reasons, road accidents are increasing in number, resulting in the loss of human life in some cases [40]. To further ensure secure and manageable provisioning of information between entities, a decentralized data storage mechanism is required [35]. Furthermore, to decrease the burden of data storage, the data must be filtered and made less redundant. The data filtration will help in solving the issue of data redundancy. Storage of less redundant data improves the efficiency of the overall VN and also solves the issue of delayed response. Due to the rapid migration of people from traditional vehicles to EVs, the need for proficient knowledge of people about the batteries installed within their vehicles is also increasing. Due to the low literacy rates in many countries, the issue of the lack of such awareness is arising. People are less knowledgeable about their vehicles and also about the exact locations of the charging entities, which causes mismanagement in the VNs. Moreover, the lack of knowledge about the methods required to calculate the shortest distance to the nearest charging entities, the time required to cover that distance, and the time required to charge the vehicles leads to burdens on charging entities and irregular flows of energy in the VNs [41]. This further leads to issues like load-shedding and imbalances between energy supply and demand.
To promote users’ participation and privacy, incentive provisioning and location privacy are factors that play vital roles. When users are guaranteed that they are being provided with enhanced security and better incentives, they tend to participate actively and without selfishness. However, much work has not been done in providing these two aspects simultaneously; therefore, they demand quick and active attention from the research community [42].

4. Proposed System Model

The proposed blockchain-based VN is comprised of EVs, MVs, CSs, an Authorization Unit (AU), and a TSIU. It covers various aspects, such as authentication of vehicles, charging scheduling of vehicles depending upon distance and charging time calculation, uploading and saving the files related to weather information and road conditions using the IPFS-integrated TSIU along with data redundancy minimization, incentive provisioning based on data credibility and timely responses by vehicles, etc. Moreover, the transaction details of the verified transactions are stored in a blockchain in a distributed manner; copies are kept at every node’s end, hence ensuring data integrity, trust, and transparency. Figure 1 shows the proposed system model comprised of all the involved entities. In the figure, different types of charging strategies, i.e., V2V, M2V, and G2V, are given. Moreover, the authorization of new vehicles by the AU is also shown in Figure 1. Along with that, the uploading of data to the RSUs and then to the TSIU and IPFS is also given in the same diagram. Furthermore, the incorporation of blockchain technology in the proposed system model is also shown. The blue arrows used in the diagram show the flow of data between different entities. The stepwise workflow of the proposed system model is given in Section 4.1.
The details of the entities involved in charging of vehicles are given below.
  • RSUs both store and provide the required information, such as weather conditions, road conditions, congestion and accidents, etc., to the vehicles.
  • CSs are the providers of energy/charge to the vehicles. They are situated at certain distances and remain in an active state at all times so that the EVs do not wait for a long time to be charged.
  • EVs are the ordinary vehicles; they act as consumers and are powered using electricity. They have batteries installed within, which help to store the charge and keep the vehicles moving. Once the batteries reach a certain level, they need to be charged again. The greater the storage capacity, the greater the distance the vehicles can cover.
  • MVs act as prosumers, i.e., they possess the capability of charging themselves using RESs and are capable of providing surplus energy to other neighboring EVs (acting as consumers). When MVs run out of energy and are in need of bulk energy, they send requests to CSs to get energy. Once charged, they are again able to provide energy to EVs moving in that area according to a proper schedule.
Table 2 shows the comparison between the work done in Reference [43] and the proposed work done in this paper. From this comparison, it is inferred that our work is almost 70–80% different from the work done in [43]. Different parameters are considered while carrying out this comparison, such as contributions made, mathematical formulations done, performance parameters chosen, etc.

4.1. Workflow of the Proposed System Model

The workflow of the proposed system model, shown in Figure 1 and discussed in the above section, is given here.
Step 1: Every new incoming vehicle in the network needs to be registered before it can become a part of the network and move freely. This registration is done through the AU, which assigns a pair of public and private keys to the vehicle.
Step 2: After a vehicle becomes a part of the network, it is supposed to send information to the nearest RSUs for storage purposes. This information can be of any type, such weather information, roadside information, or charging selling/buying requests. Meanwhile, the RSUs collect and save the incoming demands and the vehicles’ data, keeping a check on the total number of requests being made.
Step 3: As the number of vehicles increases, the amount of information generated and sent to the RSUs also increases. Therefore, the TSIU and IPFS are used to filter the data and reduce data redundancy.
Step 4: When a vehicle needs energy, it broadcasts its request in the network, which includes EVs, MVs, CSs, and RSUs. This request is received by all of the other nearest entities that are part of the network.
Step 5: Upon receiving the request, the RSU decides the best charging entity for the vehicle. For the selection of the charging entity, different factors are considered, such as traveling distance, time taken to cover the distance, etc. The distance between the entities is calculated using the Great-Circle Distance formula.
Step 6: After reaching a suitable charging entity selected by the vehicle, the time required for charging the vehicle is calculated. This time varies with the State of Charge (SoC).
Step 7: After the time required for charging the vehicle is calculated, the total charging cost is calculated, which involves charging cost, distance cost, waiting cost, and reward/penalty cost. All of these costs are summed up to give the final charging cost, which needs to be minimized.
Step 8: The vehicles are also awarded with incentives to increase their participation in the proposed model. The incentives are calculated using reputation values based on two factors: Timely response and credible message delivery. The vehicles with negative reputations are penalized up to a certain threshold value. After that, they are blacklisted and eventually removed from the network.
Table 3 shows the one-to-one mapping of the identified limitations with the proposed solutions. In the table, the limitations identified and discussed in Section 3 and shown in Figure 1 are referred to as L.1–L.9. The solutions proposed for tackling these limitations are also provided in Table 3 and are referred to as S.1–S.9.

4.2. Authentication of Vehicles

Figure 2 shows the authentication process of the vehicles, which was motivated by [44]. First of all, the new vehicles are directed towards the AU for registration. The arrows pointing towards the AU from the vehicles in Figure 2 show the coming in of new vehicles. The AU assigns unique identity key pairs to the vehicles, consisting of a private key and a public key. The personal data of vehicles are linked and accessed using the private key, whereas the public key is used when the request is to be made in the network. The AU signs every new incoming vehicle digitally using some sort of encryption technique and ensures the security of the vehicles and the network. Only the vehicles with the pair of keys are able to join the network and share information with other vehicles.

4.3. TSIU

The TSIU ensures the reliable transfer of information between the vehicles and the charging entities in a two-way communication manner. The pairs of keys assigned to the vehicles are digitally signed through the AU. The TSIU provides vehicles with various types of information, e.g., the weather conditions, the road congestion information, the locations of the CSs, etc. The vehicle users then decide upon what should be the optimal time and route for traveling using this information. This also helps to combat the range anxiety issue. The vehicle owners know beforehand how much battery charge and time is required for reaching the required destination so that they will not be in constant worry about the availability of the CSs. Figure 3 gives an overview of the TSIU model used. In the figure, different entities exist, such as EVs, MVs, TSIU, etc. The arrows used in the figure show the sharing of data between vehicles and the TSIU. All of the vehicles moving on the road are capable of sharing the road-related information with the TSIU, such as road conditions, number of vehicles, roadside accidents, etc. The TSIU is also capable of sharing this information with all of the vehicles at all times.
As all vehicles are capable of sending the information to the TSIU, this increases the burden on TSIU. To minimize it, the unwanted data are discarded before being sent to the TSIU. For removal of data redundancy, data filtration is performed by comparing the incoming data strings with the predefined string templates stored in the TSIU. If they both match, then the incoming data string will be stored in the TSIU. Otherwise, it will be discarded. Once the less redundant data are received by the TSIU, they are sent to the IPFS for further reducing the storage issue.


The vehicles send the information related to weather and road conditions to the TSIU, where this information is stored in the IPFS in a Distributed Hash Table (DHT). The IPFS helps in storing data in a secured distributed manner [45]. The hashes are assigned to each incoming file, and are then forwarded to the blockchain network. Whenever a new vehicle needs some information, it provides the hash to the TSIU, where it is matched with the existing hash. If the hashes are matched, then the information is provided to the vehicle. Otherwise, the request is regarded as fake. Once the information is provided to the network, the blockchain network is updated and a new transaction is stored in a block. The smart contract is written in Solidity and verified in RemixIDE for the IPFS. The main functions involved in the IPFS are: Add road file, add weather file, get file count, get file ID, and assign malicious state. The first two functions, i.e., add road file and add weather file, are for storing the files in the IPFS, and have maximum gas consumption. The other functions perform small tasks only; e.g., get file count gives the total number of files uploaded to the IPFS, get file ID gives the vehicle’s ID for a specific file, and assign malicious state checks for the malicious status of a vehicle. Therefore, these functions have minimum gas consumption. Figure 4 shows the sequence diagram of the IPFS. However, Algorithm 1 gives the working of the IPFS in the TSIU.

4.4. Location Privacy

In the proposed system model, the location of the vehicles is not shared with other entities in order to increase the vehicles’ privacy. This privacy is achieved using the AES128 encryption technique. The actual location of the vehicle in the network is only known to the vehicle authorized by it. Whenever any unauthorized vehicle wants to know the actual location of another vehicle, it first has to get itself authorized by that vehicle. Without authorization, it will only get an encrypted alphanumeric string, which is almost impossible to decrypt. This location privacy solves the issue of users’ hesitance to communicate with other vehicles.
Algorithm 1: Algorithm of IPFS
Sustainability 12 05151 i001

5. Charging Schedule

In this section, the charging schedule of the EVs is discussed. It is important to ensure that the EVs added in the proposed blockchain-based network should have a proper scheduling scenario. For calculation purposes, real-time data are taken from the Electric Vehicle Database [46] and are given in Table 4.

5.1. Scheduling of Vehicle Charging

Figure 5 shows the charging of an EV in three different sources, i.e., using an MV, using another EV, and using a CS. The charging source of the EV is decided by the EV according to the distance and price relationship. If the distance between the EV and the charging source is large, then the price will automatically be high. So, the EV will discard that source and go for the next nearest charging source.

5.2. Great-Circle Distance

In this subsection, the distance between vehicles, CSs, and MVs is calculated. This distance calculation is very important for the selection of the entity for charging purpose. This formula gives the shortest distance between two points on a spherical surface. The inputs are the longitude and the latitude values for two different locations. The output is the distance between the provided locations in terms of kilometers or miles [47]. Great-Circle Distance is used in this work because it gives the spherical distance between two entities located on the circumference of the circle. In our work, we set a threshold of 50 km for the selection of the charging entity by an EV. If the charging entity lies outside the 50 km radius, then it will not be selected. Algorithm 2 gives the algorithm for shortest distance selection using Great-Circle Distance. In the algorithm, lines 4–12 record the geographical coordinates of the EVs, MVs, and CSs, respectively. After recording the coordinates, line 13 calculates the distance between an EV and MV, an EV and CS, and an EV and another vehicle using the Great-Circle Distance formula. Furthermore, the conditional statements, e.g., the nested-if loop given in lines 14–26, help in determining the shortest distance.
Algorithm 2: Algorithm for shortest distance selection using the Great-Circle Distance.
Sustainability 12 05151 i002

5.3. Calculation of Time Taken for Covering the Distance

In this subsection, the total time taken by a vehicle for traversing the distance to the nearest charging entity, obtained using the Great-Circle Distance formula, is calculated. For this calculation, real-time data of four different EVs are used. The time taken by the vehicle for traversing the distance is given in minutes using Equation (1). The time taken for covering the distance is calculated by dividing the total distance between an EV and the nearest charging entity by the average speed of that EV.
T o t a l t i m e t a k e n = T o t a l d i s t a n c e A v e r a g e s p e e d

5.4. Calculation of Time Taken for Charging the Vehicles

In this subsection, the time taken for the charging of the vehicles is calculated. For calculation of the charging time, we make use of the real-time data given in Table 4. The time taken for charging the vehicles is taken in hours and is calculated using Equation (2).
T o t a l c h a r g i n g t i m e = B a t t e r y c a p a c i t y C h a r g i n g p o w e r

5.5. Charging Scheduling Algorithm

Algorithm 3 gives the charging schedule and cost calculation of the vehicles. Line 1 initializes the algorithm, whereas lines 2 and 3 are for declaring the inputs and the output. Line 4 finds the total number of vehicles present in the network. After finding the total number of vehicles, lines 5–13 calculate the SoC values of the vehicles to check which vehicles need charging and at what percentage. After that, lines 14–26 select the charging entity on the basis of distance.
Algorithm 3: Algorithm of Charging Schedule
Sustainability 12 05151 i003

6. Mathematical Formulation

This section provides the mathematical formulations of the calculations of the total charging cost and of the objective function in Section 6.1 and Section 6.2, respectively.

6.1. Charging Cost Calculation

The total charging cost is calculated by calculating the sum of four individual costs, i.e., charging cost, distance cost, waiting cost, and reward/penalty cost, motivated by [43]. These costs are denoted as C 1 T , C 2 T , C 3 T , and C 4 T , respectively. These costs are given in Equations (3)–(Section 6.1).
The first cost is the total charging cost for CSs, EVs, and MVs. P C S , P M V , and P E V are the generation costs per unit for CSs, EVs, and MVs, respectively, whereas C C S , C M V , and C E V are the energy selling costs for CSs, EVs, and MVs, respectively. The product of generation cost with the selling cost provides a complete cost of an entity; when the costs of all three entities are added up, the total charging cost is given, as shown in Equation (3).
C 1 T = ( P C S * i = 1 I C C S i ) + ( P M V * j = 1 J C M V j ) + ( P E V * k = 1 K C E V k )
After calculating the charging cost, the next cost that needs to be calculated is the distance cost. This cost is related to the distance between the charging and discharging entities. The main objective of the vehicles is that they should be charged using their closest entities, either using the CSs, MVs, or other EVs. Equation (4) calculates the total distance cost, where dis S 2 V , dis M 2 V , and dis V 2 V give the distance from vehicle to CS, vehicle to MV, and vehicle to EV, respectively.
C 2 T = ( P C S * d i s S 2 V ) + ( P M V * d i s M 2 V ) + ( P E V * d i s V 2 V )
The third cost, i.e., the waiting cost, also needs consideration. This cost is incurred when the vehicle needs to wait at the time of charging. For instance, a vehicle goes to the CS for charging. At that CS, a number of vehicles are already present for charging purposes. Therefore, this new incoming vehicle is added to the waiting queue. This is also implied even when the vehicle intends to be charged by the MV or the EV. So, for calculating this cost, the distance is calculated, and is then multiplied with the number assigned to the vehicle in the queue. This cost calculation is given in Equation (5).
C 3 T = ( d i s S 2 V * d i f f ( V , v ) ) * y = 1 Y V e y + z = 1 Z V m z
The fourth cost is the reward/penalty cost. If a certain vehicle saves some units of charge or if it generates some extra units that it can sell to other vehicles, then the particular vehicle is given some reward, and vice versa. Equation (6a), Equation (6b) show the reward and penalty calculations. In the given equations, Q is the price per unit, T s are the total units saved, and T w are the units wasted; ev and mv are the numbers of EVs and MVs, respectively.
C 4 T r = ( Q * T s ) * l = 1 L e v l + m = 1 M m v m
C 4 T p = ( Q * T w ) * l = 1 L e v l + m = 1 M m v m
Equations (3)–(6) are all summed up to calculate the total cost, as given in Equation (7).
C Total = C 1 T + C 2 T + C 3 T + C 4 Tr / 4 Tp

6.2. Objective Function

The total charging cost is minimized using Equation (11), which is the objective function [43].
m i n ( C T o t a l ) = C 1 T + C 2 T + C 3 T + C 4 T
It is subject to following constraints:
  • Minimizing the EV and MV charging costs, as given in Equations (9a) and (9b).
    0 C M V C M V m a x
    0 C E V C E V m a x
  • The other is maximizing the units saved or minimizing the units being wasted, as given in Equation (9c).
    m a x ( T s ) o r m i n ( T w )

6.3. Comparison of Equations

In this subsection, the comparison between the existing equations [43] and our proposed equations is given in a tabular form. This comparison helps the reader to understand which changes have been made to the previous equations, which help in further reducing the total charging cost. Table 5 gives the comparison of Equations (3)–(9c). In the first column, the Equations used in [43] are given. The Equations used in our paper are given in the second column. In the third column, the differences between the equations are given.

7. Power Flow and Associated Losses

In the charging of EVs, efficient energy flow plays an important role. This is because EVs may pose serious economical impacts if not charged properly. The major reason behind this economic disturbance is the ultimate loss that is incurred while charging EVs [48]. This loss is further comprised of different losses that occur due to inefficiency of inverters, worn and outdated infrastructure, weather conditions, etc. These losses occur in all types of charging strategies, like V2G, V2V, and M2V. These losses not only pose economic concerns, but also lead to degradation of the lifetime of the batteries installed within the vehicles [49]. The amounts of the economic losses incurred in the V2G are the maximum, while they are minimum in M2V. The reason is because V2G uses conventional fuels for charging vehicles, whereas M2V uses RESs, due to which both the financial and the infrastructural losses are minimized. Figure 6 shows different types of losses incurred in VNs, termed Loss 1, Loss 2 and Loss 3. Loss 1 is cable loss, which occurs due to the usage of old and worn cables. Loss 2 and Loss 3 are the losses that occur due to inverters’ inefficiencies and severe weather conditions, respectively.

Formulating the Associated Energy Losses

In this subsection, the energy losses associated with the charging of vehicles are formulated along with the parameters they rely on. Equation (10) is used for calculating the Total Power Loss ( P l o s s t o t a l ) incurred while charging the vehicles.
P l o s s t o t a l = ( L c a b l e * I t ) + η i n v e r t e r ¯ + ω ,
where, L c a b l e denotes the cable length, and I t shows the current passing through the cable at time t. η i n v e r t e r ¯ represents the inefficiency of an inverter installed within a vehicle and ω denotes the weather effects on the charging process. The ranges of these parameters are given in Table 6. The value of η i n v e r t e r ¯ depends on the life cycle of the vehicle’s battery, while the value of the weather effect coefficient ω depends on the effects caused by weather conditions, i.e., its value is 0 when there is no effect, while the value is 1 in the case of severe weather effects.
The objective function is formulated to minimize the P l o s s t o t a l , given in Equation (8). The objective function can be achieved using updated and efficient cables, inverters, batteries, etc., and by increasing the insulation to protect the devices against severe weather effects.
O b j e c t i v e F u n c t i o n = m i n ( P l o s s t o t a l )
This is subject to the constraints provided in Equations (12a)–(12d).
  • The length of a cable used for charging the vehicles should lie within a specific range, given in Equation (12a). If a longer cable is used, then the power losses will be greater, and vice versa [50].
    0 < L c a b l e 5 m
  • The current supplied at a certain time t should lie within a specific range, taken from [51] and given in Equation (12b).
    16 A m p I t 32 A m p
  • The inefficiency of an inverter installed within a vehicle should not be greater than a certain limit, given in Equation (12c). There exists a direct relation between the inefficiency of an inverter and the power losses [52].
    0 η e f f i c i e n c y ¯ 40 %
  • The charging infrastructure should not be affected by weather conditions to a great extent. Equation (12d) gives the value of the weather effect coefficient, i.e., ω .
    0 ω < 1
Moving ahead, the losses that occur in the aforementioned strategies are discussed according to case. Cases 1–3 discuss the energy losses in V2G, V2V, and M2V, respectively. The discussions of these cases, along with the mathematical equations, are given below.
  • Case 1: Energy Losses in V2G
    In this case, the losses incurred in V2G charging of vehicles are discussed. In V2G, maximum economic losses occur, while the power losses are less as compared to the V2V charging strategy. The reason for the maximal economic losses is the usage of conventional fuels in the charging stations. The power losses incurred in V2G are calculated using Equation (10).
  • Case 2: Energy Losses in V2V
    In V2V charging of vehicles, the maximum amount of power losses occurs. The reason is increased amount of inefficiency of the inverters [52]. Energy trading is done between two vehicles, both equipped with energy inverters; therefore, the inverter inefficiency will be squared, i.e., ( η i n v e r t e r ) ¯ 2 . Equation (13) is used to calculate the power loss incurred in V2V charging of vehicles.
    P l o s s t o t a l = ( L c a b l e * I t ) + ( η i n v e r t e r ¯ ) 2 + ω
  • Case 3: Energy Losses in M2V
    In M2V, we have the minimum amounts of both economic and power losses. The primary reason is that the Mobile Vehicles (MVs) make use of RESs to generate electricity and have the ability to store and provide the surplus amount of energy to other EVs. The power loss incurred in the M2V charging strategy is calculated using Equation (13).

8. Incentive Provisioning

In the proposed model, the EVs with high message credibility and good timely responses are given reputation and incentives to motivate them further. On the other hand, the EVs that act maliciously or that have low message credibility are penalized. The degree of the penalty is more than the degree of reward given to the vehicles to restrict them from acting maliciously or selfishly. The reputation and incentives are provided on the basis of the following two conditions.
  • The vehicles should respond to other vehicles or RSUs in a predefined time. In our case, this value is set to be 15 s.
  • The messages delivered by the vehicles should be credible, i.e., having only predefined identities in the message string. The messages with vehicle ID, locations of events, status of events, and times of event occurrence are considered credible.
The vehicles delivering authentic messages are given a reputation value of +1 and are awarded with $1 as an incentive, whereas the vehicles broadcasting fake messages are given a reputation value of −1 and penalized $1.5. At the beginning, all vehicles are given equal reputation values. The vehicles that continuously broadcast fake messages are finally blacklisted after their reputation value reaches −1. Figure 7 shows the flowchart of the rewards and penalties incurred by the vehicles.

9. Results and Discussion

This section covers the simulation results and their discussion.

9.1. Simulation Environment

The simulations are performed in two different environments: Solidity in Visual Studio Code and RemixIDE. Solidity is used for writing smart contracts and is provided by Ethereum. The connectivity of smart contracts with the web interface is done using MetaMask. To log into MetaMask, accounts with digital currency are required. These accounts are provided by Ganache. The smart contracts cover the registration of the vehicles and the nature of the requests being made: Requests accepted and requests denied. In the later stage, the charging schedule was done in Spyder (Python 3.6 package), provided by Anaconda. These simulations were performed on HP 450G ProBook with a 1 TB hard drive and 8 GB RAM.

9.2. Simulation Parameters

Table 7 shows the average values of different simulation parameters that were used in the proposed work. These values are taken from the Electric Vehicle Database [46].
Initially, when the smart contract was made and deployed, the transaction and execution costs were calculated. These costs are calculated in terms of ‘gas’. Table 8 shows the values of Ether and its multipliers. These values are taken from [53].
Figure 8 shows the transaction and execution costs in terms of gas for five different functions. These are some of the functions used in the smart contract deployed for vehicles’ registration and charging scheduling. It is seen that the function “EV registration” incurs the highest gas consumption, as it is the major function that assigns details to all new EVs added to the system. Similar behavior is observed for “MV registration”, the function designed to add new MVs to the network. The transaction costs are always higher than the execution costs because the former costs are linked with the deployment of the contract, whereas the latter costs are incurred while executing a specific function.
Figure 9 shows the comparison between the time taken to store the redundant information and the time taken to store the filtered information in the TSIU. A vivid difference is seen in the aforementioned times. Along with time reduction, the storage burden on the TSIU is also decreased. The data with more than the predefined number of entities, i.e., ID of the vehicle, location of the vehicle, time of reporting, and nature of the event that occurred are discarded, as more data entities will increase the storage burden on the TSIU.
Figure 10 shows the cost comparison between the transaction cost and the execution cost when a vehicle uploads the weather information and road information to the TSIU. The graph shows the gas consumption for five different functions, which are included in the smart contract. It is seen that the gas consumptions of add weather file and add road file are greater in comparison with other functions. The reason is that these files consist of all of the weather-related information and the road-related information.
Figure 11 shows the average payments and rewards of the charging and discharging EVs. A comparison was done between the existing techniques and the proposed techniques. This graph was motivated by [54]. The graph shows that the costs are reduced as compared to the existing work due to the scheduling algorithm proposed in this paper. The graph also shows that the convergence rate for both the payments of charging EVs and rewards of discharging EVs are fast in comparison with the existing techniques.
Figure 12 shows the charging price and the traveling price of G2V, V2V, and M2V. It is observed that both the charging price and the traveling price are less for the proposed technique, i.e., M2V. This is because, when charging through the CSs, waiting cost and distance cost are also incurred by the vehicles. On the other hand, charging through the EVs incurs the distance cost along with the charging cost of the EVs through CSs. MVs, on the other hand, have lower charging costs because they are equipped with batteries and are self-charged. So, the major cost that exists in M2V is the distance cost. Figure 12 shows the increasing trend with the increasing number of vehicles. The traveling cost consists of fuel costs, maintenance costs, etc.
The time taken by the EVs to be charged is shown in Figure 13. In the figure, real-time data of four different EVs are used, as given in Table 4 in Section 5.3. The charging time is calculated using Equation (2). It is observed from the figure that the time taken to charge the Nissan Leaf is the maximum, as it has the slowest charging speed of all of the vehicles. All EVs are charged using Type-2 chargers, which allow the vehicles to be charged both from single-phase and three-phase main supplies.
Figure 14 shows the time taken by four different vehicles to cover the distance to the nearest charging entities. For this time calculation, real-time data of four different EVs are used, which are given in Table 4 in Section 5.3. This time is calculated using Equation (1).
The real-time power losses incurred in all three charging strategies, i.e., V2G, V2V, and M2V are shown in Figure 15, Figure 16, Figure 17 and Figure 18. The comparison of cable losses incurred in the aforementioned charging strategies is shown in Figure 15. It is observed that the cable loss incurred in V2G is the maximum because it also includes the transformer loss along with other losses, like copper loss, hysteresis loss, etc.
Figure 16 shows the comparison between the inverter losses of V2G, V2V, and M2V. It is seen that the inverter losses are the greatest for both V2G and M2V because, in these strategies, two inverters are involved simultaneously, which means that the inverters’ inefficiencies will be squared.
Moving on, the third type of loss incurred in vehicle charging is due to the effects caused by weather conditions. The comparison between these losses is given in Figure 17. It is observed that the weather losses are the most in V2G because it also involves the weather effects on other devices, such as transformers, circuit breakers, etc.
In Figure 18, the combined losses for the three different strategies are given. The total combined loss involves the cable loss, inverter loss, and loss caused by sever weather effects. It can be seen that V2V has the maximum amount of incurred losses, mainly due to the increase in inefficiency of the inverters.
Figure 19 shows the participation rates of users with the increase in the reputation values, which in turn increases the amount of incentives awarded. These reputation values are given on the basis of timely responses of credible messages. In accordance with these, monetary incentives are given. On the contrary, the incentives are converted into penalties upon false reputation values and are deducted from users’ wallets. The amount of the penalty charged is more than the incentive given to users. This difference in amount restricts the users from acting maliciously.
Figure 20 and Figure 21 show the number of hashes generated and the mining time for the transactions performed against different difficulty levels. It is observed that both the number of hashes generated and the mining time taken increase with the increase in difficulty level. Difficulty is defined as the measure of the complexity for miners to find a hash or a signature for a block in the network. The hash is generated using random numbers. The number of zeros that a signature requires initially determines the difficulty level. The formula for calculating difficulty is given in Equation (14), taken from [55].
d i f f i c u l t y = H a s h t a r g e t ( g e n e s i s b l o c k ) H a s h t a r g e t ( c u r r e n t b l o c k )
where the target is a 256 bit number. The hash target becomes smaller and smaller, thereby making the difficulty greater.
Table 9 gives an abstract view of the simulation results given above and maps them with the limitations that they tackle. The limitations identified in Figure 1 and further mentioned in Table 3 are given in Table 9 along with the proposed solutions that are given in Table 3. In the fourth column of Table 9, the validation results are presented and mapped with the identified limitations.
Table 10 gives the values of the public key and the private key generated for 10 different vehicles. The public key is open to all the participants of the network, whereas the private key is used only by a specific participant and also for digitally signing the transactions. Table 11 gives all the important details related to the contract creation phase. It is seen that both the execution cost and the transaction cost of contract creation are the greatest because they cover all the functions involved in the smart contract.
Table 12 and Table 13 give the details related to the EV and MV registration in the proposed blockchain network. Whenever a new vehicle wants to join the network, it first has to register itself through a central entity. For registration purposes, information consisting of different aspects of a vehicle is required, such as ID, model, make, etc. Moreover, Table 14 and Table 15 show the details associated with the scheduling of the energy in the future. Initially, the energy of the current time slot is calculated.
Then, the energy requirement for the next time slot is calculated; finally, energy is scheduled as per the requirements. Table 16 gives the values for the mining time and number of hashes generated against different difficulty levels in tabular form. In the table, difficulty level is abbreviated as ‘Diff. level’. Diff. level 1 is not addressed because it performs transactions in a very short time as compared to other difficulty levels. Difficulty is encountered when mining is performed using PoW. The mining becomes difficult with the increase in the difficulty level. This table makes the comparison between different difficulty levels easy to understand.
Figure 22 shows the output results when a weather information file is added to the IPFS according to the conditions set in the smart contract. Similarly, Figure 23 shows the output when the IPFS assigns a malicious state to a vehicle, denies the file retrieval request, and considers it a malicious request. Figure 24 shows the output results when a user inquires about the total number of files stored already in the IPFS and retrieves the ID of a specific file from the IPFS. Similar outputs are obtained when a road information file is added to the IPFS.

10. Conclusion and Future Work

In this paper, the vehicles communicate with each other in a P2P manner for data sharing and energy trading. For an efficient charging schedule of the vehicles, new algorithms are proposed. Using the scheduling algorithm, an efficient cost reduction is observed. The proposed work uses blockchain technology for vehicles’ registration and also for ensuring the immutability, security, and tamper proof-nature of the data. In the proposed work, the PoW consensus mechanism is used to achieve consensus between nodes, which makes the entire system trustworthy. The data generated by the vehicles are important entities and are stored in the TSIU after filtration.
Moreover, the shortest distance between an EV and the nearest charging entity is calculated using the Great-Circle Distance formula. The time taken by the EVs to cover this distance and the time taken to charge are also calculated in this work. Moving ahead, user participation is increased by awarding the users with incentives based upon their reputation and also by providing them with location privacy. The locations of vehicles are encrypted using the AES128 encryption technique. The power flow and the associated energy losses are also presented in this work. The mathematical formulation guarantees that all possible costs are calculated and the total charging cost is reduced. The proposed vehicle charging scenario, i.e., M2V, is compared with the existing scenarios, i.e., G2V and V2V, and the results are shown in the simulation section. Furthermore, the simulation results show that the charging cost incurred using M2V is 20–25% less than in V2V and 35–40% less than in G2V. It is also observed that the time required to store the data in TSIU is almost 45–50% less for filtered data in comparison with original data, which reduces the storage complexity. Besides the positive aspects of the proposed system, it still has some limitations. For example, PoW is used in the proposed system, which has the major limitation of being computationally resource-expensive.
In the future, PoW will be replaced with a better consensus mechanism to deal with the issue of excessive resource utilization. Moreover, AES128 will be replaced by a better encryption technique to enhance privacy provisioning.

Author Contributions

M.U.J. and N.J. proposed and implemented the main idea, M.U.J. and M.R. performed the simulations and wrote the simulations section, N.J., A.A., and M.T. organized and refined the manuscript, and M.U.J. and N.J. worked together and responded to the respected reviewers’ comments. Supervision, N.A. All authors have read and agreed to the published version of the manuscript.


This research was funded by Deanship of Scientific Research, King Saud University, through the Vice Deanship of Scientific Research.


The authors are grateful to the Deanship of Scientific Research, King Saud University, KSA for funding through the Vice Deanship of Scientific Research Chairs.

Conflicts of Interest

The authors declare no conflict of interest.


The following abbreviations are used in this paper:
AUAuthorization Unit
B 2 ITSBlockchain-based Intelligent Transport System
CSCharging Station
DHTDistributed Hash Table
ECEnergy Consumer
ECUElectronic Control Unit
EVElectric Vehicle
ICTInformation and Communication Technologies
IoTInternet of Things
IPFSInter-Planetary File System
IVIntelligent Vehicle
LAGLocal Aggregator
MDPMarkov Decision Process
PtMSParallel transportation Management System
RESRenewable Energy Sources
PoSProof of Stake
PoWProof of Work
SESSmall Energy Supplier
SHSmart Homes
SGSmart Grid
TSIUTransport System Information Unit
VNVehicular Network
VANETVehicular Ad-hoc Network
WSNWireless Sensor Network
C C S CS charging cost
C E V EV charging cost
C M V MV charging cost
C E V m a x Maximum EV charging cost
C M V m a x Maximum MV charging cost
C 1 T Charging cost
C 2 T Distance cost
C 3 T Waiting cost
C 4 T r Reward cost
C 4 T p Penalty cost
C S l a t Latitude of CS
C S l o n g Longitude of CS
C T o t a l Total cost
d i s S 2 V Distance between vehicle and CS
d i s M 2 V Distance between vehicle and MV
d i s V 2 V Distance between vehicle and EV
E V l a t Latitude of EV
E V l o n g Longitude of EV
I t Current at time t
L c a b l e Length of charging cable
M V l a t Latitude of MV
M V l o n g Longitude of MV
P C S CS generation price
P E V EV generation price
P M V MV generation price
P l o s s t o t a l Total power loss
QPrice per unit
T s Saved units
T w Wasted units
VTotal number of vehicles in queue
vNumber of incoming vehicle
η e f f i c i e n c y ¯ Inverter inefficiency
τ Threshold distance
δ Threshold difference between vehicles in charging queue
ω Weather effect coefficient


  1. Xie, S.; Zhong, W.; Xie, K.; Yu, R.; Zhang, Y. Fair energy scheduling for vehicle-to-grid networks using adaptive dynamic programming. IEEE Trans. Neural Netw. Learn. Syst. 2016, 27, 1697–1707. [Google Scholar] [CrossRef]
  2. Usman, M.; Knapen, L.; Bellemans, T.; Janssens, D.; Wets, G. Optimal recharging framework and simulation for electric vehicle fleet. Future Gener. Comput. Syst. 2020, 107, 745–757. [Google Scholar] [CrossRef]
  3. Liu, C.; Chai, K.K.; Zhang, X.; Lau, E.T.; Chen, Y. Adaptive blockchain-based electric vehicle participation scheme in smart grid platform. IEEE Access 2018, 6, 25657–25665. [Google Scholar] [CrossRef]
  4. Noel, L.; de Rubens, G.Z.; Sovacool, B.K.; Kester, J. Fear and loathing of electric vehicles: The reactionary rhetoric of range anxiety. Energy Res. Soc. Sci. 2019, 48, 96–107. [Google Scholar] [CrossRef]
  5. Aitzhan, N.Z.; Svetinovic, D. Security and privacy in decentralized energy trading through multi-signatures, blockchain and anonymous messaging streams. IEEE Trans. Dependable Secur. Comput. 2018, 15, 840–852. [Google Scholar] [CrossRef]
  6. Alghamdi, T.A.; Ali, I.; Javaid, N.; Shafiq, M. Secure Service Provisioning Scheme for Lightweight IoT Devices with a Fair Payment System and an Incentive Mechanism based on Blockchain. IEEE Access 2019, 8, 1048–1061. [Google Scholar] [CrossRef]
  7. Sultana, T.; Almogren, A.; Akbar, M.; Zuair, M.; Ullah, I.; Javaid, N. Data Sharing System Integrating Access Control Mechanism using Blockchain-Based Smart Contracts for IoT Devices. Appl. Sci. 2020, 10, 488. [Google Scholar] [CrossRef][Green Version]
  8. Khalid, R.; Javaid, N.; Almogren, A.; Javed, M.U.; Javaid, S.; Zuair, M. A blockchain based load balancing in decentralized hybrid P2P energy trading market in smart grid. IEEE Access 2020, 8, 47047–47062. [Google Scholar] [CrossRef]
  9. Samuel, O.; Almogren, A.; Javaid, A.; Zuair, M.; Ullah, I.; Javaid, N. Leveraging Blockchain Technology for Secure Energy Trading and Least-Cost Evaluation of Decentralized Contributions to Electrification in Sub-Saharan Africa. Entropy 2020, 22, 226. [Google Scholar] [CrossRef][Green Version]
  10. Yahaya, A.S.; Javaid, N.; Alzahrani, F.A.; Rehman, A.; Ullah, I.; Shahid, A.; Shafiq, M. Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism. Sustainability 2020, 12, 3385. [Google Scholar] [CrossRef][Green Version]
  11. Shahid, A.; Almogren, A.; Javaid, N.; Al-Zahrani, F.A.; Zuair, M.; Alam, M. Blockchain-Based Agri-Food Supply Chain: A Complete Solution. IEEE Access 2020, 8, 69230–69243. [Google Scholar] [CrossRef]
  12. Zhang, T.; Pota, H.; Chu, C.C.; Gadh, R. Real-time renewable energy incentive system for electric vehicles using prioritization and cryptocurrency. Appl. Energy 2018, 226, 582–594. [Google Scholar] [CrossRef]
  13. Luo, Y.; Zhu, T.; Wan, S.; Zhang, S.; Li, K. Optimal charging scheduling for large-scale EV (electric vehicle) deployment based on the interaction of the smart-grid and intelligent-transport systems. Energy 2016, 97, 359–368. [Google Scholar] [CrossRef]
  14. Kang, J.; Yu, R.; Huang, X.; Maharjan, S.; Zhang, Y.; Hossain, E. Enabling localized peer-to-peer electricity trading among plug-in hybrid electric vehicles using consortium blockchains. IEEE Trans. Ind. Inform. 2017, 13, 3154–3164. [Google Scholar] [CrossRef]
  15. Tian, Z.; Jung, T.; Wang, Y.; Zhang, F.; Tu, L.; Xu, C.; Tian, C.; Li, X.Y. Real-time charging station recommendation system for electric-vehicle taxis. IEEE Trans. Intell. Transp. Syst. 2016, 17, 3098–3109. [Google Scholar] [CrossRef]
  16. JJaved, M.U.; Javaid, N. Scheduling charging of electric vehicles in a secured manner using blockchain technology. In Proceedings of the 17th International Conference on Frontiers of Information Technology, Islamabad, Pakistan, 16–18 December 2019. [Google Scholar]
  17. Yong, Y.; Wang, F.-Y. Towards blockchain-based intelligent transportation systems. In Proceedings of the 2016 IEEE 19th International Conference on Intelligent Transportation Systems, Rio de Janeiro, Brazil, 1–4 November 2016. [Google Scholar]
  18. Leiding, B.; Parisa, M.; Dieter, H. Self-managed and blockchain-based vehicular ad-hoc networks. In Proceedings of the 2016 ACM International Joint Conference on Pervasive and Ubiquitous Computing: Adjunct, Heidelberg, Germany, 12–16 September 2016. [Google Scholar]
  19. Dorri, A.; Steger, M.; Kanhere, S.S.; Jurdak, R. Blockchain: A distributed solution to automotive security and privacy. IEEE Commun. Mag. 2017, 55, 119–125. [Google Scholar] [CrossRef][Green Version]
  20. Rowan, S.; Michael, C.; Meriel, H.; Ciaran Mc, G. Securing vehicle to vehicle data sharing using blockchain through visible light and acoustic side-channels. arXiv 2017, arXiv:1704.02553. [Google Scholar]
  21. Zhang, K.; Yuming, M.; Supeng, L.; Sabita, M.; Yan, Z.; Alexey, V.; Magnus, J. Incentive-driven energy trading in the smart grid. IEEE Access 2016, 4, 1243–1257. [Google Scholar] [CrossRef]
  22. 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]
  23. Liu, Y.; Hu, S. Renewable energy pricing driven scheduling in distributed smart community systems. IEEE Trans. Parallel Distrib. Syst. 2017, 28, 1445–1456. [Google Scholar] [CrossRef]
  24. Zhang, B.; Jiang, C.; Yu, J.; Han, Z. A contract game for direct energy trading in smart grid. IEEE Trans. Smart Grid 2018, 9, 2873–2884. [Google Scholar] [CrossRef]
  25. Wu, X.; Hu, X.; Yin, X.; Moura, S.J. Stochastic optimal energy management of smart home with PEV energy storage. IEEE Trans. Smart Grid 2018, 9, 2065–2075. [Google Scholar] [CrossRef]
  26. Mozafar, M.R.; Amini, M.H.; Moradi, M.H. Innovative appraisement of smart grid operation considering large-scale integration of electric vehicles enabling V2G and G2V systems. Electr. Power Syst. Res. 2018, 154, 245–256. [Google Scholar] [CrossRef]
  27. Amini, M.H.; Moghaddam, M.P.; Karabasoglu, O. Simultaneous allocation of electric vehicles’ parking lots and distributed renewable resources in smart power distribution networks. Sustain. Cities Soc. 2017, 28, 332–342. [Google Scholar] [CrossRef]
  28. Vallés, M.; Bello, A.; Reneses, J.; Frías, P. Probabilistic characterization of electricity consumer responsiveness to economic incentives. Appl. Energy 2018, 216, 296–310. [Google Scholar] [CrossRef]
  29. Eissa, M.M. First time real time incentive demand response program in smart grid with “i-Energy” management system with different resources. Appl. Energy 2018, 212, 607–621. [Google Scholar] [CrossRef]
  30. Mortaz, E.; Valenzuela, J. Microgrid energy scheduling using storage from electric vehicles. Electr. Power Syst. Res. 2017, 143, 554–562. [Google Scholar] [CrossRef]
  31. Lu, X.; Zhou, K.; Yang, S. Multi-objective optimal dispatch of microgrid containing electric vehicles. J. Clean. Prod. 2017, 165, 1572–1581. [Google Scholar] [CrossRef]
  32. Aliasghari, P.; Mohammadi-Ivatloo, B.; Alipour, M.; Abapour, M.; Zare, K. Optimal scheduling of plug-in electric vehicles and renewable micro-grid in energy and reserve markets considering demand response program. J. Clean. Prod. 2018, 186, 293–303. [Google Scholar] [CrossRef]
  33. Rehman, M.; Javaid, N.; Awais, M.; Imran, M.; Naseer, N. Cloud based Secure Service Providing for IoTs using Blockchain. In Proceedings of the IEEE Global Communications Conference, Waikoloa, HI, USA, 9–13 December 2019. [Google Scholar]
  34. Samuel, O.; Javaid, N.; Awais, M.; Ahmed, Z.; Imran, M.; Guizani, M. A Blockchain Model for Fair Data Sharing in Deregulated Smart Grids. In Proceedings of the IEEE Global Communications Conference, Waikoloa, HI, USA, 9–13 December 2019. [Google Scholar]
  35. Fukumitsu, M.; Hasegawa, S.; Iwazaki, J.; Sakai, M.; Takahashi, D. A proposal of a secure P2P-type storage scheme by using the secret sharing and the blockchain. In Proceedings of the 2017 IEEE 31st International Conference on Advanced Information Networking and Applications, Taipei, Taiwan, 27–29 March 2017. [Google Scholar]
  36. Guo, R.; Shi, H.; Zhao, Q.; Zheng, D. Secure attribute-based signature scheme with multiple authorities for blockchain in electronic health records systems. IEEE Access 2018, 6, 11676–11686. [Google Scholar] [CrossRef]
  37. Naz, M.; Al-zahrani, F.A.; Khalid, R.; Javaid, N.; Qamar, A.M.; Afzal, M.K.; Shafiq, M. A Secure Data Sharing Platform Using Blockchain and Interplanetary File System. Sustainability 2019, 11, 7054. [Google Scholar] [CrossRef][Green Version]
  38. Nizamuddin, N.; Salah, K.; Azad, M.A.; Arshad, J.; Rehman, M.H. Decentralized document version control using ethereum blockchain and IPFS. Comput. Electr. Eng. 2019, 76, 183–197. [Google Scholar] [CrossRef][Green Version]
  39. Nyaletey, E.; Parizi, R.M.; Zhang, Q.; Choo, K.-K.R. BlockIPFS—blockchain-enabled interplanetary file system for forensic and trusted data traceability. In Proceedings of the 2nd IEEE International Conference on Blockchain, Atlanta, GA, USA, 14–17 July 2019. [Google Scholar]
  40. Su, Z.; Wang, Y.; Xu, Q.; Fei, M.; Tian, Y.; Zhang, N. A secure charging scheme for electric vehicles with smart communities in energy blockchain. IEEE Internet Things J. 2018, 6, 4601–4613. [Google Scholar] [CrossRef][Green Version]
  41. Wang, Y.; Su, Z.; Zhang, N. BSIS: Blockchain-based secure incentive scheme for energy delivery in vehicular energy network. IEEE Trans. Ind. Inform. 2019, 15, 3620–3631. [Google Scholar] [CrossRef]
  42. Chaudhary, R.; Jindal, A.; Aujla, G.S.; Aggarwal, S.; Kumar, N.; Choo, K.-K.R. BEST: Blockchain-based secure energy trading in SDN-enabled intelligent transportation system. Comput. Secur. 2019, 85, 288–299. [Google Scholar] [CrossRef]
  43. Huang, X.; Zhang, Y.; Li, D.; Han, L. An optimal scheduling algorithm for hybrid EV charging scenario using consortium blockchains. Future Gener. Comput. Syst. 2019, 91, 555–562. [Google Scholar] [CrossRef]
  44. Singh, M.; Kim, S. Branch based blockchain technology in intelligent vehicle. Comput. Netw. 2018, 145, 219–231. [Google Scholar] [CrossRef]
  45. Javed, M.U.; Rehman, M.; Javaid, N.; Aldegheishem, A.; Alrajeh, N.; Tahir, M. Blockchain-Based Secure Data Storage for Distributed Vehicular Networks. Appl. Sci. 2020, 10, 2011. [Google Scholar] [CrossRef][Green Version]
  46. “EV Database”. EV Database. 2020. Available online: (accessed on 1 May 2020).
  47. Porcu, E.; Bevilacqua, M.; Genton, M.G. Spatio-temporal covariance and cross-covariance functions of the great circle distance on a sphere. J. Am. Stat. Assoc. 2016, 111, 888–898. [Google Scholar] [CrossRef]
  48. Abdolmaleki, M.; Masoud, N.; Yin, Y. Vehicle-to-vehicle wireless power transfer: Paving the way toward an electrified transportation system. Transp. Res. Part C Emerg. Technol. 2019, 103, 261–280. [Google Scholar] [CrossRef]
  49. Apostolaki-Iosifidou, E.; Codani, P.; Kempton, W. Measurement of power loss during electric vehicle charging and discharging. Energy 2017, 127, 730–742. [Google Scholar] [CrossRef]
  50. ‘Losses In Distribution & Transmission Lines | Electrical India Magazine On Power & Electrical Products, Renewable Energy, Transformers, Switchgear & Cables’. Electrical India Magazine On Power & Electrical Products, Renewable Energy, Transformers, Switchgear & Cables. 2020. Available online: (accessed on 20 May 2020).
  51. Electric Vehicle Charging 101 | Calevip. Calevip.Org. 2020. Available online: (accessed on 20 May 2020).
  52. Koufakis, A.-M.; Rigas, E.S.; Bassiliades, N.; Ramchurn, S.D. Offline and online electric vehicle charging scheduling with V2V energy transfer. IEEE Trans. Intell. Transp. Syst. 2019. [Google Scholar] [CrossRef]
  53. Wood, G. Ethereum: A secure decentralised generalised transaction ledger. Ethereum Project Yellow Pap. 2014, 151, 1–32. [Google Scholar]
  54. Kim, O.T.T.; Tran, N.H.; Nguyen, V.; Kang, S.M.; Hong, C.S. Cooperative between V2C and V2V charging: Less range anxiety and more charged EVs. In Proceedings of the 2018 International Conference on Information Networking, Chiang Mai, Thailand, 10–12 January 2018. [Google Scholar]
  55. Nanayakkara, H. Blockchain Mining Difficulty. The Geveo Blog. 2019. Available online: (accessed on 10 May 2020).
Figure 1. Proposed system model.
Figure 1. Proposed system model.
Sustainability 12 05151 g001
Figure 2. Authentication of vehicles.
Figure 2. Authentication of vehicles.
Sustainability 12 05151 g002
Figure 3. TSIU Model.
Figure 3. TSIU Model.
Sustainability 12 05151 g003
Figure 4. Sequence diagram of the IPFS.
Figure 4. Sequence diagram of the IPFS.
Sustainability 12 05151 g004
Figure 5. Charging process of an EV using different sources.
Figure 5. Charging process of an EV using different sources.
Sustainability 12 05151 g005
Figure 6. Energy losses in Vehicular Networks (VNs).
Figure 6. Energy losses in Vehicular Networks (VNs).
Sustainability 12 05151 g006
Figure 7. Flowchart of rewards/penalties incurred by vehicles.
Figure 7. Flowchart of rewards/penalties incurred by vehicles.
Sustainability 12 05151 g007
Figure 8. Gas consumption for EV registration and charging schedule.
Figure 8. Gas consumption for EV registration and charging schedule.
Sustainability 12 05151 g008
Figure 9. Storage time comparison of redundant and filtered data.
Figure 9. Storage time comparison of redundant and filtered data.
Sustainability 12 05151 g009
Figure 10. Gas consumption for the IPFS.
Figure 10. Gas consumption for the IPFS.
Sustainability 12 05151 g010
Figure 11. Average payments.
Figure 11. Average payments.
Sustainability 12 05151 g011
Figure 12. Cost comparison of different scenarios.
Figure 12. Cost comparison of different scenarios.
Sustainability 12 05151 g012
Figure 13. Charging times taken by EVs.
Figure 13. Charging times taken by EVs.
Sustainability 12 05151 g013
Figure 14. Time taken by EVs to traverse the distance to the nearest charging entity.
Figure 14. Time taken by EVs to traverse the distance to the nearest charging entity.
Sustainability 12 05151 g014
Figure 15. Cable losses incurred.
Figure 15. Cable losses incurred.
Sustainability 12 05151 g015
Figure 16. Inverter losses incurred.
Figure 16. Inverter losses incurred.
Sustainability 12 05151 g016
Figure 17. Weather losses incurred.
Figure 17. Weather losses incurred.
Sustainability 12 05151 g017
Figure 18. Combined losses incurred.
Figure 18. Combined losses incurred.
Sustainability 12 05151 g018
Figure 19. Users’ participation versus reputation values.
Figure 19. Users’ participation versus reputation values.
Sustainability 12 05151 g019
Figure 20. Hashes generated for different transactions.
Figure 20. Hashes generated for different transactions.
Sustainability 12 05151 g020
Figure 21. Mining time for different transactions.
Figure 21. Mining time for different transactions.
Sustainability 12 05151 g021
Figure 22. Adding a weather information file to the IPFS.
Figure 22. Adding a weather information file to the IPFS.
Sustainability 12 05151 g022
Figure 23. Assigning a malicious state to a vehicle by the IPFS.
Figure 23. Assigning a malicious state to a vehicle by the IPFS.
Sustainability 12 05151 g023
Figure 24. Getting file count and file ID from the IPFS.
Figure 24. Getting file count and file ID from the IPFS.
Sustainability 12 05151 g024
Table 1. Summary of related work.
Table 1. Summary of related work.
Scenario (s)Feature (s)Objective (s)Limitation (s)
Smart Grid (SG) energy trading [5]Use of multisignaturesSolve transaction security issuesExpensive implementation due to usage of multisignatures
Consortium blockchain [14]Local Aggregators (LAGs) are introducedAudit the transactionsIntroduction of LAGs leads to time complexity
Seven-layer blockchain model [17]Blockchain-based Intelligent Transport System (B 2 ITS) and Parallel transportation Management Systems (PtMS) dataProvide future directions for intelligent vehiclesCombining data from B 2 ITS and PtMS leads to time complexity
Ad-hoc networks [18]Vehicular Ad-hoc Networks (VANET)Optimization of applicationsDelay and scalability issues
Blockchain-based architecture [19]Emerging services and software updatesProtect privacy of usersTrust issues between users
Inter-vehicle protocol [20]Visible light and acoustic side-channelMinimize throughput and securing communicationApplicable only for small area
Cloud-based Vehicle-to-Vehicle (V2V) [21]Incentive-based trading schemesEfficient increase of the generated profitSingle point of failure and data leakage
Decentralized security model [22]Registration and authentication detailsSecuring and scheduling vehicle chargingTwo-fold security mechanism of vehicle charging leads to computational complexity
Cross-entropy optimization technique [23]Pricing schemesBill reduction for both community and individualsTime complexity
Contract-based direct trading [24]Decision-making process and asymmetric informationProvide benefits to both Energy Consumers (ECs) and Small Energy Suppliers (SESs)Time complexity
Stochastic dynamic programming framework [25]Energy demands of Smart Homes (SHs) with Plug-in Electric Vehicles (PEVs)Minimize cost while balancing power demandOverlooking user satisfaction
Vehicle-to-Grid (V2G) and Grid-to-Vehicle (G2V) systems [26]Stability and reliability indicesImprovement of stability and reliabilitySecurity issues
Two-stage model [27]Economic benefits and technical constraintsAllocate Renewable Energy Sources (RESs) and Electric Vehicle (EV) parking lots simultaneouslySpace complexity
SG architecture [28,29]Incentive DRProvide incentives to consumersThird-party involvement
Grid-connected Micro-Grids (MGs) [30,31]MG operational costs, RES costsReduce the operational costsOverlooking user satisfaction
RES-powered MG [32]RES costs and DR strategy informationCost reduction and incentives for DR usersVolatile nature of RESs
Cloud- and edge-based network [33]Services provided by edge serversSecure service provisioning to Internet of Things (IoT) devicesSpoofing attacks are not considered
Deregulated SGs [34]Fair data sharingProvide privacy to customersTradeoff between accuracy and privacy
Online data storage scheme [35]Robustness against attacksEnsure privacy provisioning to users’ dataTime complexity
Medical data sharing [36]Avoidance of sensitive medical information disclosurePrivacy provisioning to medical data of patientsTime complexity
Data sharing [37]Secure and authorized data sharingHonest reviews given to data filesTime complexity
Document sharing [38]Secure and trusted document sharing and version controlFacilitate multi-user collaborationTime complexity
Data traceability framework [39]Transparent and authorized data sharingProvide transparent audit tracking to track data deliverySecurity issues
Table 2. Comparison between work done in [43] and in our paper.
Table 2. Comparison between work done in [43] and in our paper.
ParametersPaper [43]Our Paper
System modelFour major entities are used in the system model, which include agents, EVs, Charging Stations (CSs), and Mobile Charging Vehicles (MCVs). MCVs act as mobile discharging electricity providers in the proposed workMore than four major entities are used in the proposed system model. Agents are replaced by Roadside Units (RSUs) and MCVs are replaced by Mobile Vehicles (MVs) (acting as prosumers)
Blockchain network typeConsortium blockchain is usedPublic blockchain is used
Consensus mechanism usedNot explicitly mentionedProof of Work (PoW) consensus mechanism is used
Mathematical formulation doneFour different costs are calculated, which are summed to get the total charging cost. Furthermore, user satisfaction is calculatedDistance to the charging entity, time required to travel that distance, time required to charge the vehicles, and time required for data storage are calculated along with four different costs involved in total charging cost
Data usedReal-time data of Beijing are usedReal-time data of four EVs are used
Major contributionsCharging scheduling is done and charging cost is calculated. Furthermore, user satisfaction is also considered. Moreover, a hybrid charging scenario, i.e., Mobile Charging Vehicle-to-Vehicle (MCV2V), is proposed. A double-objective optimization model is used, and an improved algorithm, termed the Non-Dominated Sorting Genetic Algorithm (NSGA), is proposedCharging scheduling is done and charging cost is calculated. The new charging strategy, i.e., Mobile-Vehicle-to-Vehicle (M2V), is proposed, which is not a hybrid strategy. The data storage issue is solved using the IPFS, in which data is stored after filtration and time for data storage is calculated. Distance to the nearest charging entity and the time taken to cover that distance are also calculated. Furthermore, time taken to charge the vehicles and reputation values are calculated. To promote user participation, an incentive provisioning mechanism is designed and location privacy is also provided.
Performance parameters usedDriving speed, location of charging/discharging entities, time of waiting are usedGas consumption of smart contracts, mining time taken, and number of hashes generated using blockchain technology are used. Moreover, storage time, traveling time, charging time, reputation values, and charging and traveling costs are also used
Table 3. Mapping of problems with proposed solutions.
Table 3. Mapping of problems with proposed solutions.
Limitation NumberLimitation IdentifiedSolution NumberProposed Solution
L.1Authentication of vehiclesS.1Authorization Unit (AU) is used to authorize every new incoming vehicle before it becomes part of the network
L.2Data redundancy removalS.2Data filtration is done through the Transport System Information Unit (TSIU), which helps in reducing the data redundancy
L.3Data storageS.3Using the Inter-Planetary File System (IPFS) and TSIU, the data storage issue is solved, as only important and filtered data are saved in the network
L.4Charging cost reductionS.4Mathematical formulation is done to calculate the charging cost and reduce it
L.5Charging time calculationS.5The time taken to charge the vehicles is calculated beforehand to reduce time complexity
L.6Shortest distance calculationS.6The distance between the EV and charging entity is calculated using the Great-Circle Distance formula
L.7Charging schedulingS.7Algorithms are designed to schedule the charging of vehicles
L.8Location privacyS.8Location privacy is achieved using the AES128 encryption scheme
L.9Lack of user participationS.9Users are given incentives to increase their interest and participation in the proposed work
Table 4. Real-time data of EVs.
Table 4. Real-time data of EVs.
ManufacturerModelTop Speed (kph)Charging Time (hours)Battery Capacity (kWh)
Table 5. Comparison of equations.
Table 5. Comparison of equations.
Paper [43]Our PaperDifference
L 1 j = l s n = 1 N s j n + l m r = 1 R m j r + l d k = 1 K d j k C 1 T = ( P C S * ∑ i = 1 I C C S i ) + ( P M V * ∑ j = 1 J C M V j ) + ( P E V * ∑ k = 1 K C E V k )These equations are used for calculating the charging cost in both papers. In [43], the prices charged by charging stations, MCVs, and discharging EVs are multiplied by the amount of energy provided by these entities, respectively. However, in our paper, we multiplied the generation cost with the selling cost and then summed all to get the total cost. Hence, the difference lies in that we do not include the amount of energy provided by the entities during calculation.
L 2 j = η d i s j v j + l d d i s j L C 2 T = ( P C S * d i s S 2 V )+( P M V * d i s M 2 V )+( P E V * d i s V 2 V )These equations are used for calculating the cost incurred while traveling, known as the distance cost. In [43], this cost is calculated considering the distance to travel and the time taken to cover that distance. In this paper, this cost is calculated in terms of generation costs and the distance to travel. Hence, the difference is that we are not considering the time in this equation.
L 3 j = ∑ z = 1 Z α (Z – z) V j z v z c C 3 T = ( ( d i s S 2 V * diff(V,v)) * ( ∑ y = 1 Y V e y +∑ z = 1 Z V m z ) )This equation is used to calculate the waiting cost while the vehicle waits to be charged. In [43], this cost is calculated as a product of waiting cost and the difference between the number of a specific vehicle and the total number of vehicles. This equation includes the waiting times of all the entities involved and then takes their aggregate. Hence, the difference is that, previously, this equation only involved a single entity, while currently, it involves all types of entities.
L 4 j = ϕ e j C 4 T r = (Q * T s ) * ( l = 1 L e v l + m = 1 M m v m ) or C 4 T p = –(Q * T w ) * ( l = 1 L e v l + m = 1 M m v m )This equation is used to calculate the amount of reward given to the nodes. In [43], only the reward is calculated on the basis of verified transactions. In our case, the reward and penalty are both calculated, which restricts the nodes from malicious activities.
L c j = L 1 j + L 2 j + L 3 j + L 4 j C T o t a l = C 1 T  +  C 2 T  +  C 3 T  +  C 4 T This equation is the same in both papers, as it only aggregates the equations given above into one equation.
min  ( L c j ) = L 1 j + L 2 j + L 3 j + L 4 j min  ( C T o t a l ) = C 1 T  +  C 2 T  +  C 3 T  +  C 4 T This equation gives the objective functions of both papers. It is similar in both papers because they both aim at reducing the overall charging cost.
0 ≤ m j r m r m a x , 0 ≤ d j k d k m a x , c j m i n e j c j m a x and 0 ≤ s j n 0 ≤ C M V C M V m a x , 0 ≤ C E V C M V m a x and max ( T s ) or min ( T w )These are the constraint equations for the objective function. These are almost same, except that, in our paper, the numbers of units saved or wasted are also considered as constraints for the objective function.
Table 6. Parameters and their values.
Table 6. Parameters and their values.
L c a b l e 1–5 m
I t 16–32 Amperes
η i n v e r t e r ¯ 0–40%
ω 0–1
Table 7. Simulation parameters.
Table 7. Simulation parameters.
Battery capacity of an EV40–45 kWh
Charging time of an EV6–8 h
Electricity price10–14 cents/kWh
Maximum number of vehicles in a queue10
Threshold distance for MV10 km
Table 8. Values of Ether and its multipliers.
Table 8. Values of Ether and its multipliers.
10 0 Wei
10 12 Szabo
10 15 Finney
10 18 Ether
Table 9. Mapping of problems with validation results.
Table 9. Mapping of problems with validation results.
Limitation NumberLimitation IdentifiedProposed SolutionValidation Results
L.1Authentication of vehiclesS.1No direct validation
L.2Data redundancyS.2To remove data redundancy in the proposed work, data filtration is performed. The comparison between the time taken to store redundant data and filtered data is shown in Figure 9.
L.3Cost of storing data in the IPFSS.3Figure 10 shows the gas consumed while uploading and saving data in the IPFS.
L.4Charging cost reductionS.4Figure 11 and Figure 12 present the cost comparison between different entities. The former shows the difference between reward and payment, whereas the latter shows the difference between three charging scenarios.
L.5Time taken for vehicles’ chargingS.5The time taken to charge vehicles with different State of Charge (SoC) values is shown in Figure 13.
L.6Time complexityS.6Figure 14 shows the time taken to traverse the distance between a vehicle and the nearest charging entity.
L.7Charging schedulingS.7No direct validation; however, it contributes to the charging cost reduction, which can be seen in Figure 11 and Figure 12.
L.8Location privacyS.8No direct validation; however, the effect can be seen in the increase in participation rate in Figure 19.
L.9Lack of user participationS.9Figure 19 presents a three-dimensional graph relating reputation value, incentives, and the user participation.
Table 10. Keys generated for digital signatures.
Table 10. Keys generated for digital signatures.
Vehicle identityPublic keyPrivate key
Vehicle 104e4c6...47979f7429f2...886b52
Vehicle 204260a...0a95e9ed9acc...65b48d
Vehicle 3049b61...bee1ae35ea24...bf841f
Vehicle 4047ec6...16a60824cad1...f49eec
Vehicle 504e8a0...9e150f36aa54...acffac
Vehicle 604e4c6...47979f7429f2...886b52
Vehicle 704260a...0a95e9ed9acc...65b48d
Vehicle 8049b61...bee1ae35ea24...bf841f
Vehicle 9047ec6...16a60824cad1...f49eec
Vehicle 1004e8a0...9e150f36aa54...acffac
Table 11. Contract creation.
Table 11. Contract creation.
transaction hash0x2e104...a93a6
contract address0x35ef0...450cf
transaction cost998685 gas
execution cost713861 gas
decoded input{}
decoded output
Table 12. EV registration.
Table 12. EV registration.
transaction hash0x53cbd...cba6a
transaction cost25455 gas
execution cost1852 gas
decoded input{ “address Make”: “Honda”,
“address Model”: “X”,
“uint256 Batterysize”: “12” }
decoded output{}
Table 13. MV registration.
Table 13. MV registration.
transaction hash0xdabdb...0bbdc
transaction cost24531 gas
execution cost1875 gas
decoded input{ “address Make”: “Tesla”,
“address Model”: “S”,
“uint256 Excessenergy”: “10” }
decoded output{}
Table 14. Getting the energy requirements.
Table 14. Getting the energy requirements.
transaction hash0x68107...f30b3
transaction cost22135 gas
execution cost836 gas
decoded input{}
decoded output{ “uint256 Start”: “10”,
“uint256 End”: “11”,
“uint256 Requiredenergy”: “5” }
Table 15. Energy requirement for the next schedule.
Table 15. Energy requirement for the next schedule.
transaction hash0x16f16...87424
transaction cost23098 gas
execution cost1698 gas
decoded input{}
decoded output{ “uint256 Start”: “11”,
“uint256 End”: “12”,
“uint256 Requiredenergy”: “8” }
Table 16. Mining time and hashes generated against different difficulty levels.
Table 16. Mining time and hashes generated against different difficulty levels.
TransactionsDiff. Level = 2Diff. Level = 3Diff. Level = 4
Mining Time (ms)Hashes GeneratedMining Time (ms)Hashes GeneratedMining Time (ms)Hashes Generated
Transaction 11448981414278149744
Transaction 221841162197326158409
Transaction 3231572283203345260456
Transaction 4251602333277378565287
Transaction 5252432834372402572856
Transaction 6272603155125423277465
Transaction 7292666007538461888631
Transaction 83627363910400578097964
Transaction 944502645110356605109892
Transaction 1069515847110636627110688

Share and Cite

MDPI and ACS Style

Javed, M.U.; Javaid, N.; Aldegheishem, A.; Alrajeh, N.; Tahir, M.; Ramzan, M. Scheduling Charging of Electric Vehicles in a Secured Manner by Emphasizing Cost Minimization Using Blockchain Technology and IPFS. Sustainability 2020, 12, 5151.

AMA Style

Javed MU, Javaid N, Aldegheishem A, Alrajeh N, Tahir M, Ramzan M. Scheduling Charging of Electric Vehicles in a Secured Manner by Emphasizing Cost Minimization Using Blockchain Technology and IPFS. Sustainability. 2020; 12(12):5151.

Chicago/Turabian Style

Javed, Muhammad Umar, Nadeem Javaid, Abdulaziz Aldegheishem, Nabil Alrajeh, Muhammad Tahir, and Muhammad Ramzan. 2020. "Scheduling Charging of Electric Vehicles in a Secured Manner by Emphasizing Cost Minimization Using Blockchain Technology and IPFS" Sustainability 12, no. 12: 5151.

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