Content uploaded by Nadeem Javaid
Author content
All content in this area was uploaded by Nadeem Javaid on Nov 04, 2019
Content may be subject to copyright.
Energy Trading Between Prosumer and
Consumer in P2P Network Using
Blockchain
Muhammad Usman Gurmani, Tanzeela Sultana, Abdul Ghaffar,
Muhammad Azeem, Zain Abubaker, Hassan Farooq, and Nadeem Javaid(B
)
Department of Computer Science, Comsats University Islamabad,
Islamabad 44000, Pakistan
nadeemjavaidqau@gmail.com
Abstract. Nowaday’s energy demand and energy production are
increasing. Renewable energy resources will play an important role in
managing future production of electricity due to an increase in the devel-
opment of societies. The centralized energy trading system faces a chal-
lenge in terms of fair energy distribution. Centralized existing energy
trading system totally relies on a central system or third party, because
the third party has many drawbacks in the form of record tampering
or record altering. The fair transaction is the main issue in the energy
trading sector. When the bitcoin is introduced in the market, the trust
of Blockchain technology is increased. We proposed a Blockchain based
energy trading system in peer to peer networks. Blockchain technol-
ogy provides trust, security, and transparency for energy trading. In
Blockchain technology, there is no necessary need of the third party
in the energy supply sector. In our proposed paper, we facilitate the
prosumer who produces renewable energy and sells surplus energy to
the consumer. We achieved transparency, accuracy, efficiency in our pro-
posed paper. Using a double auction process, we obtain low energy price
and acheived consumer trust in energy trading.
Keywords: Blockchain ·Prosumer ·Consumer ·Energy trading ·
DSO ·Double auction ·Smart grid ·Peer-to-Peer network
1 Introduction
The existing power system is rapidly changing around the world. From many
years, these existing systems rely on fossil fuel, plant, oil, gas, and petroleum
to generate electricity and to deliver it to users. In today’s world, real-time
monitoring is important in the management of a smart grid. Renewable energy
is beneficial because there is no impact on surrounding it. There are many types
of renewable energy resources such as solar energy, wind energy, geothermal
energy, and biomass. People spend a lot of money on security and trust. In peer
to peer network analysis of security in energy trading is an important factor for
c
Springer Nature Switzerland AG 2020
L. Barolli et al. (Eds.): 3PGCIC 2019, LNNS 96, pp. 875–886, 2020.
https://doi.org/10.1007/978-3-030-33509-0_82
876 M. U. Gurmani et al.
a financial investment in the field of renewable energy production [1]. Various
applications which are connected with the Internet of things (IoT) have been
installed into the smart grid to save the time and to balance the energy supply
demand. Blockchain technology provides us a secure Platform for storing many
transaction records between distributed peer to peer networks [2].
A centralized energy trading system has some drawbacks and has become the
non-guaranteed source for an energy provider. In a centralized system, all the
participant nodes rely on a central servers however, system can be failed at any
time and nodes should be ready to leave the network. In centralized energy sector,
chance of energy supply loss is increased due to trust or to rely on the thirdparty.
The consumer has always securely used electricity and also demand to receive
electricity in every time. Prosumer energy production ratio is increasing rapidly
due to the interest of consumer on secure and less energy cost. In decentralizing
Blockchain, every node must participate in validation of every transaction and
furthermore, update every transaction record and distribute the ledger copy
of the transaction to every node in the Blockchain network. In existing system
energy trading between prosumer and consumer in limited Platform and analysis
of security problem of that existing system [3], the consumer has no option of
trading with other entity which provides the better opportunity on bases of low
price.
In our proposed work, we apply the double auction feature. This feature
is handled by the distribution system operator (DSO). The role of DSO is to
manage the information of the double auction feature between prosumer and
consumer. In the current environment, consumers are wanting to like a secure
and low price platform for energy trading. In double auction process, prosumer
want to sell or buy energy in maximum rate, and consumer wants to buy energy
at a minimum cost to an auctioneer. If the consumer rate is matched with the
prosumer rate then the auction process is done. In this work, every node can
perform transaction with two types of energy trading. One is with the smart
grid and the second is prosumer. By applying the Blockchain in double auction
process prosumer participation interest and market competition are increased.
2 Motivation
People use the current trading system, which is not secure to maintain energy
trading. Nowaday’s technology is growing very fast. Furthermore, we need to
change the traditional energy trading system into secure decentralized technol-
ogy. In to-day’s world, on one hand energy demand is fastly increasing on the
other hand these energy demand are fulfilling by renewable energy. The benefit of
renewable energy production is to sell the surplus energy and to fulfill consumer
energy requirement. Blockchain technology provides a secure and tamper-proof
energy trading platform in which we can perform energy trading in secure envi-
ronment. Blockchain technology is a chain in which blocks are made and all the
transaction are stored in the blocks and all the transaction are not handling by a
single person. Blockchain is a distributed ledger anyone who participates in the
Energy Trading Between Prosumer and Consumer in P2P Network 877
Blockchain network easily access the ledger and further update the ledger and
distributed it to another node [4]. Each owner of the bitcoin the digital signature
on bitcoin and transfer it to the next person by public key [5].
3 Related Wok
3.1 Blockchain in Smart Grid
Existing system has some issue in privacy. Existing system relied on third-party.
In this work, security is major problem for nodes. In this work, the authors
proposed a decentralized and automated secure platform for renewable energy
trading in a smart home. Using Blockchain technology and ethereum smart con-
tract for making the system secure without any need of third-party involvement
in a microgrid. The simulation of this paper is implement in solidity language. In
this work, energy trading is limited between two nodes. In future work, we will
expand our system in which more and more nodes can participate. We check
the maximum scalability of our system [6]. In Existing system energy market
relies on third party and produce electricity with the help of oil and gas. On
the other hand prosumer has produced a surplus energy as they want to trade
this energy to consumer in secure platform without the intervention of third
party. In this work, authors proposed a secure and transparent energy trad-
ing platform. In proposed decentralized system, prosumer and consumer can
trade energy in autonomous system [7]. Nowadays’ energy demand is increasing
rapidly. In this work, the current regional energy production is not enough to ful-
fill the requirement of energy demand. Traditional energy system has face many
challenges. In this work, authors proposed a Blockchain based crypto-trading
project for energy trading. Using Blockchain technology software for exchanging
cryptocurrency to the renewable energy trading market. There are some issues
in the proposed system in terms of security concern and lack of immaturity
[8]. In current energy system Local energy market (LEM) faces challenging in
current energy trading system due to involvement of third-party. Local energy
generation cannot meet the local energy demand. LEM has trust on local agents
who have set energy prices, which is a major problem of local energy market.
In this work, the authors proposed a private Blockchain based technology for
local energy trading. Using private Blockchain, intelligent POW consensus we
provide a secure energy trading platform for the Local energy market with-
out any extra transaction. We provide bidding platform in which prosumer and
consumer can trade each other with their own energy bidding schemes. The
simulation of this work are performed in solidity language and ethereum plat-
form is used for making smart contract for security purpose. In future, there
will be a need for changing regulatory system for Blockchain based technology
in the Local energy market [9]. In the existing system, energy trading cost is
increased due to the involvement of third-party. Prosumers nodes have commu-
nication in limited area. Due to this restriction, they do not communicate with
each other. In this work, the authors proposed a Blockchain based decentralized
low-cost energy trading platform. Using Blockchain cost-effective technology, we
878 M. U. Gurmani et al.
guarantee a secure transactive energy trading against tampering. In this work,
we tackle the issue of reliability, visible service availability, and high cost on the
transaction of energy trading. The simulation of this paper is implement in hyper
ledger fabric and smart contract is also written in hyper ledger. In future, we will
expand our system to achieve the specific Blockchain based solution for adapter
module [10]. The centralized energy trading system faces many challenges in
terms of good quality services, the accuracy of the record. The existing energy
trading system totally relies on a central system or third party. The third party
has many drawbacks in the form of record tampering or record altering. Trust
and security are a major problem in this work. In this work, authors proposed
a Blockchain technology for the purpose of the energy trading system. Using
Blockchain technology no longer necessarily need of third parties to maintain
the record. In this paper, authors analysis of security issues of a decentralized
energy trading system. Keeping in mind the hacker attack in system authors
prevent the proposed system from hacker attack. Using Blockchain cryptocur-
rency security mechanism is used the chord algorithm to find out the disrupted
node in the P2P energy trading system. In this proposed work, authors used
the bitcoin along with SHA-256 cryptographic hash function, the authors used
the advanced encryption standard (AES) for encrypted message. In this work,
the authors highlight the different attacks. In any time the performance of a
hacker attack is presented in this work. Using the overlay network, we prevent
the system from various attacks [3]. In this work, authors tackle the problem of
privacy in term of data sharing [11].
3.2 Blockchain in Vehicular Network
The concept of intelligent vehicles remove the presence of driver working. Intelli-
gent vehicles consider a self-driving car, but nowadays security and trustfulness
is the main issue in communication between intelligent vehicles. In this work, the
authors proposed a Blockchain technology to tackle the security and trustfulness
issues. In this work, we divided Blockchain into two branching 1 local dynamic
Blockchain 2 Main Blockchain these are used to minimize the latency of mes-
sage are also used to manage the trustworthiness. In the case of incorporative
Blockchain, transparency is safety is less due to increasing the data [12]. There
has been a vast development in the field of (IoV), but facing a big challenge for
intelligent storing the data. Information security is key issues for the (IoV) The
existing centralized traditional system for the (IoV) face much hardness for quick
response on real time. With the existing (IoV) generates big data as a record
however, the problem is that storing these big data in a secure environment. In
this paper, the authors proposed a Blockchain technology for the (IoV). Using
the Blockchain technology storing the vehicle information data in the intelligent
system is maintained in a secure environment. In this work, Blockchain technol-
ogy is applied to achieve the better privacy and communication system between
vehicle-to-vehicle and vehicle to roadside units (RSU). In this paper, authors dis-
cuss the future work how a multiple Blockchain vehicle nodes can communicate
Energy Trading Between Prosumer and Consumer in P2P Network 879
with other vehicles and (RSU). In cellular network how we achieved reliability
of channels in which traffic is increasing among the vehicles [13].
3.3 Blockchain in Network Communication
Numerous existing security mechanism are inappropriate for IoT devices plat-
form due to the same problem of maintenance and extra resource utilization
are used to provide the services like hardware. The usage of (IoT) devices is
increased on a network then it arises some security risk due to the trustfulness
on a network. Providing security to lightweight clients for the request of ser-
vices is a challenging task. In this paper, authors proposed a Blockchain based
security mechanism to maintain the tamper-proof and authenticate the state of
edge service and off chain services that are handled by arbitration cloud trader,
and also helped the lightweight clients this paper provides the services to a
lightweight client through the process of authentication and validation. When
the lightweight client wants to perform a transaction on the network through the
validation process, using this process it reduces the cost of IoT devices on the
network. We have achieved the low delay and throughput by applying the proof
of authority. The simulation of this paper is implement in Geth 1.8.11 software
using CPU 3.4GHz. Ubuntu mate and fedora 12 software. In this paper, authors
discuss future work, he attains much feedback from IoT devices he wants to
attain a superior tradeoff among scalability, availability, flexibility secure ser-
vices by using the Blockchain base platform [14].
3.4 Blockchain in Wireless Sensor Network
The multi-domain network face many challenge in term of operation based. Using
distributed Blockchain, Dapps technology handles the operational phases in a
multi-administration network. In future, we will handle the important research
Problems toward Blockchain based multi-administration domain network [15].
The crowd sensing is not provided as a large task to the mobile user who par-
ticipates in it. The crowd sensing has not facilities to the mobile user for huge
level awareness. It give many incentives mechanisms for cloud platforms how-
ever, not anyone can handle privacy issues. There are many devices connecting
with the IoT devices, when the number of devices is connecting to IoT create
then these IoT devices are face many challenges in terms of security risk, and
privacy. The existing traditional sensor is not portable and their deployed cost is
high. Privacy hack is an important problem for a mobile user for collecting the
sensor data. In this paper, authors keep in mind the privacy issue which is seen
clearly in the existing traditional system. In this paper, the authors introduced
a Blockchain technology to handle privacy and security issues. Using Blockchain
based protective incentive mechanism to protect the privacy information of peo-
ples. By giving an incentive mechanism to increase the interest of the user to
participate in the sensing responsibility. In this paper, the range of experiment
is applied in the limited environment and the data is taken in a short area. By
applying this type of experiment the result is attained in single-sided [16]. Using
880 M. U. Gurmani et al.
blockchain technology different authors to resolve the different problems such as:
data rights management, healthcare problem, data securing and fair sharing of
data, data trading, node recovery problems, efficient energy trading, data rights
management, edge servers participation. In [17–25] authors, using blockchain
technology also have provided a solution for the above mentioned problem.
4 Problem Statement
All the current energy trading systems are centralized and all the procedures
rely on a single system which has many drawbacks. The record may be altered,
change and not be available on every time [2]. Security is a serious issue in the
centralized system anyone can enter the system and can alter the record. Peo-
ple spent a lot of money on a centralized system but does not achieve security.
In existing, the energy trading system is limited between two nodes [6]. The
attacker node continuously try to enter in the energy trading system and keep
on damaging the system [3]. To prevent from different attack, we apply the Proof
of Authority (POA) in our proposed scheme. However, nowadays, people con-
vert their trust in developed industries which provide a secure environment for
trading renewable energy. All these facilities are done by Blockchain technology.
In Blockchain technology, record cannot update until when 51% of people can
validate or authenticate the transaction record.
Fig. 1. Blockchain based energy trading between prosumer and consumer
Energy Trading Between Prosumer and Consumer in P2P Network 881
5 Proposed System Model
Our Blockchain based decentralized proposed system model consists of three
entities that provide secure energy trading between prosumer and consumer in a
P2P network. Our proposed work is motivated from [3]. When the prosumer has
to need energy for maintenance of their production, he purchases energy from
the smart grid on fixed price. Distribution system operator (DSO) is consider
as a node to handle the double auction task between prosumer and consumer.
Prosumers send a request to (DSO) for energy supply, DSO receives the different
requests from prosumer and consumer after verification as shown in Fig.1.DSO
announces the double auction process among different prosumer and consumer
for energy trading. When the process of double auction is completed, DSO saves
the double auction record in decentralized BlockChain. Consumer purchases the
energy from smart grid on fix price, whereas, he cannot afford the fixed price
of smart grid energy. He wants to purchase the less cost of energy for their
benifit. For this purpose, consumer sends request to DSO for purchase low price
of energy. (DSO) deliver the information about energy price to all participating
prosumers and consumers. When consumer feels satisfaction about energy price
Furthermore, deal with prosumer for low-cost energy in secure P2P network.
Fig. 2. Blockchain based peer to peer energy trading
The Fig. 2of our proposed submodel is motivated from [6]. As shown in
Fig. 2Prosumer and consumers can energy trading in a decentralized Blockchain
network. Each node can energy trading to another node in a secure network. All
882 M. U. Gurmani et al.
the transactions of nodes is stored in block and further blocks are increased
and making a Blockchain network. Every node validates the transaction and
distributes the copy of the transaction to all other nodes.
5.1 Proof of Authority
Proof of authority is a type of consensus mechanism of Blockchain technology in
which consensus refers to a list of validators (mention to as authorities when they
are linked to the physical entity) validators are a type of accounts or nodes. Val-
idator is participating in such a way that validate the transaction and blocks. In
our proposed model, the (DSO) node is an authority node. Its responsibility is to
maintains the distributed ledger, smart contract and transaction to validate the
prosumer and consumer entity. First of all (DSO) node is responsible for authen-
tication of prosumer and consumer nodes and then execute the smart contract.
When the DSO node is working in POA mechanism mode. Where (DSO) broad-
casts the double auction for energy trading to all prosumers and consumers.
After the double auction, (DSO) is responsible for storing all the transactions
in Blockchain. In POA consensus mechanism attacker required 51%attack to
control over the Blockchain network. POA consensus mechanism is harder to
obtaining control of nodes as compared to POW.
5.2 Smart Contract
A smart contract is a self-executing code. It is a type of agreement between
purchaser and seller without any requirement of a third person or external
mechanism. A smart contract makes the Blockchain secure as compared to a
centralized system. We use the smart contract in our proposed model to make a
secure transaction between trading parties. In this paper, if prosumer and con-
sumer participate for energy trading. The both parties must have to create a
smart contract for energy trading.
6 Simulation and Results
The simulations of our proposed model are done in window 10 using laptop
with 8 GB RAM, 500 GBROM along with Intel(R) Core (TM) i3-2350M CPU
@2.30 GHz 2.30 GHz Processor. The simulations of our proposed model are
implemented in solidity language. A smart contract is created in solidity lan-
guage. Ganache tool is used for calculating the gas consumption that is required
for performing a transaction. In Fig. 3shows the comparison of gas cost values
among different events. When any event occurs in solidity, it take some gas value
as a cost. We seen that the values of events are increased according to their tasks.
When the event of a double auction is occures that take high gas cost as a value
as compared to Prosumer and consumer events.
It is shown in Fig. 4we have performed different transactions in solidity
language. Ganache tool is used for gas consumption. Noted the time of every
Energy Trading Between Prosumer and Consumer in P2P Network 883
Fig. 3. Gas cost and event creation
Fig. 4. No of transaction and time M/S
Fig. 5. Prosumer energy rate and No. of transaction of consumer
884 M. U. Gurmani et al.
Fig. 6. Double auction time and No. of prosumer and consumer request
transaction in a ganache tool. When the transaction is done, the time is increased
or decreased according to the deploy smart contract and relies on values of
functions that we call during the transaction.
Figure 5represents a graph and comparison of some entities values, where
x-axis takes a value of the prosumer energy rate bitcoin per/unit and y-axis
takes a value of no of the transaction of consumers. When the price of prosumer
energy is increased than the no of the transaction of consumer decreases. Because
consumers want to use a minimum cost of energy that they cannot afford the
high price of energy. The prosumers energy rate is associated with consumer
trust and consumers frequentely transactions. We can see in the Fig. 5when the
prosumers energy rate is low, whereas the trust of consumer energy transaction
will increased.
Figure 6represents a transaction execution time between prosumer and
consumer using a double auction process. When any transaction is done in
Blockchain, it takes some time to execute the transaction. When multiple con-
sumers send a request for the transaction to prosumer then response time is
increased to complete the execution. When more prosumers participate in the
double auction for energy supply then market competition will be increasing and
energy prices will also be decreased so, we have acheived the low cost of energy
trading.
7 Conclusion
In our proposed work, Blockchain technology is used for energy trading in renew-
able energy resources between prosumer and consumer in distributed peer to peer
network. Using Blockchain technology, we provide a secure platform for energy
trading. Where we check the efficiency of our system and analysis of market
cost competition. In this paper, we handle the privacy and transparency in dis-
tributed peer to peer network for limited energy trading environment. It is clear
Energy Trading Between Prosumer and Consumer in P2P Network 885
from our proposed idea that every node can participate in the double auction
process to perform a transaction. The important benefit of a double auction is
to give the facility to the consumer for a secure and optimal platform for energy
trading. The main contribution of this paper is to provide a secure energy envi-
ronment at low-cost energy as compared to the market. In future work, we will
expand our system for large scale market and will improve the further scalability
and efficiency of our system in a real experimental environment.
References
1. Aitzhan, N.Z., Svetinovic, D.: Security and privacy in decentralized energy trading
through multi-signatures, blockchain and anonymous messaging streams. IEEE
Trans. Dependable Secure Comput. 15(5), 840–852 (2016)
2. Karame, G.O., Androulaki, E.: Bitcoin and blockchain security: introduction. In:
Bitcoin and Blockchain Security, pp. 1–9. Artech House (2016)
3. Rahmadika, S., Ramdania, D.R., Harika, M.: Security analysis on the decentralized
energy trading system using blockchain technology. J. Online Inform. 3(1), 44–47
(2018)
4. Nakamoto, S.: Bitcoin: a peer-to-peer electronic cash system (2008). http://bitcoin.
org/bitcoin.pdf
5. Narayan, P.: Building Blockchain Projects: Develop Real-time Dapps Using
Ethereum and Javascript. Packt Publishing Ltd., Birmingham-Mumbai (2017)
6. Kang, E.S., Pee, S.J., Song, J.G., Jang, J.W.: A blockchain-based energy trading
platform for smart homes in a microgrid. In: 2018 3rd International Conference on
Computer and Communication Systems (ICCCS), pp. 472–476. IEEE, April 2018
7. Pee, S.J., Kang, E.S., Song, J.G., Jang, J.W.: Blockchain based smart energy trad-
ing platform using smart contract. In: 2019 International Conference on Artifi-
cial Intelligence in Information and Communication (ICAIIC), pp. 322–325. IEEE,
February 2019
8. Mannaro, K., Pinna, A. Marchesi, M.: Crypto-trading: blockchain-oriented energy
market. In: 2017 AEIT International Annual Conference, pp. 1–5. IEEE, September
2017
9. Mengelkamp, E., Notheisen, B., Beer, C., Dauer, D., Weinhardt, C.: A blockchain-
based smart grid: towards sustainable local energy markets. Comput. Sci.-Res.
Dev. 33(1–2), 207–214 (2018)
10. Lombardi, F., Aniello, L., De Angelis, S., Margheri, A., Sassone, V.: A blockchain-
based infrastructure for reliable and cost-effective IoT-aided smart grids (2018)
11. Samuel, O., Javaid, N., Awais, M., Ahmed, Z., Imran, M., Guizani, M.: A
blockchain model for fair data sharing in deregulated smart grids
12. Singh, M., Kim, S.: Branch based blockchain technology in intelligent vehicle. Com-
put. Netw. 145, 219–231 (2018)
13. Jiang, T., Fang, H., Wang, H.: Blockchain-based internet of vehicles: distributed
network architecture and performance analysis. IEEE Internet Things J. (2018)
14. Lin, J., Shen, Z., Miao, C., Liu, S.: Using blockchain to build trusted lorawan
sharing server. Int. J. Crowd Sci. 1(3), 270–280 (2017)
15. Rosa, R., Rothenberg, C.E.: Blockchain-based decentralized applications for mul-
tiple administrative domain networking. IEEE Commun. Stand. Mag. 2(3), 29–37
(2018)
886 M. U. Gurmani et al.
16. Jia, B., Zhou, T., Li, W., Liu, Z., Zhang, J.: A blockchain-based location privacy
protection incentive mechanism in crowd sensing networks. Sensors 18(11), 3894
(2018)
17. Rehman, M., Javaid, N., Awais, M., Imran, M., Naseer, N.: Cloud based secure
service providing for IoTs using blockchain
18. Mateen, A., Javaid, N., Iqbal, S.: Towards energy efficient routing in blockchain
based underwater WSNs via recovering the void holes. MS Thesis, COMSATS
University Islamabad (CUI), Islamabad 44000, Pakistan, July 2019
19. Naz, M., Javaid, N., Iqbal, S.: Research based data rights management using
blockchain over ethereum network. MS Thesis, COMSATS University Islamabad
(CUI), Islamabad 44000, Pakistan (2019)
20. Javaid, A., Javaid, N., Imran, M., Ensuring analyzing and monetization of data
using data science and blockchain in loT devices. MS Thesis, COMSATS University
Islamabad (CUI), Islamabad 44000, Pakistan (2019)
21. Kazmi, N., Javaid, N., Imran, M.: Towards energy efficiency and trustfulness in
complex networks using data science techniques and blockchain. MS Thesis, COM-
SATS University Islamabad (CUI), Islamabad 44000, Pakistan (2019)
22. Zahid, M., Javaid, N., Babar, M.: Balancing electricity demand and supply in
smart grids using blockchain. MS Thesis, COMSATS University Islamabad (CUI),
Islamabad 44000, Pakistan (2019)
23. Noshad, Z., Javaid, N., Imran, M.: Analyzing and securing data using data science
and blockchain in smart networks. MS Thesis, COMSATS University Islamabad
(CUI), Islamabad 44000, Pakistan, 2019
24. Ali, I., Javaid, N., Iqbal, S.: An incentive mechanism for secure service provision-
ing for lightweight clients based on blockchain. MS Thesis, COMSATS University
Islamabad (CUI), Islamabad 44000, Pakistan (2019)
25. Jalees, R., Javaid, N., Iqbal, S.: Blockchain based node recovery scheme for wireless
sensor networks. MS Thesis, COMSATS University Islamabad (CUI), Islamabad
44000, Pakistan (2019)