100% found this document useful (1 vote)
15 views25 pages

Peer-To-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning for Sustainable Electrical Power Supply in Smart Grid

This paper presents a blockchain-based peer-to-peer energy trading mechanism that utilizes machine learning for predictive analytics in smart grids. The proposed platform aims to optimize energy consumption and trading between consumers and prosumers by enabling real-time monitoring and scheduling of distributed energy resources. The study employs historical energy data to build predictive models and evaluates the system's performance using various statistical measures and blockchain metrics.

Uploaded by

A.F
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
15 views25 pages

Peer-To-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning for Sustainable Electrical Power Supply in Smart Grid

This paper presents a blockchain-based peer-to-peer energy trading mechanism that utilizes machine learning for predictive analytics in smart grids. The proposed platform aims to optimize energy consumption and trading between consumers and prosumers by enabling real-time monitoring and scheduling of distributed energy resources. The study employs historical energy data to build predictive models and evaluates the system's performance using various statistical measures and blockchain metrics.

Uploaded by

A.F
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Received January 26, 2021, accepted February 14, 2021, date of publication February 19, 2021, date of current

version March 16, 2021.


Digital Object Identifier 10.1109/ACCESS.2021.3060457

Peer-to-Peer Energy Trading Mechanism Based


on Blockchain and Machine Learning for
Sustainable Electrical Power Supply
in Smart Grid
FAISAL JAMIL , NAEEM IQBAL , IMRAN , SHABIR AHMAD , AND DOHYEUN KIM
Computer Engineering Department, Jeju National University, Jeju City 63243, South Korea
Corresponding author: Dohyeun Kim ([email protected])
This work was supported in part by the Energy Cloud Research and Development Program through the National Research Foundation of
Korea (NRF) by the Ministry of Science, and ICT (MSIT) under Grant 2019M3F2A1073387, and in part by the Institute for Information
and Communications Technology Planning and Evaluation (IITP) Grant by the Korean Government through MSIT (AutoMaTa:
Autonomous Management framework based on artificial intelligent Technology for adaptive and disposable IoT) under Grant
2018-0-01456.

ABSTRACT It is expected that peer to peer energy trading will constitute a significant share of research
in upcoming generation power systems due to the rising demand of energy in smart microgrids. How-
ever, the on-demand use of energy is considered a big challenge to achieve the optimal cost for house-
holds. This paper proposes a blockchain-based predictive energy trading platform to provide real-time
support, day-ahead controlling, and generation scheduling of distributed energy resources. The proposed
blockchain-based platform consists of two modules; blockchain-based energy trading and smart contract
enabled predictive analytics modules. The blockchain module allows peers with real-time energy consump-
tion monitoring, easy energy trading control, reward model, and unchangeable energy trading transaction
logs. The smart contract enabled predictive analytics module aims to build a prediction model based on
historical energy consumption data to predict short-term energy consumption. This paper uses real energy
consumption data acquired from the Jeju province energy department, the Republic of Korea. This study aims
to achieve optimal power flow and energy crowdsourcing, supporting energy trading among the consumer
and prosumer. Energy trading is based on day-ahead, real-time control, and scheduling of distributed energy
resources to meet the smart grid’s load demand. Moreover, we use data mining techniques to perform
time-series analysis to extract and analyze underlying patterns from the historical energy consumption data.
The time-series analysis supports energy management to devise better future decisions to plan and manage
energy resources effectively. To evaluate the proposed predictive model’s performance, we have used several
statistical measures, such as mean square error and root mean square error on various machine learning
models, namely recurrent neural networks and alike. Moreover, we also evaluate the blockchain platform’s
effectiveness through hyperledger calliper in terms of latency, throughput, and resource utilization. Based
on the experimental results, the proposed model is effectively used for energy crowdsourcing between the
prosumer and consumer to attain service quality.

INDEX TERMS Energy trading, energy prediction, predictive analysis, machine learning, blockchain.

I. INTRODUCTION to fulfill the load demand of a large population [1], [2].


During the last few decades, the primary energy genera- Similarly, the non-renewable energy resources are not eco-
tion source is non-renewable energy resources, such as coal, friendly, which indicates that the energy generation process
natural gas, and oil. Nonetheless, the non-renewable energy produced high carbon emission [3]–[5]. Therefore, many
sources are becoming costly over time and are difficult eco-friendly organizations have emphasized using renewable
energy sources (RES), such as solar, wind, tidal, biomass,
The associate editor coordinating the review of this manuscript and etc. RES are eco-friendly and are used for producing cheaper
approving it for publication was Ali Shariq Imran . energy with less transmission cost [6], [7]. Furthermore, RES

This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/
VOLUME 9, 2021 39193
F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

is also used to contribute to the main grid to meet the grid load attempted to address the issues mentioned earlier, and the
demand. The evolution in renewable energy resources opens main contribution of this paper is followed as:
the door for distributed Peer-to-Peer (P2P) energy trading, • The main aim of this study is to propose an intelligent
such as home and buildings [8]. The P2P energy trading is peer-to-peer energy trading between the prosumer and
also referred to as trading between consumer and prosumer. the consumer.
The peers can trade energy with each other without the inter- • The proposed system comprised of smart contract
vention of any traditional energy distributors, such as grid [9]. enabled real-time and day-ahead controlling and gener-
The smart grid innovation, such as Distributed Energy ation scheduling of DER, controllable loads in order to
Resources (DER) and microgrids, has to change energy gen- meet the load demand of smart grid based on reward and
eration and consumption in two aspects. Firstly, the addition agreement.
of a prosumer as a grid participant helps with energy contribu- • The proposed blockchain-enabled intelligent energy
tion to main grid storage and provides grid decentralization. trading platform is modeled and implemented using
Second, the modification in utility to service providers from a permission blockchain network called Hyperledger
the power retailer, which aims to provide (renting) transmis- Fabric, which allows the system admin to operate the
sion line to the prosumer. The shifting of the traditional grid network, crowdsourcees to manage their accounts, and
to the smart grid requires a trusted energy platform, mathe- perform energy transactions within the eco-system.
matical model, distributed operations, and control algorithms • The data analytics module is implemented based on data
to facilitate stable grid functions, prosumer interaction, and mining techniques to extract the knowledge and hid-
business model based on intensive [10]–[12]. den patterns important for energy distributors to devise
Crowdsourcing is the large-scale set off for numerous effective decisions and manage energy resources effec-
industries and has been implemented in many disciplines, tively.
e.g., cyber-physical system, medicine, and engineering sys- • The proposed energy predictive analytics module is
tem [13]. The main aim of crowdsourcing is to use crowds’ implemented based on machine learning techniques to
services and goods to attain system objectives [14], [15]. predict the short-term energy demand in order to min-
Crowdsourcing can also be applicable in the energy sector. imize the delivery cost of electrical energy for con-
We have studied the most prominent crowdsourcing market, sumers.
i.e., Amazon Mechanical Turk, which facilitates customers to
pole their job along with expiry-date and financial rewards. The rest of the paper is formed as follows. Section 2
Similarly, the energy crowdsourcing system (ECS) is useful describes the start-of-art comparison of energy trading
for many scenarios, such as charging and discharging of the platform based on blockchain and machine learning.
battery, electric vehicle charging, meet energy demand(real- Section 3 presents the predictive peer-to-peer energy trading
time) via renewable energy resources, such as solar panel, based on blockchain, including an operational model of dis-
wind, and other DER [16]–[20]. These scenarios can be tributed energy resources, smart contract centric energy trad-
automated by using smart plugs, inverters, and digital meters ing transaction, and reward model. Section 4 demonstrates the
with the involvement of a power distributor and blockchain implementation and development scenario. Section 5 presents
implementation. the results and discussion. Conclusion and future directions of
The conversion in the continual energy system, where the proposed peer-to-peer energy trading platform are given
prosumer is used for crowdsourcing and expedite in two ways in Section 6.
such as:
• A crowdsourcing based energy system that provides grid II. RELATED TERMINOLOGIES
stability via real-time management of the grid. Many studies focus on integrating the distributed energy
• A secure computerized framework (e.g., blockchain) resources operation in distributed networks. The operation
that supports millions of energy trading transactions, includes economic dispatch problems, distributed energy
such as prosumer to consumer or prosumer to the utility. resources scheduling, grid frequency maintenance, and load
Most of the existing studies rely on optimal power flow, and renewable forecasts. Nowadays, the energy demand and
which is used to estimate the optimal operational level for reward pave away the owner of distributed energy resources
a utility to meet the load demand by minimizing the cost to contribute to eco-friendly production.
of operations [21], [22]. Moreover, blockchain technology
is also used by many researchers for providing data secu- A. ENERGY TRADING AND BLOCKCHAIN SYSTEMS
rity in the energy system. However, the energy system and Blockchain is a distributed ledger technology that relies on
computerized framework have many shortcomings. Firstly, a consensus and communication protocol that safeguards
the existing computerized framework is not scalable in sup- the ledger’s integrity through connected cryptographically
porting millions of energy trading transactions. Second, there time-stamp block that represents transactions [23]–[29]. The
is an ambiguity of how the trading between the peers took blockchain approach originates after the bitcoin invention,
place. Finally, how the prosumers and crowdsourcees can which uses the Proof of Work (PoW) concept. The miner
adopt the controllable loads and DER. This research study incorporates transactions into tree-based blocks encrypted

39194 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 1. Characteristic of blockchain with various component.

with predefined hash range [30]. Nonetheless, the PoW • Smart Contract: A smart contract is a type of computer
approach using public ledger has too many shortcomings in program which provide the functionality of self-
privacy, scalability, numbers of the transaction, and energy execution, self-verification, and tamper-resistant abili-
consumption [31]. During the last few years, many new ties. Nick Szabo initially developed a smart Contract
blockchain technologies have been introduced in order to in 1994. [41]. Smart Contract supports turing virtual
overcome the shortcoming mentioned above. These technolo- machine(VM) and protocol that allow nodes to execute
gies include privacy and permission mechanism, consensus services based on the results of transaction processor
mechanism, and smart contracts [31], [32]. The details of function and also provide the facility of sophisticated
these technologies are mentioned below. logic [42]. Smart Contract integrated with offer an
• Privacy and Permission Mechanism: The blockchain efficient and secure platform for both the consumer and
system can be divided into a private and public prosumer to perform energy trading transaction [43].
blockchain. The private blockchain is an invitation-only
network managed and administered by a set of reg- Table 1 summarized the consensus protocol feature along
istered participants. In permissioned blockchain, only with the public and private blockchain platform.
the registered parties can participate in the block cre-
ation, while in permissionless blockchain, anyone can
participate in the creation of block and consensus mech- B. MACHINE LEARNING IN MICROGRID
anism [33]. Therefore the permissionless blockchain During the past several decades, many machine learning
is less transparent, less anonymous, and less secure algorithms have been proposed to discover and investigate the
as it depends on the participants’ integrity. Likewise, massive amount of data’s hidden patterns and knowledge.
the permissioned blockchain is more secure, high cus- Nowadays, the enhancement in the machine learning algo-
tomizability, better scalability, and enhanced access con- rithm provides a way to discover hidden information from
trol mechanism [34], [35]. In other words, the private the large volume of data to construct a predictive model to
blockchain is more efficient than the public blockchain; drive a conclusion [44]–[46]. In every prediction system,
therefore, in the presented system, we use Hyperledger the important part is the prediction algorithm that influ-
Fabric, a permissioned blockchain used for developing ences the system’s prediction result and performance. Deep
blockchain-based application [33], [36]. neural network (DNN) is widely used in computer science,
• Consensus Mechanism: The consensus protocol is used energy management, speech recognition, computer vision,
to provide consistency and integrity in blockchain and etc. Several researchers use DNN to build a prediction model
assure the sequence of transactions across the distributed using several algorithms like data mining and text mining to
nodes [37]. The existing consensus protocol, like PoW, enhance the system performance. The LSTM is a renowned
which is used by the bitcoin, consumes 47.1 ter- machine learning approach used to prediction, classifying,
aWatt/hour energy consumption per annual. Moreover, and processing using time-series based data [47]–[49].
the PoW consensus protocol has many shortcomings Utility companies and energy sector decision-makers have
in terms of numbers of a transaction, which minimize claimed that blockchain can solve the challenges of the
the chance of using the system in a high-performance energy sector. Nowadays, many energy trading platforms
environment [38]. Many new consensus protocols have integrated with blockchain have been introduced to solve
been developed during the last couple of years, e.g., PoS the energy sector problem while providing an eco-friendly
(Proof of Stake) and Practical Byzantine Fault Toler- environment. The German Energy Agency [50] suggested
ance (PBFT). Some of these consume more energy, and that the current blockchain technology have the potential to
some of them are used to reduce energy consumption. enhance the efficiency of energy sectors and expedite the
In this work, we use PBFT, which is used to increase research and development of IoT based application which
the frequency of transactions between each shared and boosts the innovation in the P2P energy trading solutions.
eliminate the risk of blockchain centralization [39]. Furthermore, blockchain technology also facilitates the usage
Furthermore, the PBFT minimizes energy consumption of energy trading by the utility companies and local residen-
by removing the hash energy to process the block in tial consumer and prosumer, which improve customer costs
blockchain [40]. and services [2].

VOLUME 9, 2021 39195


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

In the energy trading market, the P2P network model an NRGcoin, an open-source Belgium based energy trading
provides and manages consumers and supports the pro- platform that uses individual renewable energy and pays
sumer, which improves traditional energy trading to a flex- NRGCoin. The NRGcoin is a virtual crypto-currency and
ible energy market. The author in [51], presented a P2P easily convertible with euros. Table 3 summarized the com-
network model that is used to enhance the energy market parison of the existing energy trading platforms.
efficiency. Furthermore, the distributed system also con-
tribute to improving the high rigor demand response sig- III. LITERATURE REVIEW
nal [52], minimize cost, and boost speed [53]. The energy The scientific community has produced various techniques
system endures a transformational change provoked by the concerning optimization in microgrids and effectuate the
upgrading of distributed energy resources and information energy trading process. Optimization is the selection of the
technology. One of the main challenges of the energy sys- best option from a set of available alternatives. Beside Energy
tem is digitization and decentralization, which requires the optimization is used in other field of sciences such as sustain-
adoption, consideration, and exploration of unique distributed able smart solutions [61]–[64]. An optimization model [65] is
technologies. Blockchain provides a solution to manage presented to optimize energy trading between two microgrids
and control complex decentralized microgrids and energy operating in islanded modes using a central controller. The
systems due to the inherent nature. Integrating consumer model meets the power demand for a microgrid and reduces
participants, small-scale renewables, flexibility services, and energy production costs. In a study [66], authors have intro-
distributed generation in the energy sector is challenging. The duced an incentive-based renewable energy sharing technique
author in [50] discussed that blockchain technology provides to meet load demands with surplus energy through which
an innovative and secure energy trading system where the energy is traded among multiple users in a simultaneous man-
consumer and the prosumer can trade surplus energy on ner. An optimal electricity price for energy trading is derived
a P2P basis. The operating consumer record is stored in using coalitional game [67]. The model results in balanced
tamper-proof, immutable, and transparent smart contracts. revenue for small-scale energy producers and consumers. The
The development of such an energy trading platform can study [68] presents a cooperative distributed power gener-
provide information on energy cost and price signals to the ation and trading mechanism to enable multiple prosumers
consumer efficiently. for energy trading in a cost-efficient manner. Besides, various
During the last few years, many blockchain-enabled energy ML [45], [69]–[73] and blockchain techniques can be proven
trading platforms have been introduced, which improve the useful in solving prediction to optimization-related issues
consensus mechanism, cost minimization, energy consump- for energy trading in smart grid [74]–[77]. The author in
tion, and security of personal data. In [54], Brooklyn micro- [78] presented an approach to optimize microgrid based on
grid, the first blockchain-based energy trading platform, was machine learning. The developed system forecasts the stan-
introduced by the exergy team in April 2016. Similarly, dalone microgrid’s security and energy demand. In another
in [55], Sunchain project is presented using Hyperledger Fab- study, a hybrid energy management system based on machine
ric, which provides virtual network support for solar energy learning, fuzzy logic, and multi-objective optimization using
and improves energy transactions at minimum cost. The Sun- linear programming. This system’s main purpose is to mini-
chain startup did not get success as few users involved in mize renewable energy’s operational cost while maximizing
sharing the surplus solar energy. The project traces the com- the energy generation [79]. The author in [80], presented an
plete trail of energy generation and sharing. In [56] author energy trading system on a vehicle to grid-based on edge
presented the interoperable, transparent, and trustless energy computing and blockchain. The efficient and secure trading
trading platform named Power ledger. The Power Ledger is system is a two-stage model comprised of the Stackelberg
an Australian startup that supports token-based transactions leader-follower game and backward induction approach. The
that provide users to receive real-time payment in exchange model is evaluated using numerical and theoretical anal-
for energy trading. In [57], the author presented a Pylon ysis. In [81], the industrial internet of thing (IIoT) based
network, an open-source P2P energy trading system that blockchain-enabled energy trading is presented known as
complete store record of each energy transaction and provide FeneChain. The FeneChain is a secure energy trading plat-
transparency and security while energy payment. SolarCoin form based on industry 4.0, which improves and manages
[58] a global incentive solution that provides rewards to energy management in buildings. The following table reca-
prosumers for selling surplus solar energy. The SolarCoin pitulates the pros and cons of the state-of-the-art in microgrid
foundation rewards solar energy producers one solar coin energy trading.
for one megawatt/hour of energy. SolarCoin is open-source,
decentralized, and decoupled from any government organi- IV. INTELLIGENT PEER-TO-PEER ENERGY TRADING
zation. SolarCoin is based on blockchain that creates a P2P A. CONCEPTUAL SCENARIO OF INTELLIGENT ENERGY
network that allows energy trading across the distributed TRADING
global network. Grid Singularity is an open-source energy Figure 1 presents the model of an intelligent peer-to-peer
trading platform that connects individuals to the marketplace energy trading platform based on blockchain. The smart
through smart contracts [59]. The author in [60], presented contract-enabled intelligent energy trading consists of two

39196 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 2. Comparison of energy trading platform.

TABLE 3. Critical analysis of machine learning based blockchain-enabled energy trading platform.

distinct modules, i.e., real-time and day-ahead energy trading used for real-time and day-ahead controlling and scheduling
based on pre-processed data and short-term energy predic- of distributed energy resources. Moreover, the discovered
tion. Each node of the proposed platform is used to store and time-series features, such as hourly, daily, weekly, yearly, and
process energy trading data. In this study, we have considered seasonally, are used to predict the short-term energy demand
solar energy generation (PV), dispatchable load (e.g., ESS), using machine learning models. Every transaction between
and shapeable load(e.g., electric vehicle). The energy con- the nodes that act as prosumers and consumers is stored in
sumption data from these sources are analyzed using different the state database in the form of an Energy trading transaction
machine learning and data mining approaches to discover the (ETT). The participants, such as prosumer, consumer, and
useful time-series pattern and hidden knowledge from the utility operator, can interact with the system through the
data to meet future energy demand. The pre-processed data is client application, which is used for secure energy trading.

VOLUME 9, 2021 39197


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 1. Intelligent energy trading platform conceptual scenario.

The communication between the blockchain network and the by retrieving surplus energy from energy sources. Afterward,
client application is established through the RESTFul API, the energy consumption data is analyzed and used in an
which used the HTTP protocol to handle user requests. intelligent smart contract in order to perform real-time and
day-ahead energy trading. Similarly, the analyzed data is also
used by a machine learning model to predict future energy
B. INTERACTION MODEL FOR INTELLIGENT ENERGY demand. Each energy trading transaction data is stored in
TRADING the blockchain. The notification is sent to the respective user
The proposed blockchain-based intelligent energy trading upon the successful energy trading transaction.
workflow is presented in Figure 2. The designed system com-
prises technical infrastructure that consumes the distributed
ledger technology(DLT) and smart contract as a service to the C. BLOCKCHAIN MODEL FOR INTELLIGENT ENERGY
blockchain through a user service framework. The intelligent TRADING
energy trading platform contains a set of peers or nodes as The proposed blockchain-enabled predictive energy trading
illustrated in Figure 1, where each peer maintains the ledger platform is a modular architecture where each layer is inde-
copy to sustain the consistency of the distributed ledger tech- pendent of other layers so that the developer can easily mod-
nology. The distributed ledger (DL) is responsible for storing ify existing components or new components without changes
the immutable energy trading transactions into the chain of the rest of the system. The distribution grid network model
blocks. In contrast, the proposed system data lake main- consists of various distributed energy resources, e.g., solar
tains and store the information related to distributed energy energy and dispatchable loads connected via a bus trans-
sources, system participants, and energy trading transactions. mission line. Each node in the grid distributed network is
The blockchain network store and keep all the modification equipped with distributed energy resources such as shapeable
arise in the data lake. The data lake is considered as an loads, dispatchable loads, and solar energy with the ability
off-chain database that maintains the data related to energy to generate and consume energy. Finally, each bus is used
trading transactions and is also used for the data analytics to connect the grid with a node in order to consume and
model. Moreover, the proposed system also provides the transmit energy. The blockchain-based energy trading service
functionality RESTfull API in order to provide the back-end layer provides several features of blockchain such as identity
services to the front-end energy trading client application. management, API Interface, distributed ledger, P2P com-
Each participant must be enrolled using the identity manager munication, and consensus manager. The distributed ledger
before committing the blockchain network’s energy trading comprises synchronized, shared and replicated digital data
transaction. Similarly, the participants, like prosumer, con- distributed across the blockchain network where all the net-
sumer, and utility, can submit the energy trading transaction work participant maintains their ledger replica. Furthermore,

39198 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 2. System workflow of the intelligent blockchain based energy trading platform.

the distributed ledger also provides secure data storage capa- We have used a single feeder based on a radial distribution
bility to store microgrid configuration and energy consump- network linked with utility-scale renewable and traditional
tion and generation between the consumer and prosumer. Any generation in a blockchain-based predictive energy trading
modification in the ledger is reflected in all the replicas in a platform. We consider a scenario where crowdsourcees are
minute or seconds. The blockchain’s ledger can be permis- connected at the feeder level with n-buses modeled as tree
sionless or permissioned, concerning anyone or an approved graph structure (Tn , TL ). The Tn is the set of nodes connected
network member who can run a peer and validate the trans- on the lines TL ⊆ (Tn )2 . The Tn in the radial distribution
action. The smart contract is a chaincode triggered by the network can be defined as Tn = {Un ∪ Ln ∪ Cn }, where Un
client application to perform defined operations. We defined denotes utility-scale power generation attached to the feeder;
several transaction processor functions such as the Real-time Cn which connects with buses containing user who agree for
reward model and Day-ahead scheduling, to name a few. The energy crowdsourcing. Ln denotes load on buses.
smart contract is initiated and install on every peer within The crowdsourcer is the residential building or house
the blockchain network. The application programming inter- equipped with distributed energy resources like PV, WT, and
face is used to visualize the back-end blockchain services ESS. The crowdsourcer in Cn also act as a participant in the
managed and accessed through a client application. Simi- proposed system which is of two types, i.e., CType1 , CType2 .
larly, the application layer provides the services to render the CType1 are the user responsible for committing a day-ahead
services-oriented data from the distributed network model. market (weekly or monthly) according to the plan assigned by
Lastly, the system’s users are prosumer, consumer, and utility the grid operator. The grid/operator, in return, provides ben-
operators responsible for selling, buying, and managing the efits in terms of bill discounts or social-economic incentives.
distributed energy resources. The prosumer in the proposed Similarly, CType2 users are responsible for committing a
system aims to sell the distributed energy resources to the real-time decision and notification based on the task assigned
utility or consumer. Similarly, the consumer is the one who by the operator/grid, e.g., charging and discharging of electric
consumes the energy, whereas the utility operator is responsi- vehicle based on the location of the user and grid physi-
ble for managing the distributed energy resources of the user cal state. In other words, the CType1 users contribute with
based on mutual consensus. The layered architecture of the the day-ahead policies as per the grid/operator suggestion,
proposed system is presented in Figure 3. whereas CType2 is aimed to provide real-time support. The

VOLUME 9, 2021 39199


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 3. Block diagram of energy trading and distribution network model based on blockchain.

proposed blockchain-based radial distribution network model storage system, dispatchable, and non-dispatchable gen-
is presented in Figure 3. eration. The dispatchable energy generation is generated
The proposed system also support energy trading trans- by the grid/utility to meet the energy load demand.
action and is of two types, i.e., ETType1 and ETType2 . The In contrast, non-dispatchable energy generation includes
ETType1 is used solely between the crowdsourcees (CType1 renewable energy sources like wind power and solar
and CType2 ) and the grid. In ETType1 transaction, the crowd- power.
sourcees act as prosumer and feed the utility/grid with the
power generated from the distributed energy resources. Like- 1) SOLAR ENERGY GENERATION
wise ETType2 is only committed between the CType2 users. In this article, we consider only solar power as a
In ETType2 transaction, the user CType2 can trade energy non-dispatchable energy source. Let assume that index
with each other generated from distributed energy resources. ∈ Tn represents the distribution system and the time
The flow of transaction, according to the crowdsourcees, are period is denoted by t. The solar power generation is for-
pow
shown in Figure 4. mulated as Sindex,t for bus index ∈ Cn at time t. The
pow
CType1 crowdsourcees feed the Sindex,t into the grid, but
D. OPERATIONAL MODEL OF DISTRIBUTED ENERGY the controlled authority only lies with the grid. Likewise,
RESOURCES the CType2 crowdsourcees have the choice to feed the
pow
In the proposed system, we consider a scenario in which Sindex,t to grid or sell or trade it locally with other CType2
energy is generated from multiple sources, e.g., energy crowdsourcees.

39200 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

and tindex,end respectively. The electric vehicle model can be


defined as
l
X
Ensindex,dem = s
Vindex,t 1t (7)
t=1
s
Vindex,t = fort = 0, 1, . . . , tindex,st , tindex,end , . . . , l (8)
s,min s s,max
Vindex ≤ Vindex,t ≤ Vindex (9)

where the time-horizon length is denoted by t, 1t denotes


time interval. we modeled shapeable load into single vector
that can be represented as Qsindex,t = Vindex,t
s .
The net power injection for every bus index at time inter-
val t can be formulated as presented in Equation 10. Let
assume that for every buses in the network we defined Qt =
pow
(Qsindex,t , Qindex,t )t as a vector variable which is used to con-
trol variables related to shapeable loads and batteries. For
FIGURE 4. Energy trading transactions types.
crowdsourcees CType1 and CType2 we divide the controlling
vector Qt into Q1 for CType1 and Q2 for CType2 . Likewise
pow
for solar energy Sindex,t we defined R variable.
2) DISPATCHABLE LOADS
pow pow
The dispatchable loads are the batteries that are used to with- PIindex,t = Sindex,t + Bindex,t − Psindex,t (10)
draw or inject energy. The output of the battery is formulated
pow pow In the proposed system, the crowdsourcees configuration
as Bindex,t where index ∈ Cn . The Bindex,t can be positive or
negative, which implies the power is injecting or withdrawn and desire parameter, e.g., eagerness to sell energy, criterion
from the battery. The operational model of the battery can be relevant to load, batteries, and solar panel are disseminate
expressed as with the utility/operator.
pow pow pow pow
Enindex,t = Enindex,t−1 + CBindex,t,Kin − DBindex,t,Kout (1) E. SMART CONTRACT CENTRIC ENERGY TRADING
pow pow pow
Bindex,t= DBindex,t − CBindex,t (2) TRANSACTION AND REWARDS DESIGN MODEL
pow pow
0 ≤ DBindex,t ≤ Bindex,t,rel (3) This section discussed different types of energy trading
pow pow transactions and defined a reward mechanism that urges the
0 ≤ CBindex,t ≤ Bindex,t,inj (4) crowdsourcees to participate in the design platform. The
pow,min pow pow,max
En ≤ Enindex,t ≤ En (5) proposed system comprised of two energy trading transac-
pow tion, i.e., ETType1 and ETType2 . These types of transactions
In the above model, the Enindex,t represents the battery’s are committed between the crowdsourcees and the utility.
energy at time t. Kin and Kout denotes the efficient con- Furthermore, the design system supports P2P energy trading
stant of the charging and discharging of the battery. The between the prosumer and the consumer and prosumer and
pow pow
DBindex,t and CBindex,t is the discharging and charging of the utility, while awarded crowdsourcees with an incentive so
pow
battery. The net power Bindex,t is calculated by subtracting that they can contribute to the energy trading eco-system. The
pow
the battery discharging and charging power. The Bindex,t,rel proposed system supports two types of algorithms for crowd-
pow
and Bindex,t,inj is the discharging and charging limitation sourcees, i.e., day-ahead scheduling and real-time reward
power of the battery. In the designed system, we modeled the model. In day-ahead scheduling, we consider the energy
pow
dispatchable load into a single vector variable as Qindex,t : load demand, solar energy forecast, and crowdsourcees
pow pow pow pow
Sindex,t , Enindex,t , DBindex,t , CBindex,t . day-ahead energy trading transaction scheduling. Similarly,
in the real-time reward model, the CType2 users get rewarded
3) SHAPEABLE LOADS by selling the surplus energy either to the grid or other CType2
In the proposed system, we consider the shapeable load as users in order to full their load demand. The details of these
an electric vehicle that takes fixed power input 24 hours. The two algorithms along with users and transaction type are
shapeable load can be formulated as presented in Table 4.
s
Vindex,t = Psindex,t + iXindex,t
s
(6)
1) DAY-AHEAD ENERGY SCHEDULING
where index ∈ Ln which implies load on bus. The electric In day-ahead scheduling, the distributed energy resources of
vehicle is defined with constant energy demand Ensindex,dem CType1 users’ is controlled by the utility as per the agreement
for 1 day. The Pindex + iXindex is the power flow in the bus signed on the mutual concern. Similarly, the CType2 has a
index to indexn . Furthermore the electric vehicle must be choice to participate or not in the crowdsourcing process
contented between start and end time represented as tindex,st based on the offered rewards. The CType2 can trade the

VOLUME 9, 2021 39201


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 4. Energy trading transaction types along with corresponding user and algorithm.

surplus solar energy either to the utility or other CType2 A. SMART CONTRACT ENABLED PREDICTIVE ANALYTICS
users if the offered reward is sufficient in the hour-ahead or MODEL FOR ENERGY TRADING
real-time markets. Furthermore, for CType2 users, the out- The proposed approach is evaluated using real-time data from
pow
put energy from dispatchable loads Bindex,t and solar energy smart grid institute Jeju, South Korea. The dataset contains
pow
Sindex,t where index ∈ CType2 are not managed by the utility. time-series energy consumption(MW) data. The dataset con-
Therefore, if CType2 made decision to not to trade energy sists of 116,189 energy consumption records from the time
with other CType2 users as mentioned in ETType2 then these period of 2002 to 2018. The proposed energy data analytics
parameter are set to zero in (10) as presented in (11). model consists of an input layer, energy data pre-processing,
pow pow energy predictive analysis, performance analysis, and valida-
Sindex,t = Bindex,t = 0, index ∈ CType2 (11) tion layer, as shown in Figure 5.
First, the data is prepared for the analysis models; the
In other cases, the seller and buyer can trade energy
final dataset contains two features: time(hr) and energy con-
based on the energy supply-demand request. The energy
sumption. The raw data is transformed into reliable data
trading request for CType2 users can be expressed as
using different data pre-processing techniques and statistical
EnergyTradingTransaction(Q2 , R).
measures. In the start, all redundant records from the energy
consumption dataset are identified and removed. Hence this
2) REAL-TIME REWARD MODEL
reduces dataset size and also the computation cost of data
In the real-time reward model, the CType2 users are rewarded
analysis. Similarly, the tuples with the missing values are
whenever the surplus solar energy is trade to meet the grid’s
also removed from the dataset. The missing values represent
energy demand load. In this model, the real-time energy ser-
that the energy consumption tuples don’t have date-time
vices are provided like charging electric vehicle and real-time
or energy consumption data for the specific record. The
energy trading, which is used to meet the real-time load
time-series attribute, which represents the time and date of
demand using surplus solar energy. In exchange for these
the energy consumption data, is used to extract the underlying
services, the crowdsourcees will get rewarded based on the
time-series hidden patterns to predict the short term energy
amount of energy unit. The amount of energy trade in terms
prediction. The short-term and long-term analysis enable to
of net power can be computed as
plan and minimize the cost of delivering electrical energy
pow pow for consumer and thus is significant to economize power
index,t = Sindex,t −Pindex,t +Bindex,t , index ∈ CType2
Pnet s
(12)
engineering. Furthermore, accurate electricity consumption
In (12), the shape load that consumes energy can be prediction is essential for policymakers to formulate electric-
reduced from the surplus solar energy afterward; the com- ity supply policies such as meet load demand.
puted net power can be used to trade either to CType2 users The next layer is the energy data analysis layer, which
or grid. If the (Pnet
index,t ≤ 0) then the crowdsourcees has no uses descriptive data analysis methods to find hidden patterns
index,t > 0)
energy to sell at time interval t. Similarly if the (Pnet from the pre-processed dataset. The extracted features using
then the crowdsourcees have surplus solar energy to trade descriptive analysis can effectively enhance machine learning
either with grid or other CType2 users. models’ training process for short-term and long term energy
prediction. Time-series pattern discovered using descriptive
V. ENERGY TRADING ANALYTIC MODEL analysis is short-term energy analysis such as hourly and
This study introduces an integrated operational model of daily energy consumption and long-term energy analysis such
blockchain-enabled intelligent energy trading platform that as weekly, monthly, yearly, and seasonally. These extracted
contemplate an immense domain of distributed energy features are used as input to the proposed predictive analy-
resources, energy trading transaction, and several types of sis models. Descriptive and predictive analysis will enable
crowdsourcees in a distributed network. The main aim is accurate prediction to minimize the cost of delivering elec-
blockchain-enabled secure energy trading based on energy trical energy for the consumer. We proposed Bi-directional
crowdsourcing between the prosumer and the consumer and Long Short Term Memory (Bi-directional LSTM) predict
intelligent energy model to predict energy utilization to meet the short and long term energy prediction in a predictive
short term energy demand. In other words, the proposed sys- analysis approach. A Bidirectional LSTM consists of two
tem is divided into two modules, the secure blockchain-based LSTMs: one for input in a forward direction and the backward
P2P energy trading and intelligent energy prediction model to direction. LSTM is a type of RNN that recognizes value
fulfill energy demand in a distributed network. after a random layoff. LSTM is useful to process, classify,

39202 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 5. Proposed model of the blockchain-based predictive energy trading.

and predict the time-series energy data. Every node specifies multiplicative entities, such as input and output gates. These
the neuron of an individual time step. Every block in LSTM layers present continuous analog of reading, write, and reset
contains self-connected solo or multiple memory cells and transactions for the memory cell. Similarly, the RNN training

VOLUME 9, 2021 39203


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 6. Predictive energy trading platform implementation and use-case deployment.

process consists of a forward and backward pass. The RNN energy trading blockchain network consists of four peers,
forward pass is similar to multi-layer perception with a solo an orderer node running as an image in the container. Each
layer. Likewise, the backward pass is the same as propagation peer in the blockchain network consists of data storage and
through time which is used to compute weight derivative for smart contract to record the transaction block to the ledger.
RNN. We have used CouchDB, which acts as a state database, and
The final layer is the energy prediction performance mea- support enriches queries used to retrieved customized data
sure, as the problem discussed in this paper is a regres- from the database. The data record in the state database is
sion problem. Therefore, we will evaluate the proposed time in key-value format, and the datatype is JavaScript Object
series-based prediction models in terms of R2 score, Mean Notation (JSON). Furthermore, the composer-rest-server is
square error, mean absolute error, and root means square used to generate the RESTful API that exposes the distributed
error. grid network services like real-time reward model, day-ahead
scheduling, to name of a few, to the client application through
VI. IMPLEMENTATION ENVIRONMENT OF THE client SDK. The blockchain is based on distributed ledger
INTELLIGENT ENERGY TRADING PLATFORM technology, where each block in the network is cryptographi-
Figure 6 presents the case study’s development environment cally secured to form a block sequence of transactions. Prac-
for the proposed blockchain-enabled predictive energy trad- tical Byzantine Fault Tolerance (PBFT) is installed on the
ing platform and shows the link between the distributed orderer node to maintain the ledger consistency. Moreover,
grid network and the blockchain network. The distributed the orderer node runs independently of the peer process and
grid network consists of distributed energy resources used arranges the transaction in FCFS( first come, first serve) order
to buy and sell surplus solar energy. In the design sys- across the entire blockchain network. Finally, the system user
tem, we use Hyperledger Fabric, an open-source framework, gets a notification from the blockchain network in case of the
to develop a blockchain-based application. The predictive transaction response.

39204 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 5. Smart Contract modeling for predictive energy trading platform.

A. SMART CONTRACT MODELING OF PREDICTIVE the specified network has the privilege to access certain types
ENERGY TRADING PLATFORM of resources across the entire blockchain network. Lastly,
The smart contract in the designed system is implemented queries are written in a bespoke language as a separate file in
using an open-source framework and toolset to facilitate the the smart contract. The queries are used to fetch customized
development of the blockchain applications. The smart con- data based on the user-defined operation from the world state
tract is model as Business Network Archive (.bna), which database. Table 5, summarized the types and definition of the
comprises assets, participants, transaction processor function, assets, participants, and transaction processor function.
access control rules, and query definition. The assets are In this work, we use Hyperledger Composer to create a
services, goods, or property, which are the smart contract smart contract(.bna) which is further used in developing the
and modified based on the defined transactions. Participants representational state transfer application program interface
can also interact with assets that are directly linked with RESTful API. The composer-rest-server is used to generate
task and identity across the entire blockchain network. The the platform-independent RESTful API and provide interop-
participants can perform a particular operation like create, erability between the platform worldwide. In the presented
delete, update, and reading on assets to perform user-specific system, the RESTful API is used to connect the client appli-
tasks. We define multiple assets like solar energy, shapeable cation, and the blockchain back-end service like energy trad-
loads, dispatchable loads, utility, ESS, reward, and energy, ing, scheduling, and managing distributed energy resources,
to name a few used to perform a specific task in the proposed to name a few. Generally, the RESTful API is comprised of
system. Like assets, participants are also defined in the smart three-part, i.e., resource, verb, and action. The resource is the
contract as a part of a business network whose responsibil- HTTP request, while verbs execute a singular resource, like,
ity is to submit transactions and interact with assets. The PUT, POST, GET, and DELETE. The RESTful API works
prosumer, consumer, and utility operator are the participant based on HTTP based protocol where the request header
defined in the blockchain network. The transaction processor consists of the following parameters such as media type,
function specifies logical actions performed on the assets verb, and base URI. The media type represents the transition
defined as a part of a smart contract. In the proposed system, state element, e.g., Application/JSON. In contrast, the URI
we develop a transaction processor function in JavaScript determines the path of the data request, e.g., a POST request
language. In the design system, we defined multiple transac- to the resource like /api/EnergyTrading will update
tion functions that include, but are not limited to, a real-time the assets in the registry in the encrypted form. Table 6,
reward model, day-ahead scheduling, energy trading, and summarized the RESTful API used in the proposed system.
transfer rewards. In the real-time reward model, the CType2
participants sell the surplus solar energy to other participants B. TRANSACTION PROCESS OF PREDICTIVE ENERGY
types(i.e., utility and CType2 ) in exchange for rewards. In a TRADING PLATFORM
smart contract, we defined an access control rule in order to The energy trading platform aims to enable monitoring, man-
provide authorization and authentication to the user of the aging, originating, and trading distributed energy resources
system within the blockchain network. Each participant in in a decentralized manner. Hyperledger Fabric blockchain is

VOLUME 9, 2021 39205


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 7. Execution process for the predictive energy trading platform between Prosumer to Consumer.

used to streamline the distribution, tracking, and trading of in the ESS based on mutual concern. The consumer can get
energy. The smart contract automates the processes without available energy on the market by sending a query request to
third-party intervention. The residential can either be the the blockchain. To purchase the energy, the consumer invokes
prosumer who produces the energy or the consumer who the energy purchase transaction, and the ESS transfers the
purchases the energy. The execution process between CType2 corresponding energy to the consumer. Once the required
users of the proposed predictive energy trading platform is energy is successfully transferred to the consumer, the reward
presented in Figure 7. model will be initiated by the smart contract. The smart
In this transaction ETType2 , the CType2 users are divided contract converts the required energy into coins. Afterward,
into two types, i.e., prosumer and consumer. Prosumer moni- the payment is sent to the prosumer account and also notified
tors the energy status collected from the solar panel. Prosumer both prosumer and consumer.
invoked energy transactions to record the amount of energy In prosumer to Utility energy transaction ETType1 , the util-
from the solar panel into the blockchain and stored it in the ity request the energy demand to meet the load demand. The
energy storage system (ESS). The user sells the energy stored system will notify the prosumer to start an energy trading

39206 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 6. RESTful API for blockchain-enabled predictive energy trading


platform.

process. The surplus solar energy will be transferred to the


utility in exchange for reward based on mutual concern and
agreement. The surplus solar energy is stored in the ESS
using the blockchain platform. On a successful transaction,
the notification is sent to every participant of the system. The
energy is converted into a reward based on the per-unit price.
Afterward, the reward is transferred to the prosumer money
pool, and an acknowledgment is sent to the prosumer and
utility.

VII. DEVELOPMENT ENVIRONMENT FIGURE 8. Web application for intelligent energy trading blockchain
The tool and technologies used in the proposed intelli- platform.

gent energy trading blockchain platform are summarized


in Table 7. The proposed system development environment is coins. The proposed model support two types of energy trad-
segregated into two parts, i.e., the intelligent energy trading ing transaction, i.e., ETType1 and ETType2 which is also shown
blockchain network and the front-end client application. with Type-1 and Type-2 transaction along with consumer and
In the back-end blockchain network, we have used the Intel prosumer details. The dashboard also provides the energy
central processing unit with 3.0 GHz computation power. prediction functionality that uses the computed features to
Similarly, the operation used is Ubuntu Linux 18.04 LTS predict the future energy load and demand. Finally, the update
with the run-time support of docker composer and engine. button fetches the updated energy trading transaction records
The docker composer is used to configure the docker con- through the RESTful API.
tainer and docker image in the Ubuntu operating system.
Furthermore, Hyperledger Fabric V − 1.2 is used to develop VIII. RESULTS AND DISCUSSION
a blockchain network, which supports intelligent smart con- A. DESCRIPTIVE ANALYTICS
tract construction. The smart contract is furthered managed Descriptive analysis is used to process the data and convert
using the administrator’s command-line tool to deploy the it into meaningful knowledge. In contrast, the energy load
proposed intelligent energy trading chaincode. Likewise, dataset is used to predict short-term energy load prediction.
the participant uses the front-end intelligent energy trad- In the proposed descriptive analytics model, we have col-
ing application, like consumer, prosumer, and utility oper- lected the Jeju, South Korea energy consumption data from
ator, to consume the back-end blockchain services, such the mid of 2002 to 2018. The data is stored on an hourly basis.
as secure energy trading, energy prediction, and energy In order to perceive the data hidden knowledge, we carry out
reward/incentive model. The web application is implemented a descriptive analysis of energy data. We analyze the energy
using multiple programming languages, such as HTML, consumption data into short-term and long-term. In short-
CSS, JavaScript, and Node.js and the JQuery, Notify.js, and term, we consider hourly (9a), and daily (9b) analysis, sim-
Bootstrap library. ilarly, for long-term we consider, weekly (11a), monthly
The blockchain-enabled intelligent energy trading (11b), and yearly (11c), and quarterly (11d) analysis.
web-interface is presented in Figure 8. The proposed sys- As stated earlier, in short-term energy consumption anal-
tem prototype is implemented using the Hyperledger Fabric ysis, we examine the hourly and daily energy consumption
framework. The developed interface provides the functionally in Mega Watt(MW) as shown in Figure 9. The Figure shows
of complete CRUD operation on Prosumer, Consumer, and the relationship between the hours of the day and energy con-
Utility operator. Moreover, the Records dashboard shows sumption. In Figure 9 (a) shows whereas 9 (b) shows day-wise
the energy trading record and the renaming energy and energy analysis. The hourly analysis shows that energy consumption

VOLUME 9, 2021 39207


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 7. Development environment for the proposed patient vital sign monitoring.

increase from the morning slot of the day. The maximum prediction mechanism considers user preference parameters
energy load at 6 PM is 62000 MW, whereas the minimum and parameters discovered during descriptive analysis. Firstly
energy load is 41500 MW at 3 AM midnight. Similarly, in the we prepared the data for building our proposed model. Apart
case of Day Wise analysis, the x-axis of the graph represents from traditional data processing techniques, we also applied
the day of the week, and the y-axis represents the energy the data partitioning approach to split the data into training
consumption. and testing energy consumption datasets. The split ratio of
As stated earlier, in long-term energy consumption analy- the training and testing dataset is 70-30 %, 70 % of the
sis, we analyze the energy consumption distribution based on energy consumption data is used for training, and 30 %
the season. Seasonally energy consumption analysis is given data is used for testing purposes. Furthermore, we consider
in Figure 10. The analysis results are categorized into four the time of data instances while splitting the dataset; for
seasons of the year, winter, summer, spring, Autumn. It is instance, the energy consumption data from 2002 to 2017 is
evident from the graph that the energy load is more in winter used as a training dataset, and the remaining instances
and the least in autumn. of 2018 are used for testing purposes. In terms of the number
Finally, we consider weekly, monthly, yearly, and quar- of instances, training set instances are 110,000, and the testing
terly analysis of energy consumption, as shown in Figure 11. set is 6189 instances. Now, we discuss the experimental
Figure 11-(a) represents weekly analysis, Figure 11-(b) rep- environment of the proposed blockchain-enabled predictive
resents monthly analysis, Figure 11-(c) represents yearly energy trading platform. The proposed system’s experiment
analysis, whereas Figure 11-(d) represents quarterly analysis. is carried out on tensor flow version 1.15.0, python, hardware
Y-axis in Figure 11 represents energy consumption, whereas configurations included 24 GB RAM and core-i7 proces-
X-axis represents weekly, monthly, quarterly, and yearly dis- sor. However, minimum configurations could be followed
tribution. The figure’s illustration shows that the energy load per the requirement of tensor flow and python integrated
is high in the last quarter of the year when the temperature is development environment such as anaconda. As stated ear-
cold outside. lier, the dataset consists of 116,189 data instances from
the time period of 2002 to 2018. Each instance of energy
B. PREDICTIVE ANALYTICS consumption data depicts the hourly energy load of south
In this section, we present the predictive analysis performed Korea. Table 8 summarized the proposed blockchain-enabled
on the energy consumption blockchain data. Predictive predictive energy trading platform’s implementation and
analysis methods are used to predict future events based on experimental setup.
historical event data. Previously, predictive analysis is used Figure 12-(a) present the comparison between the actual
for optimal decisions and making effective policies [44], and predicted energy prediction data using the RNN model.
[84], [85]. For predictive analysis, we propose a prediction We used the RNN model for the energy consumption
model based on Bi-directional LSTM. We also trained other sequence of data; each energy consumption sample data can
models such as LSTM, RNN, Random Forest, and XGBoost be assumed to be dependent on previous energy consump-
for long and short-term energy prediction. The proposed tion sample data. As RNN is recurrent, it repeats the same

39208 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 9. Short-term energy consumption analysis based on hourly and daily analysis (2002-2018).

TABLE 8. Implementation and experimental setup.

function for input energy consumption data, while output


energy consumption data depends on the past computation
of energy consumption data. RNN used its internal state
called memory for processing the sequence of input energy
consumption data. Figure 12-(b) present actual and predicted
energy consumption in term of power consumption data using
FIGURE 10. Seasonally energy consumption analysis.
the LSTM model.LSTM model for energy consumption pre-
diction is trained using Backpropagation Through Time series
data of the energy consumption. LSTM is a type of RNN that mean square error, mean absolute error, and root mean square
can address difficult sequence problems such as energy con- error, mean absolute percentage error. We also trained other
sumption prediction from time-series data to achieve the best traditional regression models to compare the accuracy of
results than other traditional regression approaches. Forget LSTM and RNN, such as XGBoost and random forest. Com-
Gate decides what energy consumption information to forget parative analysis of the proposed model with these models is
and throw away from block-based on conditions. Input Gate discussed in detail in the performance analysis section.
decides which input energy consumption sequence should be
used to update the state of the memory. Output gate used the C. PERFORMANCE ANALYSIS
status of input and memory block to determine the output In this section, we conducted numerous tests in order to assess
energy consumption sequence. As discussed earlier, a Bidi- the performance of the proposed blockchain-enabled predic-
rectional LSTM consists of two LSTMs: one for input in a tive energy trading platform. We have considered several per-
forward direction and the second for the backward direction. formance measures, such as throughput latency, and resource
Figure 12-(c) present the comparison between the actual and utilization, and block size. For simulation, we have used
predicted energy prediction data using Bidirectional LSTM an open-source framework known as Hyperledger Calliper,
Model. For evaluating the accuracy of these models, we used which evaluates the blockchain performance. Similarly, some
regression model performance matrices such as R2 score, parameters have been defined for the experiment, i.e., four

VOLUME 9, 2021 39209


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 11. Long-term energy consumption analysis based on Energy Consumption Data of the years(2002-2018).

peer and solo orderer nodes. In this study, we evaluate the transaction send rate. The transaction throughput decreases
throughput in two ways, i.e., read and transaction throughput. after the optimal send rate of 2500 tps. Similarly, in the case of
Equation 13 define the formulation of transaction throughput, transaction throughput, as shown in Figure 13b, the through-
which indicate the number of invoked transaction in a defined put increases after the optimal send rate of 1100 tps.
time. In the case of read throughput, the number of read
TCT
operations is calculated in a blockchain using an Equation 14. TT = (13)
The overall throughput is measured by differing the trans- Tsec
action send rate with an arbitrary configuration of machine where TT denotes transaction throughput, TCT represents the
utilization. The read transaction throughput is accessed with total committed transaction, and finally, the Tsec is the time.
an arbitrary send rate of 500 tps to 3000 tps, whereas the
TRO
transaction throughput is measured by a varying send rate RTT = (14)
of 200 tps to 1300 tps as shown in Figure 13. Tsec
In Figure 13a, the transaction throughput is investigated Likewise, RTT stand for read transaction throughput and
with the transaction send rate of 500 to 3000 transaction TRO denotes total read operation, and finally the Tsec is a time
per second. The throughput increases with the increase of the per second.

39210 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 12. Comparison of proposed Bidirectional LSTM approaches with traditional deep learning approach for energy consumption Prediction.

The transaction latency in the proposed system is measure the read latency is measured as varying the transaction send
in two ways, read and transaction latency, as shown in Equa- rate from 500 tps to 3000 tps with arbitrary machine uti-
tion 15 and 16, respectively. The total time required to execute lization resources. It is estimated from the graph that read
the transaction in a blockchain network is called transaction latency increases comparatively less as the send rate increase.
latency. The transaction latency consists of transaction broad- However, the read latency notably increased with the rise of
cast, submission, and consensus time. Likewise, the trans- the send rate after 2500 transactions per second.
action round trip time is computed as the time response of
RL = TRTT − TIT (15)
transaction from submission to the execution, as mentioned
in Figure 14. where RL is the read latency, transaction round trip time is
Figure 14a illustrate the transaction latency of the pro- denoted by TRTT, and TIT represents the invoke transaction
posed blockchain-enabled predictive energy trading platform, latency.
which increases as the number of user request increase in
TL = (TET × NTT ) − TIT (16)
the blockchain network. It is investigated from the graph that
the transaction latency rise after the optimal transaction sends Similarly, transaction latency is represented as TL, TET
rate of 1100 transaction per second. Likewise, in Figure 14b, denotes as transaction execution time, NTT is the network

VOLUME 9, 2021 39211


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 13. Transaction Throughput analysis.

FIGURE 14. Transaction latency analysis.

threshold time, and finally, the transaction invokes time is and throughput, as shown in Figure 16. In Hyperledger Fab-
denoted as TIT . ric, the ordering service is responsible for transactions order.
The intelligent peer-to-peer energy trading platform’s per- We have considered three types of ordering services in the
formance is also evaluated by changing the number of proposed system: solo, solo-raft, and raft over different send
endorser peers in terms of latency and throughput. The rates between 25-200 transactions per second. It is found from
endorser peer is responsible for endorsing the transaction the graph that the solo ordering service has less latency as
once it is proposed. The endorser peer contains the chain- compared to solo-raft and raft because of the extra processing
code, which is used to endorse the transaction when it is of transaction layer security (TLS) among the peer nodes.
triggered. Figure 15 demonstrates the performance of the Figure 16a presents the orderer node latency over the different
proposed platform by varying the number of peer nodes. send rates. Likewise, the throughput of solo ordering service
Figure 15a shows the proposed platform’s latency by chang- is higher than the solo-raft and raft because the solo ordering
ing the number of peer nodes with a send rate between service contains a single node and doesn’t require additional
25-200 transaction per seconds. It is investigated from the TLS support in processing, as shown in Figure 16b.
results that increasing the number of peers node will increase The performance of the proposed system is also evaluated
the network latency. Furthermore, the network traffic volume in terms of resource utilization. The Hyperledger Calliper
is also increased by increasing the number of peer nodes, with five rounds is used for the experimental environment.
which conclusively decreased the proposed network through- The average memory and CPU utilization of a peer node in
put, as shown in Figure 15b. the network is recorded as 92.21 MB and 4.65 %, respectively.
Similarly, the performance of the proposed system is also Likewise, in the case of the orderer node, the average CPU
accessed by changing the ordering service in terms of latency and memory utilization is noted as 1.20% and 24.5 MB,

39212 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

FIGURE 15. Impact of varying peer node with different transaction rate.

FIGURE 16. Impact of varying ordering service with different transaction rate.

respectively. Lastly, the machine and memory utilization for Square Error is given in Equation 18
certificate authority is reported as 1.50 % and 5.1 MB. Table 9 Pn
summarized the resource used in the proposed system in (yi − ŷi )2
MSE = i=1 (18)
terms of the memory and CPU. n
In this section, we evaluate the performance of the 3) Mean Absolute Error is used for evaluating the per-
energy consumption prediction models in terms of a regres- formance of the regression model which determine
sion performance measure, such as R2 score, Mean Square the deviation among the actual and predicted values.
Error(MSE), Mean Absolute Error(MAE), Mean Abso- The formulation of Mean Absolute Error is given in
lute Percentage Error(MAPE), and Root Mean Square Equation 19
Error(RMSE). First, we explain these measures in detail. Pn
|yi − ŷi |
1) R2 score is also known as coefficient of determina- MAE = i=1 (19)
tion (CoD) and used for evaluating regression model n
using statistical measures. The formulation of R2 is 4) Root Mean Square Error is used for regression model
given in Equation 17 to determine the error rate and accessed whether the
X yi − ŷi size of target is same as the size of error. It is computed
R2 = 1 − ( )2 (17) by taking square root of Mean Square Error as given in
yi − µ Equation 20
i

2) Mean Square Error is used to eliminate the below


sP
n 2
zero values and determine the average among the pre- i=1 |(yi − ŷi )|
RMSE = (20)
dicted and the actual values. The formula of Mean n

VOLUME 9, 2021 39213


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

TABLE 9. Utilization of resources of proposed blockchain platform.

TABLE 10. Comparison of the proposed approach with state of art which provides the functionality of securing crowdsourcees
prediction methods.
energy trading transaction records and real-time energy trad-
ing, day-ahead energy trading, predictive short-term energy
results, and personal user records in a decentralized manner.
It also provides support of energy reward and incentive model
in case of successful energy trading transaction. The proposed
predictive energy trading platform is implemented based on
PBFT to address the issue of security, interoperability, trans-
Mean Absolute Percentage Error (MAPE) is used to compute parency, accountability, and reliability. Similarly, an inter-
an average deviation found in energy consumption value from active front-end application is developed, which is used to
actual energy consumption value. MAPE is calculated by expose the blockchain back-end services through RESTful
dividing the sum of absolute differences between the actual APIs. For experimental analysis, we have used Hyperledger
and predicted energy consumption by the machine learning Caliper in order to evaluate the performance of the proposed
algorithm we applied in this study with the total number of system. The results show that the proposed predictive energy
energy data records such as n. trading platform performs better in terms of latency and
100% X et
n throughput. Secondly, the data and smart contract-enabled
MAPE = (21) predictive analytics module are designed using several data
n yt
t=1 mining and machine learning approaches where the data is
We present the performance comparison of the smart taken from the renewable energy department of Jeju province,
contract enabled predictive analysis using state of the art Republic of Korea. The hidden and discovered patterns are
predictive analysis method RNN, LSTM, and Bi-directional useful to minimize the cost of electrical energy consump-
LSTM. The energy prediction analysis models are evalu- tion for customers and are very important to economize
ated in two steps. First, we compare RNN, LSTM, and power engineering. The proposed data exploration is based on
Bi-directional LSTM in terms of MAE, MSE, RMSE, and the comprehensive analysis of 116,189 energy consumption
MAPE. The second step of the prediction performance anal- data instances over the time-span of 16 years (2002-2018).
ysis is R2 score. Table 10 presents the performance analysis Furthermore, the smart contract-enabled predictive analyt-
comparison of proposed Bi-directional LSTM and sate of art ics model aimed to develop an intelligent prediction model
prediction methods in MAE, MSE, RMSE, R2 and MAPE. using RNN random forest, XGBoost, and LSTM to predict
The models’ prediction performance shows the robustness of the short-term energy demand. The prediction results show
the proposed prediction model based on Bi-directional LSTM that the LSTM has the minimum MAPE value compared to
for long-term and short-term energy predictions. Proposed other machine learning models using time-series data. In the
approach regression score in term of R2 score is more as future, we can improve the performance by integrating the
compared to the previously used state of the art prediction hybrid machine learning model to make the system robust.
methods. Furthermore, in the future, we may consider other features,
such as humidity, temperature, and wind speed, which can be
IX. CONCLUSION AND FUTURE DIRECTION selected using optimization algorithms.
In this research, we proposed a blockchain-enabled pre-
dictive energy trading platform that is based on the inte- CONFLICT OF INTERESTS
gration of machine learning and blockchain model. The The authors declare that there is no conflict of interest regard-
proposed platform comprises three modules, i.e., intelli- ing the publication of this paper.
gent peer-to-peer energy trading, data analysis, and smart
contract-enabled predictive analysis. Predictive analysis is REFERENCES
made using deep learning approaches based on RNN, [1] I. S. Bayram, M. Z. Shakir, M. Abdallah, and K. Qaraqe, ‘‘A survey on
LSTM, and Bi-directional LSTM for predicting short-term energy trading in smart grid,’’ in Proc. IEEE Global Conf. Signal Inf.
and long-term energy demand. The predictive peer-to-peer Process. (GlobalSIP), Dec. 2014, pp. 258–262.
[2] E. Mengelkamp, J. Gärttner, K. Rock, S. Kessler, L. Orsini, and
energy trading platform is developed based on a permis- C. Weinhardt, ‘‘Designing microgrid energy markets: A case study: The
sion blockchain network known as Hyperledger Fabric, Brooklyn microgrid,’’ Appl. Energy, vol. 210, pp. 870–880, Jan. 2018.

39214 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

[3] M. T. I. Khan, M. R. Yaseen, and Q. Ali, ‘‘Nexus between financial [26] H. Liao, Y. Mu, Z. Zhou, M. Sun, Z. Wang, and C. Pan, ‘‘Blockchain
development, tourism, renewable energy, and greenhouse gas emission in and learning-based secure and intelligent task offloading for vehicular fog
high-income countries: A continent-wise analysis,’’ Energy Econ., vol. 83, computing,’’ IEEE Trans. Intell. Transp. Syst., early access, Jul. 21, 2020,
pp. 293–310, Sep. 2019. doi: 10.1109/TITS.2020.3007770.
[4] M.-H. Kim, D. Kim, J. Heo, and D.-W. Lee, ‘‘Energy performance investi- [27] Z. Zhou, B. Wang, Y. Guo, and Y. Zhang, ‘‘Blockchain and computational
gation of net plus energy town: Energy balance of the Jincheon eco-friendly intelligence inspired incentive-compatible demand response in Internet of
energy town,’’ Renew. Energy, vol. 147, pp. 1784–1800, Mar. 2020. electric vehicles,’’ IEEE Trans. Emerg. Topics Comput. Intell., vol. 3, no. 3,
[5] J. Li, X. Zhang, S. Ali, and Z. Khan, ‘‘Eco-innovation and energy produc- pp. 205–216, Jun. 2019.
tivity: New determinants of renewable energy consumption,’’ J. Environ. [28] Z. Shahbazi and Y.-C. Byun, ‘‘A procedure for tracing supply chains for
Manage., vol. 271, Oct. 2020, Art. no. 111028. perishable food based on blockchain, machine learning and fuzzy logic,’’
[6] Z. Sen, Solar Energy Fundamentals and Modeling Techniques: Atmo- Electronics, vol. 10, no. 1, p. 41, Dec. 2020.
sphere, Environment, Climate Change and Renewable Energy. London, [29] Z. Shahbazi and Y.-C. Byun, ‘‘Towards a secure thermal-energy aware
U.K.: Springer-Verlag, 2008. routing protocol in wireless body area network based on blockchain tech-
[7] G. C. van Kooten, ‘‘Economic analysis of feed-in tariffs for generating nology,’’ Sensors, vol. 20, no. 12, p. 3604, Jun. 2020.
electricity from renewable energy sources,’’ in Handbook Energy Climate [30] I. Bashir, Mastering Blockchain: Distributed Ledger Technology,
Change. Victoria, BC, Canada: Univ. Victoria, Resource Economics and Decentralization, and Smart Contracts Explained. Birmingham, U.K.:
Policy, 2013. Packt Publishing, 2018.
[8] Z. Li, S. Bahramirad, A. Paaso, M. Yan, and M. Shahidehpour, [31] E. Politou, F. Casino, E. Alepis, and C. Patsakis, ‘‘Blockchain mutability:
‘‘Blockchain for decentralized transactive energy management system in Challenges and proposed solutions,’’ IEEE Trans. Emerg. Topics Comput.,
networked microgrids,’’ Electr. J., vol. 32, no. 4, pp. 58–72, May 2019. early access, Oct. 25, 2020, doi: 10.1109/TETC.2019.2949510.
[9] F. S. Ali, M. Aloqaily, O. Alfandi, and O. Ozkasap, ‘‘Cyberphysical [32] A. Sunyaev, ‘‘Distributed ledger technology,’’ in Internet Computing.
blockchain-enabled Peer-to-Peer energy trading,’’ Computer, vol. 53, no. 9, Cham, Switzerland: Springer, 2020, pp. 265–299.
pp. 56–65, Sep. 2020. [33] E. Androulaki et al., ‘‘Hyperledger fabric: A distributed operating sys-
[10] T. Morstyn, N. Farrell, S. J. Darby, and M. D. McCulloch, ‘‘Using peer-to- tem for permissioned blockchains,’’ in Proc. 13th EuroSys Conf., 2018,
peer energy-trading platforms to incentivize prosumers to form federated pp. 1–15.
power plants,’’ Nature Energy, vol. 3, no. 2, pp. 94–101, Feb. 2018. [34] H. Sukhwani, J. M. Martínez, X. Chang, K. S. Trivedi, and A. Rindos,
[11] J. Rodríguez-Molina, M. Martínez-Núñez, J.-F. Martínez, and ‘‘Performance modeling of PBFT consensus process for permissioned
W. Pérez-Aguiar, ‘‘Business models in the smart grid: Challenges, blockchain network (Hyperledger Fabric),’’ in Proc. IEEE 36th Symp.
opportunities and proposals for prosumer profitability,’’ Energies, vol. 7, Reliable Distrib. Syst. (SRDS), Sep. 2017, pp. 253–255.
no. 9, pp. 6142–6171, Sep. 2014. [35] Z. Zheng, S. Xie, H. Dai, X. Chen, and H. Wang, ‘‘An overview
[12] E. Espe, V. Potdar, and E. Chang, ‘‘Prosumer communities and relation- of blockchain technology: Architecture, consensus, and future trends,’’
ships in smart grids: A literature review, evolution and future directions,’’ in Proc. IEEE Int. Congr. Big Data (BigData Congr.), Jun. 2017,
Energies, vol. 11, no. 10, p. 2528, Sep. 2018. pp. 557–564.
[13] H. Simula, ‘‘The rise and fall of crowdsourcing?’’ in Proc. 46th Hawaii [36] T. T. A. Dinh, J. Wang, G. Chen, R. Liu, B. C. Ooi, and K.-L. Tan,
Int. Conf. Syst. Sci., Jan. 2013, pp. 2783–2791. ‘‘Blockbench: A framework for analyzing private blockchains,’’ in Proc.
[14] F. R. P. M. Vianna, A. R. Graeml, and J. Peinado, ‘‘The role of crowdsourc- ACM Int. Conf. Manage. Data, 2017, pp. 1085–1100.
ing in industry 4.0: A systematic literature review,’’ Int. J. Comput. Integr. [37] W. Yang, S. Garg, A. Raza, D. Herbert, and B. Kang, ‘‘Blockchain: Trends
Manuf., vol. 33, no. 4, pp. 411–427, Apr. 2020. and future,’’ in Proc. Pacific Rim Knowl. Acquisition Workshop. Cham,
[15] W. Li, W.-J. Wu, H.-M. Wang, X.-Q. Cheng, H.-J. Chen, Z.-H. Zhou, Switzerland: Springer, 2018, pp. 201–210.
and R. Ding, ‘‘Crowd intelligence in AI 2.0 era,’’ Frontiers Inf. Technol. [38] S. Wan, M. Li, G. Liu, and C. Wang, ‘‘Recent advances in consen-
Electron. Eng., vol. 18, no. 1, pp. 15–43, Jan. 2017. sus protocols for blockchain: A survey,’’ Wireless Netw., vol. 26, no. 8,
[16] W. Tushar, T. K. Saha, C. Yuen, D. Smith, and H. V. Poor, ‘‘Peer-to-peer pp. 5579–5593, Nov. 2020.
trading in electricity networks: An overview,’’ IEEE Trans. Smart Grid, [39] S. Bano, A. Sonnino, M. Al-Bassam, S. Azouvi, P. McCorry,
vol. 11, no. 4, pp. 3185–3200, Jul. 2020. S. Meiklejohn, and G. Danezis, ‘‘Consensus in the age of
[17] S. Seven, G. Yao, A. Soran, A. Onen, and S. M. Muyeen, ‘‘Peer-to-peer blockchains,’’ 2017, arXiv:1711.03936. [Online]. Available:
energy trading in virtual power plant based on blockchain smart contracts,’’ http://arxiv.org/abs/1711.03936
IEEE Access, vol. 8, pp. 175713–175726, 2020. [40] W. Wang, D. T. Hoang, P. Hu, Z. Xiong, D. Niyato, P. Wang, Y. Wen,
[18] S. Xie, H. Wang, Y. Hong, and M. Thai, ‘‘Privacy preserving dis- and D. I. Kim, ‘‘A survey on consensus mechanisms and mining strategy
tributed energy trading,’’ 2020, arXiv:2004.12216. [Online]. Available: management in blockchain networks,’’ pp. 1–33, 2018, arXiv:1805.02707.
http://arxiv.org/abs/2004.12216 [Online]. Available: http://arxiv.org/abs/1805.02707
[19] Q. Yao, Z. Chen, T. Q. Quek, A. Huang, H. Shan, X. Wang, and [41] N. Szabo, ‘‘Formalizing and securing relationships on public networks,’’
J. Zhang, ‘‘Crowdsourcing in wireless-powered task-oriented networks: First Monday Editorial Group (United States), Univ. Illinois Chicago,
Energy bank and incentive mechanism,’’ IEEE Trans. Wireless Commun., Chicago, IL, USA, Tech. Rep., 1997.
vol. 17, no. 12, pp. 7834–7848, 2018. [42] D. Di F. Maesa, P. Mori, and L. Ricci, ‘‘A blockchain based approach for
[20] S. Wang, A. F. Taha, and J. Wang, ‘‘Systems and methods for energy the definition of auditable access control systems,’’ Comput. Secur., vol. 84,
crowdsourcing and peer-to-peer energy trading,’’ U.S. Patent 16 688 977, pp. 93–119, Jul. 2019.
May 21, 2020. [43] C. Molina-Jiménez, I. Sfyrakis, L. Song, H. D. A. Nakib, and J. Crowcroft,
[21] J. Guerrero, D. Gebbran, S. Mhanna, A. C. Chapman, and G. Verbič, ‘‘The benefits of deploying smart contracts on trusted third parties,’’
‘‘Towards a transactive energy system for integration of distributed energy vol. abs/2010.12981, 2020.
resources: Home energy management, distributed optimal power flow, [44] N. Iqbal, F. Jamil, S. Ahmad, and D. Kim, ‘‘Toward effective planning
and peer-to-peer energy trading,’’ Renew. Sustain. Energy Rev., vol. 132, and management using predictive analytics based on rental book data of
Oct. 2020, Art. no. 110000. academic libraries,’’ IEEE Access, vol. 8, pp. 81978–81996, 2020.
[22] J. A. Momoh, ‘‘Smart grid design for efficient and flexible power networks [45] Z. Shahbazi and Y. C. Byun, ‘‘Toward social media content
operation and control,’’ in Proc. IEEE/PES Power Syst. Conf. Expo., recommendation integrated with data science and machine learning
Mar. 2009, pp. 1–8. approach for E-learners,’’ Symmetry, vol. 12, no. 11, p. 1798,
[23] F. Jamil, S. Ahmad, N. Iqbal, and D.-H. Kim, ‘‘Towards a remote mon- Oct. 2020.
itoring of patient vital signs based on IoT-based blockchain integrity [46] N. Iqbal, F. Jamil, S. Ahmad, and D. Kim, ‘‘A novel blockchain-
management platforms in smart hospitals,’’ Sensors, vol. 20, no. 8, p. 2195, based integrity and reliable veterinary clinic information
Apr. 2020. management system using predictive analytics for provisioning
[24] F. Jamil and D. Kim, ‘‘Payment mechanism for electronic charging using of quality health services,’’ IEEE Access, vol. 9, pp. 8069–8098,
blockchain in smart vehicle,’’ Korea, vol. 30, p. 31, May 2019. 2021.
[25] F. Jamil, L. Hang, K. Kim, and D. Kim, ‘‘A novel medical blockchain [47] D. Kumar, H. D. Mathur, S. Bhanot, and R. C. Bansal, ‘‘Forecasting of solar
model for drug supply chain integrity management in a smart hospital,’’ and wind power using LSTM RNN for load frequency control in isolated
Electronics, vol. 8, no. 5, p. 505, May 2019. microgrid,’’ Int. J. Model. Simul., vol. abs/10.1080, pp. 1–13, Jun. 2020.

VOLUME 9, 2021 39215


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

[48] M. Aslam, J.-M. Lee, H.-S. Kim, S.-J. Lee, and S. Hong, ‘‘Deep learn- [73] F. Jamil, N. Iqbal, S. Ahmad, and D.-H. Kim, ‘‘Toward accurate position
ing models for long-term solar radiation forecasting considering micro- estimation using learning to prediction algorithm in indoor navigation,’’
grid installation: A comparative study,’’ Energies, vol. 13, no. 1, p. 147, Sensors, vol. 20, no. 16, p. 4410, Aug. 2020.
Dec. 2019. [74] J. Alzubi, A. Nayyar, and A. Kumar, ‘‘Machine learning from theory
[49] M. Husein and I.-Y. Chung, ‘‘Day-ahead solar irradiance forecasting for to algorithms: An overview,’’ J. Phys. Conf., vol. 1142, no. 1, 2018,
microgrids using a long short-term memory recurrent neural network: Art. no. 012012.
A deep learning approach,’’ Energies, vol. 12, no. 10, p. 1856, May 2019. [75] G. Deep, R. Mohana, A. Nayyar, P. Sanjeevikumar, and E. Hossain,
[50] M. Andoni, V. Robu, D. Flynn, S. Abram, D. Geach, D. Jenkins, ‘‘Authentication protocol for cloud databases using blockchain mecha-
P. McCallum, and A. Peacock, ‘‘Blockchain technology in the energy sec- nism,’’ Sensors, vol. 19, no. 20, p. 4444, Oct. 2019.
tor: A systematic review of challenges and opportunities,’’ Renew. Sustain. [76] A. Kaur, A. Nayyar, and P. Singh, ‘‘Blockchain: A path to the future,’’
Energy Rev., vol. 100, pp. 143–174, Feb. 2019. Cryptocurrencies and Blockchain Technology Applications. Hoboken, NJ,
[51] A. Basnet and J. Zhong, ‘‘Integrating gas energy storage system in a peer- USA: Wiley, 2020, pp. 25–42.
to-peer community energy market for enhanced operation,’’ Int. J. Electr. [77] S. Kaneriya, S. Tanwar, A. Nayyar, J. P. Verma, S. Tyagi, N. Kumar,
Power Energy Syst., vol. 118, Jun. 2020, Art. no. 105789. M. S. Obaidat, and J. J. P. C. Rodrigues, ‘‘Data consumption-aware load
[52] C. Pop, T. Cioara, M. Antal, I. Anghel, I. Salomie, and M. Bertoncini, forecasting scheme for smart grid systems,’’ in Proc. IEEE Globecom
‘‘Blockchain based decentralized management of demand response pro- Workshops (GC Wkshps), Dec. 2018, pp. 1–6.
grams in smart energy grids,’’ Sensors, vol. 18, no. 2, p. 162, Jan. 2018. [78] M. A. Karim, J. Currie, and T.-T. Lie, ‘‘A machine learning based optimized
[53] J. J. Sikorski, J. Haughton, and M. Kraft, ‘‘Blockchain technology in the energy dispatching scheme for restoring a hybrid microgrid,’’ Electr. Power
chemical industry: Machine-to-machine electricity market,’’ Appl. Energy, Syst. Res., vol. 155, pp. 206–215, Feb. 2018.
vol. 195, pp. 234–246, Jun. 2017. [79] A. Chaouachi, R. M. Kamel, R. Andoulsi, and K. Nagasaka, ‘‘Multiob-
[54] Orsini. (2018). Exergy-Technical White Paper. Accessed: jective intelligent energy management for a microgrid,’’ IEEE Trans. Ind.
Aug. 14, 2020. [Online]. Available: https://lo3energy.com/wp-content/ Electron., vol. 60, no. 4, pp. 1688–1699, Apr. 2013.
uploads/2018/04/Exergy-BIZWhitepaper-v11.pdf [80] Z. Zhou, B. Wang, M. Dong, and K. Ota, ‘‘Secure and efficient vehicle-
[55] H. Fabric. Sunchain. Accessed: Aug. 14, 2020. [Online]. Available: to-grid energy trading in cyber physical systems: Integration of blockchain
http://www.Sunchain.fr and edge computing,’’ IEEE Trans. Syst., Man, Cybern. Syst., vol. 50, no. 1,
[56] Power Ledger. Accessed: Aug. 14, 2020. [Online]. Available: pp. 43–57, Jan. 2020.
https://www.powerledger.io [81] M. Li, D. Hu, C. Lal, M. Conti, and Z. Zhang, ‘‘Blockchain-enabled secure
[57] Pylon Network Team. Pylon Network WhitePaper v.2.0. Accessed: energy trading with verifiable fairness in industrial Internet of Things,’’
Aug. 14, 2020. [Online]. Available: https://pylon-network.org/wpcontent/ IEEE Trans. Ind. Informat., vol. 16, no. 10, pp. 6564–6574, Oct. 2020.
uploads/2019/02/WhitePaper_PYLON_v2_ENGLISH-1.pdf [82] H. Wang, T. Huang, X. Liao, H. Abu-Rub, and G. Chen, ‘‘Reinforcement
[58] Solarcoin. Accessed: Aug. 14, 2020. [Online]. Available: learning in energy trading game among smart microgrids,’’ IEEE Trans.
http://www.solarcoin.org Ind. Electron., vol. 63, no. 8, pp. 5109–5119, Aug. 2016.
[59] Grid Singularity. Accessed: Aug. 14, 2020. [Online]. Available: https:// [83] G. El Rahi, W. Saad, A. Glass, N. B. Mandayam, and H. V. Poor,
energyweb.atlassian.net/wiki/spaces/EWF/ ‘‘Prospect theory for prosumer-centric energy trading in the smart grid,’’ in
[60] NRGcoin. Accessed: Aug. 14, 2020. [Online]. Available: Proc. IEEE Power Energy Soc. Innov. Smart Grid Technol. Conf. (ISGT),
http://www.nrgcoin.org Sep. 2016, pp. 1–5.
[61] S. Ahmad, Imran, F. Jamil, N. Iqbal, and D. Kim, ‘‘Optimal route [84] Imran, S. Ahmad, and D. H. Kim, ‘‘A task orchestration approach for
recommendation for waste carrier vehicles for efficient waste collec- efficient mountain fire detection based on microservice and predictive
tion: A step forward towards sustainable cities,’’ IEEE Access, vol. 8, analysis in IoT environment,’’ J. Intell. Fuzzy Syst., pp. 1–16, Nov. 2020.
pp. 77875–77887, 2020. [85] Imran, S. Ahmad, and D. H. Kim, ‘‘Quantum GIS based descriptive and
[62] F. Wahid, M. Fayaz, A. Aljarbouh, M. Mir, M. Aamir, and Imran, ‘‘Energy predictive data analysis for effective planning of waste management,’’
consumption optimization and user comfort maximization in smart build- IEEE Access, vol. 8, pp. 46193–46205, 2020.
ings using a hybrid of the firefly and genetic algorithms,’’ Energies, vol. 13,
no. 17, p. 4363, Aug. 2020.
[63] S. Ahmad, Imran, N. Iqbal, F. Jamil, and D. Kim, ‘‘Optimal policy-making
for municipal waste management based on predictive model optimization,’’
IEEE Access, vol. 8, pp. 218458–218469, 2020. FAISAL JAMIL received the B.S. degree in com-
[64] S. Ahmad and D. Kim, ‘‘Design and implementation of thermal comfort
puter science from the Capital University of Sci-
system based on tasks allocation mechanism in smart homes,’’ Sustainabil-
ence and the M.S. degree in computer science
ity, vol. 11, no. 20, p. 5849, 2019.
[65] J. Matamoros, D. Gregoratti, and M. Dohler, ‘‘Microgrids energy trading
from the University of Engineering and Technol-
in islanding mode,’’ in Proc. IEEE 3rd Int. Conf. Smart Grid Commun. ogy, Taxila, Pakistan, in 2018. He is currently
(SmartGridComm), Nov. 2012, pp. 49–54. pursuing the Ph.D. degree with the Department of
[66] H. Wang, J. X. Zhang, and F. Li, ‘‘Incentive mechanisms to enable fair Computer Engineering, Jeju National University,
renewable energy trade in smart grids,’’ in Proc. 6th Int. Green Sustain. South Korea. His research work mainly focused
Comput. Conf. (IGSC), Dec. 2015, pp. 1–6. on the IoT applications, blockchain application,
[67] W. Lee, L. Xiang, R. Schober, and V. W. S. Wong, ‘‘Direct electricity energy optimization and prediction intelligent
trading in smart grid: A coalitional game analysis,’’ IEEE J. Sel. Areas service, and mobile computing.
Commun., vol. 32, no. 7, pp. 1398–1411, Jul. 2014.
[68] Y. Wu, X. Sun, X. Tan, L. Meng, L. Yu, W.-Z. Song, and D. H.-K. Tsang,
‘‘Cooperative distributed energy generation and energy trading for future
smart grid,’’ in Proc. 33rd Chin. Control Conf., Jul. 2014, pp. 8150–8157.
[69] Z. Shahbazi and Y.-C. Byun, ‘‘Product recommendation based on content- NAEEM IQBAL received the B.S. and M.S.
based filtering using XGBoost classifier,’’ Int. J. Adv. Sci. Technol., vol. 29,
degrees in computer science from COMSATS Uni-
pp. 6979–6988, Jun. 2020.
versity Islamabad, Attock Campus, Punjab, Pak-
[70] Z. Shahbazi and Y.-C. Byun, ‘‘Computing focus time of paragraph using
deep learning,’’ in Proc. IEEE Transp. Electrific. Conf. Expo, Asia–Pacific
istan, in 2019. He is currently pursuing the Ph.D.
(ITEC Asia–Pacific), May 2019, pp. 1–4. degree with the Department of Computer Engi-
[71] Z. Shahbazi, F. Jamil, and Y. Byun, ‘‘Topic modeling in short-text using neering, Jeju National University, South Korea.
non-negative matrix factorization based on deep reinforcement learning,’’ He has professional experience in the software
J. Intell. Fuzzy Syst., vol. 39, no. 1, pp. 753–770, 2020. development industry and academics as well. His
[72] F. Jamil and D. H. Kim, ‘‘Improving accuracy of the alpha–beta filter research work mainly focused on machine learn-
algorithm using an ann-based learning mechanism in indoor navigation ing, big data, AI-based intelligent systems, opti-
system,’’ Sensors, vol. 19, no. 18, p. 3946, 2019. mization algorithms, and information retrieval.

39216 VOLUME 9, 2021


F. Jamil et al.: Peer-to-Peer Energy Trading Mechanism Based on Blockchain and Machine Learning

IMRAN received the B.S. degree (Hons.) in DOHYEUN KIM received the B.S. degree in
information technology from the University of electronics engineering from Kyungpook National
Malakand, KPK Pakistan and the M.S. degree in University, South Korea, in 1988, and the M.S.
computer science from Bahria University, Islam- and Ph.D. degrees in information telecommunica-
abad, Pakistan, in 2018. He is currently pur- tion from Kyungpook National University, South
suing the Ph.D. degree with the Department Korea, in 1990 and 2000, respectively. He was
of Computer Engineering, Jeju National Univer- with the Agency of Defense Development (ADD),
sity, South Korea. His work experience includes from 1990 to 1995. Since 2004, he has been with
full stack software development, IT training, Jeju National University, South Korea, where he
and entrepreneurship. His research work mainly is currently a Professor with the Department of
focused on the Internet of Things applications, machine learning, data sci- Computer Engineering. From 2008 to 2009, he was a Visiting Researcher
ence, and blockchain applications. with the Queensland University of Technology, Australia. His research inter-
ests include sensor networks, M2M/IoT, energy optimization and prediction,
intelligent service, and mobile computing.

SHABIR AHMAD received the B.S. degree in


computer system engineering from the Univer-
sity of Engineering and Technology, Peshawar,
Pakistan, and the M.S. degree in computer soft-
ware engineering from the National University
of Science and Technology, Islamabad, Pakistan,
in 2013. He is currently pursuing the Ph.D.
degree with the Department of Computer Engi-
neering, Jeju National University, South Korea.
He is currently a Faculty Member with the Soft-
ware Engineering Department, University of Engineering and Technology,
Peshawar. His research interests include the Internet-of-Things application,
cyber-physical systems, and intelligent systems.

VOLUME 9, 2021 39217

You might also like