Research ProposalPDF Available

Blockchain based Privacy aware Energy Trading in Electric Vehicles and Smart Homes - Synopsis

Authors:
Research Proposal

Blockchain based Privacy aware Energy Trading in Electric Vehicles and Smart Homes - Synopsis

Abstract and Figures

The rapid deployment of Electric Vehicles (EVs) and usage of renewable energy in day-to-day activities of energy consumers have contributed toward the development of a greener smart community. However, load balancing problems, security threats, privacy leakages, and lack of incentive mechanisms remain unresolved in energy systems. Many approaches have been used in the literature to solve the aforementioned challenges. However, these approaches are not sufficient to obtain satisfactory results because of the resource and time-intensiveness of the primitive cryptographic executions on the network devices. In most cases, energy trading systems manage transactions using a centralized approach. This approach increases the risk of a single point of failure and overall system cost. In this study, a blockchain based Local Energy Market (LEM) model considering Home Energy Management (HEM) system and demurrage mechanism is proposed to tackle the issue of a single point of failure in the energy trading system. It allows both the prosumers and consumers to optimize their energy consumption and minimize electricity costs. This model also allows end-users to shift their load to off-peak hours and to use cheap energy from the LEM. On the other hand, users’ privacy leakages are still not solved in blockchain and can limit its usage in many applications. This research also proposes a blockchain based distributed matching and privacy-preservation model that uses a reputation system for both residential homes and EVs to preserve users’ privacy and efficiently allocate energy. A starvation free energy allocation policy is presented in the model. In addition, a charging forecasting scheme for EVs is introduced that allows users to plan and manage their intermittent EVs’ charging. Partial homomorphic encryption based on a reputation system is used to hide the EVs users’ whereabouts. Identity Based Encryption (ID Based encryption) technique is incorporated in the model to preserve the users’ information privacy in the blockchain. Another bottleneck in the energy trading systems is to perform efficient and privacy-preserving transactions. Therefore, an efficient and secure energy trading model leveraging contract theory, consortium blockchain, and a reputation system is proposed. Firstly, a secure energy trading mechanism based on consortium blockchain technology is developed. 1 Then, an efficient contract theory based incentive mechanism considering the information asymmetry scenario is introduced. Afterwards, a reputation system is integrated to improve transaction confirmation latency and block creation. Next, a shortest route and distance algorithm is implemented in order to reduce the traveling distance and energy consumption by the EVs during energy trading. Cheating attacks launched by both buyers and sellers are also issues, which are still not resolved. Thus, a mutual-verifiable fairness mechanism during energy trading based on timed commitment is presented. Proof-of-Energy Reputation Generation (PoERG) and Proof-of Energy Reputation Consumption (PoERC) consensus mechanisms are proposed to solve the high computational cost and huge monetary investment issues created by Proof-of- Work (PoW) and Proof-of-Stake (PoS) existing mechanisms. The mechanisms are developed based on reputation where energy trading transactions are audited, validated, and added into blocks of a blockchain. In order to protect the proposed model from impersonation attacks and minimize malicious validators, a two-stage peer-to-peer secure energy trading model based on blockchain is proposed. The proposed model has two layers: a mutual authentication process layer, and a secure and privacy-preserving energy trading layer. Afterwards, an incentivepunishment algorithm is introduced to motivate energy prosumers to contribute more energy in the proposed model. Next, a dynamic contract theory based supply-demand ratio pricing scheme is proposed. The purpose of the proposed pricing scheme is to solve the issues associated with the existing pricing scheme. Also, to preserve the privacy of the actual energy consumption behavior of the trading participants.
Content may be subject to copyright.
COMSATS University Islamabad, Islamabad Campus
Synopsis For the Degree of M.S/MPhil. PhD.
PART-1
Name of Student Adamu Sani Yahaya
Department Computer Science
Registration No.
FA18-PCS-002 Date of Thesis Registration FALL 2019
Name of Research Supervisor (i) Dr. Nadeem Javaid
Research Area Artificial Intelligence
Members of Supervisory Committee
1Dr. Nadeem Javaid
2 Dr. Prof. Sohail Asghar
3 Dr. Majid Iqbal Khan
4 Dr. Muhammad Manzoor Ilahi Tamimy
Title of Research Proposal Blockchain based Privacy aware Energy Trading in Electric Ve-
hicles and Smart Homes
Signature of Student:
Summary of the Research
The rapid deployment of Electric Vehicles (EVs) and usage of renewable energy in day-to-day ac-
tivities of energy consumers have contributed toward the development of a greener smart commu-
nity. However, load balancing problems, security threats, privacy leakages, and lack of incentive
mechanisms remain unresolved in energy systems. Many approaches have been used in the litera-
ture to solve the aforementioned challenges. However, these approaches are not sufficient to obtain
satisfactory results because of the resource and time-intensiveness of the primitive cryptographic
executions on the network devices. In most cases, energy trading systems manage transactions us-
ing a centralized approach. This approach increases the risk of a single point of failure and overall
system cost. In this study, a blockchain based Local Energy Market (LEM) model considering
Home Energy Management (HEM) system and demurrage mechanism is proposed to tackle the
issue of a single point of failure in the energy trading system. It allows both the prosumers and
consumers to optimize their energy consumption and minimize electricity costs. This model also
allows end-users to shift their load to off-peak hours and to use cheap energy from the LEM. On
the other hand, users’ privacy leakages are still not solved in blockchain and can limit its usage
in many applications. This research also proposes a blockchain based distributed matching and
privacy-preservation model that uses a reputation system for both residential homes and EVs to
preserve users’ privacy and efficiently allocate energy. A starvation free energy allocation policy
is presented in the model. In addition, a charging forecasting scheme for EVs is introduced that
allows users to plan and manage their intermittent EVs’ charging. Partial homomorphic encryp-
tion based on a reputation system is used to hide the EVs users’ whereabouts. Identity Based
Encryption (ID Based encryption) technique is incorporated in the model to preserve the users’
information privacy in the blockchain. Another bottleneck in the energy trading systems is to
perform efficient and privacy-preserving transactions. Therefore, an efficient and secure energy
trading model leveraging contract theory, consortium blockchain, and a reputation system is pro-
posed. Firstly, a secure energy trading mechanism based on consortium blockchain technology is
developed.
1
Then, an efficient contract theory based incentive mechanism considering the information
asymmetry scenario is introduced. Afterwards, a reputation system is integrated to improve
transaction confirmation latency and block creation. Next, a shortest route and distance algo-
rithm is implemented in order to reduce the traveling distance and energy consumption by the
EVs during energy trading. Cheating attacks launched by both buyers and sellers are also issues,
which are still not resolved. Thus, a mutual-verifiable fairness mechanism during energy trad-
ing based on timed commitment is presented. Proof-of-Energy Reputation Generation (PoERG)
and Proof-of Energy Reputation Consumption (PoERC) consensus mechanisms are proposed
to solve the high computational cost and huge monetary investment issues created by Proof-of-
Work (PoW) and Proof-of-Stake (PoS) existing mechanisms. The mechanisms are developed
based on reputation where energy trading transactions are audited, validated, and added into
blocks of a blockchain. In order to protect the proposed model from impersonation attacks
and minimize malicious validators, a two-stage peer-to-peer secure energy trading model based
on blockchain is proposed. The proposed model has two layers: a mutual authentication pro-
cess layer, and a secure and privacy-preserving energy trading layer. Afterwards, an incentive-
punishment algorithm is introduced to motivate energy prosumers to contribute more energy in
the proposed model. Next, a dynamic contract theory based supply-demand ratio pricing scheme
is proposed. The purpose of the proposed pricing scheme is to solve the issues associated with
the existing pricing scheme. Also, to preserve the privacy of the actual energy consumption
behavior of the trading participants.
1 Introduction
A Smart Community (SC) integrates Information and Communication Technology (ICT) in an
advanced way to elevate the living quality of its residents. The rapid growth in the modern
ICT has contributed to the increased accessibility of many services to customers within a spe-
cific time, for example, public administration, e-government, smart education, smart transport
and Smart Energy Management (SEM) [1,2]. Thus, making institutional, residential, business,
etc., environments smart. SEM is one of the constituents of a smart community that efficiently
monitors, controls and regulates the energy without affecting the comfort of energy users [37].
An example of SEM is Smart Energy Trading (SET), which comprises of energy providers and
consumers. The former include utility companies and local energy prosumers while the lat-
ter are found in all domains, i.e., commercial, residential, transportation and industrial [810].
Recently, the dramatic rise in the penetration of Electric Vehicles (EVs) in the transportation do-
main has increased the pressure on the power grids. It is because EVs are charged using electric
power and the power grids have to fulfill their electricity demand [11,12]. Besides, EVs play
a very important role in balancing energy demand and supply as they can act as both energy
carriers as well as energy consumers according to certain situations.
The energy provider and consumer entities establish an energy network where energy re-
sources need to be managed efficiently to retain energy sustainability in the SC. Therefore, it
is a priority of the power systems to manage these sources efficiently. However, as the energy
generation becomes scarce, efficient trading of energy becomes challenging in the SC. It poses
issues for SET, such as the increased penetration of highly intermittent distributed renewable
energy sources in the power systems, poorly coordinated EVs, load balancing problems, etc.
The balance in energy demand and supply in a conventional system requires thousands of en-
ergy storage devices and centralized generators. This results in a huge investment in operational
and capital expenditure [13]. An alternative method is required to focus on the tremendous
increase in demand of electricity that arises in the community [1416]. Therefore, Demand Re-
sponse (DR) is an option to manage energy at the demand side [1719]. It is the change in energy
usage made by consumers from their regular electricity consumption patterns in response to the
modifications in energy prices over a period of time [20]. The introduction of DR system with
2
Internet-connected EVs provides efficient methods to minimize the huge electricity demand of
EVs without increasing the number of energy storage devices and generators [21]. The benefits
of integrating DR with EVs are structured into two perspectives, which are energy perspective
and communication perspective [21,22]. From the energy perspective, a number of EVs can be
used as a backup energy source when energy is critically needed. From the communication per-
spective, the internet of EVs facilitates the continuous collection of information from EVs for
several purposes like to get information for driving behaviors, vehicle conditions, energy states,
route trajectories and road environment. This data collection is of great importance for traffic
control and energy management in the SCs [13]. Different SEM systems for DR Management
(DRM) are deployed in the energy network of the smart city with the help of communication
technologies [2326]. Therefore, these are vulnerable to different forms of attacks in which
a malicious user may take advantage of the network security loopholes [27]. For instance, an
attacker may maliciously alter the data to delay service provisioning in the network. In order to
ensure the network security and privacy of all the energy trading participants, a robust and safe
energy management system is required. This system must ensure the user’s privacy and network
security in case of an adversary’s attack. On the other hand, a single point of failure is another
issue that is caused when a centralized energy trading model is used.
A new technology called blockchain has emerged as an effective solution to solve the secu-
rity challenges and eliminate the dependency on the central system. This technology provides a
way of storing transactions in a decentralized platform. It resolves the security challenges in a
distributed and decentralized fashion. It also facilitates in many aspects, such as authentication,
integrity, and confidentiality. In the blockchain, the nodes manage the executed transactions and
keep their records in the form of blocks. Therefore, breaking the system’s security is almost
impossible as it requires to compromise the miners that are responsible for managing the overall
security of the system [12]. Miners are the blockchain users that secure, verify, and add transac-
tion data in the blockchain ledgers. In the ledger, blocks are cryptographically secure, and each
block is connected with its previous block forming a chain. In this thesis, miners and validators
are used interchangeably. Despite the significant advantages of using blockchain to solve the se-
curity and a single point of failure issues in the energy trading system, the privacy leakage issue,
high computational complexity, etc., remain unsolved. To efficiently resolve the issues in energy
trading systems, this study proposes a new model for SET and load balancing. The proposed
model leverages contract theory, blockchain technology, and reputation system along with many
more techniques. For example, contract theory is introduced to provide an effective mechanism,
which addresses the incentive challenges using a private information or asymmetric informa-
tion of users. Asymmetry information is a kind of information where only the entity itself has
full knowledge about it. Furthermore, in order to minimize the computational complexity and
increase the system’s reliability, a reputation based consensus mechanism is proposed. In the
proposed model, the transactions are validated and audited publicly by the authorized nodes at
a reduced cost. Furthermore, delay in communication and storage overhead are problems, es-
pecially in resource constrained devices that need urgent solution for efficient and sustainable
transactions. Thus, the consortium blockchain based vehicular system is proposed in this work
for secure communication and optimized data storage in Internet of Vehicles (IoVs) network. A
cache memory technique is introduced to reduce service delay and high resource consumption.
In the work, an encryption technique and an authentication mechanism are proposed to secure
the system from active, passive, and double spending attacks.
1.1 Expected Contributions
Our expected contributions for all the proposed solutions are summarized below.
1.1.1 Expected Contributions for Solution 1
An Local Energy Market (LEM) using private blockchain will be proposed, which con-
siders both Home Energy Management (HEM) system and demurrage mechanism simul-
3
taneously,
A dynamic pricing mechanism will be proposed for energy trading to take place. This
mechanism ensures that all members participating in local energy trading gain better eco-
nomic benefits. This pricing model will be modified from the Supply and Demand Ratio
(SDR) mechanism [28] to include demurrage value, and
A thorough assessment will be conducted in the research to evaluate the economic benefits
of the buyers and sellers of locally generated energy in a residential community. Also,
based on the proposed system, the potential security risks of the energy trading system
are analyzed. Conclusively, a complete security protection technique will be provided
against these security vulnerabilities in the system.
1.1.2 Expected Contributions for Solution 2
A secure for energy trading model and an optimal energy scheduling algorithm for users
will be proposed using blockchain and smart contract. The proposed model will ensure
that the transaction is verified and it came from a legitimate user.
An improved privacy preserving and EVs’ matching mechanism will be proposed by in-
tegrating the reputations of users. The mechanism will help to prevent exposing the EVs’
privacy.
A novel method for calculating Reward Index (RI) between prosumers will be proposed.
Furthermore, a Reward based Starvation-Free Energy Allocation Policy (RSFEAP) algo-
rithm will be presented to distribute energy between prosumers. The proposed algorithm
motivates prosumers to subjectively share their resources. It also ensures efficient and
stable operations of the network as well as establishes a fair trading environment.
ID-Based encryption and HE techniques will be incorporated into the proposed system to
protect the privacy of the transactions and users, respectively.
A short-term load forecasting model for EVs’ charging using Multiple Linear Regres-
sion (MLR) will be proposed to accurately plan and manage the uncertainty of EVs’
intermittent charging behavior.
Simulation study and theoretical analysis are employed to show the effectiveness of the
proposed system. Furthermore, the security vulnerabilities of the smart contracts will be
analyzed to make the system bug-free against attacks.
1.1.3 Expected Contributions for Solution 3
Based on consortium blockchain, an optimal and secure model for energy delivery in an
immutable and verifiable manner will be proposed.
A Proof of Work based on Reputation (PoWR) consensus mechanism in the consortium
blockchain based energy trading context will be proposed to efficiently meet consensus.
A contract based incentive mechanism will be introduced, which will help to perform load
balancing and energy trading using information asymmetry.
We will propose a route optimization algorithm, which will reduce the traveling time and
driving range of EVs. On top of that, the EVs arrive at their final destination with mini-
mum monetary and time costs. To assess the effectiveness and efficiency of the proposed
scheme, we will perform rigorous experimental simulations.
4
1.1.4 Expected Contributions for Solution 4
A secure and privacy preserving blockchain enabled energy trading model will be pro-
posed. In this model, the energy trading process is efficiently managed with verifiability,
traceability, and immutability using the blockchain.
We will propose a consistent pricing scheme, which resolves the issues faced in the fixed,
negotiation, and double auction pricing schemes.
Proof-of-Energy Reputation Generation (PoERG) and Proof-of-Energy Reputation Con-
sumption (PoERC) consensus mechanisms will be proposed. PoERG will encourage an
energy seller to generate more energy and PoERC will motivate energy consumers to use
less electricity during peak hours.
A timed commitment technique [29] will be used to ensure trust and mutual verifiable
fairness between market participants at the time of trading. Moreover, the privacy preser-
vation and security of the energy trading model will be theoretically analyzed.
To show the effectiveness of the proposed model, simulations will be performed using
energy cost, PAR, and trust as performance metrics.
1.1.5 Expected Contributions for Solution 5
A two-layered efficient and reliable energy trading model using a permissioned blockchain
will be proposed. The study will propose an off-chain mutual authentication mechanism
to prevent the system from impersonation, active, and passive attacks.
A reputation based score mechanism will be presented to tackle collusion and dishonesty
between energy buyers and sellers in this study.
An efficient privacy preserving energy trading model using a dynamic pricing mechanism
based on contract theory and SDR will be proposed. The pricing mechanism will be
proposed to solve the problems that are originated from auction, negotiation, and fixed
pricing schemes.
A monetary incentive mechanism will be introduced that will motivate users to contribute
more energy in the proposed market scenario.
The effectiveness of the proposed energy trading model is shown by conducting simula-
tions. Moreover, the privacy and security of the model will be theoretically analyzed.
2 Related work
In this section, related work is categorically divided into energy trading and EVs’ charging load
forecasting.
2.1 Energy Trading
A blockchain is a shared and distributed ledger, which has many benefits [3032]. It allows each
executed transaction to be verified and stored permanently. It plays an important role in estab-
lishing a secure, transparent and distributed energy trading platform [3335]. It has undergone
rapid changes from version 1.0 to 3.0 with applications in the fields of finance, education, health,
energy sectors, etc. [3643]. Nowadays, an alternative way to design a secure digital transac-
tion system is by exploring blockchain technology. Despite the numerous benefits of using the
blockchain, several challenges are also encountered [4446]. The challenges are insufficient
5
security, lack of trust, privacy leakages, lower processing efficiency, and many more. The au-
thors in [47] propose an NRGcoin model, also called a novel decentralized digital currency.
The model allows locally generated renewable energy from prosumers to be sold using the digi-
tal currency. The currency obeys the renewable energy market paradigm in the power networks.
The authors in [48] present an adaptive aggressive strategy in a microgrid using blockchain
based Continuous Double Auction (CDA), putting forward a new perspective on an energy mar-
ket. However, various bid combinations may have distinct initial conditions, and there is an
inadequate flexibility to change the bid quantity during the CDA bid process. Similarly, in [49],
the authors present a secure credit based system of payment by reducing wait time for trans-
action confirmation of the energy chain in permissioned blockchain based Industrial Internet
of Things (IIoTs). Reducing the wait time makes electricity trading faster and responses more
frequent. The authors also use an optimal pricing mechanism by exploring the idea of stack-
elberg game theory to optimize bank utility credit based loans. The authors in [50] propose a
P2P Electricity Trading system with COnsortium blockchaiN (PETCON) model to conduct a
secure private P2P energy trading between plugin Hybrid EVs (HEVs). The study focuses on
establishing trust and uses the anonymous property of blockchains to defend the user’s privacy.
In [5153], an approach based on the power quality perceived by a specific economical category
is proposed. However, the proposed approach does not consider solving security issues, privacy
leakages, and single point of failure.
The authors in [54] propose a decentralized and secure energy transaction using blockchain
technology in smart grids. In the research, participants anonymously negotiate energy trad-
ing prices, and perform secure and anonymous transactions using encrypted messaging streams
and multi-signatures. In [55], the authors present a distributed, scalable, and secure blockchain
based network for coalition structure creation and microgrid energy trading. However, the deter-
mination of the trading price between the parties is difficult to reach via negotiation. Similarly,
in [56], the authors propose an energy trading model that facilitates a sustainable transaction
of energy ecosystems between smart homes’ consumers and prosumers. However, energy and
profit optimizations are not considered. The authors in [57] propose an Internet of Things (IoT)
system to account for power flows as well as a blockchain platform to resolve the need for a
centralized entity. The model allows LEM to manage the energy in a decentralized manner
without the need for central control. On the other hand, a new approach for smart city network
architecture is proposed [58]. The architecture combined the benefits of blockchain technology
and emerging Software-Defined Networking (SDN). The rapid growth in volume and number
of the connected IoT devices becomes challenges. The challenges are bandwidth bottleneck,
scalability, privacy, and high latency in the current architecture of smart city networks. The cur-
rent limitations are drastically reduced by introducing blockchain and dividing the architecture
into core and edge networks. However, memory scalability, high latency, and efficient deploy-
ment of edge nodes are issues that remain unresolved. An interesting lab-scale energy sharing
framework is implemented in [59]. For the sake of sharing solar energy, this framework de-
pends on a hyperledger fabric blockchain platform. In another work [60], the authors propose a
survey on distributed energy trading principles in a smart grid. The authors discuss topics like
the advantages of distributed energy trading and reasons behind its implementation, the tech-
nology needed to develop these framework, and a review of past literature work. In [61], the
authors identify seven microgrid electricity market principles and assess the Brooklyn micro-
grid in compliance with those principles. The authors develop and model a local power market
with a more realistic emphasis on a private Ethereum blockchain that allows users to exchange
locally generated energy supply on a distributed and decentralized exchange system without the
involvement of control authority. However, efficient allocation and pricing mechanisms are not
considered. The authors in [62] analyze the effects of EV’s charging position. The results have
shown that charging at foreign station cause penetration of privacy far more than charging at
home. The authors in [63] propose an effective privacy reservation system for EVs charging
6
stations. The system provides a penalty and authentication mechanisms. However, the system
is centrally controlled and managed, which makes the management more challenging as the
number of users increases. In [64], the authors implement an integrated system that combines
charging prioritization, encryption mechanism, and payment framework for dynamic charg-
ing model. The system reduces communication overhead and overall computational overhead.
However, the system does not eliminate the issues of a single point of failure.
In [65], the authors develop an accurate, automated, and confidential model for the selection
of charging stations based on EVs’ distance and energy cost. They also implement a payment
protocol on a blockchain where EVs are sending out their demand and charging stations are
sending offers more closely like an auction mechanism. However, increasing the overall system
efficiency is not considered in the model. Similarly, the authors in [66] propose a secure com-
munication framework that achieves privacy preservation of the rewarding processes for EVs’
monitoring. Additionally, the proposed framework enhances the communication and compu-
tational overhead. However, a mechanism to verify and authenticate users participating in the
system is completely not included. A new communication model for the on-the-move charging
of EVs based on a Subscribe/Publish (S/P) method for dissemination of appropriate data to EVs
is proposed. The method allows the EVs’ users to make optimal decisions about where to charge
their Vehicles [67]. In [68], the authors propose a three-party smart grid framework incorpo-
rated with EVs. The proposed framework involves flexible and complex interactions between
EVs, energy grids, and SC. It also introduces two fascinating models based on the three-party
framework, which are EV-centered and SC-centered. In the framework, a schedule-on-demand
power management scheme is also proposed. The scheme incorporates both EVs and SCs to
achieve efficient and effective resource management in the energy generation network. The
authors in [69] implement a reliable credit based payment system by minimizing the waiting
period for transaction confirmation delays. The authors carry out the implementation in a per-
missioned blockchain based on the Industrial Internet of Things (IIoTs). This tends to make
the energy trading quicker and more frequent. Moreover, the authors apply an optima pricing
strategy to maximize the bank utility credit based loans considering the idea of the stackelberg
game. However, a trust evaluation for each node in the system and effective privacy mechanisms
are not considered.
In [70], the authors present a distributed energy trading scheme to motivate P2P sharing of
energy between prosumers. The proposed scheme has two layers. A coalition of prosumers is
formed in the first layer to negotiate energy trading. In the second layer, blockchain technology
is used as a medium to perform the monetary process. The work proposed in [71] smooths the
lower level fluctuation of demand profile and also reduces the PAR. The energy mismatch is
caused as a result of supply constraints. Moreover, the work improves the blockchain model for
a distributed microgrid platform. It also manages the payment system together with the sharing
of energy information. In this model, the authors propose a non-cooperative theoretical game
method for a Demand Side Management (DSM) scheme, which integrates storage components.
In [72], authors introduce a blockchain framework, known as EnergyChain, to ensure secure en-
ergy trading between smart homes and smart grid. The proposed framework involved selection
of miners, validation, block creation, and transaction management. However, blockchain is not
widely used in devices with less computational capabilities because of the higher computational
cost involved when creating blocks. In [73], the authors propose a smart contract to execute
the energy trading procedures between the participants, which provides trust within them. The
authors in [74] implement a decentralized and secure energy trading model using a token that
allows trading transactions to take place between participants. In this model, anonymous energy
price negotiation is applied using blockchain. In [75], the authors propose a zonal scheduling
and hierarchical model along with an iterative two-layer scheme. The model efficiently man-
ages the discharging and charging energy of EVs. This model, therefore, minimizes the entire
energy load variance of the distributed network under a limited vehicle travel demand and power
7
flows. Moreover, in the proposed model, a decentralized energy trading architecture is designed
based on consortium blockchain technology. This design ensures the privacy and security of
the bi-directional energy trading between the smart grid and EVs. The results of the system
show that the proposed model ensures privacy preservation and security of both energy trading
and the underlying system, in general. Authors in [12] present a secure blockchain based DRM
model, named GUARDIAN, to make secure energy trading decisions. It aims to efficiently
manage the entire load profiles in the industrial, commercial and residential domains. In the
proposed model, energy transaction validators are selected based on their processing and con-
sumption power. The obtained results show the effectiveness of the model for securing DRM in
the smart grid. Similarly, the authors in [76] present a secure energy trading framework based
on blockchain and edge computing in Vehicle-to-Grid (V2G) ecosystem. The idea of approver
nodes for secure energy trading is used in this framework. These nodes are selected based on
a utility function and also serve to validate all the executed transactions. However, minimizing
the confirmation latency of the transactions and block creation duration are not considered in the
framework. The authors in [13] present a secure consortium blockchain based energy trading
model for EVs at a cheaper cost. The proposed model uses a contract theory based incentive
method to encourage EVs to participate in DRM. The efficiency of performance and the security
of the proposed model are validated and analyzed, respectively. Similarly, the authors in [77]
implement an efficient and secure V2G energy trading model by exploring an edge computing
system, contract theory, and blockchain technology. In this model, consortium blockchain is
used to perform and secure the energy trading between Local Energy Aggregator (LEAG) and
energy entities. An information asymmetry scenario is considered in the model and applied
a contract theory based incentive mechanism to tackle problems. The results of the proposed
model are analyzed and validated using theoretical and numerical analysis. From literature re-
view, it is observed that the proposed systems do not consider how to minimize the confirmation
latency of the transactions and block creation. Also, none of the above works consider minimiz-
ing routes and distance to the energy seller location.
The authors in [78] propose a model that combines consortium blockchain technology and
homomorphic encryption to provide trust and privacy. Moreover, the authors use dynamic en-
ergy pricing and a demurrage mechanism to solve the problem of a fixed pricing scheme. Sim-
ilarly, the authors in [79] develop a dynamic pricing scheme to solve the fixed pricing scheme
issues. In [80], the authors implement a decentralized and automated energy framework. The
framework is proposed to achieve efficient energy management and a highly scalable system
in an IoT environment. The authors in [81] present an energy model based on blockchain to
protect privacy in an IIoT system. The authors also propose a credibility based equity proof
protocol that enhances system availability. The authors in [82] develop an EV charging network
payment model by adopting a Bitcoin based payment system. In this model, the high fees of the
transaction are removed by creating a payment network in parallel to the primary ledger, with
signatures and permission. The purpose of the payment method is to reduce the trading delay in
the energy trading model. The authors implement and design this network between mobile EVs
and charging stations with fairness constraints, connectivity, and flow. In [83], the authors store
power losses, energy allocation loss, and transaction timing information in blockchain technol-
ogy. The work in [84] presents a distributed model to manage the DR mechanism in a smart
grid context. The model integrates blockchain technology with a power grid. This approach
ensures the programmatic definition of the expected energy flexibility levels. It also maintains
the balance of energy demand-generation and validates the agreements of DR through a smart
contract. However, an effective and efficient approach to reach consensus is not considered.
Furthermore, the privacy of transaction information is also not resolved.
Blockchain technology is a distributed and decentralized P2P network that allows commu-
nication between untrusted users in a verifiable fashion. In [85], the authors propose a secure
blockchain model that allows energy users to negotiate a price directly without involving a third
8
party. The authors thoroughly discussed on how the energy system is secure. In this model,
once the selling prosumer did not commit to the purchaser’s energy need within a stated period,
the associated transaction is expired and considered as invalid. This robust verification scheme
makes the proposed model stand well against many attacks. The authors in [86] initially demon-
strate a blockchain based IoTs powerful combination across many industries. Afterwards, a list
of secure blockchain energy trading models in the blockchain based IIoTs is proposed. In [29],
the authors propose an energy trading based on blockchain to manage and supervise the trading
process in order to build a reliable trading platform as well as improving the quality of energy.
The authors use anonymous authentication to safeguard the privacy of users. Also, a timed
commitments model is developed to affirm verifiable fairness at the time of trading. In [87],
the authors present a lightweight blockchain based model, which is known as a directed acyclic
graph based V2G network. In this work, a tangle data structure is adapted to store the trans-
actions in a scalable and secure manner in the network. Also, to perform negotiation between
the vehicles and the grid at an optimal cost, a game theory framework is used. The proposed
model does not require charge fees to conduct transactions and it does not require heavy com-
putation. The authors in [88] develop a consortium blockchain model to address the privacy
leakage issues without hindrance in trading functions. The model mainly focuses on the privacy
of users during energy trading in the smart grid. It also screens the distribution of energy sales
of selling prosumers. The sales are derived from the fact that many energy trading are mined.
They also detect their relationship with one another, e.g., energy usage and physical location.
The experimental evaluation has shown the effectiveness of the model.
The authors in [89] propose an efficient and secure energy trading model based on blockchain.
The model is divided into two layers, which can protect privacy and also achieve a power balance
between demand and supply. Also, credibility based on an equity proof scheme is developed to
improve the system availability in the energy internet. In [90], the authors propose a method-
ology for local P2P energy trading and power distribution network co-simulation systems. The
simulator of the distribution system is interfaced with the P2P energy trading platform, which
incorporates a distributed double auction technique based on blockchain. The system is demon-
strated using a case study of a typical European suburban distribution network. In [91], the au-
thors introduce a general model for a blockchain network, which allows P2P energy trading in a
nearby power market. The research work focuses its attention on seeking energy-matching pairs
between demand and supply sides. It also motivates direct energy trading between consumers
and generators. The developed multi-directional blockchain network implements a complete
trading process. As smart contract executes payment and trading rules without the interven-
tion of a third party, the fairness and security of the energy trading are enhanced significantly.
The authors in [92] propose an energy trading model based on blockchain between EVs (gen-
erators) and critical load (consumers) in microgrids. Contrary to the conventional wholesale
energy market where consumers buy energy from retailers, in this proposed model, the pro-
sumers are directly connected to consumers to meet their temporary energy needs. Blockchain
technology is introduced to create a reliable energy trading platform. Also, a prototype for en-
ergy trading is implemented to monitor the energy trading activities between consumers and
generators remotely using a graphical user interface. In [93], the authors propose a consortium
blockchain based energy trading framework using a Proof-of-Stake (PoS) mechanism. In the
framework, the pre-selected validators are custodians for power losses compensations in dis-
tribution lines by energy transactions. The authors demonstrate the process of smart contract
creation and blockchain establishment. Furthermore, another type of crypto-currency called
“eleccoin” is developed in the P2P energy market, which is announced by the consensus pro-
cess of the blockchain. The results of the simulation show effectiveness of the framework.
2.2 Electric Vehicles Charging Load Forecasting
The authors in [94] propose a one-step short-term load forecasting for EVs model using Convo-
lutional Neural Network (CNN) with a niche immunity lion technique. The model is improved
9
by incorporating niche immunity to obtain better forecasting results. As shown in the experiment
results, traditional forecasting models have less accuracy than the deep learning models when
the dataset is small. Similarly, authors in [95] propose a model for short-term load forecasting
by incorporating LSTM in the conventional RNN scheme. The LSTM solves gradient vanishing
problem in the RNN network. The authors in [96] propose an LSTM model for electricity load
forecasting of individual residential homes.
In [97], the authors proposed a system that predicts the daily load of EV charging stations
using Back Propagation Neural Network (BPNN). A fuzzy clustering approach based on the
method of transfer closure is implemented to pick the actual load data, which is similar to the
predicted data as the training data to enhance the predictive precision. However, BPNN causes
over-fitting and get trapped into the local minimum easily. Similarly, in [98], the authors propose
a short-term load forecasting scheme for EVs’ charging stations using Radial Function Neural
Networks (RBFNNs). The proposed scheme is modified using the fuzzy control theory [99] to
address the issues of trapping into local minimum and over-fitting. The experimental results
show that the forecasting accuracy has increased exponentially. However, the forecasting sys-
tems are implemented using a centralized approach, which are vulnerable to a single point of
failure, and security and privacy related issues.
Finally, the studies above do not consider solving the lingering challenges in the existing
pricing scheme. Also, to protect the system from impersonation attacks and collusion attacks
between buyers and sellers. The studies fail to add a robust privacy protection mechanism in the
systems. Moreover, none of the above studies consider to include mutually verifiable fairness
mechanism in their proposed models. From literature review, it is observed that the proposed
systems do not consider how to minimize the confirmation latency of the transactions and block
creation. Also, none of the above works consider minimizing routes and distance between
energy buyers and sellers using EVs. Furthermore, a private and secure energy charging of EVs
is not consider using blockchain technology. A secure and privacy preserving load balancing
between prosumers and communities are also not considered.
3 Problem Statement
With the rapid increase in distributed renewable energy resources and the existence of scattered
energy consumers in communities, local energy trading between prosumers becomes essen-
tial. Nowadays, energy trading is executed using a centralized model. However, this model
is weak and vulnerable to different forms of attacks. For example, a single point of failure,
security threats, and privacy leakages are possible attacks that affect the central models’ plat-
forms. In this regard, there is a need for distributed and decentralized secure energy trading
between prosumers. Blockchain technology is one option that works in a distributed and decen-
tralized manner. It has been used in many applications and domains. However, low efficiency,
users’ privacy leakages, and trust are still problems that have not been solved in blockchain
designed systems. Moreover, none of the studies above explicitly considers resolving the is-
sues of energy hoarders in peak generation hours and cheating attacks from both participants.
On the other hand, climatic change and excessive greenhouse gas emission by fossil fuel based
vehicles contributed immensely to environmental damages. One solution to reduce the envi-
ronmental damages, which causes harmful gas pollution is by introducing EVs. However, the
rapid increase in uncoordinated EVs, increases burden to existing power grids. On top of that,
charging of EVs is time consuming and happens regularly. Because of this, an optimal charging
scheduling system is needed for effective energy allocation from charging stations. Also, in
order to reduce the EVs traveling cost and distance, optimal shortest routes selection algorithm
is essential. Another bottleneck that restricts the implementation of the distributed and decen-
tralized energy trading is price determination without the involvement of a trusted third party
by the prosumers and the systems. Therefore, the mentioned price issue discourages partici-
10
pants of Peer-to-Peer (P2P) energy trading. In order to solve the problem, fixed energy pricing
model is proposed. However, the model is non-beneficial for energy prosumers (selling part)
as the grid’s pricing tariff is less than fixing pricing scheme. The other pricing methods that
are used in the energy market are based on negotiation and auction, which are assumed to be
the best method for solving the fixed price issue [78,192197]. However, both the negotiation
and auction methods are time consuming and complex as the number of participants increases.
The negotiation method are performs using an arbitrator that makes it to lack transparency and
trust while the auction method consumes more time for a matching process to converge. Thus,
a dynamic, secure, and privacy preserving pricing scheme is necessary. Furthermore, storage
overhead and delay in communication are challenges that need urgent attention, especially in
resource constrained devices for sustainable and efficient transactions. The problem statement
is divided into sub-problems, which are discussed in the following sections.
3.1 Sub-problem Statement 1
The authors in [61] propose a decentralized market mechanism using a private blockchain and
an auction method to determine prices. However, trading of surplus energy through auction or
bidding is logically impossible for all users [100]. The reason is that some consumers or pro-
sumers cannot participate in the trading due to limited time, lack of expertise, and above all, lack
of technology. Similarly, another problem arose in [28,101], and there is a possibility for the oc-
currence of single point of failure since the proposed models allowed a third party to serve as a
controller to manage or control prosumers’ batteries and all transactions information [102106].
Moreover, the system is prone to privacy threats, i.e., information disclosure and security con-
cern. Additionally, including a third party requires a central processing center to process and
collect the information of participants, which is a challenging task in Distributed Energy Re-
sources (DER). Two problems naturally arise when relying on a third party. Firstly, intensive
communication infrastructures are needed in the case of a central controller [5,107111]. Sec-
ondly, it is difficult to encourage a large number of participants in energy trading. The exponen-
tial development of energy trading shows the importance of related research.
Generally, according to the literature discussed in [28,61,101], the researches do not empha-
size how to resolve the privacy and security challenges, and a single point of failure problem.
Moreover, none of the literature explicitly considers resolving the issues of energy hoarders in
peak generation hours. Also, the research works do not consider combining a conventional Local
Energy Market (LEM) mechanism, Home Energy Management (HEM) system, and blockchain
technology concurrently. Combining these mechanisms will centrally merge their benefits in a
single pool. In this thesis, we propose an LEM model using private blockchain by consider-
ing the HEM system and demurrage mechanism in a community with residential photovoltaic
energy generations. The proposed model allows prosumers and consumers to manage their
resources and information in a decentralized, secure, trustful, transparent, anonymous, and ver-
ifiable manner.
3.2 Sub-problem Statement 2
The attention of many automobile companies has been attracted to develop EVs as a result of
the excessive greenhouse gas emissions from petroleum machines. Concerning this, the automo-
bile companies manufacture a large number of EVs to provide an eco-friendly and sustainable
conveyance system. However, this results in an insufficient charging infrastructure to cater to
the needs of energy users due to massive penetration of EVs in the SC. Many research works
provide solutions to the lingering problems. For example, inefficient allocation of resources,
leakage of sensitive information of EVs, and a single point of failure are the problems in the ex-
isting works, which are not fully solved. Therefore, improvements in the literature are strongly
needed. To manage energy efficiently, some research works use machine learning [112114],
and deep learning [115120] techniques. Other works enhance the techniques using game the-
ory optimization algorithms [121,122], while some use heuristic [123129] and metaheuris-
11
tic [130134] algorithms. However, these works use a centralized model, which causes privacy
leakages, security threats, a single point of failure, and other related issues. The authors in [135]
propose a model for distributed privacy preserving and efficient matching of charging demander
with charging suppliers. This model uses Bichromatic Mutual Nearest Neighbor (BMNN) to
address the issue of exposing driving patterns, schedules, and whereabouts of EVs. However,
the pieces of information transmitted or received are not verified and not guaranteed to be from
legitimate users.
On the other hand, blockchain permits users to have a distributed and decentralized P2P
network where non-trusted users communicate verifiably with each other. Several methods to
secure P2P energy trading are proposed in the blockchain based models. In [136], the authors
propose an optimal scheduling algorithm for charging Hybrid EVs (HEVs). The model adopts
consortium blockchain to ensure the users’ privacy and secure the energy trading system. In the
model, the scheduling algorithm aims to reduce energy cost and optimize the satisfaction func-
tion of users while targeting different performance metrics. The targeted metrics include waiting
time, EV driving speed, discharging location, and charging entities. The optimization technique
used in solving the problem is an improved Non-dominated Sorting Genetic Algorithm (NSGA).
However, the privacy of transmitted information is not guaranteed using blockchain technology
alone [137,138]. The reason is that the contents of all monetary balance and transactions are
visible to the public, which allows the information to be easily accessed. Also, consortium
blockchain is partially secure and less efficient as compared to other categories of blockchain
technology. Similarly, in [139], the authors examine the adaptability of consortium blockchain
to set up a stable electricity trading network. The blockchain based network provides distributed
storage and maintenance of the authorized nodes. However, relying on the merits of consortium
blockchain cannot guarantee the reliability of the network’s security. Also, it does not prevent
the information from internal attackers. The authors in [140] propose an effective solution to
reduce the excessive operational overhead in the trading model. The overhead increases when
nodes are motivated to use local energy out of their self-interest as elaborated in [141]. As a
result, it may tantamount to a high cost of transportation for the trading partners. However,
this mechanism decreases the financial benefits of the system. Also, privacy and security of the
trading data are overlooked.
In terms of optimal energy allocation, many research works are studied in the literature
based on prosumers’ reputation. These works use different performance parameters to deter-
mine the reputation. The performance metrics used are historical energy supply contribution,
rate of past participation of a prosumer, and load demand in the current time interval. The au-
thors in [142] and [143] propose a contribution based allocation of energy policy to establish
models that simplify energy trading in the electricity markets. In these models, the energy al-
locator collects excess energy from providers and allocates it to the energy deficit prosumers.
However, these models do not consider the Starvation Level (SL) of consumers and designed
of a proper mechanism to detect malicious energy transactions. The authors in [144] propose a
novel Starvation-Free Optimal microgrid-generated Energy Allocation Policy (SF-OEAP). The
model is based on three parameters for prosumers in the smart distributed network of an en-
ergy market. The parameters are mentioned as follows: revenue index, prediction accuracy, and
energy starvation. The Distribution System Operator (DSO) collects excess energy from en-
ergy generators and performs a fair energy allocation between consumers. However, the authors
in [142144] do not consider any mechanism to detect malicious transactions, which plays an
important role to determine the reward for the prosumers and make the system free from ma-
licious activities. In spite of the observable advantages of using blockchain [50,139,146] to
establish a trustworthy platform, the privacy concern and other related issues still restrict its im-
plementation in energy trading systems. In this study, a mechanism to solve privacy and security
issue, and lack of optimal fairness in energy allocation is proposed. The challenges to be solved
also include operational inefficiency of the system, a single point of failure, and absence of an
12
optimal scheduling algorithm for users.
3.3 Sub-problem Statement 3
A lot of research work is conducted using blockchain technology in various domains to secure
and protect systems [31,147150]. Blockchain technology is one of the most effective tech-
nologies that serves as a foundation for security and crypto-currencies solutions [151157]. Its
environment is reliable and cannot be easily compromised [158161]. Several research domains
use blockchain as a method of authentication in a distributed fashion [162165]. Considering
the potential benefits of blockchain, its applications in energy trading [72,166], and DRM are
increasing rapidly. It also enables the efficient integration of EVs in these systems [167,168].
In the literature, there exist few works that combine blockchain, energy trading, and DRM
considering the information asymmetry scenario in a smart grid, which leverage commercial,
transportation, residential and industrial sectors. However, the studies in [12,13,77] do not con-
sider how to efficiently minimize the confirmation latency of the transactions and block creation
in a cost-effective manner. Moreover, the reduction in traveling costs and distance from EV’s
current position to local aggregators are not considered in these systems. The penetration and
deployment of EVs as energy carriers to manage energy demand encounter some problems in
the SC, such as privacy leakage, denial of service attacks, a single point of failure, etc. The
challenges arise due to the lack of a well-designed DR incentive mechanisms for the energy
carriers and a secure energy trading process. To overcome the aforementioned problems, an ef-
ficient and secure DR system along with the energy trading model using consortium blockchain
is proposed in this thesis.
3.4 Sub-problem Statement 4
As the number of distributed energy generators increases, energy trading becomes essential
within a SC. Several research works are proposed to solve the problems of energy trading sys-
tems in the SC [169173,211]. However, many issues are partially left unresolved or neglected.
The issues include security threats, privacy leakages, and lack of proper pricing mechanisms.
Load balancing issues, lack of trust and fairness between different trading entities are also crit-
ical challenges that need to be solved. The authors in [174] propose a decentralized and hybrid
P2P energy trading scheme using blockchain. The proposed system adopts a double auction
closed book technique to determine the trading price. The scheme reduces the consumers’ elec-
tricity cost as well as minimizes the grid’s Peak-to-Average Ratio (PAR). However, the elec-
tricity is not traded on the same price in the market as each seller places the energy selling bid,
which contains the information of available energy and its price. On the other hand, an energy
buyer accepts the bid if its need is fulfilled. This is because a double closed auction mechanism
requires the energy seller to compete with other sellers. Subsequently, it can lead to selfishness
between the participant and discrepancies in energy trading prices. Thus, it causes an imbalance
in the energy market. Moreover, the auction mechanism takes much computational time for
the matching process to converge. It becomes impractical when the number of auctioneers in-
creases. In [175], the market price is fixed for all energy consumers. However, it is not beneficial
for the prosumers as the grid energy price is 70% more than the local energy price. However,
trust and transparency issues are not solved and also, it is time consuming when the number of
traders increases.
The authors in [13] propose an efficient and secure energy trading model based on consor-
tium blockchain for EVs. In [77], the authors improve the efficiency of the consensus mech-
anism. The proposed models help to balance load demand within a SC. However, the im-
provement of the model leads to an increase in computational and communicational costs. The
model uses Proof of Work (PoW) consensus mechanism, which requires enormous computa-
tional power during the consensus process. Also, the huge monetary investment is required by
13
a Proof of Stake (PoS) consensus mechanism, which is an issue and can lead to centralization
problem. Thus, to participate in a consensus process, users must have robust computational re-
sources and high investment. To resolve this problem, a new and feasible consensus mechanism
is needed to allow all the interested users to participate in the consensus process. Moreover, the
above mentioned studies do not consider how to resolve the issues of trust and fairness between
energy trading participants. Such kinds of problems are dangerous in the energy trading models
and can eventually push away the energy buyers from the current systems. Also, load balanc-
ing, mutual verifiable fairness, reputation, proper pricing scheme, and consensus mechanism
without the need for high computational hardware and energy consumption are not considered
in [29,77,174,175] scenarios.
In general, to address the problems mentioned above, we propose a secure, privacy preserv-
ing, and decentralized energy trading model. The model presents verifiable, trust, and fairness
mechanisms for energy users. It further implements an energy market pricing scheme and cost-
effective consensus mechanisms.
3.5 Sub-problem Statement 5
As the number of distributed energy generators and consumers increases, secure P2P energy
trading is paramount in a SC [176183]. However, in a distributed energy trading model in-
tegrated with public blockchain technology, energy trading users can join or leave the trading
network with no permission at any time. This makes the energy system difficult in control-
ling and authenticating the network users. It can also lead to possible impersonation, active,
and passive eavesdropping attacks when an authentication mechanism is not implemented. An
authentication mechanism in networks ensures that data communication can take place only be-
tween legitimate users [184189]. Traditionally, centralized systems were used to ensure energy
trading between entities. However, these systems exhibited several issues like lack of trust, se-
curity and privacy threats, single point of failure, etc. To tackle the issues, decentralized systems
were introduced, which provided efficient solutions for the issues.
To overcome the vulnerabilities of centralized energy trading models, blockchain technol-
ogy is one option [139,190,191]. However, blockchain alone cannot guarantee the successful
delivery of energy and information from a sender to a receiver without collusions. Also, privacy
and trust concerns restrict the implementation of the blockchain technology in many research
domains. Furthermore, using a consortium blockchain, an authentication certificate is produced
by a central authority [50,7577]. In this regard, a single point of failure can still occur. There-
fore, developing efficient privacy preserving methods for an energy trading system based on
blockchain can improve the effectiveness of the P2P energy trading platforms.
However, there still exist different issues in the systems such as price determination with-
out the involvement of a trusted third party, which discourages P2P energy trading. So, the
aforementioned problem discourages energy users to participate in P2P trading. The authors
in [175] propose a P2P energy trading model in which the energy prices in the market are fixed.
However, this model is inefficient and non beneficial for prosumers as price of energy is more
than the grid’s pricing tariff. In another work, energy prices are determined based on auction
or negotiation market approaches, which are the best approaches for solving the problem of
fixed pricing determination [78,192197]. However, both auction and negotiation approaches
become complex and time consuming when the number of users grows. The auction approach
takes more time for a matching process to converge. Whereas, the negotiation approach usually
takes place through an arbitrator, which makes the approach to lack trust and transparency.
According to the above mentioned challenges, it is clear that applying blockchain alone
in energy trading systems cannot provide a sustainable and efficient energy trading platform.
Moreover, the studies discussed do not consider solving the lingering challenges in the existing
pricing schemes. At the same time, protecting the system from impersonation and collusion
attacks are not fully resolved. So, it is the motivation of this study. To tackle this issue, the
14
proposed system comprising of blockchain technology, cloud system, reputation and incentive
mechanism, and SDR pricing mechanism are introduced.
SM-5
Homes
EVs
Commercial buidings
Industries
and
1. LEM
2. HEM
3. Demurrage based Pricing
Scheme
1. EV's Optimal Scheduling
2. RSFEAP
3. EV's Charging Forecasting Model
4. Privacy Preservation Techniques
for Users
1. Reputation based PoW Consensus
2. Contract based Incentive
Mechanism
3. Optimal Shortest Path Algorithm
4. Trust Evaluations
SM-4
1. PoERG and PoERC
Consensus Mechanism
2. Mutual-verifiable Fairness based
on Timed Commitment
Technique
3. Modified ToU Pricing Scheme
1. A two-stage Energy Trading Model
2. Off-chain Mutual Authentication
Process
3. Dynamic Pricing Scheme based on
Contract Theory and SDR
4. Punishment-Incentive Algorithm
5. Validators' Selection Mechanism
Expected Contributions Energy Entities
Figure 1. Combined Proposed System Model.
4 Proposed Solution
In this section, the combined system model for static and mobile energy prosumers are presented
in Figure 1. The model consists of five (5) sub-system models: SM1, SM2, SM3, SM4, and
SM5. Details of each sub-system model is discussed in the following sections.
4.1 Blockchain based LEM Considering HEM and Demurrage Mechanisms
In this section, the description of the system model, the energy optimization using HEM, and
pricing model based on demurrage mechanism are discussed.
4.1.1 Description of the System Model
The proposed model comprises of three participants: prosumers, consumers, and the main grid
as depicted in Figure 2. This model is inspired by studies [28,61,101]. Prosumers and con-
sumers participate in the local energy trading when PV energy generation is at its peak. In
this model, the prosumers are equipped with PV solar panels, which generate electricity, and
with smart meters that record, monitor, and transmit energy information (both generation and
consumption) to the blockchain through smart contracts. The consumers are equipped only
with smart meters through which energy consumption information is generated and sent to the
blockchain via smart contracts for future purposes. The main grid supplies energy to the local
community when the local energy generated is insufficient to satisfy the user’s demand. In the
proposed model, the prosumers and consumers optimize their electricity consumption through
shifting demand from on-peak hours to off-peak hours, as discussed in section 4.1.3. The energy
optimization and pricing models are executed at the individual local level, i.e., the consumers
and prosumers level. The pricing model is developed using SDR by including the demurrage
mechanism. Demurrage mechanism is a technique used to disincentivize energy hoarding and
to foster price signals to customers. This mechanism allows customers to shift their electricity
15
consumption to a period where local energy generation is overflowing. With the demurrage
mechanism, the redemptive value of the hoard energy-backed price declines with time. De-
tails on the pricing model are discussed in Section 4.1.4. Transactions information, payment
processes, and market platforms are executed on a private blockchain through the smart con-
tract to get rid of a third party. The blockchain provides a secure, decentralized, transparent,
anonymous, and verified information platform.
4.1.2 Blockchain Technology and Smart Contract in LEM
This section discusses blockchain technology and smart contract in LEM.
Blockchain Technology in LEM
We modeled a blockchain based architecture to decentralize an LEM within a small commu-
nity with many residential PV systems, as shown in Figure 3. The model comprises of nodes
in the network, which are prosumer, consumer, and the main grid. These nodes can coordi-
nate through blockchain’s infrastructure to support the decentralization of energy generation
and demand. The challenges in P2P energy trading are identified as lack of data security and
privacy. However, the problems are addressed using decentralized and distributed blockchain
ledger features. The issues of storing and maintaining energy transactions in a centralized ap-
proach are still open research challenges. In a decentralized manner, energy transactions can be
maintained locally and stored in the blockchain. Moreover, a copy of the blockchain ledger is
created at an individual level (node). The process is done with the help of customers’ unique
identifier that shares and replicates the copy of the transaction to all the peers in the network
for validation. The benefits of using blockchain technology in the proposed system are infor-
mation immutability, self-enforced smart contract, security, etc. Information immutability in
blockchain technology ensures that all information stored in Ethereum blockchain remains un-
changed after validation. To achieve consensus between the energy trading participants, we use
an PoW consensus mechanism [198203].
Smart Contract in LEM
The author in [204] defined smart contracts as a collection of instructions or rules that exe-
cute the terms of contracts. It is also suggested to convert contractual clauses, e.g., bonding,
collateral, etc., into code and to incorporate them into hardware and software that could self-
impose them to reduce or remove the need for trusted third parties. A smart contract is a set
of blockchain’s residing code or script. There is a unique address for each entity stored in a
blockchain. According to the rules set, smart contracts are performed independently and auto-
matically on each node in the network. It means that each node operates a virtual machine in
the smart contract-enabled blockchain, and the blockchain serves as a distributed virtual ma-
chine [205].
In the proposed model, smart contracts are the collection of guidelines that regulate energy
trading mechanisms (energy selling and buying) as well as monitor and record all the energy
transactions information. Besides that, it is responsible for executing all payment processes
between the prosumers, consumers, and the main grid. Due to the limited availability of math-
ematical functions in blockchain to calculate demurrage and their expensive gas consumption,
we perform the arithmetic calculation off-chain and passed the results to the smart contracts.
Algorithm 1shows the excerpt of the smart contract.
4.1.3 Optimization Problem
In this model, the optimization problem is categorized based on appliance scheduling in each
time slot to reduce the cost of electricity. Power rating and appliance status (ON or OFF) are the
attributes associated with each appliance. The description and specifications of the household
16
...
Figure 2. SM1: Blockchain based LEM Considering HEM and Demurrage Mech-
anisms.
appliances are provided in Table 1. The multi-objectives scheduling problem formulation is
given in the following subsections.
Appliance Categorization
Based on the appliances’ energy consumption pattern and their operational behavior, the resi-
dential appliances are classified into two classes. That is, the appliances that are shiftable and
those that are non-shiftable. The details of each appliance class are explained below.
Shiftable appliances: shiftable appliances for household load are categorized into interrupt-
ible and uninterruptible appliances. Interruptible appliances are the kind of devices that can be
shifted and interrupted at any time, even when they start their operation, and have a fixed en-
ergy consumption rate. Examples of interruptible appliances are water heater, refrigerator, air
conditioner, etc. The uninterruptible appliances are the kind of appliances, which can be shifted
to any time slot before they are turned on but, once they start their operation, they cannot be in-
terrupted unless they finish their Length of Operational Time (LoT). Examples are dishwasher,
cloth dryer, washing machine, etc.
17
Algorithm 1 Buy and Sell with Demurrage Smart Contract Functions.
Input addr, Id, quantity, d price, T ime d price is demurrage price computed off-chain
Output U pdatedQuantity,FinalCost
1: function BUY WI THDEMURRAGE(add r,Id,quantity,d price,Time)
2: if <quantity of required energy is not enough> then
3: terminate
4: end if
5: if <Time is within the demurrage agreed time> then
6: update consumer’s and prosumer’s quantity
7: update consumer’s and prosumer’s wallet FinalCost
8: else
9: update consumer’s and prosumer’s quantity
10: update consumer’s and prosumer’s wallet FinalCost with
d price
11: end if
12: return U pdated Quant it y,FinalCost
13: end function
1: function SEL LWITHDEMURR AGE(addr,Id,quantity,d price,Time)
2: if <quantity of energy to sell is not enough> then
3: terminate
4: end if
5: if <Time is within the demurrage agreed time> then
6: update consumer’s and prosumer’s quantity
7: update consumer’s and prosumer’s wallet FinalCost
8: else
9: update consumer’s and prosumer’s quantity
10: update consumer’s and prosumer’s wallet FinalCost with
d price
11: end if
12: return U pdated Quant it y,FinalCost
13: end function
Non-shiftable appliances: non-shiftable appliances, sometimes referred to as unchangeable
household devices, are those appliances that are not manageable, for example, fan, light, tv, etc.
Let Yap (t)represents appliance status at time interval tTas shown in Equation (1).
Yap (t) = (1, if <appliance = ON>,
0 , <otherwise>. (1)
Cost of Electricity
The reduction in costs of electricity is described as the lowest possible rates (charges) of energy
loads consumed issued by the utility to energy users. For minimizing the problem of electricity
costs, we consider non-shiftable and shiftable appliances loads. The problem is formulated as
given in Equation (2).
Min
Na
a=1
T
t=1
Yap (t)ρEPrice
a(t).(2)
Where EPrice
a(t)represents the price of electric energy consumed at any time interval t.ais
18
Copy of
Blockchain
Ledger
Copy of
Blockchain
Ledger
Copy of
Blockchain
Ledger
Copy of
Blockchain
Ledger
Copy of
Blockchain
Ledger
Customer
Customer
Customer
Customer
Customer
Communication through
Smart Contract
Communication
Flow
Figure 3. Blockchain based Architecture for Decentralized LEM.
Table 1 Specification of Appliances [206]. LoT: Length of Operational Time.
Appliances Types Name of Appliance Time Starts (hour) Time Ends (hour) Power Rating (kW) LoT (hour)
Shiftable Air conditioner 12 24 1.00 10.00
Shiftable Cloth dryer 06 14 1.50 4.00
Shiftable Dish washer 08 22 1.00 0.50
Shiftable EV 16 24 2.50 2.50
Shiftable Hair dryer 06 13 1.00 1.50
Shiftable Iron 06 16 1.00 0.50
Shiftable Pool pump 12 21 2.00 8.00
Shiftable Refrigerator 06 15 0.125 24.00
Shiftable Television 01 16 0.25 6.75
Shiftable Vacuum cleaner 06 15 1.00 0.50
Shiftable Water heater 06 23 1.50 3.00
Shiftable Other 06 24 1.50 2.00
Non-shiftable Electric stove 06 14 1.50 5.00
Non-shiftable Heater 03 15 1.50 3.00
Non-shiftable Light 16 24 0.50 6.25
Non-shiftable Personal computer 08 24 0.25 4.00
the index for the overall number of appliances in the smart home, and time index is represented
as twith maximum threshold of Thours of a day. Nais the total number of appliances in a
smart home.
Energy Consumption
The energy consumption is shifted from on-peak to off-peak hours in a stable manner with the
aid of the HEM system. The shift in energy load over a period of time is based on demand and
is inversely proportional to the market price of the electricity. It is mathematically represented
19
in Equation (3).
Pconsumpt ion =
T
t=1
Nshif t able
Sshi f tabl e=1
Yap (t)ρ+
T
t=1
Nnonshif t able
Snonshi f tabl e=1
Yap (t)ρ.(3)
where the energy consumption of shiftable and non-shiftable appliances is given as Pconsumption.
The electricity load is divided based on the consumer’s behavior and household appliances op-
eration. ρrepresents each appliance power rating, and Sshi f t able represents the collection of
household appliances that are shiftable. Nshi f tabl e represents the number of shiftable appliances
and the number of non-shiftable appliances is denoted as Nnonshi f tabl e for all household appli-
ances. Snonshi f t able represents the collection of household appliances that are non-shiftable.
Load Balancing
The stability of the power grid is essential to ensure the reliability and sustainability of grid
operations and management. A decrease in the PAR helps to maintain the reliability of the
utility, thereby reducing the cost of electricity. It is mathematically shown in Equation (4).
PAR =Maximum(Pconsumption )2
Average(Pconsumption)2,(4)
where Pconsumpt ion is calculated using Equation (3).
Objective Function
The aggregated objective function is represented as a function of multi-objective optimization
techniques to reduce energy cost and energy consumption in residential homes of prosumers
and consumers while maximizing energy consumption from LEM. The optimization techniques
are adopted from [206,207] to achieve the overall objectives. The load scheduling is carried out
using earliglow based optimization algorithm. The earliglow algorithm is a hybrid algorithm,
which is a combination of jaya and strawberry algorithms. To evaluate the HEM consump-
tion and electricity cost, we consider Real-Time Price (RTP) scheme and Critical Peak Price
(CPP) scheme to show the effectiveness of the optimization technique. The objective function
is computed using Equations (2) and (3).
4.1.4 Price and Cost Models
This section discusses the price and cost models of the prosumer, self-consumption, and self-
sufficiency.
Price Model
The PV generation at the ith prosumer premises in a given interval of time tis defined as given
in Equation (5).
P
i(t) = {P
1(t),P
2(t),...,P
NB (24)},i={1,2,...,NB}.(5)
Where NB represents the prosumers’ number (NN B)in the network. The consumption of
prosumers or consumers at time tis defined as given in Equation (6).
T P
i(t) = {T P
1(t),T P
2(t),...,T P
N(24)},i={1,2,...,N}.(6)
Where the consumers number in the network is represented as N. For any prosumer i, the net
power in a given time tis represented as given in Equation (7).
NP
i(t) = T P
i(t)P
i(t),t={1,2,...,24}.(7)
20
As all prosumers have different electricity consumption patterns. The prosumers can serve as
either sellers or buyers depending on the net power at a certain time slot. Therefore, the Total
Selling Power (TSP) and the Total Buying Power (TBP) are defined as given in Equation (8)
and Equation (9) .
T SP(t) =
24
t=1
NP
i(t),NP
i(t)<0,(8)
T BP(t) =
24
t=1
NP
i(t),NP
i(t)0.(9)
According to economics theory [208], price and SDR relationships are inversely proportional.
Similarly, as the price model in [28] is formulated based on SDR. In this research, we apply
the same price model, which is modified by introducing a demurrage mechanism. The TBP is
the prosumer’s or consumer’s energy consumptions, and the TSP is the PV power generations.
Therefore, the SDR at time slot tis represented as in Equation (10).
SDR(t) = T SP(t)
T BP(t).(10)
The selling and buying prices change over the period of time of the day. Therefore, the prices
are assumed to be
Prbuy(t) = {Prbuy(1),Prbuy(2), ...,Prbuy(t)}and Prsell (t) = {Prsell (1),Prsel l (2),...,Prsell (t)},
Pr ={Prbuy(t);Prsell (t)}.
Where selling and buying prices at time slot tat the prosumer’s side are represented as Prsell (t)
and Prbuy(t), respectively. The purchasing and selling powers to utility grid are represented as
αbuy(t)and αsell (t)at time slot t, respectively.
In order to motivate the consumers and prosumers to fully participate in energy trading, es-
pecially, at peak PV generation, the prosumer or consumer buying prices (Prbuy (t)) should not
be greater than the price (αbuy(t)) of energy bought from the main grid. Additionally, the selling
price (Prsell (t)) of the prosumer(s) must not be less than the selling price (αsell (t)) of the util-
ity grid. Thus, the buying price Prbuy(t)and selling price Prsell(t)are represented as a function
of SDR(t)in Equation (11) and Equation (12)
Prsell (t) = f(SDR(t)) = ((αsell (t)+α).αbuy(t)
(αbuy(t)αsell (t)α).SDR(t)+αsell (t)+α,0SDR(t)1,
αsell (t) + α
SDR(t),SDR(t)>1,(11)
Prbuy(t) = f(SDR(t)) = (Prsell (t).SDR(t) + αbuy(t).(1SDR(t)),0SDR(t),
αsell (t) + α,SDR(t)>1.(12)
In our scenario, the demurrage mechanism is triggered whenever the prosumer or consumer
hoards energy or delays buying energy within peak power generation periods. In this case,
the condition given by SDR(t)is slightly different. Therefore, the buying price is slightly
higher, and the selling price is slightly lower than the utility grid’s prices. This is to encour-
age participants to patronize local energy generated at on-peak hours. In the peak generation
hours, the prices obey the SDR pricing model. When SDR(t) = 1, both the buying and selling
power in the neighborhood are the same (T BP(t) = T SP(t)) and no power is needed to import
from or export to the utility grid. Also, both the selling and buying prices are equal to the utility
grid selling price, along with the compensation price (Prsell (t) = Prbuy(t) = αsell (t) + α). When
SDR(t) = 0, this means that there is no selling power in the neighborhood. The consumers must
buy energy from the main grid with a grid price of αbuy(t). Therefore, the buying and selling
21
prices are equal to the main grid’s buying price (Prsel l (t) = Prbuy(t) = αbuy(t)). The compen-
sation price αis introduced to compensate the prosumer to ensure that the energy sellers are
better remunerated when participating in local energy trading. It also ensures that the selling
and buying prices are not the same when SDR(t)>1, and provides more economic benefits
to the prosumers than the consumers. The buying and selling prices keep changing based on
Equations (11) and (12), when 0 <SDR(t)<1. The equations mentioned calculate the rela-
tionship between SDR(t)and the proposed buying or selling prices. It shows that SDR(t)is
reduced when power consumption increases. An increase in SDR(t)decreases both the selling
and buying prices and vice versa. To increase the selling price, the participants must increase
their energy consumption and the buyer would also need to decrease their energy consumption
for a lower buying price. In order to discourage energy hoarders and encourage consumers to
purchase energy at peak power generation hours, we introduce a demurrage mechanism in pro-
sumer’s buying and selling prices [209]. Let βbe the demurrage value as represented in Equa-
tions (13) and (14). The new buying and selling prices are Prbuyβ(t)and Prsellβ(t), which are
derived from the demurrage mechanism and are represented in Equations (15) and (16). While
Equation (17) represents the combination of buying and selling price with demurrage.
β=Pr(t) = Pr(t)Prt(t
K),(13)
t= [Min,Max],(14)
Prsellβ(t) = (Prsell(t),0tMax,
Prsell (t)β,otherwise (15)
Prbuyβ(t) = (Prbuyβ(t),0tMax,
Prbuyβ(t) + β,otherwise, (16)
Pri(t) = (Prsellβ(t),
Prbuyβ(t).(17)
Cost Model of Consumers and Prosumers
The prosumers and consumers involved in the energy trading DR are expected to have some
portion of shiftable loads. The participants change their energy profile consumption because of
the price incentives. This makes the initial energy consumption T P
i(t)to be changed from its
actual values. The energy consumption adjusted is given in Equation (18).
yi={y1,y2,...,yt}.(18)
The adjusted net consumption for both prosumer and consumer at time slot tis updated as in
Equation (19).
NP
i(t) = yiP
i(t),t={1,2,...,24}.(19)
The cost function for PV prosumers iat time slot tis defined in Equation (20).
Cost(yi(t)) = Pri(t)NP
i(t).(20)
The total cost for PV prosumers ifor a day is defined in Equation (21).
Cost(i) =
24
t=1
Cost(yi(t)).(21)
Pri(t)is the customer price at time slot t, which can be either the buying or selling price. The sta-
tus of the price is determined by the net power to be either the buying or selling price Pri(t),
which is given in Equation (22).
22
Pri(t) =
Prsellβ(t),NP
i(t)>0,
0,NP
i(t) = 0,
Prbuyβ(t),NP
i(t)<0.
(22)
In the energy scheduling process, we have two constraints:
24
t=1
yi(t) =
24
t=1
T P
i(t),(23)
min(T P
i)yi(t)max(T P
i).(24)
Equation (23) means that the total energy before and after shifting the load is assumed to be
unchanged, while Equation (24) means that the shifted electricity load must lie between the
minimum and maximum electricity loads of the original customer profile.
Self-Consumption and Self-Sufficiency
In this section, we discuss self-consumption and self-sufficiency [210] and their mathematical
representations.
Self-consumption
The self-consumption is determined as the ratio of the total power consumption of prosumers
T P
i(t)and the total power generated from the on-site PV system by the prosumers P
i(t). The en-
ergy generated on-site is selected by taking the smallest between the generation or consumption
profile of the prosumers, which is shown in Equation (25). Self-consumption is represented in
Equation (26). Mi(t) = min{T P
i(t),P
i(t)}(25)
Self-Consumption =Rt=24
t=1Mi(t)dt
Rt=24
t=1P
i(t)dt .(26)
Self-Sufficiency
The self-sufficiency is calculated using Equation (27). A prosumer’s self-sufficiency defines the
share of the total energy supplied by the PV system.
Self-Sufficiency =Rt=24
t=1Mi(t)dt
Rt=24
t=1T P
i(t)dt .(27)
The relationship between self-sufficiency and self-consumption is expressed as in Equation (28).
Self-Consumption
Self-Sufficiency =Rt=24
t=1T P
i(t)dt
Rt=24
t=1P
i(t)dt .(28)
4.2 Energy Trading using Blockchain based Privacy Preservation and Reward
Mechanisms
The proposed system model is divided into two components: residential energy prosumers and
EVs. The model is discussed in the following sections.
4.2.1 Electric Vehicles’ Component
In Figure 4, the overall system model is presented. The proposed system model is divided into
two components: EVs and residential energy prosumers. In the EVs’ component, the com-
ponent is categorized into three parts: (i) privacy preserving search and match scheduling,
(ii) validation of transactions and blockchain based EVs’ energy trading, and (iii) load fore-
casting for EVs. The proposed component has two users groups, which are Energy Buying
EVs (EBEVs) and Energy Selling EVs (ESEVs). Examples of ESEVs are V2V chargers, pub-
lic/private charging stations, and residential stations. The system is assumed to have no central
23
EV Energy
Requester
Energy Blockchain
and Smart Contract
Searching and Matching
Information Flow via
Blockhain
Encrypted Data with ID-
based Encryption
Encrypted Data with
Homomorphic Encryption
Decrypted Data
Figure 4. SM2: Energy Trading using Blockchain based Privacy Preservation and
Reward Mechanisms.
scheduler. In the EVs’ component, the EBEV initiates a local query using communication de-
vices that helps to search for available ESEV in the SC. The communication between the EBEVs
and ESEVs is done either by Long-Term Evolution (LTE) or Dedicated Short-Range Commu-
nications (DSRC). More elaboration about the communication devices can be found in [135].
The ESEVs receive charging request from EBEVs and respond them in a distributed fashion.
In this component, the selection of ESEVs is based on their reputation points. The reputation
points are submitted to and retrieved from the blockchain. This ensures the integrity of the
reputation points and also verifies its source. By considering the reputation points, the EVs’
locations are outrightly hidden. In the model, it is assumed that all EVs are situated within a
short proximity. Thus, the EVs’ reputation points are considered instead of the distance between
the EBEVs and ESEVs. When the EVs’ selection is complete, then the ESEV sends its location
to the EBEV using Partially Homomorphic Encryption (PHE). After the completion of search
and match process, the energy trading takes place using smart contract along with the monetary
process. Additionally, the information of EBEVs and ESEVs is verified and is stored in the
blockchain. However, EVs’ load forecasting is introduced to properly plan and manage the
intermittent charging and discharging behavior of the vehicles.
4.2.2 Homomorphic Encryption
HE is a cryptographic system, which was first proposed in 1970s [212]. It is an encryption
process that allows a specific type of mathematical computation to be executed on a cipher-text,
which further generates another cipher-text. Thus, the output of the generated encrypted text
matches the plain-text operations as if the operations are performed directly on the plain-text
without any sign of distortion or alteration. This method allows users to perform operations
on an encrypted data without knowing the real data supplied from the sender or having the
public key to decrypt the encrypted message. It also provides the prospect for privacy preser-
vation in many applications, e.g., storing data in cloud, and improving election security and
transparency. Furthermore, HE solves the challenges of maintaining the confidentiality of pro-
cessed and stored data in a database faced by other non-HE techniques. It is subdivided into
24
Fully HE (FHE) and PHE [213]. FHE allows all computations (multiplication and addition)
on cipher-text while PHE supports either multiplication or addition. In this paper, Pailliers’
cryptosystem is used, which is classified under PHE. It is more efficient and simpler than FHE
scheme [219]. Paillier system has three steps: decryption, encryption, and key generation. The
equations of the cryptosystem are adopted from study [135].
pand qare two large prime numbers that are selected with the same bit length in the key
generation step, setting n=pq and λ= (p1)(q1).µand gare computed from λand n,
which are µ= (λmod n2)1mod n, and g= (n+1). The encryption and decryption keys are
defined as (n,g)and (λ,µ), respectively. A random integer rεZnis selected when encryption
is performed on a plain-text (i.e., E(a,r)).
At the encryption step, the data is encrypted using Equation (29).
E(a,r) = ga.rnmod n2.(29)
While at the decryption step, the data is decrypted using Equation (30).
D(b) = (L(E(a,r))λmod n2)µmod n.(30)
Where L(u) = u1
n. Both encryption and decryption functions must satisfy Equations (31) and (32).
E(a).E(c) = E(a+c),(31)
E(a)c=E(ac).(32)
Where aand care plain-texts.
4.2.3 Adversary Model
In the proposed model, an Honest-But-Curious (HBC) adversary model is adopted specifically at
the privacy preserving search and match part. The commonly used adversary model in studying
privacy preserving matching profile is the HBC [220]. The users in this model carefully report
and respond to other users’ queries. In this model, we assume that some nodes in the blockchain
are malicious nodes, which can attack the system in two ways.
(Q1) The attacker will try to understand other users’ location even though they are not matched.
(Q2) The attacker may try to understand and change reputations of other users to gain advantage
of being selected.
It is further assume that the attacker has adequate power to breach any node’s privacy in the
system. Also, the attackers are unable to take over more than 51% of the computational power
in the blockchain. It is further assumed that the minority nodes in the network have malicious
behavior, i.e., the malicious nodes are not more than 50%.
4.3 Residentials’ Energy Component
Residentials’ energy component is also an important component in the proposed system model.
This component consists of an AGgregator (AG) and a set of participating prosumers (Prosumer1,
Prosumer2,...,Prosumern)in the distributed network. The prosumers in the network are inter-
linked and share energy using dedicated power-sharing lines. Both AG and prosumers interact,
and trade energy through blockchain. It is assumed that in a given time slot, every prosumer is
able to produce energy G, and it has a load L. When GjLj, the jth prosumer becomes energy
seller (provider). Whereas, when Gj<Lj, the prosumer becomes energy buyer (consumer) and
purchases energy either from the main grid or another prosumer with surplus energy. The AG is
an autonomous entity between seller and buyer that gathers the surplus energy from the energy
25
providers. AG is encouraged to have its own energy storage devices to store energy, and main-
tain the system’s stability and reliability, e.g., ultra-capacitor, batteries, etc. The sum of surplus
energy from providers is given as Ej,as =GjLj,E=jProsumer (Ej,as).
A typical scenario where consumers request energy from AG is depicted in Figure 4. AG
plays a god role in this component as an independent system. It is an equitable entity, which has
full control over prosumers. Additionally, the AG uses RSFEAP algorithm to allocate the avail-
able energy to consumers, which is collected from the providers and distribute it to consumers.
Besides that, the AG distributes rewards to prosumers after the collection of all necessary trans-
actions’ data as shown in Figure 5. Moreover, the data used to communicate between AG and
prosumers is invariably passed through an encryption mechanism before the communication
takes place. The encryption technique used in this component is ID-Based encryption. The
details of the encryption process are presented in Section 4.9.
4.4 Proposed Solution for Electric Vehicles’ Component
In this section, privacy preserving reputation based distributed matching, smart contracts, and
EVs’ charging load forecasting are discussed.
4.4.1 Privacy Preserving Reputation based Distributed Matching
Internet based markets play a significant role in providing business opportunities for both smaller
and larger retailers. The exponential increase in the business opportunities steadily draw the
attention of many fraud retailers whose aim is to exploit the market for financial gain by com-
mitting fraud. The common committed frauds in the marketplaces are [221]: (1) buyer receives
products that are completely different from the targeted products and (2) buyer receives product
of less quality as compared to the requested product. According to the Experian statistics, online
business fraud has significantly increased by 30% [222]. Thus, marketplaces’ fraud resulted in
a downfall of thousands of dollars every year across the world [223]. Customers in electronics
marketplaces do not have the opportunities to physically explore services or products before
buying them. Therefore, to learn the truthfulness of the service provider on a website, the user
must rely on certain third-party data. The cloud, mobile edge or e-commerce marketplace intro-
duces a reputation system, which gives a piece of information on the retailer’s trustworthiness to
new clients. The information allows the customers to decide on whether to render business with
the service provider or not. The trustworthiness (reputation) points are calculated by cumulating
all the feedback scores provided by customers on the market-platform according to their inter-
action with the service providers. A reputation system is divided into two subsystems [221]:
(a) a content-driven system that calculates reputation points of the retailers from content of the
message left by the customers on the marketplace and (b) the user-driven system that calculates
reputation points using customers’ feedback points such as rating (0-10) for the retailers’ pre-
vious transactions. Many online systems have implemented a reputation based system while
other systems implemented using hybrid reputation based system [224]. These systems involve
a trusted third-party to process and collect the feedback provided by customers. The systems
must ensure the security, integrity, and privacy of the users’ data. However, the customer cannot
fully trust a centralized system that can easily be attacked by a malicious user and leads to a
single point of failure problem.
In this study, a blockchain based decentralized and distributed reputation system is proposed.
The complete layout of the proposed system is given in Algorithm 2. In the system, once EBEV
requests for charging, the algorithm checks for ESEV that has the highest reputation points
without considering the distance. If the ESEV with the highest reputation points accepts the
charging request from EBEV, then the algorithm matches the ESEV with EBEV. Otherwise,
the ESEV with the second-highest reputation points will be considered by the algorithm. The
sequence continues until the EBES and ESEV are matched. To preserve the privacy of the EVs,
26
Algorithm 2 Generic-Matching Function
Input : D and S;
Output : Matched result;
1: function GEN ER IC-MATCHING(D, S)
2: i=1;
3: while D not matched with S do
4: Find Distance (D) based on reputation in a privacy
5: preserved manner;
6: if Siaccepts the request then
7: Match D with Si;
8: Break;
9: end if
10: i+ +;
11: end while
12: end function
the ESEVs are chosen based on their reputation points without considering EBEV’s whereabouts
information. After selecting the ESEV, communication between the two parties takes place
using Paillier cryptosystem based on homomorphic computation SC.
4.4.2 Calculating Reputation
The EBEVs submit ratings of ESEV after energy trading task is completed. Afterwards, the
process of calculating reputation points is initiated in the blockchain. At the initial stage, the
EVs first register themselves and obtain initial reputation and credibility points. These points
are publically available for all the involved EVs. The actual reputation is the total accumulated
rating provided by the EBEVs for the services received along with the raters’ credibility, which
are discussed and presented in Section 4.5.2. Therefore, the usage of credibility method gives
the reputation points of rater with higher credibility more weight as compared to the one with
less credibility. The mechanism to obtain the EVs’ credibility is not extensively discussed in this
research. When EBEVs are confirmed to be trustworthy, their credibility increases; otherwise,
their credibility decreases.
4.4.3 Privacy Preserving Reputation based Distance and Location Calculations
To compute the distance between EBEV and ESEV, the EBEV needs to know the ESEV’s repu-
tation points, which are retrieved from blockchain. The EBEV ensures that the reputation points
are verified because they are stored in the blockchain. This method gives a logical approach to
hide the ESEV location. Let the cipher-text of abe E(a)using the Paillier cryptosystem. Also,
an encrypted squared distance computation between an ESEV Sjat location locSj= (xj,yj)and
an EBEV Diat location locDi= (xi,yi)is achieved using Equations (33) and (34) [135].
Dist(i,j) = |locDilocSj|= (xixj)2+ (yiyj)2,(33)
E(Dist(i,j)) = E(x2
i2xixj+x2
j+y2
i2yiyj+y2
j).(34)
In the proposed model, each EV has PHE keys to encrypt the transactions between ESEV and
EBEV. Furthermore, Algorithms 3and 4are inspired from [135], which show the communica-
tion between EBEV and ESEV in a privacy preserved manner.
4.5 Smart Contracts of Energy Blockchain
In a blockchain network [225], smart contracts are a collection of rules that digitally facilitates,
enforces, and verifies the contract made by the participants in the network [225]. The smart
27
Algorithm 3 EBEV Function
Output : Send distance;
1: function EBEV()
2: notmached = True;
3: while notmatched do
4: Broadcast the need for matching;
5: if only one supplier S1responded then
6: S=S1;
7: else
8: S=Select the ESEV with the highest-reputation points;
9: end if
10: Sendmessage(propose, D, S);
11: msg = getMessage();
12: if msg = accepted then
13: add EBEV’s loc(x, y). and calculate encrypted square distance;
14: Sendmessage(encrypted(distance));
15: notmatched= False;
16: end if
17: end while
18: end function
Algorithm 4 ESEV Function
Output : Request result;
1: function ESEV()
2: notmached = True;
3: while notmatched do
4: msg =getMessage;
5: if msg.type =propose &Siaccept proposal then
6: respond with encryption loc(x,y);
7: Sendmessage(accept, S, D);
8: notmatched = False;
9: else
10: Sendmessage(reject, S, D);
11: end if
12: end while
13: end function
contract provides a credible transaction that is made automatically without involving a third-
party. In addition, the transaction that is performed using a smart contract is traceable, auditable,
and irrevocable. The proposed smart contracts in this model, i.e., reputation and energy trading,
are discussed in the following sections.
4.5.1 Energy Trading based Smart Contract
The energy trading smart contract comprises of three essential functions: selling, buying, and
creating storage. The selling and buying functions work hand-in-hand, which enable EVs to
sell or buy energy. When the energy trading begins, the smart contract first checks the credit of
EBEV available. It is necessary to confirm whether the EBEV has enough money to purchase
energy or not. Afterwards, it also checks whether the ESEV has enough energy to sell or not.
The smart contract checks whether the EBEV has enough energy storage capacity to accommo-
date the purchased energy or not. After all conditions are checked and returned true, then the
28
Algorithm 5 Smart Contract for Energy Trading
Input : Energy requested from EBEV;
Output : (1) ESEV gives energy to EBEV; (2) EBEV sends money to ESEV;
1: function ENERGYTRADING()
2: if (EBEV available balance <EV’s charging cost) then
3: return false;
4: end if
5: if (ESEV available energy <EV’s requested energy) then
6: return false;
7: end if
8: if (EBEV storage <amount of energy purchased) then
9: return false;
10: else
11: Subtract amount from EBEV’s account balance;
12: Add amount to EBEV account balance;
13: Store transaction;
14: Subtract energy from storage of ESEV;
15: Add energy to storage of EBEV;
16: Store transaction;
17: end if
18: return Updated information;
19: end function
ESEV’s account is credited with the digital coin while it is deducted from EBEV’s account. On
the other hand, the energy from the storage of the ESEV will be subtracted and is added to the
EBEV’s storage. The create storage function allows ESEVs to display the amount of available
energy to sell out with their respective prices. The pseudocode of the energy trading’s smart
contract is given in Algorithm 5.
4.5.2 Reputation based Smart Contract
EBEV contacts ESEVs through the smart contract to utilize their charging services. In public
setting, various ESEVs are available with different capabilities, intentions, and services. After
interacting with an ESEV, the EBEV evaluates ESEV based on its energy services that affects
the energy demander. The reputation points of each ESEV depend on EBEVs’ ratings. Due to
the fact that some EBEVs may misbehave, therefore, their integrity must be taken into consider-
ation. The EBEV with higher credibility point acts honestly as compared to one with less points.
Therefore, EBEV rates ESEVs fairly to increase their credibility significantly. The reputation
points are the cumulated ratings of EBEVs with their credibility points. The smart contract for
reputation comprises of two main functions: the viewing aggregated feedback and feedback sub-
mit. The viewing aggregated feedback allows both EBEVs and ESEVs to check their available
ratings. The feedback submit function allows EBEVs to assess the ESEV after a transaction of
energy takes place. The ESEVs’ reputation is calculated using Equation (35) [226].
RI=M
m=0Credm×Rm
M
m=0Credm
.(35)
Where, Iis a unique identification for each ESEV that is evaluated while the total number of
EBEV rated ESEVs is M. The credibility of EBEV mis Credm.Rmis the rating of node Igiven
by EBEV mand the total reputation points of node Iis RI. To reduce the execution and trans-
action gas consumption of the blockchain, the mathematical computations for reputation and
EBEVs’ credibility are done off-chain. Off-chain computation is defined as the computational
29
Algorithm 6 Smart Contract for Reputation
Output : (1) EBEV rated ESEV; (2) EVs View reputation points;
1: function SUBMITFEE DBACK()
2: Positive or negative rating point is added;
3: return True;
4: end function
5: function VIEWFEE DBACK()
6: return Aggregated feedback;
7: end function
model where the functions of state transition are calculated by a trusted entity that is not on the
blockchain. The resulting transition state then continues on-chain after verifying the compu-
tation of the state transition [227]. The computation results are transferred to the reputation’s
smart contract for further processing. The pseudocode of the smart contract for reputation is
given in Algorithm 6.
4.6 Energy Load Forecasting for EVs’ Charging Station based on Linear Regres-
sion
In this work, a forecasting approach is employed to predict the EVs’ charging consumption load
based on regression analysis. Regression analysis [228232] is a type of predictive technique for
modeling and investigating relationship between independent and dependent variables. These
predictive techniques are commonly used for forecasting, time series modeling, and finding a
collective relationship between variables. Regression analysis is divided into linear, multiple
logistics, polynomial, stepwise, ridge, lasso, and elasticNet regression. In this model, MLR is
used.
4.6.1 Multiple Linear Regression
MLR determines the relationship between the variables that are independent and dependent.
The equations presented for MLR are adopted from [233], which are expressed as shown in
Equation (36).
y=α0+α1x1+α2x2+... +αrxr+ε.(36)
Where yis the EVs’ charging load consumption, x1,x2, ..., xrare the independent variables,
α1,α2,...,αrare regression coefficients with respect to the independent variables, and εdenotes
error rate. For multiple observations, Equation (36) is splitted as presented in Equation (37).
y1=α0+α1x11 +α2x12 +... +αrx1r+ε1,(37)
y2=α0+α1x21 +α2x22 +... +αrx2r+ε2,
...
yi=α0+α1xi1+α2xi2+... +αrxir +εi,
...
yn=α0+α1xn1+α2xn2+... +αrxnr +εn.
These equations are represented in the form of matrices as follows.
y=αX+ε.(38)
30
Where, y=
y1
y2
.
.
.
yn
,X=
x11 x12 ... x1r
x21 x22 ... x2r
.
.
.
xn1xn2... xnr
,
α=
α1
α2
.
.
.
αr
,and ε=
ε1
ε2
.
.
.
εn
.
The matrices yand Xcontain information of both dependent and independent variables of the
actual data. The αfrom Equation (38) is derived by Equation (39) using the least square method.
α= (X0X)1X0y.(39)
According to Equation (39), used to calculate αregression coefficient, the expected load could
be predicted as represented in Equation (40) using the MLR method.
ˆy=Xα.(40)
ˆyare the forecasted values of y. In this model, error is the absolute difference between the actual
and forecasted values.
4.6.2 Proposed Solution for Residential Prosumers’ Component
The role of blockchain in fair energy trading and the method to compute rewards for prosumers
are discussed in this section. According to the energy requirement, every energy consumer
decides its starvation parameter and sends it to the AG. The AG uses the RSFEAP algorithm to
distribute energy across all prosumers based on their energy contribution, type of transactions,
and starvation parameters.
4.6.3 Fair Energy Trading using Blockchain Technology
In this study, a blockchain based model is developed to decentralize the energy systems. The
model comprises of energy consumers, energy providers, and AG as users. These users coor-
dinate and communicate via blockchain to facilitate the decentralization of energy demand and
generation. However, maintaining and storing energy transactions using a centralized system
is still an open research problem. Therefore, transactions in energy trading are coordinated,
recorded, and maintained with the support of blockchain technology in a decentralized man-
ner. The blockchain technology has many features: consensus mechanism, self-enforced smart
contract, immutability, etc. A consensus mechanism is a collection of protocols that enables
untrusted prosumers to agree on a global state of the network. In this work, Proof of Work
(PoW) [198] is used. A self-enforced smart contract is an agreement embedded as a computer
code that is managed by the blockchain. Information immutability feature helps to ensure that
the transactions recorded on the blockchain remain unaltered after miners’ verification.
4.7 Proposed Parameters
This section discusses the parameters used for the energy allocation algorithm across residential
prosumers.
31
Figure 5. Reward Allocation.
4.7.1 Starvation Level Parameter
The consumers in the reward based energy allocation model are served with excess energy
available in the system. It is found that some prosumers in the network show a negligible
contribution, have a high rate of malicious transactions or are incapable of contributing energy.
In this case, the consumers might not receive energy and they need to purchase the required
energy at a very high price from the main grid. In RSFEAP, the minimum energy requirement
of each prosumer is represented in the form of percentage. The starvation factor Sis used to
define the threshold for the energy requirement. Based on the threshold, each consumer meets
its minimum energy requirement S×Earq to avoid energy starvation. The SL parameter is
calculated using Equation (41) [144].
SL = (1Eall ocR
Earq
)×EallocR.(41)
At every time slot, AG receives details of providers’ excess energy Eas and consumers’ energy
request Earq. The RSFEAP guarantees optimal prosumer-generated energy allocation EallocR to
each consumer.
4.7.2 Reward Index
In this model, RI plays a vital role for a fair energy allocation. It is mandatory to compute the
RI carefully to have fair energy allocation and trading mechanisms. In the process of deciding
the reward of a prosumer i, two factors are considered, which are given below.
1. The amount of energy contributions provided by the prosumer in the past.
2. The number of valid or malicious transactions performed in the present or past by the
prosumers.
Hence, RI is computed as follows.
ϒi=1e(θ
100 ),(42)
θ=(0,if valid transaction,
1,if malicious transaction, (43)
32
Ci=Ci(Ci×ϒi),(44)
RIi=Ci
CTotal
.(45)
In Equations (42)-(45), Ciis the amount of energy contributions provided by a prosumer till
the present interval and CTot al is the sum of the energy contributions recorded by the AG till
the present interval. ϒiis the quantifier for valid and malicious transactions recorded by the
miners in the blockchain while θis the index of each transaction (valid or malicious) recorded.
In the computation of RI, both energy contributions and transaction types are treated with equal
preference. However, there may be a situation where an AG gives a higher preference to the
type of transactions executed rather than the energy contributed. In such situation, the preference
values of a user will be multiplied by the weight factor ρ(ρ>0). We assume to take the value of
ρas 1 in this paper since preferences to both transaction types and energy contributions provided
in the past are the same. Therefore, a prosumer that shares surplus energy in the past will get
rewards in the future when needed energy. The reward depends on the type of transactions
conducted by the prosumer, which decreases with an increase in malicious activity during energy
transactions. Conclusively, when a prosumer purchases energy, the AG and miners store the
information about exact net energy shared by the prosumer in the blockchain ledger. The AG
uses the information to compute the RI and update it regularly. The RI is considered in RSFEAP
to show the consistency and credibility of prosumers in the system.
4.7.3 Valid and Malicious Transactions
The Valid and Malicious Transactions (VMT) algorithm consists of punishment and reward
mechanisms. There are two types of actions to be punished. First, when consumer iattempts to
alter his record to favor himself. Secondly, when consumer ibroadcasts a forged request. On the
other hand, it is rewarded when a prosumer iacts honestly and performs a valid transaction. As
shown in Algorithm 7, if a malicious transaction is not detected by the miners, the transaction
is said to be valid and its index θiwill be set to zero (0). Therefore, the prosumers’ RI will
increase. On the other hand, if a malicious act is detected based on the mentioned actions, then
the AG will collect evidence to make a judgment and send it to the miners for validation. If any
prosumer is caught with malicious activity, its transaction index θiwill increase by 1, which will
decrease the RI.
4.8 Optimization Formulation
AG optimally distributes energy to every consumer based on the aforementioned parameters.
Hence, to efficiently allocate energy Ai(Ei,allocR)to meet the consumers’ demand, an opti-
mization problem is formulated. The optimization formulation given in this research is similar
to [144].
max
iCs
Ai(Ei,allocR),(46)
Such that, S×Ei,arq Ei,all ocR Ei,arq,
iCs
Ei,allocR E.
According to the optimization problem given in Equation (46), some assumptions are made. The
AG will not distribute energy Ei,al locR to the consumer that will exceed its energy requirement
(Ei,arq) and will fall below its starvation level (SL ×Ei,arq). Therefore, the consumer will be
able to satisfy its minimum demand. Also, RSFEAP places a restriction on the total energy
33
Algorithm 7 VMT Algorithm
Input θi, Ci, CTotal ;
Output CTotal and Ci;
1: function FINDMALICIOUSTRANSACTION(θi,Ci,CTot al )
2: if (Malicious Transaction) then
3: θi=θi+1;
4: ϒi=1e(θ
100 );
5: Ci =Ci(Ci×ϒi);
6: Update CTotal with new Ci;
7: else
8: Update Ci;
9: Update CTotal with new Ci;
10: end if
11: return CTotal and Ci;
12: end function
distributed to the consumers so that it cannot exceed the total energy aggregated from prosumers
with surplus energy E. The consumers’ objective functions are given from AG perspective as
shown in Equation (47).
Ai(Ei,allocR) = αRIiEi,allocR +βSLi.(47)
Solving the following constrained optimization problem, the RSFEAP of the AG is developed.
Problem 1
Let the set of all consumers be Cs ={1,2,...,n},Earq ={E1,arq,E2,arq, ..., En,arq }be the
set of exact energy request by the consumers, and C={C1,C2,...,Cn}be the set of energy
contributions made by the prosumers. The optimal value of the optimization is computed using
Equation (48).
max
iCs
αRIiEi,allocR +βSLi,(48)
Such that, S×Ei,arq Ei,allocR Ei,arq ,
iCs
Ei,allocR E.
Where βand αare the weight factors. β+α=1 and 0 β,α1 are used to control the
preference of every parameter of RSFEAP.
Solution
If iCs Ei,allocR E, then all consumers are allocated with their requested energy, i.e.,
Ei,allocR =Ei,arq. On the other hand, an optimal energy allocation is used for the nontrivial
case, i.e., when considering iCs Ei,allocR >E. In such a situation, one can obtain closed-form
solution given by Theorem 1.
Theorem 1
An optimized allocation of energy E
i,allocR ={E
i,allocR|iCs}from the defined problem is
given below.
34
E
i,allocR =
(αRIi+βυ)
2βEi,arq,if Ei,allocR >S×Ei,arq
and <Ei,arq,
S×Ei,arq,if Ei,allocR S×Ei,arq,
Ei,arq,otherwise .
(49)
Where υis a real number that satisfies iCs E
i,allocR =E.
Proof
Since all the constraints are linear and the objective function is purely concave, the condi-
tions of Karush-Kuhn-Tucker (KKT) [144] guarantee Problem 1 given as follows.
1. Complementary slackness:
λihi(x) = 0.(50)
2. Primal feasibility:
hi(x)0,gj(x) = 0.(51)
3. Dual feasibility:
λi=0.(52)
4. Stationary:
0f(x) +
m
i=1
λihi(x) +
r
j=1
υjgj(x).(53)
Generally, the constraint vectors are represented as single column vectors.
h(x) =
h1(x)
h2(x)
.
.
.
hm(x)
,g(x) =
g1(x)
g2(x)
.
.
.
gr(x)
.(54)
We define mlagrange multipliers for λiinequality constraints and rmultipliers υjfor r
equality constraints. Hence,
λ=
λ1
λ2
.
.
.
λm
,υ=
υ1
υ2
.
.
.
υr
.(55)
From Equation (53), f(x)is derived as given in Equation (56).
f(x) = Ai(Ei,allocR),(56)
which is further simplified to Equation (57),
f(x) = αRIi+β2βE
i,allocR
Ei,arq
.(57)
In Equation (53), the second term can be represented as given in Equation (58) below. ϕin the
expression is used for the second inequality constraint.
m
i=1
hi(x) = λi+ϕi.(58)
And the last term in Equation (53), can be shown as.
r
j=1
gj(x) = υ.(59)
35
By solving Equations (57), (58), and (59), the stationary condition in Equation (53) is satisfied,
which is expressed in Equation (60).
αRIi+β2βE
i,allocR
Ei,arq
+λiϕυ=0.(60)
In primal feasibility condition, hi(x)0, gj(x)0 is solved as.
S×Ei,arq E
i,allocR 0,(61)
E
i,allocR Ei,arq 0,(62)
where Equations (61) and (62) give Equation (63).
n
i=1
E
i,allocR 0.(63)
While the complementary slackness condition is shown as.
λi(S×Ei,arq E
i,allocR) = 0,(64)
ϕi(E
i,allocR Ei,arq) = 0.(65)
Finally, the dual feasibility condition in Equation (52) is expressed in Equation (66).
λi=0,ϕi=0.(66)
The inequality constraint and objective function are convex and differentiable while the equality
constraint functions are affine. Therefore, the KKT conditions have an optimal solution [142,
234]. To satisfy Equation (66), three possible cases are generated for E
i,allocR:S×Ei,arq
E
i,allocR Ei,arq,E
i,allocR =Ei,arq, and S×Ei,arq =E
i,allocR. We first consider a case S×
Ei,arq E
i,allocR Ei,arq. It is clear that λi=0 and ϕi=0. The λiand ϕivalues are then been
substituted in the stationary condition in Equation (53) and the result of E
i,allocR is generated as
follows.
αRIi+β2βE
i,allocR
Ei,arq
υ=0,(67)
αRIi+βυ=2βE
i,allocR
Ei,arq
,(68)
where Equations (68) is further simplified to give Equation (69).
αRIi+βυ
2βEi,arq =Ei,allocR.(69)
Considering a case E
i,allocR =Ei,arq, there exists a value of λitaken from Equation (65).
The value of ϕican be substituted in the stationary condition in Equation (53) and the E
i,allocR
results are given as follows.
αRIi+β2βE
i,allocR
Ei,arq
ϕiυ=0,(70)
(αRIi+βυ)Ei,arq
2βE
i,allocR =ϕiEi,arq
2β,(71)
where Equations (70) and (71) are further simplified to give Equation (72),
(αRIi+βυ)Ei,arq
2β=E
i,allocR +ϕiEi,arq
2β0,(72)
which produces
(αRIi+βυ)Ei,arq
2βEi,arq.(73)
36