ArticlePDF Available

Blockchain based Secure, Efficient and Coordinated Energy Trading and Data Sharing between Electric Vehicles

Article

Blockchain based Secure, Efficient and Coordinated Energy Trading and Data Sharing between Electric Vehicles

Abstract and Figures

In this study, a secure and coordinated blockchain based energy trading system for Electric Vehicles (EVs) is presented. The major goals of this study are to provide secure and efficient energy trading between EVs and Charging Stations (CSs), and to ensure efficient coordination between EVs. In this study, a consortium blockchain based energy trading algorithm is presented that handles the essential energy requests, discards the redundant requests and calculates the distance between EVs and CSs. Moreover, Matching Pool (M-Pool) and Pairing Pool (P-Pool) are used to store energy and payment requests. Furthermore, a blockchain based mechanism is proposed for ensuring efficient coordination between EVs at the unsignalized crossroads and intersections. The scheme involves efficient communication between EVs and the timely sharing of important messages. In the proposed work, EVs are authenticated using a Registration Authority (RA) before they become part of a Vehicular Energy Network (VEN). The increase in the number of EVs results in an increase in the number of messages leading to data redundancy issue. To solve the issue, message filtration is performed. The delays incurred in the VEN are also mathematically formulated in this study. In addition, the range anxiety issue is discussed in the proposed work. Besides, a Local Aggregator (LAG) is used as an energy broker to manage energy trading events and transaction validation. To promote the users to take part in the proposed network, they are provided with incentives. The proposed model is tested against selfish mining attack and the security analysis is performed through Oyente tool. The simulation results show that the proposed study excels in providing a secure, efficient and coordinated energy trading and data sharing system for EVs. The results show that due to proper coordination, the risk factor is reduced by almost 25-30%. Moreover, almost 40-50% reduction in time is observed when storing less redundant data.
This content is subject to copyright. Terms and conditions apply.
Blockchain based Secure, Efficient and Coordinated
Energy Trading and Data Sharing between Electric
Vehicles
Muhammad Umar Javed1, Nadeem Javaid1,, Muhammad Waseem Malik1,
Mariam Akbar1,, Omaji Samuel1, Adamu Sani Yahaya1and Jalel Ben Othman2,3
1Department of Computer Science, COMSATS University Islamabad, Islamabad 44000, Pakistan
2Universit Paris-Saclay, CNRS, CentraleSuplec, Laboratoire des signaux et systmes, 91190, Gif-sur-Yvette, France
3Universit Sorbonne Paris Nord, France
*Corresponding author: mariam akbar@comsats.edu.pk
Abstract—In this study, a secure and coordinated blockchain
based energy trading system for Electric Vehicles (EVs) is
presented. The major goals of this study are to provide
secure and efficient energy trading between EVs and Charging
Stations (CSs), and to ensure efficient coordination between
EVs. In this study, a consortium blockchain based energy
trading algorithm is presented that handles the essential energy
requests, discards the redundant requests and calculates the
distance between EVs and CSs. Moreover, Matching Pool (M-
Pool) and Pairing Pool (P-Pool) are used to store energy and
payment requests. Furthermore, a blockchain based mechanism
is proposed for ensuring efficient coordination between EVs
at the unsignalized crossroads and intersections. The scheme
involves efficient communication between EVs and the timely
sharing of important messages. In the proposed work, EVs
are authenticated using a Registration Authority (RA) before
they become part of a Vehicular Energy Network (VEN). The
increase in the number of EVs results in an increase in the
number of messages leading to data redundancy issue. To
solve the issue, message filtration is performed. The delays
incurred in the VEN are also mathematically formulated in this
study. In addition, the range anxiety issue is discussed in the
proposed work. Besides, a Local Aggregator (LAG) is used as an
energy broker to manage energy trading events and transaction
validation. To promote the users to take part in the proposed
network, they are provided with incentives. The proposed model
is tested against selfish mining attack and the security analysis
is performed through Oyente tool. The simulation results show
that the proposed study excels in providing a secure, efficient
and coordinated energy trading and data sharing system for
EVs. The results show that due to proper coordination, the risk
factor is reduced by almost 25-30%. Moreover, almost 40-50%
reduction in time is observed when storing less redundant data.
Index Terms—Consortium blockchain, energy trading,
vehicle-to-vehicle, vehicle-to-grid, coordination, data sharing
and filtration, incentive provisioning, range anxiety.
I. INTRODUCTION
Over the past few years, the world has witnessed an
immense increase in the population and the migration of
people from rural to urban areas. This migration has pro-
vided people with many benefits. On the other side, it has
posed some serious threats as well. The scarcity of various
necessities like health facilities, employment opportunities,
and physiological and social needs are some of them. The
TABLE I: List of Abbreviations
Abbreviations Description
CS Charging Station
DAO Decentralized Autonomous Organization
DoS Denial-of-Service
ESC Energy Smart Contract
EV Electric Vehicle
IoT Internet of Things
G2V Grid-to-Vehicle
LAG Local Aggregator
MILP Mixed Integer Linear Programming
M-Pool Matching Pool
OBU On-Board Unit
PBFT Practical Byzantine Fault Tolerance
PoW Proof of Work
P-Pool Pairing Pool
PSC Payment Smart Contract
P2P Peer-to-Peer
RA Registration Authority
RES Renewable Energy Sources
RSU Road Side Unit
SDN Software Defined Networking
VANETs Vehicular Ad-hoc Network
VENs Vehicular Energy Networks
V2G Vehicle-to-Grid
V2I Vehicle-to-Infrastructure
V2R Vehicle-to-RSU
V2V Vehicle-to-Vehicle
WSNs Wireless Sensor Networks
outburst of population escalated the number of houses,
vehicles and industries. All these entities require a massive
amount of energy to power themselves. Moreover, electricity
is needed by the people to do their daily chores like washing
and ironing clothes, using cellular and multimedia devices,
running industrial plants and motors, and travelling from one
place to another place. This vast energy demand has led to an
imbalance between energy supply and demand [1]. It further
TABLE II: List of Variables
Variables Description
Bcap Battery Capacity
DijDistance between EV and CS
Eav Energy Available
Eav
kW h Energy Available in kWh
Epr Energy Present
Epr
kW h Energy Present in kWh
Erq Energy Required
Erq
kW h Energy Required in kWh
Eth Energy Threshold
end to enddelay End-to-end-delay
EV bBuyer EV
EV sSeller EV
Exrq Required Energy Expenses
ID Identity
Loccur Current Location
procdelay Processing delay
propdelay Propagation delay
P K Public Key
PsPrice for Traded Energy
Qev
nNumber of EVs present in a queue
quedelay Queuing delay
RRole of EV
SK Private Key
SoC pr Present State of Charge
SoC th Threshold State of Charge
Trq Time required to reach the CS
totaldelay Total delay
transdelay Transmission delay
directs the society towards the problems of irregular load
shedding, increased electricity bills and substantial financial
loss due to voltage fluctuation.
Consequently, a green and sustainable smart city has
become the need of the current times to tackle the above
mentioned issues [2]. Though, the concept of smart city is
not new, and many contributions have been made in making
the cities smarter, cleaner and greener over the past few
years. In a smart city, everything is transformed from old
conventional mode to intelligent and updated form. These
things include power grids, homes, hospitals, educational
institutes, industries and transportation. The scarcity of fossil
fuels is tackled by exploring Renewable Energy Sources
(RES) and utilizing them to their full potential. Examples
of RES include solar photovoltaic, wind and hydro. Despite
RES adding up to the energy generation and creating a
balance between energy demand and supply, some issues
like intermittent nature and unavailability of RES also exist
[3]. The emergence of smart cities has changed the global
transportation sector and introduced a smart transportation
system [4]. With the aid of communication and information
technologies, the smart transportation system provides vari-
ous automated services, such as traffic control, information
sharing, navigation, provisioning of parking lot information
to public transport like taxis, etc., [5], [6]. It also ensures
secure communication between Electric Vehicles (EVs) and
Road Side Units (RSUs), and the safety and privacy of
vehicles’ owners [7]. Moreover, the idea of EVs in the smart
transportation sector emerges in order to develop an eco-
friendly transportation system. Besides efficient transporta-
tion [8], EVs also provide numerous benefits, such as less
carbon emission, and less operation and maintenance cost as
compared to conventional vehicles [9].
The immense surge in the vehicles running on the high-
ways has provided many benefits to the people and have
made traveling easy. The IHS Markit estimated that the
sale of EVs could exceed 12 million by 2025 [10]. With
the introduction of state-of-the-art vehicles, large distances
are now covered in less time. However, the increase in
vehicles exhibits various issues like road congestion, road
accidents and increased amounts of pollution. To tackle these
issues, intelligent vehicles are proposed, which are able to
communicate with each other, share important information,
and avoid both road congestion and road accidents. Further-
more, these vehicles are powered using RES, which helps in
reducing the pollution and the gas emissions [11]. Despite of
these benefits, there still exist some issues like data storage
issue, lack of security and privacy, absence of trust between
vehicle users and unavailability of data transparency. In
Vehicular Energy Networks (VENs), the vehicles share im-
portant information with each other like road conditions and
weather conditions. This type of communication is known
as Vehicle-to-Vehicle (V2V) communication. Moreover, the
communication between vehicles and the Charging Stations
(CSs) takes place for fulfilling the energy requirements and
this kind of communication is termed as Vehicle-to-Grid
(V2G) and Grid-to-Vehicle (G2V) communication [12]. For
the storage of important information, which can be used for
later use, the vehicles communicate with RSUs and other in-
frastructure in Vehicle-to-Road Side Unit (V2R) and Vehicle-
to-Infrastructure (V2I) modes, respectively. No doubt, EVs
have benefited the human race in numerous ways. However,
they still exhibit some issues like lack of trust, security
and privacy, data redundancy [3], inefficient coordination
between EVs [13], delays in message propagation and range
anxiety [14]. In VENs, several other issues also arise, such
as selfish behavior of EVs and CSs, large distance between
nodes, cost of traveling incurred to reach the CSs, etc.
To overcome the issues, many different energy trading and
vehicle charging mechanisms are presented. However, the
conventional centralized energy trading mechanisms depend
on intermediary bodies to audit, verify and manage energy
transactions [16]. The inclusion of an intermediary body in
the network is a security threat, and causes issues like Denial-
of-Service (DoS) attack, a single point of failure and privacy
leakage [17]. Therefore, energy trading environment requires
a secure, reliable and distributed mechanism [18]. More-
over, an incentive mechanism, in terms of cryptocurrency
or reputation, is introduced to motivate nodes to perform
efficient energy trading. It also helps to avoid the selfish
behavior of nodes [19]. Furthermore, different solutions
present efficient distance measurement techniques. These
solutions also reduce the amount of traveling required to
reach the destination [20], [21].
In order to solve the aforementioned challenges in VENs,
blockchain technology is considered as an effective solution
that provides distributed, secure and efficient energy trading
[22]–[26]. The concept of blockchain technology was ini-
tially brought forward by Satoshi Nakamoto in 2008 [27].
Blockchain is a decentralized Peer-to-Peer (P2P) network
technology in which blocks are used to store the transactions.
The blocks are joined together in a chronological manner
using hashes. Hence, it is given the name blockchain, i.e.,
blocks linked together in a chain. The blocks comprise
of hashes, transaction data, timestamp, Merkle root and
nonce [25]. Blockchain was proposed to tackle the issues
related to the centralized networks like a single point of fail-
ure, increased transaction cost and vulnerability to security
breach. Furthermore, it also ensures security, transparency,
reliability, auditability and integrity of the transactions. It
also ensures privacy of the network nodes [28], [29]. Due
to its numerous benefits, it is widely used in many fields
like energy [30]–[32], cloud computing [33], Wireless Sensor
Networks (WSNs) [34], [35], Vehicular Ad-hoc Networks
(VANETs) [36]–[39], Internet of Things (IoT) [40]–[42], etc.
A. Contributions
In this study, a blockchain based secure and coordinated
energy trading system is presented to overcome the above
mentioned issues. The major contributions made in the
proposed work are summarized below.
A secure and efficient energy trading scheme is pro-
posed in this study. To provide security, blockchain
technology is used; while, Proof-of-Work (PoW) con-
sensus mechanism is implemented to verify energy
transactions and ensure transparency.
An algorithm is presented to perform optimal energy
trading, which prevents EVs to send multiple fake
energy requests for energy trading at the same time.
The algorithm also calculates the distance between EVs
and CSs along with the required time and expenses.
Afterwards, a list of the nearest CSs is given to the
requesting EVs.
Two memory pools are introduced to store transactions:
Matching Pool (M-Pool) and Pairing Pool (P-Pool). The
former stores the requests of energy trading temporarily;
while, the latter stores the matched pairs of CSs and
EVs.
Three different smart contracts are presented in the
proposed work: EVs’ registration smart contract, Energy
Smart Contract (ESC) and Payment Smart Contract
(PSC). ESC handles CS related information like current
energy level and present number of EVs. Whereas, PSC
ensures secure payment transactions for energy trading
among energy nodes.
The authentication of vehicles is performed using a
Registration Authority (RA), which provides a unique
ID (ID) to each EV. Furthermore, coordination between
vehicles at the crossroads and the intersections is per-
formed. The range anxiety issue of the EV users is
discussed for both high level and low level users.
Mathematical formulation of the delays incurred in the
VENs, the amount of energy traded and the correspond-
ing payment charged, and the coordination between EVs
is performed.
Message credibility is checked and redundant data is re-
moved after filtration. The legitimate and authentic users
are provided with incentives. Moreover. the reputation
of nodes that provide energy to the requesting nodes
is increased. On the other hand, nodes who perform
malicious operations like sending fake and multiple
requests to the system are discarded.
Extensive simulations are performed that prove the
efficiency of the proposed work.
The proposed model is tested against selfish mining
attack. The attack is induced and the model is designed
in such a way to prevent it from the attack. Moreover,
security analysis of the proposed work is performed us-
ing Oyente tool, which tests the system against the well
known vulnerabilities incurred in the smart contracts.
The lists of abbreviations and variables used in this paper
are given in Tables I and II, respectively. The remaining
manuscript is organized as follows. The detailed literature
review is presented in Section II. Whereas, the problem
statement is provided in Section III. Furthermore, Section
IV is dedicated to the proposed system model. Whereas, the
mathematical formulation and the coordination scenario are
discussed in Section V. Moving ahead, message credibility
and incentive provisioning mechanisms are given in Sections
VI and VII, respectively. The simulation results are presented
in Section VIII;. The overview of security analysis is given in
Section IX; while attacker model and smart contract analysis
are given in Sections X and XI, respectively. Finally, the
paper is concluded in Section XII and the future perspectives
are provided.
II. RE LATE D WORK
In this section, literature review of existing systems and
schemes for VENs is presented in detail. The underlying
works are intended to perform efficient and secure energy
trading, provide optimum charging to EVs and perform
coordination between EVs in VENs.
A. Energy Trading in VENs
Efficient power allocation plays an important role in
energy trading environments [43]. Keeping this in mind,
different authors work on promoting energy trading in VENs.
The authors in [44] introduce contract theory in Internet
of EVs (IoEVs) using consortium blockchain. Similarly,
the authors in [45] develop an energy delivery scheme for
EVs in order to maximize the energy exchange process.
Furthermore, in [46], the authors examine the feasibility
study of the energy harvesting system in a vehicular energy
environment. In [47], the authors introduce a two phase
energy resource acquisition framework for shared relay se-
lection, power control and spectrum allocation in vehicular
heterogeneous networks. The authors in [48] propose a
P2P energy trading scheme for the Industrial Internet of
Things (IIoT) using blockchain. The main objective of this
scheme is to reduce the transaction confirmation latency,
which relies on a credit based payment strategy. In [49],
the authors present EnergyChain model using blockchain,
which enables secure energy trading between nodes. The
model handles the issues of miner selection, creation and
validation of transactions and blocks. However, the security
issues in these energy trading works are not fully addressed.
Furthermore, these works rely on a common understanding
that the information on the EV side is well known through
central authority, i.e., Local Aggregator (LAG). Similarly, the
authors in [50] propose a model to continuously verify the
transactions using real time data. Two platform independent
optimization techniques are proposed in the work to reduce
the operational cost and increase the benefits for the users.
The authors in [20] present a blockchain based framework
integrated with edge computing for secure energy trading in
Software Defined Networking (SDN). The issues resolved
are delay, network overhead, and security and privacy issues.
The authors in [51] highlight the benefits of using blockchain
and smart contracts in the energy sector. Moreover, the
scalability and decentralization in the P2P energy tading
model is tackled by the authors in [52]. The profitability of
the proposed system is also enhanced using reinforcement
learning. In addition, the scalability and security issues in
the centralized cyberphysical systems are discussed in [53].
The study provides the opportunities to tackle the issues
using blockchain technology, which makes the system decen-
tralized. The authors propose a privacy preserving payment
mechanism for V2G network using hyperledger blockchain
technology with Proof of Concept (PoC) mechanism in [54].
In [55], the authors develop an EV charging and discharging
mechanism, which is based on genetic algorithm. The main
objective is to reduce the cost of EV emission and penalty of
wind power imbalance. Furthermore, V2G energy trading is
improved through Stackelberg game based pricing scheme.
However, the local energy market structure in micro grids is
ignored in these works while energy trading. The authors in
[16] propose a secure environment for the vehicle users and
enable them to share the available resources with each other.
Similarly, the authors in [56] propose a secure environment
for ensuring the privacy of EV users’ data.
B. Charging Scheduling of EVs
Scheduling of vehicles’ charging is also brought under
consideration in different papers to avoid creating a huge
burden on charging entities. The authors in [22] discussed
about scheduling the charging of EVs in an efficient manner
to address the issue of imbalance between energy demand
and supply. Similarly, Zou et al. in [57] propose a charg-
ing scheduling mechanism based on game theory for EVs.
The auction and bidding mechanisms are also included in
the proposed work to create a sense of harmony between
charging entities and EVs. In [58], the authors propose
a blockchain based decentralized EV charging scheme. It
reduces the power grid’s fluctuations and EV charging costs
at the same time. Moving on, a multi coalition mechanism
for EVs is presented in [59]. The proposed mechanism helps
in cutting down both the energy provisioning and the vehicle
charging cost in a local network. Amini et al. propose a multi
layered model for the efficient charging of a large number of
vehicles running on the roads in [60]. The taxis are directed
towards optimally placed charging lots. The specific amount
of renewable energy is also designated to the taxis.
C. Authentication in VENs
The authors in [61] use cryptographic keys in the VEN to
secure the communication between the EVs. Furthermore,
the public key infrastructure is used in the proposed work
to ensure security and privacy. Similarly, authors in [62]
propose a decentralized model to ensure security of the
trading performed between EVs. The authors in [63] use zero
knowledge proofs to ensure the EVs’ privacy preservation
and their authentication. The anonymous authentication of
EVs is done using Pederson Commitment scheme. The
charging scheduling of EVs is also done in the proposed
work. Furthermore, the vehicles’ identity is concealed us-
ing pseudonyms in [64]. Authors in [65], [66] proposed
an authentication mechanism for IoT and a signcryption
system for the EVs to ensure that only authenticated nodes
and users become part of the networks, respectively. An
incentive-punishment scheme is also proposed in this work to
encourage the users for reporting of trustworthy information.
The manipulation of users’ data is avoided using Practical
Byzantine Fault Tolerance (PBFT) mechanism.
D. Coordination between EVs
The authors in [67] propose a scheduling mechanism for
the EVs in an urbanized traffic system. The proposed work
guarantees the collision avoidance between the vehicles at
the intersections. Similarly, the authors in [68] use a buffer
assignment mechanism to cooperate between vehicles and
assign a specific crossing span to each individual vehicle.
The intersection control problem is formulated in [69] and
specific rules are provided to the vehicles to pass through the
intersections. The authors in [70] handled the coordination
between the vehicles at intersections mathematically. A two
stage procedure is used to perform coordination between ve-
hicles. No doubt, a lot of work has been done in performing
coordination between the vehicles at the intersections. How-
ever, there still exists a room for using blockchain technology
to perform secure coordination between the vehicles. The
limitations identified after performing an intensive literature
review are provided in the form of a consolidated Problem
Statement in the next section.
III. PROB LE M STATEM EN T
The conventional energy trading schemes have several
limitations like lack of trust, privacy and security, illegit-
imate and malicious requests, etc., which need to be ad-
dressed. In [20], [54], the authors propose blockchain based
mechanisms to tackle delay, network overhead, security
and privacy issues. These mechanisms ensure secure and
efficient energy trading between EVs and CSs. However,
nodes generate multiple energy trading requests. There-
fore, fake and small trading transactions are also executed,
which results in an increased computational overhead of
the networks. Moreover, the authors in [19], [44] present
blockchain based systems to tackle the selfish behavior
of users using incentive mechanisms. The energy demand-
supply ratio is balanced as well. However, different security
attacks like sybil and re-entrancy are not tackled. Apart from
that, there are no efficient payment and reputation scoring
mechanisms. Furthermore, the rapid surge in the vehicles
leads to various problems, mainly the traffic congestion
and the roadside accidents. The main reason behind these
issues is the lack of coordination between vehicles [13].
If a proper coordination strategy is established and timely
credible information sharing is performed between vehicles,
these issues can be mitigated. Moreover, the inclusion of
unauthorized vehicles in the VENs causes hindrance in the
system’s performance [71]. It is because the unauthorized
vehicles tend to generate fake messages, which causes huge
burden on the RSUs. As a result, the amount of data being
generated is increased manifolds. In addition, simultaneous
generation and sharing of messages by vehicles lead to
loss of important information over time. This also includes
delay in sharing of important information, which needs to be
minimized so that important information regarding road side
accidents and road congestion should be broadcasted within
minimum time and without any data loss. To minimize the
data redundancy by filtering out the fake messages, proper
data filtration mechanism is required [3]. The mechanism
should also help in tackling the data flooding issue. The rapid
adoption of EVs by the masses leads to the need for efficient
knowledge about the batteries placed inside the vehicles.
People having less knowledge about the batteries installed
within their vehicles leads to range anxiety issue [14]. People
are always in constant fear of their batteries being drained off
at places where no charging entities exist. This requires that
the vehicle owners be informed and made well aware about
the batteries installed within their vehicles. To promote users’
participation in adopting the blockchain based VENs, they
should be provided with identity and location privacy along
with healthy incentives [72]. When users are ensured that
their privacy is protected and they will be awarded with good
incentives, they tend to participate in the designed VENs.
Section IV presents the solutions for the problems discussed
in this section.
IV. PROPOSED SYSTEM MODEL
The proposed blockchain based energy trading and co-
ordination model for EVs is described in detail in this
section and is shown in Figure 1. The proposed blockchain
based VEN consists of EVs running on the roads along
with other vehicles like simple vehicles, buses, etc. Ve-
hicles share information with each other and with RSUs.
The arrows of three different colors are observed in the
figure. The red color arrow shows the V2V communication
between vehicles. While, the blue color arrows are used for
V2R communication. Moreover, the yellow color arrows are
used for coordination between vehicles on the unsignalized
crossroads. While passing through such crossroads, proper
coordination between vehicles is necessary to avoid mishaps.
The authorization authority, also referred as RA, exists in
the network, which is necessary for the authorization of
vehicles. It also helps in the elimination of malicious vehicles
from the network. It further reduces the sharing of fake
messages and the burden on the RSUs. In the presence of
malicious vehicles, the amount of messages being generated
increases manifolds, which leads to the loss of important
information and causes delay in the sharing of credible
information. Different transactions performed between ve-
hicles are stored using blockchain technology, which helps
in promoting data transparency, immutability, security and
privacy. The blockchain technology is implemented on the
RSUs and only the important information is stored at RSUs
after data filtration. Moreover, the proposed work is intended
to ensure efficient energy trading between EVs and CSs. Fur-
thermore, the security and reliability of energy transactions
are maintained via consortium blockchain. The transactions’
validation is done using PoW consensus mechanism. The
proposed model consists of several entities: EVs, CSs, RSUs,
LAGs and RA. In the proposed energy trading model, LAGs
are interconnected in a P2P manner, and all energy trading
transactions are audited and verified by them. While, the
CS broadcasts energy selling requests with present state
of charge (SoCpr ), current location (Loccur) and present
number of EVs in a queue (Qev
n) in the network. Moreover,
the buyer EV (EV b) communicates with the LAG to find
the nearest CS along with energy present at CS (Epr
j) and
Qev
nfor energy trading; while, seller EV (EV s) requests the
LAG to sell energy. The entities mentioned above are further
elaborated below.
EVs: in the energy trading environment, EVs play
different roles as energy sellers, energy buyers and idle
nodes. EV sshare its surplus energy with other EVs that
are in need of it. EV scan also trade energy with CSs to
earn energy coins. Furthermore, EV bsends its energy
requests to the LAGs when it requires energy. The
idle EVs are neither energy buyers nor energy sellers.
However, their role can be changed upon requirements.
Each EV in the network chooses its role according to
its energy state and driving plan.
LAGs: they work as energy brokers that manage trading
events and provide wireless communication services to
EVs, CSs and RSUs. For energy trading, EVs and CSs
send their energy requests to the nearest LAGs. The
energy broker does a statistics of local energy demand
and announces this demand to CSs and EVs. When EVs
have surplus energy, they send energy selling request
to the LAG, which sets the energy selling price and
sends it to each energy node. For each request, LAG
verifies the ID of each node through the RA. LAG also
accesses the wallet addresses of the nodes using the
respective IDs. Afterwards, LAG temporarily places
energy trading requests into the M-Pool.
RA: in the energy trading model, the registration of
EVs, CSs and LAGs is done though RA. When any
entity wants to join the network, RA registers it and
provides a unique ID. The ID is generated by a pair of
Public Key (P K) and Private Key (SK). The authenti-
cation of nodes is maintained through the assigned ID.
Moreover, EVs and CSs also request for their wallet
addresses from the RA, which then generates a mapping
list based on the request and provides them with specific
wallet addresses.
Smart meter: it is used to record and calculate the
amount of energy that is traded between energy nodes.
The energy buyers pay the corresponding price to the
sellers, according to the records of smart meters.
A real time scenario is developed to describe the workflow
of the proposed scheme. The CSs and EVs are categorized
into two groups: energy sellers and energy buyers. They
are deployed at different locations in a particular region. In
the proposed work, the EVs are considered to be equipped
with Energy Storage Systems (ESSs) and have the ability
to save energy. The surplus energy means the energy that is
not usable for the EVs at a certain time. As all EVs are in
coordination with each other, so any EV that needs energy
and is far from the CS can buy energy from that EV. In
this case, energy will be traded between EVs efficiently and
at reduced rates. EVs can also supply some certain amount
of energy to the buildings when there is a burden on the
power grids, especially during peak hours. Moreover, the
purpose of selling energy to the charging station is to help
alleviate the burden on the station. Besides, by selling energy
to the charging station, EVs can also earn some incentive.
Furthermore, in G2V trading, CS trades its energy with the
EV. Initially, the CS sends an energy selling request to LAG
along with its ID,Loccur,SoCpr, battery capacity (Bcap)
and Qev
n. Afterwards, LAG verifies the authentication of CS
and determines the corresponding energy price. The price
is set after considering Bcap and SoC pr of CS. The LAG
temporarily places the request in the M-Pool. Whereas, in
V2G trading, EV s
ishares its surplus energy with CS. In
this case, EV s
isends a request to LAG for searching the
nearby CSs. The LAG provides a list of CSs by considering
EV s
i’s Loccur. Then EV s
iselects the CS, which is at
minimum distance (Dij) and requires less time to reach.
After matching, LAG makes a pair of EV s
iand CS, and
stores it in the P-Pool. Similarly, when EV b
isends energy
buying request to LAG, it is provided with a list of the nearest
CSs along with Dijand required energy expenses (Exrq ).
EV b
iselects a preferable CS for energy trading.
The energy selling process of a CS is explained in detail
in the following steps and is also illustrated in Figure 2.
Initially, CS is registered with the RA in order to take
part in energy trading. Then, CS sends an energy selling
request to the LAG that contains Loccur,SoCpr ,Bcap
and Qev
n.
LAG executes the ESC, given in Algorithm 1, and stores
all information about the CS in the blockchain. In the
algorithm, the identity of each CS is verified. If CS is to
found to be verified, energy buying and selling requests
are entertained. If the CS is not verified, it is regarded
as invalid.
Algorithm 1: Algorithm of Energy Smart Contract
1: Initialization
2: Inputs: IDj, Locj, Bcap, SoC pr, Qev
n
3: Output: Identity validation
4: Verify identity (IDj) of each CS
5: if CS identity = Valid then
6: Save data block (IDj,Locj,Bcap ,SoCpr ,Qev
n)
7: if CS energy buying (Ei
u, Qev
n)then
8: energyUnitj+ = Ei
u
9: Qev
n=Qev
n+ 1
10: end if
11: if CS energy selling (Ei
u, Qev
n)then
12: energyUnitj=Ei
u
13: Qev
n=Qev
n+ 1
14: end if
15: else
16: Send message “Identity is not valid”
17: end if
18: End
EV b
isends energy buying request to the LAG. The
LAG executes Algorithm 2 that starts the energy trading
process when the request is validated. For validation, the
request of EV b
imust contain ID,Loccur,Bcap, role
(R) and SoC pr . Moreover, LAG accepts or rejects the
request after comparing it with the requests stored in the
M-Pool. If the request is matched, the newly generated
request is discarded; otherwise, it is placed in M-Pool
for processing.
When a LAG receives an energy buying request, it starts
finding the nearest CSs according to the EV b
i’s Loccur
and gets information through the ESC. LAG calculates
Dijbetween EV b
iand CS along with Exrq. LAG
provides a list of nearest CSs to EV b
ialong with Dij,
Exrq
kW h,Epr
kW h and Qev
n.
EV b
iselects the CS that matches with its preferences
and sends the required number of energy units (EV rq
kW h)
to it. Thus, matching is done between EV and CS.
Afterwards, EV b
iand CS are paired and Qev
nof CS is
incremented by 1. The energy units of CS are subtracted
to match the energy demand of EV b
i. Once a pair is
made, LAG stores the new pair in P-Pool and sends
confirm pair notification to both EV b
iand CS.
After energy is traded among the paired EV b
iand CS,
PSC is executed. The energy coins are deducted from
the buyer’s account and added to the seller’s account.
The PSC is given in Algorithm 3. In the algorithm,
the payment mechanism is discussed. Once energy is
traded between registered EVs and CSs, payment is
to be initiated from the buyer side towards the seller
side. Before the payment is made, the wallets of both
Solutions
S1: Delay calculation
S2: M-Pool and P-Pool
S3: Design ESC
S4: Design PSC
S5: Reputation score,
provisioning of incentives
S6: Vehicle registration,
certificate provisioning
S7: String and character
matching
S8: Coordination strategy
Limitations
L1: Computational overhead
L2: Charging time of EVs
L3: No secure energy trading
mechanism
L4: No secure payment
mechanism
L5: Reputation and credibility
L6: Lack of security and privacy
L7: Data redundancy
L8: Coordination at crossroads
L6, S6
L8, S8
L3, S3
L4, S4
L2, S2
L5, S5
L7, S7
Registration
Authority Road Side Unit
V2R Communication V2V Communication Coordination
Local
Aggregator Smart Contracts Transaction Pools
Blockchain
Figure 1: Proposed System Model
buyer and seller are registered. If wallets are found
to be unregistered, payment would not be made and
energy trading would be stopped. Once registration is
performed, the amount payable in accordance with the
energy being traded is calculated and made. The energy
units are analyzed through the smart meter. After the
execution of smart contract, a decrement of 1 is made
in Qev
nof CS.
After completion of energy trading, LAG calculates the
reputation function and updates the number of total
completed requests.
The workflow of energy trading of EV s
iis explained in
the following steps and is also illustrated in Figure 3.
Initially, EV s
iis registered by the RA to maintain its
authentication. Then, EV s
isends energy selling request
to the LAG.
The LAG compares the selling request generated by
EV s
iwith the requests that are stored in M-Pool. The
reason is to discard the request, if it matches with any
of the existing requests. If the request does not exist in
M-Pool, the available energy (Eavi) of EV s
iis checked.
If Eaviof EV s
iis more than 10 units, the LAG finds
the nearest CS and calculates the specific details, such
as Dij,Exrq and required time (Trq) to reach the
CS. Afterwards, LAG provides a list of all the nearest
CSs to the EV s
i.
EV s
iselects a preferable CS for energy trading and
notifies the LAG, which then forwards the energy
selling request of EV s
ito the CS.
In case, CS accepts the request of EV s
i, LAG creates a
pair of CS and EV s
i, and sends a pairing notification to
both CS and EV s
i. On the other hand, if the CS does
not accept the request, LAG stores it in the M-Pool.
LAG executes the ESC and increments the Qev
nby 1.
Once energy trading is performed between EV s
iand
CS, LAG executes the PSC and decrements the Qev
nby
1.
EV M-PoolLAGCS PSC
ESC
Energy trading request along with Loc
cur
,Bcap
, SoCprand Qev
Transaction stored in blockchain using ESC
Request to get CS's SoC
pr
, Qenand Loc cur
Provide specific details
Check for existing request
No existing request found
Run ESC for a specific CS according to EV's request
Provide list of nearest CSs
Confirm pair notification
Find the nearest CS
according to EV's Loc
cur
Create a pair of
CS and EV
Store request in M-Pool
Compare with
existing request
Confirm pair notification
Energy buying request
Select a preferable CS
Run PSC
Figure 2: Sequence Diagram for Buyer EV’s Energy Trading Scheme
The energy units and equivalent price are calculated
through the smart meter and PSC, respectively. The
energy coins are transferred from buyer to seller.
After successful energy trading, LAG calculates the
reputation function and updates the M-Pool according
to the requests.
In the proposed scheme, an EV can get information about
the Epr
kW h,Qev
nand total number of charging time slots
(Tslot) of a CS. Owing to this, EV can easily know that
how long the CS will remain busy. This information allows
the EV to choose the optimal charging time slot where it
can get the energy as per its demand and in due course. The
algorithm proposed for optimal energy trading is discussed
in Section IV-A.
A. Algorithm for Energy Trading
One of the main goals of the proposed work is to prevent
redundant energy requests that are repeatedly sent by the
energy seller. These requests are either fake or very small
and cause malfunctioning in the energy trading environment.
When an energy seller generates a new energy trading
request, LAG checks the seller’s authentication and matches
its request with the ones already present in the M-Pool. If the
new request is already stored in M-Pool for processing, it is
being discarded. Otherwise, it is placed in M-Pool according
to the steps given in Algorithm 2.
Initially, in the energy trading process, the node with
surplus energy sends request to the LAG. For instance, EV s
i
sends request to other nodes that contains IDi,R,Loccur,
SoC pr and Bcap. LAG calculates the Epr
kW h of the battery
with the help of SoC pr and Bcap that are provided by EV s
i,
using Equation 1.
Epr
kW h =SoCpr
100 xBcap,(1)
LAG also calculates the amount of energy required by an
EV using Equation 2
Erq
kW h = (Bcap Epr
kW h).(2)
In the next step, LAG validates the EV s
i’s ID to ensure
authentication. Afterwards, LAG checks the energy request
in M-Pool via EV s
i’s ID. It stops the transaction process
and sends a notification to the EV s
iif the energy request
already exists. The request checking function of EV s
iworks
like a filter to avoid redundant requests to be placed in M-
Pool. Besides, LAG checks the role of EV s
ias a seller. For
this purpose, a selling function is executed. Before starting
energy trading process, the function first verifies the EV-
CS pairs present in the P-Pool. If EV s
iis not already paired
with any CS, a pair is being made to perform energy trading.
As a result, the reputation value of EV s
iis increased by 1.
In another case, if EV s
iis already paired with a CS, its
reputation value is decreased by 1 and its existing pair is
removed from the P-Pool.
Moreover, in the next step, a threshold value (Eth) for
SoC pr of EV s
iis calculated, which can be different in
practice. However, in our case, the threshold level is set to
be 30 percent of the Bcap. The threshold is calculated using
EV M-PoolLAGCS PSC
ESC
Request to get CS's SoCpr
, Qenand Loc cur
Provide specific detail
Check for existing
energy request
No existing request
Run ESC for a specific CS according to EV's request
Provide a list of nearest
CSs with Dist
i jExrq and Trq
Confirm pair notification
Confirm pair notification
Select a preferable CS
Check available
energy of EV
Find the nearest CS and
calculate specific details
Compare with the
existing request
Forward request to CS having required energy
Accept EV's request
Create a pair of
EV and CS
Energy selling request
Run PSC
Figure 3: Sequence Diagram for Seller EV’s Energy Trading Scheme
Equation 3.
Eth =30
100xBcap.(3)
In addition, the value of Eth is subtracted from Epr
kW h of
EV s
ito get the total available units of energy (Eav
kW h).
Eav
kW h = (Epr
kW h Eth).(4)
In the next step, Eav
kW h of EV s
iis checked. If it is more than
10 units of energy, the energy trading request is processed.
Otherwise, the process is stopped and a notification is sent to
EV s
ithat the present energy level is very low. Furthermore,
the Loccur
iof the EV s
iis assigned to variable Locbfor pro-
cessing. According to the Loccur
i, LAG finds the appropriate
CSs for the EV s
i. The energy trading is done between EV s
i
and the selected CS. Afterwards, the corresponding price for
traded energy is determined using Equation 5 as follows.
Ps
i=aSoC pr
SoC pr SoCth ,(5)
where SoC th is a threshold value. In this study, SoCth is
set to be 30 percent on the basis of SoC for each EV s
i’s
battery. ais used to calculate price value, which is equal to
$0.065. However, SoCth and acan be different in practice.
Equation 5 is used after taking motivation from [20]. De-
pending on the location of EV s
i, information of the nearest
CSs is provided that contains Ps
j,Epr
kW h and Qev
n. Moreover,
GPS is used to find the nearest CS and to measure the
distance between EV and CS. The purpose of GPS is to
provide an accurate measurement between two different
locations. On the basis of accurate distance, Exr q and Trq
are calculated to reach the CS. Furthermore, EV s
iselects a
CS from the list that is provided by LAG, which then sends
the trading request of EV s
ito the CS. If the CS accepts the
energy selling request, the LAG makes a pair of EV s
iand
CS, and sends notification to both of them. Furthermore,
ESC is executed to perform energy trading process. After
the energy is successfully traded between a pair of EV s
iand
CS, the payment transactions are handled by the PSC. The
energy selling price is defined initially when the request is
generated. However, the payment is made using PSC after
energy is successfully traded and coins are shared between
EVs and CSs.
The energy buying functionality of EV b
iis described as
follows. Pre-made pairs are checked according to the ID of
the EV b
ithat sends the energy buying request. When the pair
does not exist, the LAG takes the location of the EV b
iand
gets request from the M-Pool with seller’s Loccur
jand Ps
j.
It then measures the distance between EV b
iand CSs using
GPS. Afterwards, LAG provides the information of all the
nearest CSs to the EV, which includes the distance of CS, Ps
j,
Qev
n,SoC pr
j,Trq and Exrq to reach the CS. The provided
list of CSs is shown in Table III. The EV selects one of the
CSs provided in the list. LAG makes pair of EV and CS, and
sends notification to both of them. In the next stage, ESC is
executed and the energy request is entertained. Afterwards,
PSC is processed. When PSC runs, it first verifies the IDs
of both CS and EV b
i. It then accesses their wallet addresses.
Algorithm 2: Algorithm of Request for Energy Trading
1: Initialization
2: Inputs: IDi, Ri, Loccur
i, SoC pr, Bcap
3: Output: Request status
4: Epr
kW h =SoC pr
100 xBcap
5: Erq
kW h = (Bcap Epr
kW h)
6: Check request (IDi)
7: if Request present (IDi)=0 then
8: if Rtype= Seller then
9: Check pair (IDi)
10: Eth =30
100 xBcap
11: Eav
kW h = (Epr
kW h Eth)
12: if Eav
kW h >10kW h then
13: Loccur
i=Loccur
i
14: Ps
i=aBcap
Epr
kW hEth
15: geocode(Loccur
i)
16: for k = 1 to No. of nearest CSs do
17: Price announced to nearest CSs
18: end for
19: if CS selects EV’s Request then
20: Create pair (IDiwith IDj)
21: Send notification (IDi,j)
22: else
23: Request stored in M-Pool with Loccur
iand Ps
i
24: end if
25: else
26: Send message “Present energy is very low”
27: end if
28: else
29: Check pair (IDi)
30: Locb=Loccur
i
31: Get requests from M-Pool with seller’s Loccur
j
and Ps
j
32: for j=1 to last 10 requests do
33: Get Locs
jand Ps
j
34: Dij=gmaps.distance matrix(Locb
i, Locs
j)
35: Exrq = (Dij/1000)x(Ps
j/8.21)
36: end for
37: Announce Exrq, Dij, T rq and P s
jto EV b
i
38: if EV selects preferable CS or EV then
39: Buyer and seller pair is confirmed
40: Create pair (IDiwithIDj)
41: Pair is sent to ESC for energy trading
42: Run PSC
43: else
44: Request discarded
45: end if
46: end if
47: Reputation score (IDi)
48: else
49: Request exist (IDi)
50: end if
51: End
When verification is performed, PSC checks the balance in
the energy buyer’s wallet. If the energy buyer’s balance is
Algorithm 3: Algorithm of Payment Smart Contract
1: Initialization
2: Inputs: IDs
i, IDb
i
3: Output: Payment to be made
4: Verify (IDs
i)
5: Verify (IDb
i)
6: wallets= access wallet address according to I Ds
i
7: walletb= access wallet address according to I Db
i
8: Verify wallet address(wallets)
9: if wallets= false then
10: Stop energy trading
11: end if
12: Verify wallet address (walletb)
13: if walletb= false then
14: Stop energy trading
15: end if
16: Event Sent(f rom, to, amount)
17: Transfer energy coin
(wallets, walletb, P s
kW h, Ek W h)
18: amountpayable =Ps
kW h xEkW h
19: if amountpayable > balance[walletb]then
20: Send message “Insufficient balance, please buy coins
21: balance[walletb]=amountpayable
22: balance[wallets] + = amountpayable
23: Emit Sent(sender, receiver, amountpayable)
24: end if
25: End
TABLE III: Time and Expenses Required to cover the
Distance for Reaching the Nearest CSs
EV
Loccur
CS
Loccur
Distance
(km)
Trq
(mins)
Qev
nExrq
(USD)
33.655,
73.153
33.672,
73.111
8.8 15 2 $0.97
33.655,
73.153
33.645,
73.163
1.9 4 3 $0.021
33.655,
73.153
33.640,
73.152
3.2 9 2 $0.035
33.655,
73.153
33.643,
73.108
13.1 19 3 $0.144
33.655,
73.153
33.644,
73.164
1.8 3 4 $0.02
less than the purchased energy coins, PSC stops the energy
trading. Otherwise, PSC withdraws money from the energy
buyer’s wallet and puts it in the energy seller’s wallet. As a
result, Qev
nof the respective CS is decremented by 1. After
EV b
icompletes the energy trading process, its reputation
score is increased.
V. MATHEMATICAL FORMULATION
The section comprises of the mathematical formulation of
the underlying work. In the first subsection, the mathematical
formulation of the delays involved in the VEN is given.
While in the next subsection, the mathematical formulation
of the coordination done between the vehicles at the cross-
roads is presented.
A. Delays in Vehicular Energy Network
There exist different types of delays in message sharing
between vehicles and the RSUs. The common delays include
the propagation delay, transmission delay, message process-
ing delay and queuing delay [73].
The delay caused while sending a message bit by bit from
one vehicle to other vehicles present in the network is known
as the propagation delay. It is denoted by propdelay and
depends upon the distance between source and destination
and the speed of sending the message. It is given in Equation
6 obtained from [73]. Transmission delay, on the other hand,
is the delay caused during the transmission of an entire
message between two vehicles. It is denoted by transdelay
and is given in Equation 7 [73]. It depends upon the total
message size and the data rate.
propdelay =distance
velocity (6)
transdelay =message size
data rate (7)
Furthermore, the message processing delay is the delay
caused in processing the message by the receiving vehicle.
It is denoted by procdelay and depends upon the message
size and the processing speed. The fourth type of delay is
encountered when there exists a large number of messages
in the queue that need to be processed. This delay is
significant at the RSUs because a great number of messages
are constantly broadcasted by the vehicles to the RSUs.
This delay is known as the queuing delay and is denoted
by quedelay . This delay is linked with transdelay using
Equation 8, taken from [74].
quedelay =transdelay queuelength (8)
All of the above mentioned delays are summed up to
provide the total delay occurred in the network. The total
delay, denoted as totaldelay, is given in Equation 9. This
delay can also be termed as end-to-end delay, denoted as
end to enddelay.
totaldelay =propdelay +transdelay +procdelay +quedelay
(9)
1) Objective Function: It is a very important function in
the mathematical formulation of any network. The objective
function of the proposed work is the minimization of the
total delay, given in Equation 10.
objective f unction =min(totaldelay)(10)
B. Coordination at the Crossroads
In VENs, the coordination between vehicles and the timely
sharing of information play important roles. To prevent both
the occurrence of mishaps between vehicles and the road
congestion, coordination between vehicles is necessary at
the crossroads. The vehicles have three choices to make
at the crossroads: 1) turn towards right side, 2) turn to-
wards left side and 3) proceed straight ahead. The proposed
coordination mechanism is designed keeping the real life
feasibility in mind. If multiple vehicles are present at the
intersections, the vehicles having high credibility and good
reputation are given the priority to cross the intersections.
Same prioritization mechanism is followed in the special
case where vehicles are mobile and various movements are
observed at the intersections. Figure 4 shows these options
and the coordination between vehicles.
Figure 4: Coordination at the Crossroads
1) Assumptions: Before discussing the options available
for the vehicles at the crossroads, it is necessary to provide
the assumptions made in this study. These assumptions are
given below.
The vehicles are right-hand driven, which means that
people drive on the left side of the roads.
The crossroads do not have traffic signals and the drivers
have to cross the intersections at their own risk.
Each vehicle has the option to either turn right, turn left
or go straight.
2) Coordination Types: There are two types of coordina-
tion available for the vehicles at the crossroads. These are
a) rule based and b) optimization based. The details of these
types are given below.
Rule based coordination: in this type of coordination,
the vehicles are bound to obey some given rules,
implemented through a predefined protocol. According
to these rules, each vehicle is assigned a specific zone
when it reaches the intersection. If no vehicle is coming
from the other three sides present in that zone, the
vehicle is allowed to pass through crossroads at a given
speed. On the contrary, if the vehicles are found present
in the coordination zone, the vehicle near the crossroads
is given the priority; while, the other vehicles are asked
to reduce their speed and let the other vehicle pass to
avoid any mishap.
Optimization based coordination: in this type of co-
ordination, the coordination between vehicles is formu-
lated as a mathematical function. Different algorithms
and tools are used to formulate the coordination.
In the proposed work, rule based coordination is used be-
cause it is easy to be followed by all the drivers. Moreover,
the aim of this work is the implementation of the proposed
scheme on a global scale and not confining to a specific
geographical area. If the optimization based coordination is
used, it would be targeted to a specific area. Furthermore, not
everyone is trained enough to implement specially designed
optimization algorithms. Therefore, keeping all the factors
in mind, rule based coordination is used in the underlying
work.
3) Coordination Cases: Three different route selection
cases available for the vehicles present at the crossroads are
discussed below.
Case 1: when the vehicles intend to turn towards
the right side: when vehicles select to turn right at
the crossroads, then they have to communicate with
the vehicles coming from the opposite side wishing to
continue in the straight path. Moreover, they also have
to coordinate with the vehicles coming from the right
side wishing to turn either towards right or go in the
straight path. In this case, we have assigned probability
value of 0.5 to the vehicles turning towards right. While,
the other options are given probabilistic value of 0.25
each.
Case 2: when the vehicles intend to turn towards
the left side: in this case, the vehicles turning left are
given the probabilistic value of 0.5; while, the other two
options are given the values of 0.25 each. The vehicles
are able to turn towards the left side without performing
any coordination as no vehicle from any other side is a
hindrance to their path.
Case 3: when the vehicles intend to go straight: in the
third case, the vehicles neither turn towards left side nor
towards the right side. Rather, they continue their course
and keep moving in the straight direction. In following
such a route, the vehicles must communicate with the
other vehicles coming from the right and left sides,
who wish to proceed straight. Furthermore, they must
also communicate with the vehicles coming from the
opposite and the left sides, who wish to turn towards the
right side. In this case, the vehicles proceeding straight
ahead are assigned probabilistic value of 0.5. While, the
vehicles turning left and right are given value of 0.25
each.
Algorithm 4 provides the guidelines to be followed by the
vehicles while passing through the crossroads. In the algo-
rithm, all the cases available for the vehicles are discussed
one by one: vehicles coming from right side (Lines 13-22),
vehicles going straight (Lines 23-32) and vehicles turning
left (Lines 33-36). If the conditions are suitable, the vehicles
are allowed to move further. Else, it is stopped from moving
ahead.
The shortage of energy and absence of an efficient energy
trading mechanism creates a sense of anxiety among the
drivers. The anxiety is because of the fact that energy
Algorithm 4: Algorithm of Coordination at Crossroads
1: Initialization
2: Inputs: Number of vehicles, T urnlef t,T urnr ight,
Gostraight
3: Output: Crossroad crossing
4: for Each vehicle, vehicle = 1, ..., n do
5: Check for the authorization of the vehicle
6: if Vehicle is authorized then
7: Check for its option of the route selection
8: else
9: Assign the vehicle as malicious
10: end if
11: end for
12: for The different options made by the vehicles do
13: if The vehicle opts for T urnright then
14: Check for the vehicles coming from right side and
from opposite side
15: if The vehicles are coming either from right side
or the opposite side then
16: Deny the vehicle from turning right
17: Send message “Do not turn right”
18: else
19: Allow the vehicle to turn right
20: Send message “Turn right”
21: end if
22: end if
23: if The vehicle opts for Gostraight then
24: Check for the vehicles coming from right side, left
side and opposite side
25: if The vehicles are coming from right side, left
side or opposite side then
26: Deny the vehicle from going straight
27: Send message “Do not go straight”
28: else
29: Allow the vehicle to go straight
30: Send message “Proceed forward”
31: end if
32: end if
33: if The vehicle opts for T urnlef t then
34: Allow the vehicle to turn left
35: Send message “Turn left”
36: end if
37: end for
38: End
consumption is more at lower speeds and vehicles are driven
at increased speeds to save energy. Moreover, when the
vehicles have to wait for a longer time at the intersections,
their energy is consumed, which reduces the energy stored
in the batteries. As a result, the anxious vehicle drivers
will try to cross the intersections hurriedly without per-
forming any coordination. It will lead to high chances of
accidents. To cater the anxiety issue and reduce the number
of accidents, an efficient energy trading mechanism and an
accident avoidance mechanism based on coordination are
proposed. The coordination between vehicles would result
in accident avoidance; while, energy trading would ensure
that the vehicles are able to get required amount of energy
from the nearby charging entities. Hence, both energy trading
and accident avoidance go side by side.
VI. ME SS AGE CREDIBILITY AND RA NG E ANX IE TY
With the increase in the vehicles running on the roads, the
messages being generated and shared between vehicles are
also increased, which further leads to data storage issue. To
deal with this issue, message credibility is ensured. The mes-
sage credibility is defined as the extent to which a message is
believed to be true by the recipients. The sharing of credible
messages between the network participants ensures trustwor-
thiness, reliability, etc. In the proposed work, the storage of
credible messages ensures data redundancy as non or less
credible messages will be discarded. The messages generated
are compared with each other and only the important and
credible ones are saved. Message credibility is different from
the vehicle credibility. In the latter, the trustworthiness of a
vehicle is checked based upon the previous activities and a
vehicle is considered either to be trustable or malicious. If
the activities are found honest and transparent, the vehicle
is considered credible and vice versa. It further leads to the
belief in the authenticity of the messages being generated.
Algorithm 5 shows the mechanism used for checking the
credibility of the incoming messages. In the algorithm, each
new incoming message is checked for redundancy. If the
vehicle is authenticated, the message is accepted else it
is discarded (Lines 4-14). Once the message is accepted,
duplication in the message content is checked. If different
text is found, message is saved; else it is discarded (Lines
15-22).
Range anxiety is the fear possessed by EV drivers that the
vehicles will run out of charge while going on long journeys.
This fear restricts the users from shifting to EVs from
conventional vehicles. The phenomenon of range anxiety
depends upon two factors: distance to cover and battery
capacity. It is directly proportional to the distance to be
covered; greater the distance, greater is the range anxiety. On
the contrary, battery capacity exhibits an inverse relation with
range anxiety; increased battery capacity yields decreased
range anxiety. Mathematically, range anxiety is calculated
using Equation 11.
rangeanxiety =distance to cover
battery capacity (11)
We have high and low range anxious users in the VEN.
The first type of range anxious users are highly anxious
about their batteries being drained off while going on long
distances. Such users are constantly looking for CSs to have
their vehicles charged at all times. On the other hand, low
range anxious users do not worry much about their batteries
being drained off and tend to recharge their batteries when
less than 20% charge is remaining. Moreover, the EV users
are also informed about the CSs’ locations on their ways
through RSUs. Knowing the exact location of the CSs helps
the drivers to select the optimal path to reach the destination.
Algorithm 5: Algorithm of Data Redundancy Removal
1: Initialization
2: Inputs: Number of vehicles, Incoming message
3: Output: Message storage
4: for Each vehicle, vehicle = 1, ..., n do
5: Check for the incoming message
6: if Message is received then
7: Check for message credibility
8: if Vehicle is authorized then
9: Accept the message
10: else
11: Discard the message
12: end if
13: end if
14: end for
15: for Each authorized message do
16: Check the message content and find duplicate text
17: if Duplicate message is found then
18: Discard the message
19: else
20: Save the message
21: end if
22: end for
23: End
VII. INCENTIVE PROVISIONING
To motivate the vehicle users to take part in the proposed
system, they are being provided with the incentives. The
incentives prevent the vehicle drivers from not following the
traffic rules and regulations. If any driver breaks the traffic
rules, he will be penalized and has to pay some amount as
penalty. The penalty rates are set by the traffic regulatory
authority. Furthermore, the users are also provided with
incentives on sharing the important and credible messages.
If the messages being shared are not credible, the vehicle is
given the negative rating. Algorithm 6 presents the incentive
provisioning mechanism used in the proposed work. In
the algorithm, the message coming from each vehicle is
initially checked from credibility perspective. If the message
is found credible and important, the vehicle is provided with
incentives (Lines 5-11) and vice versa. In the second part
of the algorithm, a vehicle is checked from the perspective
of traffic signals following. If a vehicle follows the traffic
signals, it is provided with incentives and vice versa (Lines
12-20).
VIII. SIMULATION RESULTS AN D DISCUSSION
The simulations performed in the proposed work are
discussed in this section. The simulations are performed
on an HP 450 G4 Core-i5 7th Generation ProBook sys-
tem having 1 TB SATA, 8 GB DDR4 and Windows 10
Professional operating system. Solidity language is used to
write the smart contracts; while, Remix IDE is used for
providing an Integrated Development Environment (IDE).
Moreover, for assessing the virtual accounts, Ganache is
Algorithm 6: Algorithm of Incentive Provisioning
1: Initialization
2: Inputs: Number of vehicles, Incoming message
3: Output: Incentive provisioning
4: for Each vehicle, vehicle = 1, ..., n do
5: Checks for the incoming message
6: if Message received is credible and important then
7: Provide incentives to the vehicle
8: else
9: Does not provide the incentives
10: end if
11: end for
12: for Each authorized vehicle do
13: Check if the vehicle has followed the traffic rules
14: if Rules are followed then
15: Provide incentives to the vehicle
16: else
17: Penalize the vehicle
18: Generate a traffic challan
19: end if
20: end for
21: End
used; while, MetaMask is used for connectivity. Furthermore,
the experimental results are taken in Python 3.6.
In this study, we analyzed the performance of the proposed
scheme using real environment of a certain area in a city,
which is presented in Figure 5. In the given map, the red
marks indicate the CSs. The data of charging stations used in
the proposed work is taken from Oil and Gas Development
Corporation Limited, Pakistan. The traditional fuel pumps
are referred as the charging stations and their exact locations
are used for simulations. Furthermore, the values of risk
factor, network delays and energy available for selling are
the average values selected after performing multiple simu-
lations. Table IV presents the simulation parameters used in
the proposed work.
TABLE IV: Simulation Parameters’ Values
Simulation Parameters Values
Selected area 21.5km x 15.9km
Number of CSs 20
Number of EVs 50
Maximum number of generated
messages
500
Energy selling price $0 - $0.3
Energy available for selling 0kWh - 60kWh
SoC value 0% - 100%
Risk factor 0% - 80%
Network delays 0ms - 60ms
The main purpose of considering real environment is to
check the accuracy of the obtained results on the real data.
The values are the measurement of distance between the
locations of EVs and CSs. The values of Trq and Exrq
are estimated according to accurate distance measurement.
Moreover, Loccur is calculated by executing Algorithm 2.
The algorithm provides the locations of the nearest CSs and
measures the distance along with Trq and Exrq, which are
shown in Table III.
Figure 5: Real time Distribution of CSs
The consumption cost of smart contracts is calculated in
terms of gas, which is a small unit of cryptocurrency. This
unit is deducted from the users’ accounts while performing
transactions. Gas consumption depends on the complexity
of the smart contract. The consumption cost of the smart
contracts is further divided into transaction cost and ex-
ecution cost. Transaction cost is defined as the cost of
smart contract deployment. It involves the cost of adding
transactions in the blockchain. The execution cost, on the
other hand, is defined as the computational cost of executing
each individual operation. The execution cost is always
less than the transaction cost. Figure 6a shows the gas
consumption of the EV registration smart contract in terms
of transaction cost and execution cost. It is observed that the
former is greater than the latter. This is due to the fact that
the transaction cost involves the function execution cost as
well. Four different functions are shown in Figure 6a. These
functions are (a) EV registration, (b) message broadcast, (c)
message retrieval and (d) authentication. Similarly, Figure
6b shows gas consumption cost of ESC. In ESC, five main
operations are performed: (a) energy trading request, (b)
energy selling request, (c) verify ID, (d) check S oCpr and
(e) check Qev
n. The event (a) is executed when the energy
node registers itself with RA. During the execution of the
event, the information of SoCpr,Bcap and Qev
nis stored in
the blockchain. As more computational tasks are performed
by event (a); therefore, its transaction and execution costs
are higher as compared to other events. On the other hand,
Figure 6c shows gas consumption cost of PSC. There are five
different functions in the PSC: (a) recharge wallet, (b) access
buyer’s wallet address, (c) access seller’s wallet address, (d)
transfer energy coin form one account to another account and
(e) check current balance in wallet. It is observed from the
figure that event (a) consumes more gas because it performs
more operations as compared to other events.
In Figure 7, the comparison between the number of mes-
sages generated using authentication of vehicles and without
authentication is given. It is observed that the presence of
a b c
0
5000
10000
15000
20000
Tra nsac tion Cost
Exec uti on Cost
d
25000
Events
Total Consumption (gas)
(a)
Gas Consumption of Main Smart Contract
(b)
ESC’s Gas Consumption Cost
(c)
PSC’s Gas Consumption Cost
Figure 6: Gas Consumption of Smart Contracts
authenticated vehicles lead to less messages generated over
time. Whereas, in the presence of unauthenticated vehicles,
fake messages are generated, which increases the total num-
ber of messages being generated by the vehicles and also
increases the data storage requirements.
5 10 1 5 20 25 3 0 35 4 0 45 50 5 5 60 6 5 70 7 5 80 85 9 0
Time (minutes)
0
100
200
300
400
Number of Messages Generated
Wit hou t Aut hen tica tion
Wit h Au then tic atio n
Figure 7: Authentication of Vehicles
Energy Required (kWh)
Figure 8: Energy Required to Recharge EVs’ Battery
The energy price in the proposed scheme is determined
using the formula taken from [20]. The formula uses the ex-
isting SoC pr and SoCth values to determine the appropriate
energy price. In case, the charge of battery is full, the price
would be $0.09, which is the current energy rate in USA
[75]. By using the price formula, it is assessed that the price
of energy increases as the level of charging decreases and
vise versa. Furthermore, the number of required and available
energy units are calculated to sell optimum energy using the
SoC pr value. The required and available energy units of EVs
are shown in Figures 8 and 9, respectively. It is depicted
from the figures that the value of energy changes for each
EV. The red bar in Figure 9 shows that the SoCpr of EV s
i
is very low, i.e., 10 units. It means that the EV s
icannot sell
its energy. Algorithm 2 checks the charging level of EV s
i
when it sends energy selling request. For instance, if the
present energy units of EV s
iare less than 10 units, it cannot
perform selling operation. The level of energy units might
be different; however, for simulations’ purpose, the minimum
Energy Available for Selling (kWh)
Figure 9: Energy Units Available for Selling by EVs
Figure 10: Energy Selling Price Announced by Multiple EVs
number of energy units used is 10. Furthermore, the selling
price of EV s0energy units is illustrated in Figure 10. It is
clear from the figure that the energy selling price is not fixed
and is based on the charging level of EVs. The peak factor
is not considered in this work. Moreover, the energy selling
price is calculated through the PSC. Additionally, in order to
test the working of energy price formula, an EV is selected
and the formula is executed with different SoCpr values.
It is depicted from Figure 11 that the energy selling price
increases as the time increases and vise versa. The increase
in price with respect to time is because when an EV needs
more energy for charging, it will have to spend more time at
the charging entity. When the time required for charging is
more, the energy selling and buying cost will also be more.
Hence, the analysis proves that the pricing formula, given in
Equation 5, shows accurate results. Also, the energy price
increases as the load on the CS increases. In the proposed
work, EVs’ current SoCpr value is recorded and is illustrated
Figure 11: Change in Energy Selling Price Announced by
an EV with respect to time
in Figure 12. The value is recorded during the execution
of Algorithm 2. Based on SoC pr , each EV selects its role,
either as a seller or a buyer. The change in SoCpr value with
respect to time is shown in Figure 13.
To tackle the issue of huge storage demand, and to
Figure 12: SoC pr Values of Multiple EVs
avoid storage of malicious and duplicate data, filtration of
data is required. The time taken to save both filtered and
redundant data is visualized from Figure 14. As the amount
of data increases, the difference between the time taken
for storage of filtered and redundant data is also increased.
Figure 15 shows the range anxiety probability in relation to
the time taken to travel the distance. Two types of range
anxieties are shown in the figure: high range anxiety and
low range anxiety. It is observed from the figure that as the
time increases, the high range anxious users become more
hesitant while traveling to reach the nearest CS as compared
to low range anxious users. The simulation results for the
coordination of the vehicles and the delays encountered in the
Figure 13: Change in SoC pr of an EV with respect to Time
VEN are presented and discussed further. Figure 16 shows
the delays incurred in the VENs over time. It is observed
from the figure that the rise in the number of vehicles
increases the delays in the VENs. It is observed from the
figure that as the number of EVs increases, the quedelay also
increases. It is because each message needs specific time to
be processed, which adds up and increases the total quedelay .
10 20 30 40 50 60 70 80 90 100
0
2
4
6
8
10
minutes
Redu ndan t Da ta
Filt ered Dat a
Size of Data (kB)
Figure 14: Filtration of Broadcasted Messages
Figure 17 shows the increase in the risk factor at the
crossroads with and without the coordination between the
vehicles. It is observed that using coordination between
vehicles, the risk factor of the vehicle drivers is almost
halved. It shows the necessity of the coordination between
the vehicles in the VEN. This coordination also reduces the
number of accidents occurring at the crossroads.
1) Comparison: The underlying work is compared with
the work done in [20]. The auction is performed according
to the buying prices from charging EVs and selling prices
5 1 0 15 2 0 25 30 3 5 40 4 5 50 5 5 60 6 5 70 7 5 80 8 5 90
Time (minutes)
0.0
0.2
0.4
0.6
0.8
Probability of Range Anxiety
Hig h Rang e Anx iet y
Low Range Anxi ety
Figure 15: Range Anxiety of Vehicle Users
10 20 30 40 50 60 70 80 90 100
Number of EVs
0
10
20
30
40
50
60
Delays (microseconds)
Prop agat ion D elay
Tra nsm issio n De lay
Proce ssing Dela y
Que uin g De lay
Figure 16: Delays in the Vehicular Energy Network
10 20 30 40 50 60 70 80 90 100
Number of EVs
0
10
20
30
40
50
60
70
Risk Factor (%)
Wit h Coo rdi nat ion
Wit hou t Coor dina tio n
Figure 17: Reduction in Risk Factor due to Coordination
from the discharging EVs. In this way, the accurate amount
of energy and its price are determined by the auctioneer.
Furthermore, the private information of EVs is not revealed
during energy trading. As energy nodes send more than one
request at a time, it is hard to determine that the request
is coming from one or more EVs. Therefore, a pairing of
nodes is done on the basis of buying and selling bid prices.
However, there is a chance that an EV is paired up with
multiple CSs at a time by sending multiple requests. Due
to which it is difficult to prevent malicious nodes from
sending multiple requests. On the other hand, the proposed
Algorithm 2 examines the application of EVs. In this study,
two pools are created such as M-Pool and P-Pool. In M-
Pool, energy requests of energy nodes are placed; whereas,
P-Pool maintains the pairs of energy nodes. The new requests
generated by EV and CS are compared with the existing
requests in M-Pool. If the new request is present in M-Pool,
it is discarded in order to avoid redundancy; otherwise, it is
stored in M-Pool and processed. Moreover, the EV chooses
a preferable CS and LAG makes their pair and places it in
the P-Pool.
In order to make comparison between existing and pro-
posed algorithms, five EVs and three CSs are considered.
Initially, CSs send their energy selling requests and EVs
generate energy buying requests. In this observation, a mali-
cious EV is considered that sends multiple fake requests too
frequently. As a result, the benchmark algorithm executes
each request and makes pairs of nodes, even including
the malicious node and its fake requests. However, the
proposed algorithm first examines each request and then
starts processing. The redundant or matching requests are
discarded. Afterwards, pairs of corresponding EVs and CSs
are made. If a paired node tries to make a new pair, its
request is canceled and its existing pair is removed as well.
It shows that the proposed algorithm is more efficient than
benchmark model in terms of its processing. The mapping of
identified limitations with proposed solutions and validation
results is given in Table V.
IX. SECURITY ANA LYSIS
In this contribution, the consortium blockchain is used,
which ensures provisioning of security, privacy, data im-
mutability, transparency, etc. It comprises of the character-
istics of both public and private blockchain networks. It
requires prior permission, which makes the network more
secure and blocks the malicious nodes from joining the
network. Moreover, the energy network is protected from
attacks, such as sybil and re-entrancy attacks [76]. In this sec-
tion, security of the proposed scheme is analyzed in terms of
different possible vulnerabilities. The vulnerabilities include
data auditability, wallet security, transaction authentication,
double-spending and transaction tampering. Furthermore, the
proposed smart contracts are examined using Oyente security
analysis tool. Smart contracts are analyzed in terms of
different vulnerabilities, which are discussed below.
A. Data Auditability
The consortium blockchain is used in this study that
keeps records of energy trading requests and payments in
a verifiable, timestamped, and tamper proof manner. For this
reason, data records in the energy trading network cannot be
tampered.
B. Wallet Security
In the proposed scheme, PSC is used to ensure secure
and fair payment. The smart contract accesses the wallet
addresses of buyer and seller through their IDs. Moreover,
LAG is authorized to execute smart contracts at energy
trading time. The wallet’s address is not shared publicly,
which prevents energy coins from being stolen.
C. Transaction Authentication
In the proposed scheme, the PoW consensus mechanism
and the consortium blockchain are used to empower the LAG
to validate transaction records and only the registered energy
nodes are included in the energy trading network. Therefore,
a malicious node finds it almost impossible to intrude the
network and make illegal transactions.
D. No Double-spending
The wallet address of each energy node relies on SK and
digital signatures to verify their ownership and transaction
history. In this way, the model is prevented from the double-
spending attack.
E. No Transaction Tampering
The blockchain technology stores the data in a tamper
proof manner. Therefore, it is impossible to change the
energy transaction records that are stored in the blockchain.
X. ATTACKER MODEL
In the energy trading environment, nodes can cause finan-
cial loss and pose different security attacks to the system.
Some of the attacks are discussed below.
A. DoS
A kind of cyber attack in which the malicious node sends
too many requests and floods the network with unnecessary
traffic. In this attack, a target node is flooded with requests
and the information given to it triggers a crash. Due to this,
the network becomes inaccessible for the legitimate nodes
[77].
B. Refusing to Pay
In this attack, the malicious EV may pretend that it has not
received any energy from the seller CS or EV. The malicious
EV also refuses to pay for the received energy [19], [21].
C. Sybil Attack
In the energy trading environment, the malicious EV
makes sybil attacks by using multiple fake identities. In this
attack, malicious EV affects the reputation of other EVs by
executing fake energy transactions with the help of an energy
operator. Moreover, when reputation of the malicious node
is reduced due to its poor performance, it further influences
the network by creating new fake identities [19].
TABLE V: Mapping of Identified Limitations with Proposed Solutions and their Validations
Identified Limitations Proposed Solutions Validation Results
L1: Increased computational
overhead
S1: Proposed an algorithm to
prevent multiple energy re-
quests from an EV
V1: Algorithm 2 validates the tackling of
multiple energy requests. Figure 16 shows
four different types of delays for different
number of vehicles
L2: Increased charging time of
EVs and range anxiety of users
S2: Proposed M-Pool and P-
Pool to temporarily store en-
ergy transactions and pairs, re-
spectively
V2: M-Pool and P-Pool are used to temporar-
ily save data. Only the validated requests are
saved for processing. Algorithm 2 validates
the storage of transactions in pools. Figure
15 shows the comparison between high and
low range anxious users
L3: Absence of secure energy
trading
S3: Design ESC to perform en-
ergy trading
V3: ESC’s working steps are shown in Algo-
rithm 1. Transaction and execution cost are
illustrated in Figure 6b
L4: No secure payment mech-
anism to handle energy pay-
ments
S4: PSC is proposed to execute
payment related transactions
V4: PSC’s working steps are shown in Algo-
rithm 3. Transaction and execution cost are
illustrated in Figure 6c.
L5: Lack of reputation and
credibility mechanisms
S5: Increase or decrease the
reputation based on energy
trading requests and provision-
ing of incentives
V5: Reputation scoring function discussed in
Algorithm 2. Incentive provisioning discussed
in Algorithm 6
L6: Lack of security and pri-
vacy
S6: Vehicle registration smart
contract and certificate provi-
sioning
V6: Figure 6a shows the transaction and
execution cost of the blockchain technology
integrated in the proposed work to handle
security and privacy. A comparison between
the number of messages generated by authen-
ticated and unauthenticated vehicles is shown
in Figure 7
L7: Data redundancy S7: String and character match-
ing
V7: Figure 14 shows the time taken to store
redundant and filtered data
L8: Absence of coordination at
crossroads
S8: Coordination strategy V8: The risk factor associated with the num-
ber of vehicles present at the crossroads is
shown in Figure 17
D. Selfish Mining Attack
It is one of the famous cyber attacks in which the miner
holds the block for some specific time and then releases
it when the stakes are high to get the maximum benefit
[78]. In selfish mining attack, two parameters are of utmost
importance: αand γ. The former represents the mining
power of a selfish node; while, the latter denotes the
probability of a selfish node taking over the blockchain and
forcing honest nodes to add blocks to the fake chain. The
mining power and the probability of a honest miner are
given as (1 α)and (1 γ), respectively. The values of
both parameters lie in the range of 0 - 1 [79].
From the literature, it is observed that when the mining
power of a selfish node, i.e., αexceeds a certain value, the
node takes over the entire network and forges it according
to its will. Therefore, the threshold value is set to be 1
3
or 0.33. Above this value, the selfish node starts deviating
from the predefined protocol and increases its revenue.
According to the authors in [78] the revenue of the selfish
miner lies in the range given in Equation 12.
1γ
32γ< α < 1
2(12)
By using the maximum and minimum values of γin Equa-
tion 12, we get the output of selfish mining power to be
0.0098 and 0.33, respectively. Moreover, as the value of α
exceeds 50%, the revenue of the selfish miner is maximized
and approaches 100%. It also leads to the 51% attack in
which the entire network is compromised.
In the proposed VEN, the vehicles act maliciously and try to
get the maximum incentives. The malicious vehicle does not
provide the information to the RSU at a particular instance.
Rather, it holds back the information and then broadcasts it
at a highly beneficial instance. In the proposed work, PoW
consensus algorithm is used, which is highly vulnerable to
such attacks. If the selfish node takes hold of the network,
different issues can arise like delayed propagation of infor-
mation, wrong information being shared, roadside accidents,
leading the vehicle owners to unwanted detours, etc.
1) Code implementation: For selfish mining attack, the
values of αand γare varied from 0 to 1; while, the number
of simulations are varied from 50000 to 500000. The code is
divided into different portions or blocks. The details of the
blocks are given below.
Block 1 deals with the declaration of the initialization
of the parameters used in the code like the number
of simulations, number of honest, selfish and orphan
blocks, values of alpha and gamma, etc.
Block 2 deals with the declaration of the results being
saved in a separate file.
The details of the simulations, and the mechanism to
publish the public and private chains are given in block
3.
Moving on, the selfish and honest blocks being gen-
erated along with the total number of blocks being
generated are declared in block 4.
In block 5, the output of the code is given and is stored
in a .txt file
2) Mathematical Formulation: In this section, the math-
ematical formulation of different aspects related to selfish
mining attack is performed. These aspects include probability
of attack occurrence, calculation of total revenue generated,
and Profit and Loss (PnL) ratio. The details are provided
below.
Probability of attack occurrence: the probability of
the attack depends on different factors like compu-
tational power, selfish mining power, etc. During the
attack, orphan blocks are generated, which is the indica-
tion of the attack occurrence. With the growth in selfish
power, the number of orphan blocks is also increased.
In the proposed model, the number of orphan blocks
being generated is used to show the presence of selfish
miners. The number of orphan blocks is calculated from
Equation 13.
Orphanblocks =No. of simulationsN o. of blocks
(13)
From simulations, a direct relationship between the
number of orphan blocks and the attack occurrence
probability is observed.
Total revenue calculation: the revenue is generated by
the selfish miners when they successfully fork the orig-
inal blockchain, add the blocks to the fake blockchain
and get hold of the entire network. In selfish mining
attack, the malicious miners are successful in leading
the honest miners to generate blocks, which would be
added out of the blockchain. Hence, increased resource
consumption of the honest miners is observed. In the
proposed work, the revenue is calculated using Equation
14.
Revenue =Self ish blocks mined
T otal blocks mined (14)
From [78], the total revenue Rpool is calculated as
follows.
Rpool =rpool
rpool +rothers
(15)
Rpool =α(1 α)2(4α+γ(1 2α)) α3
1α(1 + (2 α)α)(16)
Where rpool denotes the blocks that are mined in the
pool; while, rothers represents the blocks mined outside
the pool. rpool and rothers are given as follows.
rpool =p00.α.2 + p00.γ.(1-α).1 + p2.(1-α).2 + P[i >
2].(1-α).1
rothers =p00.γ.(1-α).1 + p00.(1-γ).(1-α).2 + p0.(1-α).1
Where
p00= (1-α)p1,
αp0= (1-α)p1+ (1-α)p2,
αp1= (1-α)p2,
So, a generalized formula can be established as follows.
k2 : αpk= (1-α)pk+1 and
P
k=0 pk+p00= 1.
Profit and Loss ratio: the PnL ratio of the network
is used to calculate the selfish mining attack. It is
calculated by subtracting the cost Cfrom the revenue
Rper unit time as given in Equation 17, taken from
[80].
P nL =RC
T(17)
For long term, the profitability of the attack is calculated
using Equation 18, taken from [80].
P nLt=E[R]E[C]
E[T](18)
For i-cycle, we have the values of R, C and Tas Ri, Ci
and Ti, respectively. Now using these values, Equation
18 is modified as follows, taken from [80].
P nLn=
1
nPn
i=1 Ri1
nPn
i=1 Ci
1
nPn
i=1 Ti
(19)
3) How Selfish Mining Attack is Prevented?: In the pro-
posed work, the selfish mining attack is prevented through
the authentication of EVs, and issuance of rewards and
penalty for following and not following the pre-defined set
of rules, respectively. Moreover, blockchain technology is
implemented at the RSUs, where only important and less
redundant data is stored after filtration. To avoid the creation
of forks, secure ESC and PSC are used in the proposed
work. Combining all the mentioned characteristics of the
proposed VEN ensures that it is robust against the selfish
mining attack.
4) Graphical Representation: The amount of revenue
generated by the selfish miners is observed from Figure 18
with respect to α. It is visualized from the figure that the
revenue increases with the increase in the mining power of
the attacker. As the value of αsurpasses 0.5, the revenue is
maximized. It further shows the network’s robustness before
0.5. Once the value of αcrosses 0.5, the network loses
its robustness and is collapsed. The revenue of the selfish
miner is given in percentage in the figure. Apart from the
aforementioned attacks, there are some other attacks and
vulnerabilities that can damage the network’s performance
like call stack attack, time dependency attack, concurrency
bug, etc., [81], [82].
0.0 0 .2 0 .4 0.6 0 .8
Value of alpha ( α)
0
20
40
60
80
100
Revenue ratio
Figure 18: Revenue Generated (%)
XI. SM ART CONTRACT ANALYSI S
The smart contract is the fundamental part of a blockchain
network. It is a snippet of code that possesses the character-
istics of a contractual agreement. The main goal of a smart
contract is secure execution of the transactions between the
blockchain entities. The security analysis of the proposed
smart contracts is done using Oyente symbolic execution
tool. It is developed by National University of Singapore’s
researchers [82] to test the security flaws and vulnerabilities
of smart contracts written in Ethereum platform. Some of
the well known vulnerabilities are integer underflow and
overflow, parity multisig bug 2, timestamp vulnerability, etc.
The details of the aforementioned bugs are given below.
Integer Underflow: this type of bug arises when the
integer values used in the smart contract are less than
the lower boundary [83].
Integer Overflow: when the integer values used in the
smart contract exceed the upper boundary, the bug arises
[83].
Parity Multisig Bug 2: when an attacker gets hold
of multiple accounts and generates fake signatures for
them, the bug comes into view. The accumulation of a
large number of fake accounts makes the smart contract
to stop working [84].
Callstack Depth Attack Vulnerability: the failure of
a call function when its depth is equal to 1024 frames.
For successful calling of a function, it should have a
depth of at most 1023 frames [85], [86].
Transaction-Ordering Dependency: in this attack, the
transactions in the memory pool can be ordered by an
entity, provided it has enough resources.
Timestamp Dependency: in this attack, the timestamp
conditions are altered by an attacker to get hold of the
mining process. Every transaction has its own times-
tamp and is vulnerable to tampering [86], [87].
Re-Entrancy Vulnerability: in this vulnerability, the
path condition is used. When one smart contract calls
another smart contract, the transaction waits for the call
to end and then responds to the next call. The malicious
behavior is not considered in this bug [86].
The results presented in Table VI show the robustness
of the proposed smart contracts against the aforementioned
vulnerabilities. The figure depicts that all results are false;
hence, the EV registration smart contract is secure and robust
against different vulnerabilities. The security analysis of the
other two smart contracts (ESC and PSC) is also performed
using Oyente and similar results are obtained.
TABLE VI: Security Analysis Results
Vulnerability Result
EVM Code Coverage 99.5%
Integer Underflow False
Integer Overflow False
Parity Multisig Bug 2 False
Callstack Depth Attack Vulnerability False
Transaction-Ordering Dependency False
Timestamp Dependency False
Re-Entrancy Vulnerability False
XII. CONCLUSION
In this study, a consortium blockchain based energy trad-
ing mechanism for the EVs is presented. Three different
smart contacts are used for secure and efficient energy
transactions: EV registration, ESC and PSC. Energy buyers
and sellers can trade energy in a trustful manner using
the contracts. In the proposed scheme, an energy trading
algorithm is proposed to manage energy requests and remove
redundant requests through matching. Moreover, LAG is uti-
lized as an energy broker to process energy trading requests.
It also acts as a validator and performs the transactions’
validation. Furthermore, a consortium blockchain based co-
ordination scheme is put forward in the proposed work for
communicating between EVs at the unsignalized crossroads
and intersections. The coordination is performed between
EVs to minimize the chances of accidents happening at
the crossroads and also to reduce the risk of crossing the
intersections. The authentication of every new vehicle is also
done in the proposed work through RA. Moreover, the issue
of data redundancy caused due to the presence of a large
number of vehicles is tackled in the proposed study through
message credibility. The low and high range anxieties are
also handled along with mathematically formulating different
types of delays caused in the VENs. To motivate the vehicle
users to take part in the proposed network and share credible
messages, incentives are provided. The robustness of the
proposed model and the smart contracts is analyzed against
selfish mining attack and other vulnerabilities. Finally, the
performance of the proposed energy trading scheme is eval-
uated by performing several simulations. The simulation
results exhibit 25-30%minimization in the risk factor and
40-50%reduction in the data storage time.
In the future, we aim to incorporate enhanced security
protocols and tackle the latest attacks to make the system
more robust. Moreover, we also wish to introduce a user-
friendly pricing mechanism that will benefit both the EV
users and the CS owners. Furthermore, the proposed work
will be implemented on different cyberphysical systems to
prove its scalability and robustness. We also intend to work
on vehicles’ mobility in the future.
REFERENCES
[1] Dorahaki, S., Dashti, R. and Shaker, H.R., 2020. Optimal energy
management in the smart microgrid considering the electrical energy
storage system and the demand-side energy efficiency program. Jour-
nal of Energy Storage, 28, p.101229. DOI: 10.1016/j.est.2020.101229
[2] Shahidehpour, M., Li, Z. and Ganji, M., 2018. Smart cities for a
sustainable urbanization: Illuminating the need for establishing smart
urban infrastructures. IEEE Electrification Magazine, 6(2), pp.16-33.
[3] Hassija, V., Chamola, V., Garg, S., Krishna, D.N.G., Kaddoum, G.
and Jayakody, D.N.K., 2020. A blockchain-based framework for
lightweight data sharing and energy trading in V2G network. IEEE
Transactions on Vehicular Technology, 69(6), pp.5799-5812.
[4] Zhou, Z., Tan, L. and Xu, G., 2018, October. Blockchain and edge
computing based vehicle-to-grid energy trading in energy Internet. In
2018 2nd IEEE Conference on Energy Internet and Energy System
Integration (EI2) (pp. 1-5). IEEE.
[5] Zhang, D., Yu, F.R. and Yang, R., 2019. Blockchain-Based Distributed
Software-Defined Vehicular Networks: A Dueling Deep Q-Learning
Approach. IEEE Transactions on Cognitive Communications and
Networking, 5(4), pp.1086-1100.
[6] Wang, D. and Zhang, X., 2020. Secure data sharing and cus-
tomized services for intelligent transportation based on a consortium
blockchain. IEEE Access, 8, pp.56045-56059.
[7] Dwivedi, S.K., Amin, R., Vollala, S. and Chaudhry, R., 2020.
Blockchain-based secured event-information sharing protocol in inter-
net of vehicles for smart cities. Computers & Electrical Engineering,
86, p.106719. DOI: 10.1016/j.compeleceng.2020.106719.
[8] Aujla, G.S., Jindal, A. and Kumar, N., 2018. EVaaS: Electric vehicle-
as-a-service for energy trading in SDN-enabled smart transportation
system. Computer Networks, 143, pp.247-262.
[9] Emissions and Charging Costs-electric-cars. Available
online: https://www.ucsusa.org/clean-vehicles/electric-vehicles/
emissions-and- charging-costs-electric-cars (accessed 7-July-2020)
[10] IHS Markit Forecasts Global EV Sales To Rise By 70% In 2021.
2021. IHS Markit. Available online: https://ihsmarkit.com/research-
analysis/ihs-markit-forecasts-global-ev-sales-to-rise-by-70-
percent.html. (accessed 31-January-2021)
[11] Zhu, H., Yuen, K.V., Mihaylova, L. and Leung, H., 2017. Overview
of environment perception for intelligent vehicles. IEEE Transactions
on Intelligent Transportation Systems, 18(10), pp.2584-2601.
[12] Koufakis, A.M., Rigas, E.S., Bassiliades, N. and Ramchurn, S.D.,
2016, November. Towards an optimal EV charging scheduling scheme
with V2G and V2V energy transfer. In 2016 IEEE International
Conference on Smart Grid Communications (SmartGridComm) (pp.
302-307). IEEE.
[13] Qian, B., Zhou, H., Lyu, F., Li, J., Ma, T. and Hou, F., 2019. Toward
Collision-Free and Efficient Coordination for Automated Vehicles
at Unsignalized Intersection. IEEE Internet of Things Journal, 6(6),
pp.10408-10420.
[14] Chen, R., Liu, X., Miao, L. and Yang, P., 2020. Electric Vehicle Tour
Planning Considering Range Anxiety. Sustainability, 12(9), p.3685.
DOI: 10.3390/su12093685.
[15] Ping, J., Yan, Z., Chen, S., Yao, L. and Qian, M., 2020. Coordinating
EV Charging via Blockchain. Journal of Modern Power Systems and
Clean Energy, 8(3), pp.573-581.
[16] Dorri, A., Steger, M., Kanhere, S.S. and Jurdak, R., 2017. Blockchain:
A distributed solution to automotive security and privacy. IEEE
Communications Magazine, 55(12), pp.119-125.
[17] Chin, W.L., Li, W. and Chen, H.H., 2017. Energy big data security
threats in IoT-based smart grid communications. IEEE Communica-
tions Magazine, 55(10), pp.70-75.
[18] Chen, X. and Zhang, X., 2019. Secure electricity trading and incentive
contract model for electric vehicle based on energy blockchain. IEEE
Access, 7, pp.178763-178778.
[19] Wang, Y., Su, Z. and Zhang, N., 2019. BSIS: Blockchain-based secure
incentive scheme for energy delivery in vehicular energy network.
IEEE Transactions on Industrial Informatics, 15(6), pp.3620-3631.
[20] Jindal, A., Aujla, G.S. and Kumar, N., 2019. SURVIVOR: A
blockchain based edge-as-a-service framework for secure energy trad-
ing in SDN-enabled vehicle-to-grid environment. Computer Networks,
153, pp.36-48.
[21] Chaudhary, R., Jindal, A., Aujla, G.S., Aggarwal, S., Kumar, N. and
Choo, K.K.R., 2019. BEST: Blockchain-based secure energy trading in
SDN-enabled intelligent transportation system. Computers & Security,
85, pp.288-299.
[22] Javed, M.U., Javaid, N., Aldegheishem, A., Alrajeh, N., Tahir, M.
and Ramzan, M., 2020. Scheduling Charging of Electric Vehicles
in a Secured Manner by Emphasizing Cost Minimization Using
Blockchain Technology and IPFS. Sustainability, 12(12), p.5151. DOI:
10.3390/su12125151.
[23] Wang, H., Wang, Q., He, D., Li, Q. and Liu, Z., 2019. BBARS:
Blockchain-based anonymous rewarding scheme for V2G networks.
IEEE Internet of Things Journal, 6(2), pp.3676-3687.
[24] Liu, H., Zhang, Y., Zheng, S. and Li, Y., 2019. Electric vehicle power
trading mechanism based on blockchain and smart contract in V2G
network. IEEE Access, 7, pp.160546-160558.
[25] Ali, M.S., Vecchio, M., Pincheira, M., Dolui, K., Antonelli, F. and
Rehmani, M.H., 2018. Applications of blockchains in the Internet of
Things: A comprehensive survey. IEEE Communications Surveys &
Tutorials, 21(2), pp.1676-1717.
[26] Li, Y. and Hu, B., 2019. An iterative two-layer optimization charging
and discharging trading scheme for electric vehicle using consortium
blockchain. IEEE Transactions on Smart Grid, 11(3), pp.2627-2637.
[27] Nakamoto, S., Bitcoin: A Peer-to-Peer Electronic Cash System. Avail-
able online: https://bitcoin.org/bitcoin.pdf (accessed 13-August-2020)
[28] Wang, S., Taha, A.F., Wang, J., Kvaternik, K. and Hahn, A., 2019.
Energy crowdsourcing and peer-to-peer energy trading in blockchain-
enabled smart grids. IEEE Transactions on Systems, Man, and Cyber-
netics: Systems, 49(8), pp.1612-1623.
[29] Sun, G., Dai, M., Zhang, F., Yu, H., Du, X. and Guizani, M., 2020.
Blockchain-Enhanced High-Confidence Energy Sharing in Internet of
Electric Vehicles. IEEE Internet of Things Journal, 7(9), pp.7868-
7882.
[30] Gai, K., Wu, Y., Zhu, L., Xu, L. and Zhang, Y., 2019. Permissioned
blockchain and edge computing empowered privacy-preserving smart
grid networks. IEEE Internet of Things Journal, 6(5), pp.7992-8004.
[31] Khalid, R., Javaid, N., Almogren, A., Javed, M.U., Javaid, S. and
Zuair, M., 2020. A blockchain-based load balancing in decentralized
hybrid P2P energy trading market in smart grid. IEEE Access, 8,
pp.47047-47062.
[32] Yahaya, A.S., Javaid, N., Javed, M.U., Shafiq, M., Khan, W.Z.
and Aalsalem, M.Y., 2020. Blockchain-Based Energy Trading and
Load Balancing Using Contract Theory and Reputation in a Smart
Community. IEEE Access, 8, pp.222168-222186.
[33] Zhu, L., Wu, Y., Gai, K. and Choo, K.K.R., 2019. Controllable
and trustworthy blockchain-based cloud data management. Future
Generation Computer Systems, 91, pp.527-535.
[34] Xu, H., Zhang, L., Liu, Y. and Cao, B., 2020. Raft based wireless
blockchain networks in the presence of malicious jamming. IEEE
Wireless Communications Letters, 9(6), pp.817-821.
[35] Cui, Z., Fei, X.U.E., Zhang, S., Cai, X., Cao, Y., Zhang, W. and
Chen, J., 2020. A hybrid Blockchain based identity authentication
scheme for multi-WSN. IEEE Transactions on Services Computing,
13(2), pp.241-251.
[36] Kang, J., Yu, R., Huang, X., Wu, M., Maharjan, S., Xie, S. and Zhang,
Y., 2018. Blockchain for secure and efficient data sharing in vehicular
edge computing and networks. IEEE Internet of Things Journal, 6(3),
pp.4660-4670.
[37] Liu, X., Huang, H., Xiao, F. and Ma, Z., 2019. A blockchain-based
trust management with conditional privacy-preserving announcement
scheme for VANETs. IEEE Internet of Things Journal, 7(5), pp.4101-
4112.
[38] Khalid, A., Iftikhar, M.S., Almogren, A., Khalid, R., Afzal, M.K.
and Javaid, N., 2021. A blockchain based incentive provision-
ing scheme for traffic event validation and information storage in
VANETs. Information Processing & Management, 58(2), p.102464.
DOI: 10.1016/j.ipm.2020.102464.
[39] Sadiq, A., Javed, M.U., Khalid, R., Almogren, A., Shafiq, M. and
Javaid, N., 2020. Blockchain based Data and Energy Trading in
Internet of Electric Vehicles. IEEE Access, 9, pp.7000-7020.
[40] Lei, K., Du, M., Huang, J. and Jin, T., 2020. Groupchain: Towards a
scalable public blockchain in fog computing of IoT services comput-
ing. IEEE Transactions on Services Computing, 13(2), pp.252-262.
[41] Sultana, T., Almogren, A., Akbar, M., Zuair, M., Ullah, I. and Javaid,
N., 2020. Data sharing system integrating access control mechanism
using blockchain based smart contracts for IoT devices. Applied
Sciences, 10(2), p.488. DOI: 10.3390/app10020488.
[42] Li, H., Pei, L., Liao, D., Wang, X., Xu, D. and Sun, J., 2020. BDDT:
use blockchain to facilitate IoT data transactions. Cluster Computing,
pp.1-15.
[43] Han, S., Xu, S., Meng, W. and He, L., 2020. Channel-Correlation-
Enabled Transmission Optimization for MISO Wiretap Channels.
IEEE Transactions on Wireless Communications.
[44] Zhou, Z., Wang, B., Guo, Y. and Zhang, Y., 2019. Blockchain and
computational intelligence inspired incentive-compatible demand re-
sponse in internet of electric vehicles. IEEE Transactions on Emerging
Topics in Computational Intelligence, 3(3), pp.205-216.
[45] James, J.Q., Lam, A.Y. and Tan, S.C., 2017, October. Energy ex-
change coordination of off-grid charging stations with vehicular energy
network. In 2017 IEEE International Conference on Smart Grid
Communications (SmartGridComm) (pp. 375-380). IEEE.
[46] Atallah, R., Khabbaz, M. and Assi, C., 2016. Energy harvesting in
vehicular networks: A contemporary survey. IEEE Wireless Commu-
nications, 23(2), pp.70-77.
[47] Zhou, Z., Xiong, F., Xu, C., He, Y. and Mumtaz, S., 2017. Energy-
efficient vehicular heterogeneous networks for green cities. IEEE
Transactions on industrial Informatics, 14(4), pp.1522-1531.
[48] Li, Z., Kang, J., Yu, R., Ye, D., Deng, Q. and Zhang, Y., 2017.
Consortium blockchain for secure energy trading in industrial internet
of things. IEEE transactions on industrial informatics, 14(8), pp.3690-
3700.
[49] Aggarwal, S., Chaudhary, R., Aujla, G.S., Jindal, A., Dua, A. and Ku-
mar, N., 2018, June. Energychain: Enabling energy trading for smart
homes using blockchains in smart grid ecosystem. In Proceedings of
the 1st ACM MobiHoc Workshop on Networking and Cybersecurity
for Smart Cities (pp. 1-6).
[50] Martinez-Rendon, C., Camarmas-Alonso, D., Carretero, J. and
Gonzalez-Compean, J.L., 2021. On the continuous contract verification
using blockchain and real-time data. Cluster Computing, pp.1-23.
[51] Aloqaily, M., Boukerche, A., Bouachir, O., Khalid, F. and Jangsher,
S., 2020. An energy trade framework using smart contracts: Overview
and challenges. IEEE Network, 34(4), pp.119-125.
[52] Ali, F., Bouachir, O., Ozkasap, O. and Aloqaily, M., 2020. Syn-
ergyChain: Blockchain-assisted Adaptive Cyberphysical P2P Energy
Trading. IEEE Transactions on Industrial Informatics.
[53] Ali, F.S., Aloqaily, M., Alfandi, O. and Ozkasap, O., 2020. Cyberphys-
ical blockchain-enabled peer-to-peer energy trading. Computer, 53(9),
pp.56-65.
[54] Gao, F., Zhu, L., Shen, M., Sharif, K., Wan, Z. and Ren, K., 2018. A
blockchain-based privacy-preserving payment mechanism for vehicle-
to-grid networks. IEEE network, 32(6), pp.184-192.
[55] Ghofrani, M., Arabali, A., Etezadi-Amoli, M. and Fadali, M.S., 2014.
Smart scheduling and cost-benefit analysis of grid-enabled electric
vehicles for wind power integration. IEEE Transactions on Smart grid,
5(5), pp.2306-2313.
[56] Rehman, M., Javaid, N., Awais, M., Imran, M. and Naseer, N.,
2019, December. Cloud based secure service providing for IoTs
using blockchain. In 2019 IEEE Global Communications Conference
(GLOBECOM) (pp. 1-7). IEEE.
[57] Zou, S., Ma, Z., Liu, X. and Hiskens, I., 2016. An efficient game
for coordinating electric vehicle charging. IEEE Transactions on
Automatic Control, 62(5), pp.2374-2389.
[58] Liu, C., Chai, K.K., Zhang, X., Lau, E.T. and Chen, Y., 2018. Adaptive
blockchain-based electric vehicle participation scheme in smart grid
platform. IEEE Access, 6, pp.25657-25665.
[59] Mohammadi, J., Hug, G. and Kar, S., 2016. A fully distributed
cooperative charging approach for plug-in electric vehicles. IEEE
Transactions on Smart Grid, 9(4), pp.3507-3518.
[60] Amini, M.H., Moghaddam, M.P. and Karabasoglu, O., 2017. Simul-
taneous allocation of electric vehicles parking lots and distributed
renewable resources in smart power distribution networks. Sustainable
cities and society, 28, pp.332-342.
[61] Rowan, S., Clear, M., Huggard, M. and Mc Goldrick, C., 2017. Secur-
ing vehicle to vehicle data sharing using blockchain through visible
light and acoustic side-channels. arXiv preprint arXiv:1704.02553.
[62] Huang, X., Xu, C., Wang, P. and Liu, H., 2018. LNSC: A security
model for electric vehicle and charging pile management based on
blockchain ecosystem. IEEE Access, 6, pp.13565-13574.
[63] Gabay, D., Akkaya, K. and Cebe, M., 2020. Privacy-preserving Au-
thentication scheme for Connected Electric Vehicles Using Blockchain
and Zero Knowledge Proofs. IEEE Transactions on Vehicular Tech-
nology 69, 6, pp. 5760-5772.
[64] Pu, Y., Xiang, T., Hu, C., Alrawais, A. and Yan, H., 2020. An
efficient blockchain based privacy preserving scheme for vehicular
social networks. Information Sciences. pp. 308-324.
[65] Khalid, U., Asim, M., Baker, T., Hung, P.C., Tariq, M.A. and Rafferty,
L., 2020. A decentralized lightweight blockchain-based authentication
mechanism for IoT systems. Cluster Computing, pp.1-21.
[66] Elkhalil, A., Zhang, J. and Elhabob, R., 2021. An efficient het-
erogeneous blockchain-based online/offline signcryption systems for
internet of vehicles. Cluster Computing, pp.1-18.
[67] Fayazi, S.A. and Vahidi, A., 2018. Mixed-integer linear programming
for optimal scheduling of autonomous vehicle intersection crossing.
IEEE Transactions on Intelligent Vehicles, 3(3), pp.287-299.
[68] Lin, P., Liu, J., Jin, P.J. and Ran, B., 2017. Autonomous vehicle-
intersection coordination method in a connected vehicle environment.
IEEE Intelligent Transportation Systems Magazine, 9(4), pp.37-47.
[69] Dai, P., Liu, K., Zhuge, Q., Sha, E.H.M., Lee, V.C.S. and Son, S.H.,
2016. Quality-of-experience-oriented autonomous intersection control
in vehicular networks. IEEE Transactions on Intelligent Transportation
Systems, 17(7), pp.1956-1967.
[70] Hult, R., Zanon, M., Gros, S., Wymeersch, H. and Falcone, P., 2020.
Optimisation based coordination of connected, automated vehicles at
intersections. Vehicle System Dynamics, 58(5), pp.726-747.
[71] Gope, P. and Sikdar, B., 2019. An efficient privacy-preserving authen-
tication scheme for energy internet based vehicle-to-grid communica-
tion. IEEE Transactions on Smart Grid, 10(6), pp.6607-6618.
[72] Luo, B., Li, X., Weng, J., Guo, J. and Ma, J., 2019. Blockchain
enabled trust based location privacy protection scheme in VANET.
IEEE Transactions on Vehicular Technology, 69(2), pp.2034-2048.
[73] What are the different types of network delay? https://www.educative.
io/edpresso/what-are- the-different-types-of-network-delay (accessed
15-July-2020)
[74] Network Delays and Losses https://www.d.umn.edu/gshute/net/
delays-losses.xhtml (accessed 15-July-2020)
[75] 30 states allow kWh pricing, but non-Tesla EV drivers
mostly miss benefits https://electrek.co/2019/08/12/
kWh-pricing- ev-drivers-miss- benefits/ (accessed 17-September-
2020)
[76] Sayeed, S., Marco-Gisbert, H. and Caira, T., 2020. Smart contract:
Attacks and protections. IEEE Access, 8, pp.24416-24427.
[77] Yang, H., Yuan, J., Yao, H., Yao, Q., Yu, A. and Zhang, J., 2019.
Blockchain-based hierarchical trust networking for JointCloud. IEEE
Internet of Things Journal, 7(3), pp.1667-1677.
[78] Eyal, I. and Sirer, E.G., 2014, March. Majority is not enough: Bitcoin
mining is vulnerable. In International conference on financial cryptog-
raphy and data security (pp. 436-454). Springer, Berlin, Heidelberg.
[79] Chicarino, V., Albuquerque, C., Jesus, E. and Rocha, A., 2020. On the
detection of selfish mining and stalker attacks in blockchain networks.
Annals of Telecommunications, pp.1-10.
[80] Grunspan, C. and Prez-Marco, R., 2018. On profitability of selfish
mining. arXiv preprint arXiv:1805.08281.
[81] Ethereum Smart Contract Best Practices, Known Attacks. Avail-
able online: https://consensys.github.io/smart-contract-best- practices/
known attacks/ (accessed 5-July-2020).
[82] How to use Oyente, a smart contract security analyzer So-
lidity Tutorial. Available online: https://medium.com/haloblock/
how-to-use-oyente-a- smart-contract- security-analyzer (accessed 6-
July-2020)
[83] Known Attacks - Ethereum Smart Contract Best Practices. Avail-
able online: https://consensys.github.io/smart-contract-best- practices/
known attacks/ (accessed 6-July-2020)
[84] A Postmortem On The Parity Multi-Sig Library Self-
Destruct. Blockchain Infrastructure For The Decen-
tralised Web. Available online: https://www.parity.io/
a-postmortem- on-the- parity-multi- sig-library- self-destruct/ (accessed
6-July-2020)
[85] Hackernoon.com. Smart contract security: part 1 reen-
trancy attack. Available online: https://hackernoon.com/
smart-contract- security-part- 1-reentrancyattacks-ddb3b2429302
(accessed 6-July-2020)
[86] Shahid, A., Almogren, A., Javaid, N., Al-Zahrani, F.A., Zuair, M. and
Alam, M., 2020. Blockchain-based agri-food supply chain: A complete
solution. IEEE Access, 8, pp.69230-69243.
[87] Wang, X., He, J., Xie, Z., Zhao, G. and Cheung, S.C., 2019. Con-
tractGuard: Defend ethereum smart contracts with embedded intrusion
detection. IEEE Transactions on Services Computing, 13(2), pp.314-
328.
... Blockchain technology has been used in some previous research [8,27,[33][34][35][36][37][38][39][40] to decentralize the complex energy-economy networks and P2P energy trade. Blockchain technologies are now mainly led by industry, giving the domain a slightly distinct perspective than previous academic areas. ...
... Moreover, the tokens used for authentication are generated by the RSU without both EVs' contributions, which allows other entities to gain access to the service [8]. Javed et al. (2021) proposed a V2V energy-trading scheme based on blockchain technology. Their scheme includes both public and private blockchain network characteristics. ...
... However, this is insufficient as there are chances of identity theft (it is rather an identification mechanism than authentication). Hence, the system lacks initial security and privacy requirements in terms of mutual authentication and anonymity [39]. ...
Article
Full-text available
The use of Electric Vehicles (EVs) is almost inevitable in the near future for the sake of the environment and our plant’s long-term sustainability. The availability of an Electric-Vehicle-Charging Station (EVCS) is the key challenge that owners are worried about. Therefore, we suggest benefiting from individual EVs that have excess energy and are willing to share it with other EVs in order to maximize the availability of EVCSs without the need to rely on the existing charging infrastructure. The Internet of Electric Vehicles (IoEV) is gradually gaining traction, allowing for a more efficient and intelligent transportation system by leveraging these capabilities between EVs. However, the IoEV is considered a trustless environment, with untrustworthy trading partners such as data sellers, buyers, and brokers. Data exchanged between the EV and the Energy AGgregator (EAG) or EV/EV can be used to analyze users’ behavior and compromise their privacy. Thus, a Vehicle-to-Vehicle (V2V)-charging system that is both secure and private must be established. Several V2V-charging systems with security and privacy features have been proposed. However, even if the transmitted communications are entirely anonymous, anonymity alone will not prevent the tracking adversary from reconstructing the target vehicle’s route. These systems frequently fail to find a balance between privacy concerns (e.g., trade traceability to achieve anonymity, and so on) and security measures. In this paper, we propose an efficient privacy-preserving and secure authentication based on Elliptic Curve Qu–Vanstone (ECQV) for a V2V-charging system that fulfils the essential requirements and re-authentication protocol in order to reduce the overhead of future authentication processes. The proposed scheme utilizes the ECQV implicit-certificate mechanism to create credentials and authenticate EVs. The proposed protocols provide efficient security and privacy to EVs, as well as an 88% reduction in computational time through re-authentication, as compared to earlier efforts.
... The data saved in blockchain is immutable and does not face a single point of failure issue [16]. The blockchain has different applications like healthcare [17], banking, energy trading [18], and smart cities [19]. The blockchain has three types: public, private, and consortium. ...
Article
Full-text available
In this paper, a blockchain based secure routing model is proposed for the Internet of Sensor Things (IoSTs). The blockchain is used to register the nodes and store the data packets' transactions. Moreover, the Proof of Authority (PoA) consensus mechanism is used in the model to avoid the extra overhead incurred due to the use of Proof of Work (PoW) consensus mechanism. Furthermore, during routing of data packets, malicious nodes can exist in the IoSTs network, which eavesdrop the communication. Therefore, the Genetic Algorithm based Support Vector Machine (GA-SVM) and Genetic Algorithm based Decision Tree (GA-DT) models are proposed for malicious node detection. After the malicious node detection, Dijkstra algorithm is used to find the optimal routing path in the network. The simulation results show the effectiveness of the proposed model. PoA is compared with PoW in terms of the transaction cost in which PoA has consumed 30% less cost than PoW. Furthermore, without Man In The Middle (MITM) attack, GA-SVM consumes 10% less energy than with MITM attack. Moreover, without any attack, GA-SVM consumes 30% less than grayhole attack and 60% less energy than mistreatment. The results of Decision Tree (DT), Support Vector Machine (SVM), GA-DT and GA-SVM are compared in terms of accuracy and precision. The accuracy of DT, SVM, GA-DT and GA-SVM is 88%, 93%, 96% and 98%, respectively. The precision of DT, SVM, GA-DT and GA-SVM is 100%, 92%, 94% and 96%, respectively. In addition, the Dijkstra algorithm is compared with Bellman Ford algorithm. The shortest distances calculated by Dijkstra and Bellman are 8 and 11 hops long, respectively. Also, security analysis is performed to check the smart contract's effectiveness against attacks. Moreover, we induced three attacks: grayhole attack, mistreatment attack and MITM attack to check the resilience of our proposed system model.
Article
In the underlying work, the problems faced during message dissemination in the conventional Vehicular Energy Networks (VENs) like lack of security, breach of personal identities, absence of trust between vehicle owners, etc., are tackled. In this study, a Blockchain (BC) based announcement system is proposed for VENs to ensure secure and reliable announcement dissemination in the proposed network. The proposed system is a three-layered system comprising message dissemination layer, storage layer and BC layer. In the first layer, all the vehicles are registered through a Certificate Authority (CA), which ensures only the legitimate vehicles become part of the proposed network and interact with each other. Later, in the second layer, the data sent by the vehicles is stored at the artificial intelligence based Interplanetary File System (IPFS), which is incorporated with the Road Side Units (RSUs). This ensures reduction in storage cost and data availability. Besides, vehicle owners’ privacy is ensured by concealing the real identities of the vehicles. Moreover, the hashes of the data stored in the IPFS are stored in BC in the third layer. Also, lightweight trustworthiness verification of the vehicles, reputation based incentivization and concealing predictable trends in vehicles’ reputation scores are performed in the same layer. Overall, the novelty of the proposed work lies in the fact that the proposed system efficiently tackles different problems encountered in the existing systems simultaneously. Through extensive simulations, it is inferred that the computational time is reduced by 15–18% and the storage overhead is reduced by 80–85%, respectively when storing hash of data on the BC network as compared to storing actual data on the network.
Article
Full-text available
The use of Blockchain technology has recently become widespread. It has emerged as an essential tool in various academic and industrial fields, such as healthcare, transportation, finance, cybersecurity, and supply chain management. It is regarded as a decentralized, trustworthy, secure, transparent, and immutable solution that innovates data sharing and management. This survey aims to provide a systematic review of Blockchain application to intelligent transportation systems in general and the Internet of Vehicles (IoV) in particular. The survey is divided into four main parts. First, the Blockchain technology including its opportunities, relative taxonomies, and applications is introduced; basic cryptography is also discussed. Next, the evolution of Blockchain is presented, starting from the primary phase of pre-Bitcoin (fundamentally characterized by classic cryptography systems), followed by the Blockchain 1.0 phase, (characterized by Bitcoin implementation and common consensus protocols), and finally, the Blockchain 2.0 phase (characterized by the implementation of smart contracts, Ethereum, and Hyperledger). We compared and identified the strengths and limitations of each of these implementations. Then, the state of the art of Blockchain-based IoV solutions (BIoV) is explored by referring to a large and trusted source database from the Scopus data bank. For a well-structured and clear discussion, the reviewed literature is classified according to the research direction and implemented IoV layer. Useful tables, statistics, and analysis are also presented. Finally, the open problems and future directions in BIoV research are summarized.
Thesis
Full-text available
This thesis examines the use of blockchain technology with the Electric Vehicles (EVs) to tackle different issues related to the existing systems like privacy, security, lack of trust, etc., and to promote transparency, data immutability and tamper proof nature. Moreover, in this study, a new and improved charging strategy, termed as Mobile vehicle-to-Vehicle (M2V) charging strategy, is used to charge the EVs. It is further compared with conventional Vehicle-to-Vehicle (V2V) and Grid-to-Vehicle (G2V) charging strategies to prove its efficacy. In the proposed work, the charging of vehicles is done in a Peer-to-Peer (P2P) manner to remove the intermediary parties and deal with the issues related to them. Moreover, to store the data related to traffic, roads and weather conditions, a Transport System Information Unit (TSIU) is used, which helps in reducing road congestion and minimizing road side accidents. In TSIU, InterPlanetary File System (IPFS) is utilized to store the data in a secured manner. Furthermore, mathematical formulation of the total charging cost, the shortest distance between EVs and charging entities, and the time taken to traverse the shortest distance and to charge the vehicles is done using real time data of EVs. The phenomena of range anxiety and coordination at the crossroads are also dealt with in the study. Moving ahead, edge service providers are introduced to ensure efficient service provisioning. These nodes ensure smooth communication with EVs for successful service provisioning. A caching system is also introduced at the edge nodes to store frequently used services. The power flow and the related energy losses for G2V, V2V and M2V charging strategies are also discussed in this work. In addition, an incentive provisioning mechanism is proposed on the basis of timely delivery of credible messages, which further promotes users’ participation. Furthermore, a hybrid blockchain based vehicular announcement scheme is proposed through which secure and reliable announcement dissemination is realized. In addition, IOTA Tangle is used, which ensures decentralization of the system. The real identities of the vehicles are hidden using the pseudo identities generated through an Elliptic Curve Cryptography (ECC) based pseudonym update mechanism. Moreover, the lightweight trustworthiness verification of vehicles is performed using a Cuckoo Filter (CF). It also prevents revealing the reputation values given to the vehicles upon information dissemination. To reduce the delays caused due to inefficient digital signature verification, transactions are verified in the form of batches. Furthermore, a blockchain based revocation transparency enabled data-oriented trust model is proposed. Password Authenticated Key Exchange by Juggling (J-PAKE) scheme is used in the proposed model to enable mutual authentication. To prevent collusion attacks, message credibility check is performed using Real-time Message Content Validation (RMCV) scheme. Furthermore, K-anonymity algorithm is used to anonymize the reputation data and prevent privacy leakage by restricting the identification of the predictable patterns present in the reputation data. To enable revocation transparency, a Proof of Revocation (PoR) is designed for the revoked vehicles. The vehicle records are stored in IPFS. To enhance the chances of correct information dissemination, incentives are provided to the vehicles using a reputation based incentive mechanism. To check the robustness of the proposed model, attacker models are designed and tested against different attacks including selfish mining attack, double spending attack, etc. To prove the efficiency of the proposed work, extensive simulations are performed. The simulation results prove that the proposed study achieves high success in making EVs energy efficient, secure and robust. Furthermore, the security analysis of the smart contracts used in the proposed work is performed using Oyente, which exhibits the secure nature of the proposed work.
Article
Full-text available
Supply chains play today a crucial role in the success of a company’s logistics. In the last years, multiple investigations focus on incorporating new technologies to the supply chains, being Internet of Things (IoT) and blockchain two of the most recent and popular technologies applied. However, their usage has currently considerable challenges, such as transactions performance, scalability, and near real-time contract verification. In this paper we propose a model for continuous verification of contracts in supply chains using the benefits of blockchain technology and real-time data acquisition from IoT devices for early decision-making. We propose two platform independent optimization techniques (atomic transactions and grouped validation) that enhances data transactions protocol and the data storage procedure and a method for continuous verification of contracts, which allows to take corrective actions to reduce operational costs and increase benefits in current supply chains. An automatic deployment of a large scale distributed business logic system using virtualized appliances is also proposed. Evaluation results show the feasibility or the solution proposed.
Article
Full-text available
An essential goal of the Internet of Vehicles (IoV) is to allow vehicles’ peer connections and contact a service provider through a secure communication channel. However, privacy and authentication are considered the main objectives of secure communication. In this paper, we propose an efficient Online/Offline signcryption of heterogeneous systems based on blockchain to secure data sharing between the IoV and internet servers. The blockchain prevents tampering with compatibility information. Further, the smart contract addresses the weakness of internet servers, such as passing incorrect data to the IoV nodes. The proposed protocol satisfies the security requirements of IoV, such as integrity, authentication, unforgeability, and confidentiality in a single logical step. We introduce the construction of our Efficient Heterogeneous Signcryption Scheme for Internet of Vehicles (EHSC-IoV) and verify that our protocol is secure under the Discrete Logarithm (DL) and the Computational Diffie–Hellman (CDH) assumptions. As compared with the existing five heterogeneous signcryption schemes, the performance evaluation and simulation results show that the computational cost of the IoV nodes in our protocol reduced by about \( 75\%,84.2\%,80\%, 67.9\%\), and \( 82.4\%\), respectively, and the total energy consumption of the IoV nodes in our protocol reduced by about \( 69.4\%, 75.4\%, 75.2\%, 62.3\%,\) and \( 75.1\% \), respectively.
Article
Full-text available
The drastic increase in real-time vehicle generated data of various types has imparted a great concept of data trading in vehicular networks. Whereas immense usage of Electric Vehicles (EVs) as mobile energy carriers have supported distributed energy trading due to their bidirectional charging and discharging capabilities. The trustless environment of Internet of Electric Vehicles (IoEV), including fuel vehicles and EVs, encounters trading disputes and conflicting interests among trading parties. To address these challenges, we exploit consortium blockchain to maintain transparency and trust in trading activities. Smart contracts are used to tackle trading disputes and illegal actions. Data duplication problem occurs when a dishonest user sell previously traded data multiple times for financial gain. Therefore, data duplication validation is done through previously stored hash-list at roadside units (RSUs) employed with bloom filters for efficient data lookup. Removing data duplication at an earlier stage reduces storage cost. Moreover, an elliptic curve bilinear pairing based digital signature scheme is used to ensure the reliability and integrity of traded data. To ensure persistent availability of traded data, InterPlanetary File System (IPFS) is used, which provides fault-tolerant and a reliable data storage without any single point of failure. On the other hand, the energy trading transactions among EVs face some security and privacy protection challenges. An adversary can infer the energy trading records of EVs, and launch the data linkage attacks. To address this issue, an account generation technique is used that hides the energy trading trends. The new account generation for an EV depends upon its traded volume of energy. The experimental results verify the efficiency of the proposed data and energy trading scheme in IoEV with the reliable and secure data storage.
Article
Full-text available
In Vehicular Ad-hoc Networks (VANETs), a large amount of data is shared between vehicles and Road Side Units (RSUs) in real-time. VANETs assist in sharing traffic information effectively and timely to improve traffic efficiency and reliability. However, less storage capability and selfish behavior of the vehicles are important issues that need to be tackled. The traditional storage mechanisms involve third parties for data management, which are insecure, untrustworthy, non-transparent, and unreliable. To overcome these issues, a blockchain-based data storage scheme for VANETs is proposed in this paper. It exploits the benefits of the Interplanetary File System (IPFS) and blockchain is implemented on RSUs. The RSUs receive the aggregation packets sent by vehicles. These packets contain the events' information that occur in vehicles' surroundings. After verifying an aggregation packet, the RSUs store the event's information in IPFS and the reputation values of the sender vehicle in the blockchain. The reputation value is calculated based on the witnesses' (others vehicles) opinion, whether they agree with the initiator or not about an event. The initiator is the vehicle who initializes the event. Moreover, an incentive mechanism is also proposed in this work in which monetary incentives are given to the repliers who respond to the event information. These incentives are given by the initia-tors after verifying the signatures of the repliers. All the transactions involved in the incentive process are stored in the blockchain. Finally, Oyente is used for the security analysis of the proposed smart contracts. A comparison of the proposed scheme with the logistic regression scheme is also presented.
Article
Full-text available
The rapid deployment of Electric Vehicles (EVs) and the integration of renewable energy sources have ameliorated the existing power systems and contributed to the development of greener smart communities. However, load balancing problems, security threats, privacy leakage issues, etc., remain unresolved. Many blockchain-based approaches have been used in literature to solve the aforementioned challenges. However, they are not sufficient to obtain satisfactory results because of the inefficient energy management methods and time-intensiveness of the primitive cryptographic executions on the network devices. In this paper, an efficient and secure blockchain-based Energy Trading (ET) model is proposed. It leverages the contract theory, incentive mechanism, and a reputation system for information asymmetry scenario. In order to motivate the ET entities to trade energy locally and EVs to participate in smart energy management, the proposed incentive provisioning mechanism plays a vital role. Besides, a reputation system improves the reliability and efficiency of the system and discourages the blockchain nodes from acting maliciously. A novel consensus algorithm, i.e., Proof of Work based on Reputation (PoWR), is proposed to reduce transaction confirmation latency and block creation time. Moreover, a shortest route algorithm, i.e., the Dijkstra algorithm, is implemented in order to reduce the traveling distance and energy consumption of the EVs during ET. The performance of the proposed model is evaluated using peak to average ratio, social welfare, utility of local aggregator, etc., as performance metrics. Moreover, privacy and security analyses of the system are also presented.
Article
Industrial investments into distributed energy resource technologies are increasing and playing a pivotal role in the global transactive energy, as part of a wider drive to provide a clean and stable source of energy. The management of prosumers, that consume and as well generate energy, with heterogeneous energy sources is critical for sustainable and efficient energy trading procedures. This paper is proposing a blockchain-assisted adaptive model, namely SynergyChain, for improving scalability and decentralization of the prosumer grouping mechanism in the context of Peer-to-Peer (P2P) energy trading. Smart contracts are used for storing transaction information and for the creation of the prosumer groups. SynergyChain integrates a reinforcement learning module to further improve the overall system performance and profitability by creating a self-adaptive grouping technique. The proposed SynergyChain is developed using Python and Solidity and has been tested using Ethereum test nets. The comprehensive analysis using the Hourly Energy Consumption data-set shows a 39.7% improvement in the performance and scalability of the system as compared to the centralized systems. The evaluation results confirm that SynergyChain can reduce request completion time along with an 18.3% improvement in the overall profitability of the system as compared to its counterparts.
Article
Scalability and security problems with centralized architecture models in cyberphysical systems have provided opportunities for blockchain-based distributed models. A decentralized energy-trading system takes advantage of various sources and effectively coordinates the energy to ensure the optimal utilization of available resources. Three blockchainbased energy-trading models are proposed to overcome the technical challenges and market barriers as well as enhance the adoption of this disruptive technology.
Article
An artificial noise (AN)-aided beamformer specific to correlated main and wiretap channels is designed in this paper. We consider slow-fading multiple-input-single-output wiretap channels with multiple passive single-antenna eavesdroppers in which an independent transmitter side and correlated receiver side are assumed. Additionally, the source has accurate main channel information and statistical wiretap channel information. To reduce the secrecy loss due to receiver-side correlation, this paper proposes a channel-correlation-enabled transmission optimization scheme. In particular, the correlation is viewed as a resource to acquire more knowledge about wiretap channels. Based on this, the statistical distribution of wiretap channels is described more precisely, and an elaborate channel-correlation-enabled AN-aided beamformer is designed. Then, the achievable secrecy rate under transmit power and secrecy outage constraints is derived. Finally, the study is also extended to a specific scenario of multiple-antenna eavesdroppers. Simulation results show that the secrecy rate under transmit power and secrecy outage constraints can be improved under high correlation.
Article
This paper introduces the concept of hierarchical and zonal scheduling and proposes an iterative two-layer model to optimize the charging and discharging trading of electric vehicles (EVs), so as to minimize the overall load variance of the distribution network under the constraints of power flow and vehicle travel demand. In order to solve the mixed-integer programming (MIP) problem that exists in this model, an improved heuristic algorithm, the adaptive inertia weight krill herd (KH) algorithm is proposed. In addition, we design a decentralized trading architecture and related electricity trading process based on the consortium blockchain to ensure the security and privacy of two-way electricity trading between EVs and the smart grid. The IEEE nodes based simulation experiment shows that our scheme can effectively smooth power load fluctuations, and the improved KH algorithm can effectively improve the efficiency of model solving. Security analysis qualitatively proves that our scheme can ensure the security and privacy-preserving of electricity trading. Finally, our scheme is implemented in the Hyperledger Fabric to evaluate the feasibility and effectiveness.
Article
In vehicular social networks(VSNs), edge stations or cloud service provider can support the traffic services or location services to vehicles. Moreover, the information sharing among vehicles can assist vehicles to avoid traffic accidents and guarantee driving safety. However, it is easy to be threatened in the communication of vehicle-to-edge station, vehicle-to-cloud service provider and vehicle-to-vehicle in VSNs, which leads to the vehicle’s privacy leakage easily. Besides, some malicious users may provide untrustworthy information to mislead others just for its selfishness. Hence, in this paper, we propose an efficient, reliable and privacy-preserving scheme based on blockchain for VSNs. In our scheme, pseudonym mechanism is employed to achieve individual anonymization by concealing the vehicles’ identity. Moreover, to encourage vehicles to report trustworthy information, incentive-punishment mechanism is proposed. Meanwhile, we propose multi-factors and single-factor weight-based evaluation mechanism to evaluate the reliability of message. Additionally, Practical Byzantine Fault Tolerance (PBFT) and blockchain are also employed to achieve consensus and store the records respectively, which can prevent malicious entities from manipulating on vehicles’ reward scores and credit scores. Finally, we analyze the security of the proposed scheme in terms of external attacks, internal attacks, collusion attacks etc. The relevant experimental results are shown that our scheme is feasible and efficient.