Design and Implementation of an Integrated IoT Blockchain Platform for Sensing Data Integrity
Design and Implementation of an Integrated IoT Blockchain Platform for Sensing Data Integrity
Article
Design and Implementation of an Integrated IoT
Blockchain Platform for Sensing Data Integrity
Lei Hang and Do-Hyeun Kim *
Department of Computer Engineering, Jeju National University, Jeju 63243, Korea; [email protected]
* Correspondence: [email protected]; Tel.: +82-64-7543658
Received: 11 March 2019; Accepted: 1 May 2019; Published: 14 May 2019
Abstract: With the rapid development of communication technologies, the Internet of Things (IoT) is
getting out of its infancy, into full maturity, and tends to be developed in an explosively rapid way, with
more and more data transmitted and processed. As a result, the ability to manage devices deployed
worldwide has been given more and advanced requirements in practical application performances.
Most existing IoT platforms are highly centralized architectures, which suffer from various technical
limitations, such as a cyber-attack and single point of failure. A new solution direction is essential to
enhance data accessing, while regulating it with government mandates in privacy and security. In this
paper, we propose an integrated IoT platform using blockchain technology to guarantee sensing data
integrity. The aim of this platform is to afford the device owner a practical application that provides a
comprehensive, immutable log and allows easy access to their devices deployed in different domains.
It also provides characteristics of general IoT systems, allows for real-time monitoring, and control
between the end user and device. The business logic of the application is defined by the smart
contract, which contains rules and conditions. The proposed approach is backed by a proof of concept
implementation in realistic IoT scenarios, utilizing Raspberry Pi devices and a permissioned network
called Hyperledger Fabric. Lastly, a benchmark study using various performance metrics is made
to highlight the significance of the proposed work. The analysis results indicate that the designed
platform is suitable for the resource-constrained IoT architecture and is scalable to be extended in
various IoT scenarios.
Keywords: Internet of Things; sensing data integrity; smart contract; permissioned blockchain;
resource-constrained
1. Introduction
The adoption of IoT-based technologies opens up new opportunities in various aspects of our
daily lives, such as home automation, intelligent transportation, and manufacturing [1]. With the
evolution of embedded computing hardware and network technology, the integration of these two
technologies makes large-scale autonomous IoT systems come into being [2]. In general, the IoT system
consists of heterogenous devices that produce and exchange vast amounts of safety-critical data, as
well as privacy-sensitive information. Therefore, the network is becoming especially critical. Due to
working in unattended environments, the wireless sensor network is most vulnerable to a variety of
cyber-attacks [3]. Most current IoT solutions depend on the centralized architecture by connecting to
cloud servers through the Internet. This solution provides magnificent elastic computation and data
management abilities, as IoT systems are growing more complex; however, it still faces a variety of
security issues. One of the disadvantages is that the widely-expanded IoT-based infrastructure can
introduce a single point of failure, which can compromise the availability of the entire data center. It is
necessary to implement a tamper-proof environment as well as a fault-tolerant network for the large
number of IoT devices [4].
More suitable solutions need to be proposed, and some researchers started to introduce new
paradigms by using a decentralized technology for the IoT device access control, that is blockchain [5].
From a conceptual level, blockchain is a kind of secured, distributed database comprised by numerous
peers that are able to track, verify, and execute transactions and store information from a large
variety of entities. This idea has already been applied to dream up high-level use cases in various
realistic scenarios [6], such as intelligent transport system [7], medical records management [8–10],
decentralized web applications [11,12], and prediction platforms [13,14]. In short, the main advantages
of the blockchain are great transparency, enhanced security, improved traceability, high efficiency, low
costing, and no third-party intervention [15].
Blockchain technology is a revolution in systems of record and has been foreseen by the industry
and research community as emerging technology that can play a significant role in monitoring,
controlling, and, most importantly, securing IoT devices [16–20]. The authors describe a blueprint
on the combination of IoT and blockchain technologies, which facilitate the sharing of IoT resources
and services, and allow the automation of time-sensitive workflows in cryptographically manner [21].
This work identifies solutions and workarounds to highlight that the blockchains and IoT can be used
together. For example, data transmitted by IoT devices is always cryptographically proofed by the
signature of the sender who holds a unique key pair; therefore, the authentication and integrity of
transmitted data are guaranteed. Moreover, all transactions made to or by IoT devices are recorded
on the distributed ledger that can be traced back securely. Although the blockchain may look like a
panacea to solve IoT security of privacy issues that exist in the current centralized architectures, there
are still many research challenges that prevent its incorporation into modern IoT networks. In fact,
most consensus algorithms used by current blockchain-based systems are not designed to be run
on devices with extreme limitations in computing resources. Proof-of-Work (PoW) [22] is the first
consensus algorithm introduced in the blockchain network, and is used by many existing systems.
It spreads the responsibility for a decision to all the individual nodes, namely miners. This process is
so called mining, which requires massive computing capacities.
The development of embedded devices like smart phones increases much more slowly than
desktop systems. As a result, it is difficult for these kind of devices [23] to operate transactions properly
using the current blockchain-based systems, in terms of low computing powers and limited data
storage. Although there are an increasing number of devices with integrated blockchain capabilities
available on the market. For example, embedded devices such as Raspberry Pi and Beaglebone Black
are permitted to install the full Ethereum node by EthEmbedded [24]. Furthermore, the use of wallet
for Bitcoin and Litecoin are supported by Raspnode [25], thus mining can be done on embedded
devices. However, as stated by Raspnode, it would be useless to perform mining on IoT devices.
Alternatively, some hardware such as application-specific integrated circuit (ASIC) chips are designed
and manufactured for mining, since it is improper to try it on IoT devices [26]. There is still a lot of
research to be done for enabling a wide integration of IoT devices as blockchain components.
Therefore, new ways of solving these issues are needed when considering the integration of
blockchain with IoT, for instance, one of the primary challenges is how to adapt the blockchain
technology that suited to embedded IoT devices with limited resources. A new or a customized
implementation of blockchain is required as different applications have different requirements.
By contrast to other existing system proposals, the proposed approach in this paper brings the
advancements in IoT as follows:
1. Scalability: Our solution meets the requirements of the practical IoT network, which is comprised
of numerous IoT devices connected, through different constrained networks, to a single blockchain.
2. High throughput: A high throughput network is needed so as to deal with simultaneous
communications among a large variety of devices. This work proposes the use of a permissioned
blockchain, in which interactions occur among a set of network entities that fully trust each other.
As a consequence, traditional voting-based protocols, like byzantine fault tolerant (BFT) or crash
fault tolerant (CFT) consensus protocols, can be used to improve the network throughput.
Sensors 2019, 19, 2228 3 of 26
3. Lightweight: In our solution, the IoT devices are not included in the blockchain, and alternatively,
a RESTful interface which handle requests from devices is defined to enable cross platform
communication between devices and the blockchain network.
4. Transparency: This system hides the details of the IoT devices and the transaction history that
records how a resource is manipulated, except for to the authorized user.
More precisely, we present a decentralized scheme in which device information could be stored on
a secure, permissioned chain and shared back and forth quickly, like email. The proposed architecture
is extended from the IoT platform in our previous work [27]. In order to ease the interaction between
the end user and the blockchain network, various interfaces are implemented by utilizing some of the
web front-end technologies, such as JavaScript and HTML5. This web-driven paradigm allows end
users to improve the access and management of the resources within the blockchain network. All the
product-specific services provided by the blockchain network are exposed as representational state
transfer application programming interfaces (REST APIs), which can be invoked by either web clients
or IoT devices. Device users can control and be aware of the surrounding environment without a
priori knowledge of the physical devices, for example, the types of physical devices and how to set
up them. These IoT devices do not need to install the full node, since the consensus process, such
as the practical byzantine fault tolerance (PBFT) algorithm, is performed in the blockchain network
from a remote space. Smart contract is used to provide controlled access to the device meta-data
and to host the ledger functions across the network. In the designed platform, we also define access
control policy, which allows participants to access a certain number of contents or transactions that
are authorized. For example, only the owner of the device is permitted to access and manipulate the
device. Since blockchain technology is not intended for large transaction data payloads so that new
data storage technologies are desired to deal with a large amount of IoT data. In our system, we apply
a separate software solution by deploying the Couch database (DB), resided on each peer, to enable the
large file storage and minimize the duplication across the entire blockchain filesystem. Lastly, we prove
the practicability of our proposed approach by implementing a real-life case study in a smart space.
The blockchain network is implemented by using the Hyperledger Fabric [28], which is a permissioned
decentralized platform designed for building decentralized applications (DApps) or distributed ledger
solutions on top of it.
The remainder of this paper is structured as follows: Section 2 provides an overview of a number
of the related projects and analyzes some common issues in current state of art. Section 3 looks into the
system architecture and demonstrates the work flow of the proposed IoT blockchain platform. Section 4
explains in-depth about the implementation of the smart space case study and presents execution
results with various snapshots. Section 5 presents the evaluation results of the proposed platform
in various performance metrics. Section 6 highlights the significance of the proposed work through
a benchmark analysis, by comparing the designed approach with some recent studies. Section 7
concludes the paper and discusses future research directions.
2. Related Work
So far, IoT technology has been widely adopted by the manufacturing industry in
machine-to-machine (M2M) communication. While the current technologies make the concept
of IoT feasible, a large number of challenges lie ahead for aiding large-scale real-world deployment of
IoT applications. In recent years, the blockchain has attracted extensive attention from researchers and
companies for its security and transparency. The blockchain has great potential to be the organizational
structure for interconnecting everything and for timestamping heterogeneous data in Industry 4.0 [29].
The common theme in this paper is the collaboration of blockchain and control of IoT. To the best
of our knowledge, research works on this theme is limited because blockchain is quite well-known
in financial services. In this section, we explore those blockchain technologies involved in IoT by
overviewing some recent studies.
Sensors 2019, 19, 2228 4 of 26
A total of 18 cases of blockchain use have been categorized [30], and four of them are specified to
IoT, including immutable log of events and access management of data [31], sensing data trading [32],
IoT equipment trading [33], and IoT devices authentication [34]. The authors discuss the integration of
the blockchain with IoT and highlight the integration benefits, challenges, and future directions [35].
Mainly due to its decentralized features in computation and management processes, the blockchain
can be a powerful technology to solve many IoT issues, especially security. They elaborate that it is the
right way to move the current centralized IoT system towards the decentralized architecture. A built-in
blockchain solution is proposed [36] for LoRaWAN network servers in order to implement an open,
trusted, decentralized, and tamper-proof system. An incontrovertible mechanism is provided to verify
the data of a transaction that existed at a specific time in the network. The authors declare that this work
takes advantages of the blockchain technology and it is the first implementation to integrate blockchain
with LoRaWAN IoT technology. Another proof of concept using LoRa nodes is proposed [37] to enable
low-power, resource-constrained IoT end-devices to access a blockchain-based infrastructure in an
Ethereum network. To achieve this aim, the authors utilize an IoT gateway as a blockchain node and
propose an event-based messaging mechanism for low-power IoT end devices. The authors review
the usage of smart contracts in IoT and describe how smart contracts can facilitate and support the
autonomous sharing of services among IoT devices [38], as proposed in [39]. The significance that
IoT can profit from blockchain networks are described in terms of trading, billing, shipment, and
supply chain management. The authors present a traceability system for tracking Chinese agri-food
supplies [40]. The proposed system combines the radio frequency identification (RFID) with blockchain
technology to enhance food quality and safety but meanwhile to reduce transportation costs. An IoT
device management system is proposed [41] to control and configure IoT devices remotely. The authors
propose a refreshing key management scheme whereby public keys are saved in Ethereum while
private keys are stored on each IoT device. The Ethereum network is used in the proof of concept
since it provides the means to model smart contract than can be run on top of the network. In this
way, the maintenance and debugging are simplified since the update of code can directly change the
behavior of IoT devices. A smart city application framework is proposed to integrate heterogenous
smart devices in a highly secure manner [42]. The proposed framework provides a variety of features,
including better fault tolerance capability, improved reliability, scalability, and efficient operation,
which set up a common blockchain eco system in which all devices could communicate with each
other in a secure distributed environment. The authors propose a lightweight architecture for IoT to
eliminate the overheads of classic blockchains, while maintaining most of its security and privacy
benefits [43]. A private immutable ledger that is managed centrally is designed to optimize energy
consumption from IoT devices. In addition, they use the distributed trust to reduce the block validation
processing time. Lastly, a representative case study specified for smart home is implemented to
explore the usability of the proposed architecture. CONNECT [44] is a theoretical blockchain-based
architecture that concentrates both on IoT service provision and heterogenous device interconnection.
The proposed architecture takes advantage of hierarchical and multi-layered blockchains, which enable
the building of a contextual service discovery mechanism. FairAccess [45] is a fully decentralized
management framework based on blockchain that enables users to own and control device data. In this
framework, new types of transactions are designed to issue and revoke the access using smart contracts.
A decentralized, cloud-based platform specified for industry manufacturing on the basis of blockchain
technology is proposed [46]. The authors build a trusted intermediary for transactions among the
users in order to provide on-demand access to manufacturing resources. Single board computers, such
as Beaglebone Black and Raspberry, are utilized for communication between machines, the cloud, and
the blockchain network. The authors propose a decentralized system, allowing sensors to exchange
Bitcoins with data [47]. To be more precise, the client requests data by sending the transaction (with
Bitcoins) to the address of the specific sensor, in turn the sensor responds to the client with sensing
data. To ensure the device ownership, the authors design a blockchain-based layer storage system
in order to give the end users full control over their devices [48]. The proposed system consists of
Sensors 2019, 19, 2228 5 of 26
three layers: data layer, control layer, and device layer. The data layer collects IoT data and provides
the decentralized hash table for data storage. The control layer manages the access control on the
data stored in the hash table. The device layer exposes various services provided by IoT sensors
and actuators. Sapphire [49] is a novel system that is aiming to exploit the computing power of IoT
devices to perform computation on collected data by using smart contracts. The results indicate that
this approach can reduce the data transfer on the IoT network and improve the transaction execution.
The authors present a decentralized system to preserve user’s privacy on IoT devices (Bluetooth low
energy modules) by using the Ethereum platform [50]. Besides, a blockchain gateway is introduced
to interact with the IoT towards the user. Two types of smart contracts are proposed: one for the
IoT device and the other for the gateway. The authors deploy the blockchain technology into cloud
architecture to enhance data transparency and decentralization [51]. The proposed platform abstracts
the physical resources into the cyber space and exposes them as services. Essentially, blockchain is used
as a middleware between the cloud and the manufacturing resources, guaranteeing the transparency
and security of the data in cloud manufacturing.
As mentioned, these studies have some common issues that are inappropriate for
resource-constrained IoT devices, such as token-based transactions, which cause the high time
cost involved in transaction executions. The nonuse of native cryptocurrency can remove the risk of
virtual currency speculation, and can roughly obtain the same processing performance as any other
distributed system. Furthermore, they deploy the copy of ledger onto embedded devices that act as
nodes of the blockchain network. In such way, the transaction execution rate is heavily impacted and it
is hard to fulfill the requirement of a global IoT ecosystem with millions of nodes. For the need of
practical application, this paper gives feasible solutions that are extensible to large-scale networks
with low latency and high throughput. In addition, the implementations that are compatible with
resource-constrained IoT devices are also presented.
servers for further usage, while actuators are used to perform particular actions (e.g., turn on the light)
according
Sensors 2019,to
19,commands
2228 received from end users. 6 of 26
IoT Server
User Client
IoT Network
IoTblockchain
Figure1.1.IoT
Figure blockchain platform
platformconceptual
conceptualscenario.
scenario.
3.2. Proposed IoT Blockchain Platform System Architecture
3.2. Proposed IoT Blockchain Platform System Architecture
Figure 2 presents the layer-based architecture of the proposed IoT blockchain platform that is
Figure
extended from2 presents the layer-based
our previous work [27]. Itarchitecture
is a modular of architecture
the proposed IoT blockchain
whereby each layer platform that is
is decoupled
extended from our previous work [27]. It is a modular architecture whereby each
from other layers so that developers can replace or add any new module without affecting the layer is decoupled
from
rest ofother layers soThe
the system. thatIoT
developers
physicalcan
layerreplace or add
consists any newlinked
of various module without
devices affecting
with the restof
the abilities of
the system. The
communication, IoT physical
computing, layer
and data consists
storage. The of
mainvarious linked
function devices
provided by thewith the abilities
connectivity of
layer is
communication, computing, and data storage. The main function provided by the
routing management, because self-organization is required since physical devices themselves haveconnectivity layer
is routing
no management,
global internet because
protocols self-organization
(IPs). This layer alsoiscontains
requiredother
since modules
physical devices themselves
for providing have
services,
no globalnetwork
including internetmanagement,
protocols (IPs). Thismanagement,
security layer also contains otherbroker.
and message modules
TheforIoTproviding
blockchainservices,
service
layer contains all modules that organize common services to provide various featuresIoT
including network management, security management, and message broker. The blockchain
of blockchain
service layer contains all modules that organize common services to provide various features of
technologies, including identity management, consensus, and peer-to-peer (P2P) communication.
blockchain technologies, including identity management, consensus, and peer-to-peer (P2P)
The distributed ledger is a consensus of replicated, shared, and synchronized digital data that spread
communication. The distributed ledger is a consensus of replicated, shared, and synchronized digital
across the whole blockchain network, where all participants with the network can have their own
data that spread across the whole blockchain network, where all participants with the network can
selfsame copy of the ledger. It also provides secure storage space to record the device configuration
have their own selfsame copy of the ledger. It also provides secure storage space to record the device
and sensing data provided by physical sensors. Any changes to the ledger are reflected in all copies in
configuration and sensing data provided by physical sensors. Any changes to the ledger are reflected
minutes, or in some cases, seconds. The ledger can be either permissioned or permissionless, regarding
in all copies in minutes, or in some cases, seconds. The ledger can be either permissioned or
if anyone or only approved members can run a peer to validate transactions. The big data analytics
permissionless, regarding if anyone or only approved members can run a peer to validate
module enables the blockchain to be an efficient mode for online data storage. Lots of transactional
transactions. The big data analytics module enables the blockchain to be an efficient mode for online
data from various parties are stored in structured forms of ledgers, which makes it a perfect source
data storage. Lots of transactional data from various parties are stored in structured forms of ledgers,
which makes it a perfect source for further analysis. All of these parties can be granted access to one
single network and it will be convenient to access these details. The smart contract is sort of code
invoked by an external client application to manage access and modifications in the ledger. It is
usually installed and instantiated onto every peer of the network. The event management sends
Sensors 2019, 19, 2228 7 of 26
for further analysis. All of these parties can be granted access to one single network and it will be
convenient to access these details. The smart contract is sort of code invoked by an external client
application to manage
Sensors 2019, 19, 2228 access and modifications in the ledger. It is usually installed and instantiated7 of 26
onto every peer of the network. The event management sends events every time a new block is added
events
to ledger orevery time awhenever
triggered new block is added
the to ledgercondition
predefined or triggered
in whenever
the smartthe predefined
contract condition
is fulfilled. Thein API
the smart contract is fulfilled. The API interface exposes the services provided by the
interface exposes the services provided by the blockchain network as services through which the client blockchain
network as services through which the client application can access and manage the network. The
application can access and manage the network. The top layer is the application layer, where various
top layer is the application layer, where various interfaces are provided to visualize the data from
interfaces are provided to visualize the data from physical devices, to manipulate and control devices.
physical devices, to manipulate and control devices.
IoT Blockchain
Blockchain Network
Service Layer
Event
P2P Protocol Smart Contract API Interface
Management
Sensor Sensor
Actuator Computing Communication
Resource Interface
IoT
Physical
Layer Actuator Sensor Storage
Sensor Actuator
Figure 2. Layer-based
Layer-based IoT blockchain platform architecture.
Device Owner
2. Device Registration
6. Event Notification
App Client
System work
Figure 3. System work flow
flow of
of the
the proposed
proposed IoT blockchain platform.
Figure 4 illustrates
Figure thethe
4 illustrates detailed
detailedtransaction executionprocess
transaction execution process taken
taken place
place in the
in the blockchain
blockchain
network. The client application must have credentials
network. The client application must have credentials issued by issued by the identity management service so so as
identity management service
to getasthe authorized
to get permission
the authorized permission for for
submitting
submittingtransaction proposals.The
transaction proposals. The identity
identity manager
manager holdsholds
userand
user IDs IDs authenticates
and authenticates clients
clients whowho want want to enroll
to enroll in the
in the network.
network. Transactionsstart
Transactions startout
outfrom
fromclient
client applications
applications sending transaction
sending transaction proposals proposals
to peers intothepeers in the network.
blockchain blockchainThe network. The
communication
communication between the blockchain network and the client
between the blockchain network and the client application happens over the application software application happens over the
application software development kit (SDK). These peers can either be endorsers or committers:
development kit (SDK). These peers can either be endorsers or committers: Endorsers cam simulate
Endorsers cam simulate and sign transaction proposals, respond to granting, or deny approvals;
and sign transaction proposals, respond to granting, or deny approvals; while committers validate
while committers validate transaction results prior to the writing of a block of transactions to the
transaction results
ledger. Each prior to
endorser peerthereceives
writingand of aexecutes
block of thetransactions to the ledger.
transaction proposal Each endorser
by invoking the smart peer
receives and executes the transaction proposal by invoking the smart contract in
contract in their own simulated environment. It is worth noting that in this stage, the execution results their own simulated
environment.
will not beItreflected
is worthinnoting that These
the ledger. in thisendorser
stage, the execution
peers results
just capture thewill not
set of be reflected
Read and Written in the
data,ledger.
Thesenamely
endorser
RWpeers just capture
sets, which record whatthe set
wasofread
Read andthe
from Written
currentdata, namely
state when theRW sets, which
transaction record what
is simulated
and what
was read fromwould write to
the current the state
state when after
thethe transactionishas
transaction been executed.
simulated and what Eachwould
endorser peertosigns
write the state
the RW sets and returns proposal responses to the client application for
after the transaction has been executed. Each endorser peer signs the RW sets and returns proposal endorsement inspection. The
client verifies
responses the endorsing
to the client application signatures to determine ifinspection.
for endorsement the specifiedThe endorsement policy the
client verifies (the endorsing
set of
peers that must endorse the smart contract execution results) has been fulfilled. Then the client
signatures to determine if the specified endorsement policy (the set of peers that must endorse the
packages the signed transaction and submits this transaction along with RW sets to the consensus
smart contract execution results) has been fulfilled. Then the client packages the signed transaction and
manager. Consensus happens across the network, in parallel with signed transactions, and RW sets
submits
are this transaction
submitted; along withisRW
this information sets to
ordered thea consensus
into manager.toConsensus
block and delivered all committer happens
peers. across
Each the
network, in parallel
committer with signed
peer validates transactions,
the transaction and RW whether
by checking sets are thesubmitted;
RW sets thismatch information
the current is ordered
state.
into aSpecifically,
block andthe delivered
Read data tostill
all committer
exists even ifpeers. Each committer
the transaction simulatedpeer by thevalidates
endorserthe transaction
is identical to by
checking whether the RW sets match the current state. Specifically, the Read data still exists even if
the transaction simulated by the endorser is identical to the current state. After the committer peer
Sensors 2019, 19, 2228 9 of 26
Sensors 2019, 19, 2228 9 of 26
Identity Peer
Peer
(Endorser)
Management Smart (Committer)
Contract
Peer
Peer
(Endorser) Consensus
Client Smart Client (Committer)
Contract
Manager
SDK
Peer
Peer
(Endorser)
Smart (Committer)
Contract
Figure
Figure4.4.Detailed
Detailedtransaction
transaction execution work flow.
execution work flow.
3.4. 3.4.
Smart Contract
Smart in in
Contract thethe
Proposed
ProposedIoT
IoTBlockchain
Blockchain Platform
Platform
TheThe concept
concept of the of smart
the smart contract
contract [52][52]
waswasfirstfirst introduced
introduced by Nick
by Nick SzaboSzabo in 1994,
in 1994, whichwhich is
is defined
defined as “a computerized transaction protocol that executes the terms
as “a computerized transaction protocol that executes the terms of a contract”. Within the context of of a contract”. Within the
context ofthe
blockchain, blockchain,
smart contract the smartactscontract acts as distributed
as a trusted a trusted distributed
applicationapplication
that gains that its
gains its from
trust trust the
from the blockchain and the underlying consensus among the peers. Since they reside on the
blockchain and the underlying consensus among the peers. Since they reside on the blockchain, smart
blockchain, smart contracts have a unique address through which the end user can address a
contracts have a unique address through which the end user can address a transaction to it. According
transaction to it. According to the data that triggers the predefined condition, the smart contract then
to the data that triggers the predefined condition, the smart contract then executes automatically and
executes automatically and independently in a prescribed manner by every peer in the network.
independently in a prescribed
In principle, smart contractsmanner by every
are written in apeer in the network.
non-standard, or domain-specific language (such as
Solidity) in order to reach consensus among all of the peers. or
In principle, smart contracts are written in a non-standard, domain-specific
This becomes one of language (such as
the greatest
Solidity) in order
challenges to reach
to the consensus
wide-scale usageamong
of smart allcontract,
of the peers.since This becomes
blockchain one of the
developers greatest
must learn challenges
a new
to the wide-scale
language usage
to write smartof smart contract,
contracts, and thissincemay blockchain developers
lead to various problemsmust in learn
coding.a new language
Moreover,
to write smart contracts, and this may lead to various problems in coding. Moreover, transaction
transaction execution performance and scale are limited since all transactions are executed
successively
execution by all peers.
performance andToscale
address
are these
limitedissues,
since weall deploy smart contracts
transactions onto a specific
are executed subset of
successively by all
peers
peers. To rather
address than to allissues,
these peers, we
hence, the transaction
deploy smart contractsonly needs
ontotoa be executed
specific by a of
subset setpeers
of peers.
ratherThisthan
approach
to all also supports
peers, hence, parallel execution,
the transaction only needs which canexecuted
to be prominently by increase the overall
a set of peers. Thisperformance
approach also
and scale of the system. Furthermore, we use the standard languages such as Node.js or Java to code
supports parallel execution, which can prominently increase the overall performance and scale of the
the smart contract so that developers can use their familiar programming languages without
system. Furthermore, we use the standard languages such as Node.js or Java to code the smart contract
spending time learning a new language. As shown in Figure 5, the proposed smart contract contains
so that developers can use their familiar programming languages without spending time learning a
various functions that allow users to interact with the ledger, which is a combination of the state
newdatabase
language. andAs shown in
blockchain. Figure
For example,5, the proposed
users can create, smart contract
update, contains
and query devicevarious functions
information from that
allowtheusers
ledgertobyinteract
submitting withtransactions
the ledger,to which is a combination
the smart contract. It also ofprovides
the statefunctionalities
database andtoblockchain.
handle
For the
example, users can create, update, and query device information from
transactions proposed from the devices, such as collecting sensing data or updating state changes the ledger by submitting
transactions to the
of actuators. smartcontains
A block contract. It also
a hash provides
value functionalities
of the transactions andtothehandle the transactions
hash value of the prior proposed
block
frominthe devices,
order to insure such theassecurity
collecting sensing
of the ledgerdatadata.or Evenupdating
thoughstate changes
the ledger of actuators.
hosted by one peer A is
block
tampered
contains a hashwith,
valueit would
of thenot be able to convince
transactions and theall hashthe value
other peers
of thebecause the ledger
prior block is distributed
in order to insure the
throughout
security a network.
of the ledger data. A Even
sample structure
though theofledger
a ledger is given
hosted in Figure
by one peer is5, tampered
where the with,
blockchain
it would
contains four blocks. Block 0 is the genesis block, which does not contain
not be able to convince all the other peers because the ledger is distributed throughout a network. any transactions. Each of
the other blocks contain one transaction, and these transactions are associated
A sample structure of a ledger is given in Figure 5, where the blockchain contains four blocks. Block 0 with various assets
(e.g., sensor, actuator) in the ledger state. The application running on the smart contract receives the
is the genesis block, which does not contain any transactions. Each of the other blocks contain one
transaction and performs different kinds of queries and updates. The transaction is appended in the
transaction, and these transactions are associated with various assets (e.g., sensor, actuator) in the
block, and meanwhile the ledger state is updated. In the end, the ledger updating result is returned
ledger state. The application running on the smart contract receives the transaction and performs
to the application as the response.
different kinds of queries and updates. The transaction is appended in the block, and meanwhile
the ledger state is updated. In the end, the ledger updating result is returned to the application as
the response.
Sensors 2019, 19, 2228 10 of 26
Identity
Administrator
Device Owner Client App Enrollment CA
Management
Identity
Administrator
Device Owner Client App Enrollment CA
Register (Enroll ID) Management
Register Request
Enroll
Generate ECert (Enrollment ID, Public Key)
(ID, Secret)
Enroll Request
ECert
Request
Generate
Key ECert (Enrollment ID, Public Key)
using ECert
Generate TCert (Private Key)
ECert
TCert
Store ECert, TCert Request
Key using ECert
Generate TCert (Private Key)
TCert
Figure 6. Identity
Store ECert, TCert issue for network user.
After the enrollment, the device owner is allowed to access and consume services provided by
the network. Various operations happen
Figure among issue
6. Identity different components
for network user. within the designed platform,
which are presented in Figure 7. The device owner inputs information
Figure 6. Identity issue for network user. of the IoT device through the
After the enrollment, the device owner is allowed to access and consume
client application to register a new device. This information is sent along with services provided
the request and by
thethe
network. Various operations happen among different components within the designed platform, which
After the enrollment, the device owner is allowed to access and consume services provided by
the network. Various operations happen among different components within the designed platform,
which are presented in Figure 7. The device owner inputs information of the IoT device through the
client application to register a new device. This information is sent along with the request and the
Sensors 2019, 19, 2228 11 of 26
Consensus execution
Consensus execution
Deploy task
Task request
Perform task
Consensus execution
Component Description
CPU Intel Core i5-8500 @ 3.00 GHz
Memory 12 GB
Operating Systems Ubuntu Linux 18.04.1 LTS
Docker Engine Version 18.06.1-ce
Docker-Compose Version 1.13.0
Node v8.11.4
Hyperledger Fabric v1.2
IDE composer-playground
CLI Tool composer-cli, composer-rest-server
DBMS Couch DB
Programming Language Node.js
Table 2 describes the development tools and technologies for implementing the IoT device server
that resides on the Raspberry Pi. Android Things is installed on the Raspberry Pi so that the application
can be easily programmed in Java language, like a regular Android application. The communication
between the device server and the IoT server uses the constrained application protocol (CoAP), while
for the communication between the device server and the blockchain network, HTTP is used. Physical
resources, such as temperature sensor, humidity sensor, and two LEDs, are abstracted into CoAP
resources as part of the server. Each resource is assigned with a unique URI in order to be identified by
the server.
Component Description
Hardware Raspberry Pi3 Model B
Memory 1 GB
Operating Systems Android Things v0.8
Server CoAP Server
Resources Temperature, Humidity, Green LED, Red LED
IDE Android Studio 3.1.4
Library and Framework Californium CoAP, HttpURLConnection
Programming Language Java
Sensors 2019, 19, 2228 13 of 26
Table 3 presents the development stacks to implement the blockchain web application.
The application that hosted on the Apache Tomcat can be divided into backend and frontend, which
are implemented by Eclipse Photon and WebStorm, respectively. For the backend, the Californium
CoAP framework is used to implement the server that translates the communication protocol between
web application and IoT device from HTTP to CoAP, and vice versa. For the frontend, a variety of
web techniques such as HTML, Cascading Style Sheets (CSS), and JavaScript are used. We make
use of Bootstrap and jQuery, which are two popular open-source frontend toolkits for web frontend
development. Notify.js is another jQuery plugin to provide customizable notifications to the client.
The client can interact with the REST server through which the end user can invoke relevant APIs to
submit transactions by HTTP requests using GET or POST.
Component Description
Operating System Windows 10 Pro 64 bit
Server Apache Tomcat
IDE Eclipse Photon (4.8.0), WebStorm (2018.2.3)
Browser Chrome, Firefox, IE
Library and Framework Californium CoAP, Notify.js, Bootstrap, jQuery
Programming Language Java, HTML, CSS, JavaScript
Hyperledger Fabric
Network
Peer
Notification
Web Client
WebSockets Peer Orderer Peer
HTTP
Blockchain Filesystem
HTTP State DB
User Interface WiFi (HTTP/CoAP)
Transaction Block 1
Transaction Key:sensor1
Reads[] Value:
Physical End Nodes (Sensor/Actuator) Writes[] {
"name":"sensor1",
"owner":"jack",
“unit”:”ceksius”
Block 2 "date":"9/6/2018",
Transaction “data”:”25”,
Reads[] ...
Writes[] }
...
Figure 8. IoT
Figure blockchain
8. IoT platform
blockchain platformimplementation anduse
implementation and use case
case deployment.
deployment.
4.3. Smart
4.3. Smart Contract
Contract Modeling
Modeling for
for the
the Case
Case Study
Study
The smart
The smart contract
contractisisdesigned
designedand implemented
and implemented by using the Hyperledger
by using Composer
the Hyperledger [53], which
Composer [53],
is an extensive, open development toolset and framework to facilitate the implementation
which is an extensive, open development toolset and framework to facilitate the implementation of of blockchain
applications.
blockchain Participants
applications. are members
Participants are of a business
members of anetwork,
businesswith the ability
network, to have
with the assets
ability and
to have
submitand
assets transactions. In the proposed
submit transactions. case study,
In the proposed casethey canthey
study, be device
can beowners who have
device owners whothe ability
have the
to access
ability and manage
to access their devices.
and manage In general,
their devices. assets
In general, can be
assets cangoods, services,
be goods, or property,
services, andand
or property, are
stored
are in registries.
stored TheseThese
in registries. two types are modeled
two types with anwith
are modeled identifier and can have
an identifier any have
and can other any
properties
other
as required.
properties as For example,
required. For as represented
example, in Table 4,ina Table
as represented device4,asset that asset
a device represents the IoT device
that represents the IoTis
summarized
device into sensor
is summarized and
into actuator,
sensor and typically
actuator,containing general information
typically containing such as ID,such
general information name,as and
ID,
ownerand
name, of the specific
owner physical
of the specificdevice.
physical device.
Table
Table 4. 4. Deviceasset
Device assetdefinition
definition in
inthe
thesmart
smartcontract.
contract.
Category CategoryComponent
Component TypeType
sensor_ID
sensor_ID String
String
name
name String
String
device_owner
device_owner String
String
Sensor Sensor unit
unit String
String
event_threshold Integer
event_threshold Integer
timestamp DateTime
timestamp
value DateTime
String
value String
actuator_ID String
actuator_ID
name String
String
Actuator name String
Actuatordevice_owner String
device_owner
state String
Boolean
state Boolean
As part of the smart contract, we define the transactions that can interact with assets. Participants
As part of the smart contract, we define the transactions that can interact with assets. Participants
can interact with them and each of which can be associated with an identity, across multiple blockchain
can interact with them and each of which can be associated with an identity, across multiple
networks. The condition defines which users are permitted to perform create, read, update, or delete
blockchain networks. The condition defines which users are permitted to perform create, read,
operations in the blockchain network. As given in Table 5, for example, only the device owner of
update, or delete operations in the blockchain network. As given in Table 5, for example, only the
the device can perform update operations on the instance of the device asset. Events are defined in
device owner of the device can perform update operations on the instance of the device asset. Events
the same way as assets or participants. Once events have been defined, they can be included in the
are defined in the same way as assets or participants. Once events have been defined, they can be
transaction processor functions to be emitted as part of a transaction. Table 6 presents a sample of
included in the transaction processor functions to be emitted as part of a transaction. Table 6 presents
events defined in the smart contract.
a sample of events defined in the smart contract.
Sensors 2019, 19, 2228 15 of 26
Sensors 2019, 19, 2228 15 of 26
The transaction process function is the logical operation of a transaction defined in the smart
The transaction process function is the logical operation of a transaction defined in the smart
contract. As shown in Figure 9, the structure of the transaction processor functions contains a JavaScript
contract. As shown in Figure 9, the structure of the transaction processor functions contains a
function. Here is an example, the transaction processor function relating to the actuator writing
JavaScript function. Here is an example, the transaction processor function relating to the actuator
transaction is to update the status of the actuator asset. More precisely, this function replaces the status
writing transaction is to update the status of the actuator asset. More precisely, this function replaces
of the actuator asset with the value passed from the physical device, updates the actuator asset in the
the status of the actuator asset with the value passed from the physical device, updates the actuator
registry, and then emits an event.
asset in the registry, and then emits an event.
Figure 9. Transaction
Figure 9. Transactionprocessor
processor function foractuator
function for actuator writing
writing transaction.
transaction.
Queries are written in a bespoke query language and are defined in a single query file within a
smart contract definition. By using queries,
queries, data
data can
can be
be easily
easily extracted
extracted from
from the
the blockchain
blockchain network.
network.
shown in
As shown inFigure
Figure10,
10,queries
queriescontain
containa adescription
description and
and a statement,
a statement, where
where thethe query
query descriptions
descriptions are
aare a string
string thatthat describe
describe the function
the function of query
of the the query
and and the query
the query statements
statements contain
contain the operators
the operators and
and functions
functions that control
that control the query
the query behavior.
behavior.
Sensors 2019, 19, 2228 16 of 26
Sensors 2019, 19, 2228 16 of 26
Figure
Figure10.
10.Query
Querydefinition insmart
definition in smartcontract.
contract.
Table
Table7 summarizes
7 summarizes a part
a ofpart
RESTofAPIsRESTgenerated
APIs by the composer-rest-server
generated for communication
by the composer-rest-server for
between the web between
communication client, IoTthe
device,
web and the blockchain
client, IoT device,network.
and theHTTP-based
blockchain RESTful
network.APIs contain a
HTTP-based
base URI, APIs
RESTful a media type that
contain defines
a base URI, state transition
a media typedata elements
that defines(e.g.,
stateApplication/json), and verbs (e.g.,
transition data elements (e.g.,
GET, POST, PUT, DELETE). The URI typically represents the path of the data entity,
Application/json), and verbs (e.g., GET, POST, PUT, DELETE). The URI typically represents the pathand the verb indicates
the desired
of the data action
entity,to be the
and performed in the identified
verb indicates the desiredresource
actionalong with the request.
to be performed in the For example,
identified a GET
resource
request to a the
along with resource URIFor
request. such as /api/Sensor
example, a GETwould
requestreturn
to a aresource
list of sensor information,
URI such while awould
as /api/Sensor POST
request
return atolist
theofsame URIinformation,
sensor would ask the server
while to accept
a POST the entity
request to theenclosed
same URI in would
the request.
ask the server to
accept the entity enclosed in the request.
Table 7. RESTful API used for interaction.
URI
Table 7. RESTful
Verb
API used Action
Media Type
for interaction.
/api/DeviceOwner
URI ALL
Verb Application/json
Media Type Device Owner Management
Action
/api/Sensor ALL Application/json Sensor Management
/api/DeviceOwner ALL Application/json Device Owner Management
/api/Actuator ALL Application/json Actuator Management
/api/Sensor
/api/Task ALL
ALL Application/json
Application/json Sensor Management
Task Management
/api/SensorReading
/api/Actuator GET,
ALLPOST Application/json Add Sensing
Actuator Data, Retrieve Sensing Data Log
Management
/api/ActuatorWriting
/api/Task GET,
ALLPOST Application/json
Application/json Task ManagementState, Retrieve Actuator State Log
Update Actuator
/api/system/historian GET Application/json Retrieve All Historian Records
/api/SensorReading
/api/system/identities GET, POST
GET Application/json
Application/json Add
Get Sensing Data, Retrieve Sensing Data Log
All Identities
/api/systemidentities/issue
/api/ActuatorWriting GET, POST
POST Application/json Update Actuator
Issue an IdentityState,
to theRetrieve
SpecificActuator State Log
Participant
/api/system/ping
/api/system/historian GET
GET Application/json
Application/json Test theAll
Retrieve Connection
HistoriantoRecords
the Blockchain Network
/api/system/identities GET Application/json Get All Identities
4.4. Execution Process and Results
/api/systemidentities/issue POSTof the Smart Space Case Study
Application/json Issue an Identity to the Specific Participant
/api/system/ping GET Application/json Test the Connection to the Blockchain Network
The execution sequence of the case study is described in Figure 11. First off, the device owner
inputs the information of a new device through the client and in turn the IoT server requests the REST
4.4. Execution Process and Results of the Smart Space Case Study
server using the POST method. The device information contained in the request is ingested by the
The execution
blockchain network.sequence
The device of the case studyisisstored
information described
in theinstate
Figure
DB11.
andFirst
the off, the transaction
related device owner is
inputs theininformation
recorded of a new
the blockchain device through
file system. thethe
Similarly, client and
task caninbeturn the IoT server
generated by therequests the REST
device owner in
server
the using thenetwork.
blockchain POST method. The device
The device owner information
can issue a taskcontained
requestin(e.g.,
the request is ingested by
read temperature) the
to the
blockchain network. The device information is stored in the state DB and the related transaction is
recorded in the blockchain file system. Similarly, the task can be generated by the device owner in
Sensors 2019, 19, 2228 17 of 26
Sensors 2019,
2019, 19,
19, 2228
2228 17 of
17 of 26
the blockchain network. The device owner can issue a task request (e.g., read temperature) to the
the blockchain network. The device owner can issue a task request (e.g., read temperature) to the
target device and
target and this request
request is first
first fetched byby the IoT IoT server. TheThe server parses
parses it in
in the respective
respective
target device
device and thisthis request is
is first fetched
fetched by the the IoT server.
server. The server
server parses it it in the
the respective
format
format and then passes it to the designated address of the device (e.g., temperature sensor). The
format andandthen
thenpasses
passesit to thethe
it to designated
designatedaddress
address of the
ofdevice (e.g., temperature
the device sensor).sensor).
(e.g., temperature The device
The
device collects
collects the temperature
the temperature data fromdata from
thefrom the sensor
sensor and responds the sensing data to the server.
device collects the temperature data theand
sensorresponds the sensing
and responds thedata to the
sensing server.
data to the Then the
server.
Then
server the server
visualizes visualizes
the data the
to data
the to
device the device
owner in owner
the in
client. the
At client.
the same At the
time, same
the time,
device the device
submits a
Then the server visualizes the data to the device owner in the client. At the same time, the device
submitsreading
sensor a sensor reading transaction
transaction to the to the blockchain
blockchain network by network
invoking bythe
invoking
related the related
API. The API. The
blockchain
submits a sensor reading transaction to the blockchain network by invoking the related API. The
blockchain
network network
records records the transaction
the transaction in the blockchain file system and stores the sensing data
blockchain network records theintransaction
the blockchain
in thefileblockchain
system and stores
file systemthe and
sensing data
stores theinsensing
the statedata
DB.
in
It the
also state
emits DB.
the It also emits
notification to the
the notification
client via to the
WebSockets, client via
since theWebSockets,
sensing valuesince the
exceeds sensing
the value
threshold
in the state DB. It also emits the notification to the client via WebSockets, since the sensing value
exceeds thethe
defined threshold defined by the smart contract.
exceeds by smart contract.
the threshold defined by the smart contract.
(a)
(a)
Figure 12. Cont.
Sensors 2019, 19, 2228 18 of 26
Sensors 2019,
Sensors 2019, 19,
19, 2228
2228 18 of
18 of 26
26
(b)
(b)
Figure 12. 12.
Figure
Figure 12. Snapshot
Snapshot of of
Snapshot
of device
device dashboard.
devicedashboard. (a)
dashboard. (a) Sensor
(a) Sensor dashboard;and
Sensor dashboard;
dashboard; and
and (b)
(b)(b) actuator
actuator dashboard.
dashboard.
actuator dashboard.
The
The snapshot
snapshot of of the
the task
task dashboard,
dashboard, where
where the
the device
device owner
owner cancan generate
generate and
and allocate
allocate IoT
IoT tasks
tasks
The snapshot of the task dashboard, where the device owner can generate and allocate IoT tasks
is
is presented
presented in
in Figure
Figure 13.
13. Each
Each task
task contains
contains aa URI
URI that
that stands
stands for
for the
the endpoint
endpoint of
of the
the service
service exposed
exposed
is presented in Figure 13. Each task contains a URI that stands for the endpoint of the service exposed
by
by the
the IoT
IoT device. The
device. The device
The device owner
device owner can
owner can deploy
can deploy the
deploy the task
the task to
to the
task to the specific
specific device,
device, and
and after
after confirming
confirming
by the IoT device. the specific device, and after confirming
the
the operation,
operation, the
the request
request is
is sent
sent to
to the
the physical
physical device.
device. For
For example,
example, to
to turn
turn off
off a
a red
red LED,
LED, and
and in
in
the operation, the request is sent to the physical device. For example, to turn off a red LED, and in
turn,
turn, the
the dashboard
dashboard displays
displays the
thenotification
notificationgenerated
generated from
fromthethe
blockchain
blockchainnetwork
networkto inform
to thatthat
inform the
turn, the dashboard displays the notification generated from the blockchain network to inform that
device status
the device
device is changed
status is changed
changedaccordingly.
accordingly.
the status is accordingly.
Figure 13.
Figure 13. Snapshot of
of task
task dashboard.
dashboard.
Figure 13.Snapshot
Snapshot of task dashboard.
Figure 14
Figure 14 represents
represents the
the snapshot
snapshot of
of sensing
sensing log
log history
history in
in aa timed
timed sequence.
timed sequence. Sensing
sequence. Sensing time
time is
is an
an
unalterable blockchain
unalterable
unalterable blockchainledger
blockchain ledger
ledger record
record time
timetime
record indicating
indicating when
when when
indicating the the reading
sensor
the sensor transaction
sensor reading transaction
reading transaction
is submitted. is
is
submitted.
The
submitted. The value
value presents presents
thepresents
The value numericalthe numerical
the values values
of readings
numerical of readings
values offrom from
the physical
readings the
from the physical
device, device,
in this
physical in this
case,inthis
device, case,
thisvalue
case,
this value
value represents
represents
this represents the temperature
the temperature
the temperature
value. value.
value.
Sensors 2019, 19, 2228 19 of 26
Sensors 2019, 19, 2228 19 of 26
Figure
Figure 14.
14. Snapshot
Snapshot of the sensing
of the sensing log
log dashboard.
dashboard.
5. Performance
5. Performance Evaluation
Evaluation andAnalysis
and Analysis
ThisThis section
section offers
offers actualevaluation
actual evaluation results
results to
to assess
assess thetheperformance
performance of of
thetheproposed
proposed IoT IoT
blockchain platform. Several experimental tests were carried out using different
blockchain platform. Several experimental tests were carried out using different performance metricsperformance metrics
in order
in order to provide
to provide a comprehensivemanner.
a comprehensive manner. TheThe service
serviceexecution
executiontime
timeincluded
included thethe
time for afor a
time
transaction request to be sent plus the length of time it takes for an acknowledgement to be received
transaction request to be sent plus the length of time it takes for an acknowledgement to be received
by the web client. For this test, we utilized the Postman, which is a tool to dissect RESTful APIs. It
by the web client. For this test, we utilized the Postman, which is a tool to dissect RESTful APIs.
provides a sleek user interface to customize scripts for simulating a heavy load on network. The first
It provides a sleek user interface to customize scripts for simulating a heavy load on network. The first
study was analyzed for the service execution time cost on device registration and the results are
study was analyzed
shown in Figure for 15. the
For service execution
this study, time cost
four groups on150,
of 50, device
250,registration and the
and 500 devices results are
information shown
were
in Figure 15. For this study, four groups of 50, 150, 250, and 500 devices information
provided to the proposed platform. This was implemented by using the simulation tool called were provided
to the proposed Caliper
Hyperledger platform. [54],This was
which implemented
allows by using
users to configure thethe
usesimulation
case script oftool calledblockchain
a specific Hyperledger
Caliper [54], which allows
implementation with ausers
set oftoindicators.
configure theTheuse case script
execution timeoftaken
a specific blockchain
by the proposedimplementation
blockchain
withplatform to perform The
a set of indicators. this transaction weretaken
execution time recorded in minimum,
by the average, andplatform
proposed blockchain maximum to time.
perform For this
the 50-device group set, the minimum time was recorded to be 2262 ms, averaging
transaction were recorded in minimum, average, and maximum time. For the 50-device group set, at 2286 ms, and
the maximum
the minimum timetime
waswas recorded
recorded to to
bebe 2375
2262 ms.averaging
ms, For the 150-device group
at 2286 ms, andset,
thethe minimumtime
maximum timewas
recorded to be 2375 ms. For the 150-device group set, the minimum time taken was recordedbe
taken was recorded to be 2257 ms, averaging at 2335 ms, and the maximum time was recorded to to be
2801 ms. For the 250-device group set, the minimum time was recorded to be 2254 ms, averaging at
2257 ms, averaging at 2335 ms, and the maximum time was recorded to be 2801 ms. For the 250-device
2585 ms, and the maximum time was recorded to be 3004 ms. Lastly, for the 500-device group set, the
group set, the minimum time was recorded to be 2254 ms, averaging at 2585 ms, and the maximum
minimum time was recorded to be 2267 ms, averaging at 2923 ms, and the maximum time was
timerecorded
was recorded to be 3004 ms. Lastly, for the 500-device group set, the minimum time was recorded
to be 4013 ms.
to be 2267 ms, averaging at 2923 ms, and the maximum time was recorded to be 4013 ms.
In our second study, we evaluated the service execution time on storing sensing data in the
blockchain network. All the devices had a HTTP client that was able to request the sensor reading
API from the REST server. Once the sensing data was appended in the blockchain, the REST server
fetched the execution results from the blockchain network and returned the response to the device.
The evaluation results of execution time on performing sensor reading transaction are reported in
Figure 16. In both scenarios, the experimental tests were performed by a number of concurrent clients,
and every test was measured ten times at randomly selected system resource utilization levels. It is
obvious from these two graphs that the transaction execution time increased when the scale of device
groups expanded. However, the response graph was steady and the overall transaction execution
capability could be assessed if no network congestion happened. Bitcoin takes 10 minutes to mine a
Sensors 2019, 19, 2228 20 of 26
blockchain; however, a bitcoin transaction generally needs six confirmations before it is finalized. As a
result, it can be expected that a transaction takes around an hour on average, which is unbearable to
the general public. Ethereum transaction times are around 15 seconds but the average time would
increase exponentially according to varied network environments. The experiment results from the
case study indicate that the proposed blockchain platform outperforms most other popular blockchain
systems in terms of transaction time. The limitation of this work is that the experiment given was built
on a limited size network, with only four peers. However, this is just a small case in order to prove the
usability of the designed approach. As we mentioned earlier, the proposed architecture is adopted in a
modular design that would be easy to extend. This can be achieved by adding a large number of peers
in the network, as the Hyperledger Fabric provides the scripts to construct the underlying structure of
the business network.
Sensors 2019, 19, 2228 20 of 26
In our second study, we evaluated the service execution time on storing sensing data in the
blockchain network. All the devices had a HTTP client that was able to request the sensor reading
API from the REST server. Once the sensing data was appended in the blockchain, the REST server
fetched the execution results from the blockchain network and returned the response to the device.
The evaluation results of execution time on performing sensor reading transaction are reported in
Figure 16. In both scenarios, the experimental tests were performed by a number of concurrent clients,
and every test was measured ten times at randomly selected system resource utilization levels. It is
obvious from these two graphs that the transaction execution time increased when the scale of device
groups expanded. However, the response graph was steady and the overall transaction execution
capability could be assessed if no network congestion happened. Bitcoin takes 10 minutes to mine a
blockchain; however, a bitcoin transaction generally needs six confirmations before it is finalized. As
a result, it can be expected that a transaction takes around an hour on average, which is unbearable
to the general public. Ethereum transaction times are around 15 seconds but the average time would
increase exponentially according to varied network environments. The experiment results from the
case study indicate that the proposed blockchain platform outperforms most other popular
blockchain systems in terms of transaction time. The limitation of this work is that the experiment
given was built on a limited size network, with only four peers. However, this is just a small case in
order to prove the usability of the designed approach. As we mentioned earlier, the proposed
architecture is adopted in a modular design that would be easy to extend. This can be achieved by
adding a large number of peers in the network, as the Hyperledger Fabric provides the scripts to
Figure
Figure
construct the underlying 16.
16.Performance
Performance
structure analysis
analysis
of the business graph of the
graph of
network. the sensor
sensorreading.
reading.
For the third study, we evaluated the system performance when querying sensing records stored
from the distributed ledger in the blockchain network. Figure 17 measured the execution time to
query data records from the blockchain by varying the amount of data from 500 to 10,000 records.
The minimum, average, and maximum delay time in ms taken by the proposed platform to retrieve
the sensing records were noted down ten times at randomly selected system resource utilization
Sensors 2019, 19, 2228 21 of 26
700 656
583 601 606
600 538 559
500
400
200
100
0
500 records 2500 records 5000 records 10000 records
Figure
Figure 17.
17. Performance
Performance analysis
analysis graph of the
graph of the sensing
sensing data
dataquery.
query.
Table 8. Comparative study of the proposed IoT blockchain platform with existing platforms.
The
The following
following properties
properties that
that play
play aa pivotal
pivotal role
role to
to compare
compare thethe overviewed
overviewed platforms
platforms are
are
considered for this study. Additionally, it reflects the overall performance of
considered for this study. Additionally, it reflects the overall performance of blockchain platform blockchain platform
and
and highlights
highlights the significance
the significance of ourofproposed
our proposed approach.
approach. As shownAs shown
from thefrom thethe
table, table, the presented
presented system
system in [43] is a somewhat similar approach, with the most similar characteristics
in [43] is a somewhat similar approach, with the most similar characteristics to our proposed work. to our proposed
work. As a result,
As a result, we chose
we chose to compare
to compare thisthis systemwith
system withour
ourproposed
proposed approach.
approach. The The simulation
simulation
environment
environment for this analysis was set up the same as the selected system in [43]. We simulated aa
for this analysis was set up the same as the selected system in [43]. We simulated
network
network of of 50
50 peers
peers and
and ran
ran the
the simulation
simulation for for 60
60 s,
s, during
during which 960 transactions
which 960 transactions werewere executed.
executed.
The
The processing
processing timetime metric
metric refers
refers to
to the
the time
time cost
cost on
on verifying
verifying new
new blocks
blocks inin the
the network.
network. Simulation
Simulation
results
results for evaluating the processing overhead are presented in Figure 18. As shown in the graph,
for evaluating the processing overhead are presented in Figure 18. As shown in the graph, the
the
processing overhead with our approach was lower than the selected system
processing overhead with our approach was lower than the selected system by varying the numberby varying the number of
blocks from
of blocks from10 10
to 60. In In
to 60. general,
general,ourour
approach
approach decreased
decreasedthethe
processing
processingtimetimeby by
22%.22%.
80
60
40
20
0
10 20 30 40 50 60
Number of Blocks
It
It is
is obvious
obvious to
to see
see that
that most
most systems
systems are
are built
built onon aa permissionless
permissionless blockchain
blockchain network,
network, which
which
allows
allows anyone
anyone toto participate,
participate, and
and every
every participant
participant isis anonymous. This means
anonymous. This means that
that neither
neither can
can there
there
be confidentiality of the contracts themselves, nor of the transaction data that they process. In
be confidentiality of the contracts themselves, nor of the transaction data that they process. In orderorder to
mitigate the lack of confidentiality, these systems issue their own tokens to incent costly mining
to mitigate the lack of confidentiality, these systems issue their own tokens to incent costly mining or or
to
to fuel
fuel smart
smart contract
contract execution. The transaction
execution. The transaction cost
cost and
and transaction
transaction speed
speed can
can be
be greatly
greatly affected
affected
by negative associations with cryptocurrencies. In addition, it obstructs the interaction with other
distributed systems, as the token used in both systems must be unified. In contrast, the proposed
system is built on a permissioned network, which diminishes the risk of a participant intentionally
introducing malicious code through the smart contract. These participants are known to each other
and all the actions are recorded on the blockchain in terms of the endorsement policy that was
established for the network and transaction type. Furthermore, most existing systems lack the support
of resource-constrained IoT devices, since they simply deploy full nodes on these devices to perform
time-consuming mining. However, the resource-constrained architecture of IoT has always been the
main hindrance in integrating IoT with the blockchain, since the consensus algorithms have to be
limited to work within these constraints. Some current works deploy heavy consensus algorithms
on other devices that are part of the IoT system, such as gateways. However, IoT gateways are
generally small devices lack storage space. Many blockchain platforms do not yet provide support for
lightweight nodes, and full nodes with an entire blockchain (more than 46 GB in Ethereum) must be
deployed on the gateway for validation of transactions and blocks. Furthermore, this makes gateways,
themselves, targets and also the first line of defense, since they act as bridges between devices and
the Internet. The proposed solution, however, presents a lightweight solution that avoids integrating
blockchain technology into IoT devices and these devices do not need any modification. The blockchain
is used as an external service to provide a reliable and secure storage. Besides, the transactions made
by IoT devices are validated in the blockchain network without downloading the entire blockchain.
Sensors 2019, 19, 2228 23 of 26
This improves the usability of our solution in a large variety of IoT scenarios with limited capabilities.
In addition, the communication between IoT devices and the blockchain network happens through
web service APIs, which enable cross platform communication. This approach also makes it possible
to integrate with existing systems.
This paper presents a real-life case study for smart space, which was implemented as part of the
experimental test in order to demonstrate the feasibility of the proposed system. This system is built on a
modular architecture that can be easily extended to meet all kinds of requirements in various application
domains, such as supply chain, energy trading, and data marketplace. For example, the proposed
system can be expanded in the food supply chain to improve transparency and efficiency, since the
blockchain technologies can provide a trusted source of information and traceability across the food
network. IoT sensors can be attached to any product, like fish that is relegated to someone for transport,
with remotely sensed data such as temperature, humidity, and location. By making a shared ledger
accessible to each party in the supply chain, all food processing steps can be recorded and stored on the
blockchain, including digital compliance documentation, test results, and audit certificates. The demand
for an IoT blockchain application that offers a permissioned network, no currency exchange, friendly
interface, flexible architecture, low latency of transaction, and high transaction throughput is high, and
this work aims to look for ways to solve all these issues mentioned above.
7. Conclusions
With billions of connected devices coming online, there are systemic challenges to scaling IoT.
Connected devices are always diverse and different from factors and manufactures. Therefore, identity
and interoperability need to be assured in a secure manner. Furthermore, centralized architecture
like the cloud model can have high costs, latency, and the risk of single point of failure. Blockchain
technologies provide a new security protocol and infrastructure to enable billions of IoT devices to
have trusted interoperability for both data and commerce. This paper outlines a novel approach for
the design and implementation of a decentralized IoT platform to address scalability, identity, and data
security challenges based on a permissioned blockchain network. A proof of concept of the proposed
approach is implemented by using the Raspberry Pi and various physical devices. We evaluate the
performance of the proposed system in various performance metrics, which indicated a steady level,
allowing effective transaction execution. Furthermore, a comparative analysis of the designed system
with existing works is performed to highlight the significance of this system in variety of aspects.
Although the coevolution of blockchain and IoT research studies is still in its infancy, this work
explores the potential applications of IoT and blockchain to improve efficiency and bring automation,
to revolutionize robust business solutions in various IoT scenarios. Future research directions aim at
testing the interoperability of the proposed system with different IoT frameworks. Furthermore, we
are planning to test other consensus algorithms and data storage technologies in order to improve the
transaction processing rate and make data query more efficient.
Author Contributions: L.H. conceived the idea for this paper, designed the experiments and wrote this paper;
D.-H.K. conceived the overall idea of the paper and proofread the manuscript.
Funding: This research was supported by the 2019 scientific promotion program funded by Jeju National University
and this research was supported by the MSIT(Ministry of Science and ICT), Korea, under the ITRC(Information
Technology Research Center) support program(IITP-2017-2016-0-00313) supervised by the IITP(Institute for
Information & communications Technology Promotion). Any correspondence related to this paper should be
addressed to Dohyeun Kim.
Conflicts of Interest: The authors declare no conflicts of interest.
References
1. Ahmad, S.; Hang, L.; Kim, D.H. Design and Implementation of Cloud-Centric Configuration Repository for
DIY IoT Applications. Sensors 2018, 18, 474. [CrossRef] [PubMed]
Sensors 2019, 19, 2228 24 of 26
2. Bhattacharjee, S.; Salimitari, M.; Chatterjee, M.; Kwiat, K.; Kamhoua, C. Preserving Data Integrity in
IoT Networks Under Opportunistic Data Manipulation. In Proceedings of the 15th IEEE Intl Conf on
Dependable, Autonomic and Secure Computing, 15th Intl Conf on Pervasive Intelligence & Computing,
3rd Intl Conf on Big Data Intelligence and Computing and Cyber Science and Technology Congress
(DASC/PiCom/DataCom/CyberSciTech), Orlando, FL, USA, 6–10 November 2017; pp. 446–453.
3. Sicari, S.; Rizzardi, A.; Grieco, L.A.; Coen-Porisini, A. Security privacy and trust in internet of things: The road
ahead. Comput. Netw. 2015, 76, 146–164. [CrossRef]
4. Khan, M.A.; Salah, K. IoT security: Review, blockchain solutions, and open challenges. Future Gener.
Comput. Syst. 2018, 82, 395–411. [CrossRef]
5. Fernandez-Carames, T.M.; Fraga-Lamas, P. A Review on the Use of Blockchain for the Internet of Things.
IEEE Access 2018, 6, 32979–33001. [CrossRef]
6. Zheng, Z.; Xie, S.; Dai, H.N.; Wang, H. Blockchain Challenges and Opportunities: A Survey. Available online:
http://inpluslab.sysu.edu.cn/files/blockchain/blockchain.pdf (accessed on 10 February 2019).
7. Yuan, Y.; Wang, F.Y. Towards blockchain-based intelligent transportation systems. In Proceedings of the
2016 IEEE 19th International Conference on Intelligent Transportation Systems (ITSC), Rio de Janeiro, Brazil,
1–4 November 2016; pp. 2663–2668.
8. Gordon, W.J.; Catalini, C. Blockchain Technology for Healthcare: Facilitating the Transition to Patient-Driven
Interoperability. Comput. Struct. Biotechnol. J. 2018, 16, 224–230. [CrossRef] [PubMed]
9. Dubovitskaya, A.; Xu, Z.; Ryu, S.; Schumacher, M.; Wang, F. Secure and trustable electronic medical records
sharing using blockchain. In Proceedings of the AMIA 2017, American Medical Informatics Association
Annual Symposium, Washington, DC, USA, 4–8 November 2017.
10. Hang, L.; Choi, E.; Kim, D.-H. A Novel EMR Integrity Management Based on a Medical Blockchain Platform
in Hospital. Electronics 2019, 8, 467. [CrossRef]
11. Paralkar, K.; Yadav, S.; Kumari, S.; Kulkarni, A.; Pingat, S.P. Photogroup: Decentralized Web Application
Using Ethereum Blockchain. Int. Res. J. Eng. Technol. 2018, 5, 489–492.
12. Raval, S. Decentralized Applications: Harnessing Bitcoin’s Blockchain Technology; O’Reilly Media, Inc.: Sebastopol,
CA, USA, 2016.
13. Brito, J.; Shadab, H.B.; Castillo O’Sullivan, A. Bitcoin financial regulation: Securities, derivatives, prediction
markets, and gambling. Columbia Sci. Technol. Law Rev. 2014. [CrossRef]
14. MacDonald, T.J.; Allen, D.W.E.; Potts, J. Blockchains and the Boundaries of Self-Organized Economies:
Predictions for the Future of Banking. In Banking Beyond Banks and Money; Tasca, P., Aste, T., Pelizzon, L.,
Perony, N., Eds.; Springer: Cham, Switzerland, 2016; pp. 279–296.
15. Swan, M. Blockchain: Blueprint for a New Economy; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2015.
16. Panarello, A.; Tapas, N.; Merlino, G.; Longo, F.; Puliafito, A. Blockchain and IoT Integration: A Systematic
Survey. Sensors 2018, 18, 2575. [CrossRef]
17. Kshetri, N. Can Blockchain Strengthen the Internet of Things? IT Prof. 2017, 19, 68–72. [CrossRef]
18. Joshi, A.D.; Gupta, S.M. Evaluation of design alternatives of End-Of-Life products using internet of things.
Int. J. Prod. Econ. 2019, 208, 281–293. [CrossRef]
19. Queiroz, M.M.; Samuel, F.W. Blockchain adoption challenges in supply chain: An empirical investigation of
the main drivers in India and the USA. Int. J. Inf. Manag. 2019, 46, 70–82. [CrossRef]
20. Wang, Y.; Singgih, M.; Wang, J.; Rit, M. Making sense of blockchain technology: How will it transform supply
chains? Int. J. Prod. Econ. 2019, 211, 221–236. [CrossRef]
21. Samaniego, Mayra, and Ralph Deters. Blockchain as a Service for IoT. In Proceedings of the IEEE International
Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom)
and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), Chengdu,
China, 15–18 December 2016.
22. Gervais, A.; Karame, G.O.; Wüst, K.; Glykantzis, V.; Ritzdorf, H.; Capkun, S. On the security and performance
of proof of work blockchains. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and
Communications Security, Vienna, Austria, 24–28 October 2016.
23. Sun, X.; Ansari, N. Dynamic Resource Caching in the IoT Application Layer for Smart Cities. IEEE Internet
Things 2018, 5, 606–613. [CrossRef]
24. Ethembedded. 2017. Available online: http://ethembedded.com/. (accessed on 1 February 2018).
25. Raspnode. 2017. Available online: http://raspnode.com/. (accessed on 1 February 2018).
Sensors 2019, 19, 2228 25 of 26
26. Reyna, A.; Martín, C.; Chen, J.; Soler, E.; Díaz, M. On blockchain and its integration with IoT. Challenges and
opportunities. Future Gener. Comput. Syst. 2018, 88, 173–190. [CrossRef]
27. Hang, L.; Jin, W.; Yoon, H.; Hong, Y.G.; Kim, D.H. Design and Implementation of a Sensor-Cloud Platform
for Physical Sensor Management on CoT Environments. Electronics 2018, 7, 140. [CrossRef]
28. Androulaki, E.; Barger, A.; Bortnikov, V.; Cachin, C.; Christidis, K.; De Caro, A.; Enyeart, D.; Ferris, C.;
Laventman, G.; Manevich, Y.; et al. Hyperledger fabric: a distributed operating system for permissioned
blockchains. In Proceedings of the Thirteenth EuroSys Conference, Porto, Portugal, 23–26 April 2018.
29. Xu, L.D.; Xu, E.L.; Li, L. Industry 4.0: state of the art and future trends. Int. J. Prod. Res. 2018, 56, 2941–2962.
[CrossRef]
30. Conoscenti, M.; Vetro, A.; Martin, J.C.D. Blockchain for the Internet of Things: A systematic literature Review.
In Proceedings of the 3rd International Symposium on Internet of Things: Systems, Management, and
Security, IOTSMS-2016, Agadir, Morocco, 29 November–2 December 2016.
31. Zyskind, G.; Nathan, O.; Pentland, A. Enigma: Decentralized computation platform with guaranteed privacy.
arXiv Preprint 2015, arXiv:1506.03471.
32. Huang, Z.; Su, X.; Zhang, Y.; Shi, C.; Zhang, H.; Xie, L. A decentralized solution for IoT data trusted
exchange based-on blockchain. In Proceedings of the 3rd IEEE International Conference on Computer and
Communications (ICCC), Chengdu, China, 13–16 December 2017.
33. Zhang, Y.; Wen, J. An IoT electric business model based on the protocol of bitcoin. In Proceedings of the 18th
International Conference on Intelligence in Next Generation Networks (2015), Paris, France, 17–19 February 2015;
pp. 184–191. [CrossRef]
34. Axon, L. Privacy-Awareness in Blockchain-Based PKI. Available online: https://ora.ox.ac.uk/objects/uuid:
f8377b69-599b-4cae-8df0-f0cded53e63b/datastreams/ATTACHMENT01 (accessed on 5 January 2019).
35. Atlam, H.F.; Alenezi, A.; Alassafi, M.O.; Wills, G.B. Blockchain with Internet of Things: Benefits, Challenges,
and Future Directions. Int. J. Intell. Syst. Appl. 2018, 10, 40–48. [CrossRef]
36. Lin, J.; Shen, Z.Q.; Miao, C.Y. Using Blockchain Technology to Build Trust in Sharing LoRaWAN IoT.
In Proceedings of the 2nd International Conference on Crowd Science and Engineering (ICCSE’17), Beijing,
China, 6–9 July 2017; pp. 38–43. [CrossRef]
37. Özyılma, K.R.; Yurdakul, A. Integrating low-power IoT devices to a blockchain-based infrastructure.
In Proceedings of the Thirteenth ACM International Conference on Embedded Software 2017 (EMSOFT ’17),
Seoul, Korea, 15–20 October 2017. [CrossRef]
38. Christidis, K.; Devetsikiotis, M. Blockchains and smart contracts for the Internet of Things. IEEE Access 2016,
4, 2292–2303. [CrossRef]
39. Pureswaran, V.; Brody, P. Device Democracy-Saving the Future of the Internet of Things. Available online:
http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?htmlfid=GBE03620USEN (accessed on 10 January 2019).
40. Tian, F. An agri-food supply chain traceability system for China based on RFID & blockchain technology.
In Proceedings of the 13th International Conference on Service Systems and Service Management (ICSSSM),
Kunming, China, 24–26 June 2016; pp. 1–6.
41. Huh, S.; Cho, S.; Kim, S. Managing IoT devices using blockchain platform. In Proceedings of the
19th International Conference on Advanced Communication Technology (ICACT), Bongpyeong, Korea,
19–22 February 2017; pp. 464–467.
42. Biswas, K.; Muthukkumarasamy, V. Securing smart cities using blockchain technology. In Proceedings of the
IEEE 14th International Conference on Smart City, Sydney, Australia, 12–14 December 2016; pp. 1392–1393.
43. Dorri, A.; Kanhere, S.S.; Jurdak, R. Towards an Optimized BlockChain for IoT. In Proceedings of the Second
International Conference on Internet-of-Things Design and Implementation (IoTDI), Pittsburgh, PA, USA,
18–21 April 2017. [CrossRef]
44. Daza, V.; Di Pietro, R.; Klimek, I.; Signorini, M. CONNECT: CONtextual NamE disCovery for blockchain-based
services in the IoT. In Proceedings of the 2017 IEEE International Conference on Communications (ICC),
Paris, France, 21–25 May 2017; pp. 1–6.
45. Ouaddah, A.; Elkalam, A.A.; Ouahman, A.A. FairAccess: a new Blockchain-based access control framework
for the Internet of Things. Secur. Commun. Netw. 2016, 9, 5943–5964. [CrossRef]
46. Bahga, A.; Madisetti, V.K. Blockchain Platform for Industrial Internet of Things. J. Softw. Eng. Appl. 2016, 9,
533–546. [CrossRef]
Sensors 2019, 19, 2228 26 of 26
47. Wörner, D.; von Bomhard, T. When your sensor earns money: Exchanging data for cash with Bitcoin.
In Proceedings of the 2014 ACM International Joint Conference on Pervasive and Ubiquitous Computing
(UbiComp 2014), Seattle, WA, USA, 13–17 September 2014; pp. 295–298.
48. Shafagh, H.; Hithnawi, A.; Duquennoy, S. Towards blockchain-based auditable storage and sharing of IoT
data. In Proceedings of the 9th ACM Cloud Computing Security Workshop (CCSW 2017), Dallas, TX, USA,
3 November 2017; pp. 45–50.
49. Xu, Q.; Aung, K.M.M.; Zhu, Y.; Yong, K.L. A blockchain-based storage system for data analytics in the
internet of things. In New Advances in the Internet of Things; Yager, R.R., Espada, J.P., Eds.; Springer: Cham,
Switzerland, 2018; pp. 119–138.
50. Cha, S.C.; Chen, J.F.; Su, C.; Yeh, K.H. A blockchain connected gateway for BLE-based devices in the internet
of things. IEEE Access 2018, 6, 24639–24649. [CrossRef]
51. Yu, C.X.; Zhang, L.P.; Zhao, W.F.; Zhang, S.C. A blockchain-based service composition architecture in cloud
manufacturing. Int. J. Comput. Integr. Manuf. 2019, 1–11. [CrossRef]
52. Szabo, N. Smart Contracts. 1994. Available online: http://szabo.best.vwh.net/smart.contracts.html (accessed
on 12 January 2019).
53. Gaur, N.; Desrosiers, L.; Ramakrishna, V.; Novotny, P.; Baset, S.; O’Dowd, A. Hands-On Blockchain with
Hyperledger: Building decentralized applications with Hyperledger Fabric and Composer; Packt Publishing Ltd.:
Birmingham, UK, 2018.
54. Hyperledger Caliper. Available online: https://www.hyperledger.org/projects/caliper (accessed on 15 January 2019).
© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).