You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/340891415

An Optimal Consensus Node Selection Process for IoT Blockchain

Conference Paper · November 2019


DOI: 10.1109/ITT48889.2019.9075069

CITATION READS

1 254

2 authors, including:

Khaled Shaalan
British University in Dubai
339 PUBLICATIONS   9,270 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Hindi Question Answering View project

Two-class support vector machine with new kernel function based on paths of features for predicting chemical activity View project

All content following this page was uploaded by Khaled Shaalan on 22 May 2020.

The user has requested enhancement of the downloaded file.


An Optimal Consensus Node Selection Process for
IoT Blockchain
Khaled Shaalan
Deepa Pavithran
The British University in Dubai
Abu Dhabi Polytechnic
Dubai, United Arab Emirates
Abu Dhabi, United Arab Emirates
khaled.shaalan@buid.ac.ae
deepa.pavithran@adpoly.ac.ae
Abstract—Blockchain and Internet of Things (IoT) are two other nodes were waiting for this node to create the block[4].
trending technologies, when combined together can strengthen It caused delay of several hours until the neo authorities had
the security of various applications. However, security of to forcefully restart all the nodes. Problems in consensus can
blockchain depend on its consensus mechanism. The consensus also cause the blockchain to fork or can give the blockchain
mechanisms used by cryptocurrencies requires high control to few users, such as the case of the 51% attack [5].
computations and hence cannot be applied to IoT. Applying
light weight consensus such as PBFT (Practical Byzantine IoT devices are low power devices that have minimal
Fault Tolerance) requires an authority or a protocol to select computational resources. Consensus like bitcoins PoW
leader nodes and the nodes to be involved in consensus. cannot be used in IoT blockchain. Moreover IoT are usually
However the current node selection process in many implemented in permissioned platform. Implementing IoT in
blockchain applications involves a central authority or is based a distributed nature faces lot of challenges including the
on traditional round robin techniques. Hence we propose additional storage and computations required by IoT.
simple and efficient node selection mechanism that can Currently IoT architecture is cloud based where a central
perform consensus without wasting energy. Our approach cloud provider manages and maintains the database. Such
uses PBFT, where the nodes to participate in the consensus are type of architecture is subject to single point of failure and is
not predetermined by a central authority. Nodes are selected always a target of attack. Also a cloud manager or a central
based on their performance in the blockchain. authority may modify the data generated by the sensor.
Implementing blockchain for IoT can overcome these
Keywords—Blockchain, Internet of Things, consensus,
PBFT.
problems. It can provide data integrity, availability and trust.
Considering these advantages, IoT can benefit massively
from blockchain. But implementing blockchain for IoT poses
I. INTRODUCTION many challenges due to the low computational capacity of
Blockchain has recently gained attention due to its these devices. Hence implementing blockchain on IoT needs
adoption into a variety of applications. The problem of a blockchain protocol that can adjust with the limitations of
trusting a third party in the traditional payment system has IoT.
been solved using blockchain. Apart from cryptocurrencies,
Achieving consensus in a blockchain relates to solving an
blockchain can be applied to other applications including
old problem called the Byzantines General problem[6]. .
Internet of Things (IoT) [1]. In contrast to the traditional way
Consensus node selection is an important process in
of a central authority maintaining the ledger of all
blockchain. Bitcoins PoW [7], Ethreum’s Proof of Stake
transactions, blockchain distributes the ledger to every node (PoS) [8] and Byzantines fault tolerance [9] are all different
in the network. The verification and validation of these solutions for Byzantines general problem. While bitcoin
transactions are conducted through cryptographic techniques
select miners who can solve a cryptographic puzzle for the
by a set of miners. Digital signatures are used for verifying
block creation, PoS selects block creators pseudo randomly.
the authenticity of transactions and transaction integrity is
However variants of Byzantines fault tolerance techniques
maintained through hash functions. Blockchain platforms
use round robin technique or a central authority for node
can be classified into permissionless and permissioned [2].
selection. In this paper, we provide simple and efficient
Any node in a permissionless blockchain can conduct a
consensus node selection that can be used to implement
transaction as well as take part in consensus process, e.g.
blockchain for IoT. Our approach is to identify the nodes that
bitcoin. The method of validating the transactions in the
are less busy and use it as consensus nodes.
blockchain without relying on a central authority is called
consensus. Due to the open ended nature of permissionless In section II, we briefly describe various consensus
platform, achieving consensus is extremely complicated, e.g. mechanism used in blockchain. In section III we introduce
Bitcoin’s Proof of Work (PoW). It requires high blockchain for IoT considering a case study of speed radar
computations resulting in wastage of energy. Studies prove generating traffic fines. In section IV, we briefly describe our
that the electricity wasted in bitcoin mining is comparable to approach for achieving consensus in speed radar for
the average electricity consumption of Ireland [3]. In generating traffic fine.
permissioned blockchain, adding node to the network and
nodes that participate in consensus are decided by central II. CONSENSUS ALGORITHMS
authority. Nodes participating in consensus are considered to
be trusted nodes that are verified by an authority. Here high Centralized banks maintain ledgers to validate a
computation PoW are not required and alternative consensus transaction. If Alice sends 100 USD to Bob, bank checks the
mechanisms are used. Some examples are Paxos, RAFT and ledger to verify if Alice has enough amount in her account to
variants of Byzantines Fault tolerance algorithms [2]. transfer to Bob. If there is enough amount, then they update
the ledger by reducing 100 USD from Alice’s account and
Poorly designed consensus mechanisms can interrupt the adding 100 USD to Bob’s account. In a decentralized
operation of whole blockchain. For example the Neo environment where there is no central authority to keep the
network was halted due to node failure. One of the consensus ledger, this process is done through consensus mechanisms
node was disconnected during consensus process and all

XXX-X-XXXX-XXXX-X/XX/$XX.00 ©20XX IEEE


978-1-7281-5061-1/19/$31.00 ©2019 IEEE 115
that allows secure updating of distributed shared state. new hash value. To successfully mine a block the following
Cryptocurrencies powered by blockchain uses decentralized steps are performed.
environment, where each ledger is distributed among all
nodes in the network. The process of validating the Header = Version +Previous block header hash + Merkle
transactions and adding it to the ledger are done by nodes in root hash + timestamp +nBits+ nonce
the network. But how do we trust these nodes? What if some Hash = SHA-256(SHA-256( Header)
validating nodes are malicious? They may be trying to
perform double spending or trying to discard some The miners increment the nonce value to find a hash
transactions. Such type of problems can be considered as value that is less than a target. Target is a 256-bit number
Byzantines generals Problem [6]. A byzantine node can that is shared by all bitcoin clients. To successfully mine a
mislead other nodes involved in the consensus mechanism. block, the SHA-256 hash of block’s header must be lower
Hence the consensus mechanism should be able to operate than or equal to the current target for the block. The lower
correctly and reach consensus even in the presence of the target, it is more difficult to generate a block. Difficulty
byzantine nodes. is a measure of how difficult it is to find a hash below a
given target. This indicates how much work has to be done
Consensus in the literal terms means agreement. Seibold by the node to find a hash that is smaller than the target. For
and Samman [10] define consensus mechanism as a method example, if the difficulty is set to 4 then the target should
of authenticating or validating a value or transaction on a have 4 leading zeros. Time taken to generate a block is set to
Blockchain or a distributed ledger without the need to trust 10 minutes. The network difficulty changes every 2016
or rely on a central authority. In a distributed or decentralized blocks. 2016 block would take exactly two weeks to find.
network, for nodes to reach to a common agreement, Difficulty increases if the time taken to generate the last
consensus algorithms are used [11]. Blockchain platforms 2016 blocks is less than 2 weeks or it decreases if the time
use a range of consensus model which are built on taken to generate last 2016 bocks is greater than 2 weeks
Byzantines Fault tolerance. This includes PoW (Proof of [17]. Due to these properties, bitcoin’s proof of work
work), PBFT (Practical Byzantine Fault Tolerance), Proof of requires huge number of hash calculation that consumes high
Stake (PoS). Most of the cryptocurrencies use a variant or energy.
hybrid of these consensus mechanisms. Consensus
mechanisms used by some cryptocurrencies are shown in When two miners simultaneously mine a block of
Table1. transaction, blockchain will fork leading to more than one
chain. Bitcoin uses longest chain rule. In case of a fork the
TABLE 1: CONSENSUS USED IN CRYPTOCURRENCIES longest chain will be the valid chain.
Crypto currency Consensus used
Bitcoin Proof Of work B. Proof of Stake
Ethreum Proof Of Stake Proof of Stake algorithms are designed to overcome the
XRP Ripple consensus
disadvantages of PoW in terms of high electricity
Algorithm [12]
Bitcoin Cash Proof Of work
consumption involved in mining operations. Instead of
EOS BFT-DPOS [13]
buying mining equipment and paying electricity cost, the
Litecoin Proof of work user can spend that amount buying cryptocurrency and use it
Cardano Ouroboros – Proof as a stake to buy proportionate block creation chances in the
of stake [14] blockchain system [2]. Mining in bitcoin’s PoW is for
Steller Federated BFT [15] creating a new block whereas Proof of stake isn’t about
mining, it is about validating. Block creators are selected
A. Proof of Work pseudo-randomly thereby ensuring that no validator can
Proof of work introduced by bitcoin [7] is the widest predict its turn in advance. Ouroboros-Proof of Stake,
deployed consensus mechanism in existing blockchains. delegated Proof of Stake different variants of proof of Stake
Proof of work is a cryptographic puzzle that is difficult to algorithms [14],[18].
solve but easy to verify. Bitcoin uses hashcash proof of work
system. Hashcash was proposed by Adam Back [16] to limit C. PBFT (Practical Byzantine Fault tolerance)
sending spam emails. To send an email, user has to compute A solution to Byzantine generals’ problem is PBFT [9].
a hash value which requires some amount of processing
Permissioned blockchain platforms mainly use PBFT. An
power. The receiver can verify this with a single hash. For a
normal user, sending one or two emails does not take much example is hyperledger fabric [19] by IBM that uses
time or computations. However, it delays a spammer who hyperledger blockchain platform [20]. When a client sends
wants to send 100,000 + emails per minute. This technology a request to the leader node, it distributes it to other nodes.
is used in bitcoin mining to compute the hash functions. Each node maintains an internal state. When a transaction is
Miners calculate the hash of the header to find a value less received, each node uses their internal state and run
than the given target. The fields in the bitcoin header are as computations to validate a transaction. This computation
follows. will lead to party’s decision about transaction. This will be
shared to all other nodes in the blockchain. The final
The first field in the block header is the protocol version. decision is based on the total decision from all parties.
The next field is the hash of the previous block, and then is
When enough responses are reached, a transaction is
Merkely root, which is a special hash of all transactions in
verified to be a valid transaction. In XRP cryptocurrency,
the block. It is followed by timestamp of the block and
mining difficulty value bits. Finally nonce is an arbitrary there should be a recommended validator list. The validators
value that is incremented on each hash attempt to provide a are preselected by the Ripple foundation [12] whereas in
Steller it uses Federated BFT where there is no

978-1-7281-5061-1/19/$31.00 ©2019 IEEE 116


recommended validator list chosen by central authority. is a single point of failure. They might have different
Whereas each validator decides which other validator they datacenters in different locations but the underlying
trust. Their list of trusted validators are called quorum slice. infrastructure and software used will be the same.
The new validators can then choose their set of quorum slice Also the cloud provider may go out of business. All
[15]. these cases creates single point of failure in cloud
Some of the attacks on the consensus protocols are 51% architecture[24].
attack [5], stake-grinding-attack [21] and nothing-at-stake • Trust: In cloud model we trust the authorities
attack [22]. maintaining the cloud. The administrators who have
access to the database can manipulate the data. An
III. BLOCKCHAIN FOR INTERNET OF THINGS internal employee can manipulate the data generated
In this section we will consider the example of a speed by the sensor. For example in the city of Flint,
radar system that generates traffic fines. The centralized Michigan IoT devices were used to measure the
architecture of this system is shown in Fig. 1. This quality of water. The authorities were insisting that
architecture uses a trusted third party. The basic workflow is the water in the city was safe to drink but it was later
summarized as follows. revealed that officials would have manipulated two
of the collected samples that were contaminated [25].
Radar acts as the sensor that senses the speed of the
moving vehicle. When a moving vehicle is detected for over • Target of attack: The server where the data resides is
speeding, the vehicles license plate number, date and time, always a target of attack for the attackers. A Denial
location are captured and send to the centralized database. of service attack on the server can make the data
This information is processed and fines are generated. A unavailable.
radar with a camera acts as the sensor device here. Speed of
the moving object is measured using Doppler Effect. The IV. PROPOSED APPROACH
radar transmits radio signal which bounces back after hitting
the moving vehicle. There will be difference in the frequency To implement blockchain on IoT device itself, the device
when the object is approaching the radar and when it is should be capable of perform basic cryptographic functions,
moving away from radar. This difference in frequency is perform consensus, should be able to store growing record of
used to calculate the speed of the moving vehicle. The speed transactions and should be able to communicate between
is given by (1) [23] devices. Otherwise for a light node, that is capable of only
sensing and basic operations, edge nodes or cloud based
nodes should be used. We assume our nodes are of the first
type and are implemented as a permissioned blockchain, but
nodes belong to different entities.
------------------------(1)
Implementing Blockchain for traffic fine system can
overcome the challenges with the cloud architecture. Since
Where f is the emitted frequency of radio waves, ∆f is the the data is distributed to all nodes there is no single point of
difference in frequency transmitted and then received back failure in blockchain. Similarly If an attacker wants to
and c is the speed of light. An image recorder attached to the manipulate the data, he/she will have to manipulate blocks
sensor captures the vehicle license plate and send it to the preceding the block. An internal employee within an entity
middleware layer through the network layer. Middleware will not be able to manipulate the data. In blockchain, each
layer consisting of database and servers process this IoT device will be connected to all other devices in the
information and generate fine for the vehicle owner. network as shown in Fig 2. The IoT device along with its
sensors and storage is called a full node.

FIG.2 DISTRIBUTED NATURE OF BLOCKCHAIN

FIG: 1 CENTRALIZED ARCHITECTURE When the sensor detects a traffic violation, it records the
plate number, time and date, location and generates the fine.
Some of the problems associated with this architecture The details such as license plate number, time and date,
are location will be replicated to all nodes in the blockchain as
• Single Point of failure: Cloud vendors often offer shown in Fig.3.
additional hardware and software to provide high To validate a transaction and add it to the block, PBFT can
reliability at an additional cost. But still if the cloud be used. But the problem with PBTF is that, a central
service is managed by a single company, this in-fact authority has to provide the list of nodes that can participate

978-1-7281-5061-1/19/$31.00 ©2019 IEEE 117


in consensus. But this approach will not be efficient, as
Algorithm1: Consensus node selection
some IoT nodes will be busier than others and the nodes
belongs to different entities. Hence to manage efficiently, Input: node, transaction
our approach is to identify the node that is less active, to Output: consensus node
participate in the consensus process. 1. Struct consensus
2. {Node; Transaction; }
3. Cons_Node = 0; Prev=0;
4. For i= each node in the network
5. count= count (transactions in ‘i’ )
6. If count< prev
7. Prev = count;
8. Cons_Node =i
9. endif
10. end for
11. Return Cons_node

Applying this consensus for IoT can move the additional


computational overhead of blockchain to nodes that are less
active. Hence the normal routine of other IoT devices will
not be interrupted and at the same time it provides all the
FIG.3 A GENERIC BLOCKCHAIN ARCHITECTURE OF SPEED RADAR FOR advantages of blockchain technology. However to
GENERATING TRAFFIC FINES.
implement blockchain, IoT devices should be equipped with
additional storage.
For example when a sensor detects a traffic violation, it
creates a transaction and distribute it to all other nodes in the V. CONCLUSION AND FUTURE WORK
network.
Blockchain has shown its potential for transforming
Let trans = {t1, t2, t3…tn} where tn contains {vID, td, loc,
traditional industry with its key characteristsics:
amt}.
decentralization, persistancy, anonymity and transparency.
In this paper we have shown how the potential of
trans= transaction set ;tn= nth transaction; vID = vehicle ID;
blockchain can be applied to IoT by implementing an
td = time and date; loc = Location; amt = Fine amount.
efficient consensus node selection process that can be used
by speed radars for generating traffic fines. Using this
Every node collects all ‘trans’ generated by other nodes.
system, validating the transactions and creating blocks are
When the number of ‘trans’ reaches a threshold ‘r’, it checks
done by nodes that are less active than other nodes. Hence
for the nodes that has the least number of transactions within
without interrupting the normal service of the sensors,
a time frame. ‘n’ number of nodes with the lowest number
blockchain technology can be embedded into IoT. The
of transactions will be selected for validating the
confidentiality of the data generated by the sensors can be
transactions and the least busy node will be selected for
considered as a future work.
creating the block. This node creates the block and links it
with the previous block. REFERENCES
Consider the example of a 3 node network as shown in table
2. Let t1,t2,.. tna be the transactions generated by Node A. If
[1] A. Dorri, S.S Kanhere, R. Jurdak, “Towards an optimized blockchain
tna < tnb and tna < tnc then Node A is selected for participating for IoT”. In Proceedings of the Second International Conference on
in consensus. This indicates that Node A was less busy than Internet-of-Things Design and Implementation, 2017 April ,pp. 173-
other nodes. Hence the ideal candidate to choose for 178.
consensus is Node A. [2] A. Baliga. “Understanding blockchain consensus models”. Persistent.,
White Paper, 2017.
TABLE 2: TRANSACTIONS IN 3 NODE NETWORK [3] K.J, O'Dwyer and D. Malone, Bitcoin mining and its energy
footprint, 2014.
t1 t1 t1 [4] Buntinx, J. (2018). Glitched Consensus Node Briefly Cripples NEO
Node t2 Node B t2 Node C t2 Network » The Merkle Hash. [online] The Merkle Hash. Available at:
A . . . https://themerkle.com/glitched-consensus-node-briefly-cripples-neo-
tna tnb tnc network/ [Accessed 24 Aug. 2019].
[5] J. A. Kroll, I. C. Davey, E. W. Felten. “The economics of Bitcoin
mining, or Bitcoin in the presence of adversaries”. InProceedings of
When the number of transactions reaches a threshold, the WEIS 2013 Jun 11. Vol. 2013, p. 11.
consensus node selection algorithm can be used. Algorithm [6] L. Lamport, R. Shostak, M. Pease. “The Byzantine generals problem.
takes input each node and the transactions generated by the ACM Transactions on Programming Languages and Systems
node. It counts the number of transactions generated by all (TOPLAS). 1982 Jul 1;4(3):382-401.
nodes. If the block is not created within a particular time, [7] S. Nakamoto. Bitcoin: “A peer-to-peer electronic cash system”
the node with the next least number of transactions will be Bitcoin.org. (2019). [online] Available at:
https://bitcoin.org/bitcoin.pdf [Accessed 24 Aug. 2019].
elected for consensus. In case of a fork, the longest chain
[8] F. Saleh, Blockchain without waste: Proof-of-stake, Available at
rule will be used. SSRN 3183935, 2019

978-1-7281-5061-1/19/$31.00 ©2019 IEEE 118


[9] M. Castro and B. Liskov, Practical Byzantine fault tolerance. In [18] D. Larimer, “Delegated proof-of-stake (dpos)”. Bitshare whitepaper.
OSDI, 1999 ,Vol. 99, pp. 173-186. 2014 Apr 3.
[10] S. Seibold, G. Samman, Consensus: Immutable agreement for the [19] GitHub. (2018). hyperledger/fabric. [online] Available at:
Internet of value. KPMG< https://assets. kpmg. https://github.com/hyperledger/fabric [Accessed 24 Aug. 2019].
com/content/dam/kpmg/pdf/2016/06/kpmgblockchain-consensus- [20] Hyperledger. (2018). Home - Hyperledger. [online] Available at:
mechanism. pdf. 2016 https://www.hyperledger.org/ [Accessed 24 Aug. 2019].
[11] LS. Sankar, M. Sindhu, M. Sethumadhavan, Survey of consensus [21] W. Li,S. Andreina, J M. Bohli,G. Karame, “Securing proof-of-stake
protocols on blockchain applications. InAdvanced Computing and blockchain protocols”. InData Privacy Management,
Communication Systems (ICACCS), 2017 4th International Cryptocurrencies and Blockchain Technology 2017 Sep 11, pp. 297-
Conference on 2017 Jan 6 ,pp. 1-5, IEEE 315, Springer, Cham.
[12] D. Schwartz, N. Youngs, A. Britto, The Ripple protocol consensus [22] GitHub. (2018). ethereum/wiki. [online] Available at:
algorithm. Ripple Labs Inc White Paper. 2014 https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQs#what-is-
[13] GitHub. (2018). EOSIO/Documentation. [online] Available at: the-nothing-at-stake-problem-and-how-can-it-be-fixed [Accessed 24
https://github.com/EOSIO/Documentation/blob/master/TechnicalWhi Aug. 2019].
tePaper.md [Accessed 24 Aug. 2019]. [23] En.wikipedia.org. (2018). Radar gun. [online] Available at:
[14] A. Kiayias, A. Russell, B. David, R. Oliynyko, “Ouroboros: A https://en.wikipedia.org/wiki/Radar_gun [Accessed 24 Aug. 2019].
provably secure proof-of-stake blockchain protocol”. InAnnual [24] M. Armbrust, A. Fox, R. Gri_th, A. D. Joseph, R. Katz, A.
International Cryptology Conference 2017 Aug 20, pp. 357-388. Konwinski, G. Lee, D. Patterson, A. Rabkin, I. Stoica, et al., “A view
Springer, Cham. of cloud computing," Communications of the ACM, vol. 53, no. 4,
[15] D. Mazieres, “ The stellar consensus protocol: A federated model for pp. 50-58, 2010.
internet-level consensus”. Stellar Development Foundation. 2015 [25] M. Swan, “Blockchain: Blueprint for a new economy, " O'Reilly
[16] A. Back, Hashcash-a denial of service counter-measure.[Online] Media, Inc.", 2015.
Available at:
ftp://sunsite.icm.edu.pl/site/replay.old/programs/hashcash/hashcash.p
df [Accessed 24 Aug. 2019].
[17] Bitcoin.org. (2018). Developer Guide - Bitcoin. [online] Available at:
https://bitcoin.org/en/developer-guide#block-chain [Accessed 24
Aug. 2019].

978-1-7281-5061-1/19/$31.00 ©2019 IEEE 119

View publication stats

You might also like