Hierarchical Distributed Ledger For IoT Using Ethereum Blockchain

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Hierarchical Distributed Ledger for IoT using

Ethereum Blockchain
Prof. Irfan Siddavatam Prof. Ashwini Dalvi
KJ Somaiya College of Engineering KJ Somaiya College of Engineering
Mumbai, India Mumbai, India
irfansiddavatam@somaiya.edu ashwinidalvi@somaiya.edu

Shivam Pathak Kshitiz Srivastava


KJ Somaiya College of Engineering KJ Somaiya College of Engineering
Mumbai, India Mumbai, India
shivam.pathak@somaiya.edu kshitiz.s@somaiya.edu

Abstract— In the domain of Internet of things there are large maintained by all the nodes in the network [1]. Using
number of devices generating data in the network and submitting blockchains, we can easily verify the authenticity of the data
it to their respective configured data collectors. When the sensors in a decentralized manner.
are preconfigured by the data collectors, they can easily verify
the data coming from those sensors for its authenticity using The project provides a platform for buying and selling of
cryptography. But if a third party wants to buy that data, how sensor data which also ensures that the data in the given
can they trust the data collector for the authenticity of that data scenario is authentic and the ownership of that data is
i.e whether the data they are buying is real data or some established from the moment it is created. We will accomplish
randomly generated stream of numbers. In fact, the only option this need by keeping track of each instance of data along with
left is to trust the claim made by the collectors that the data they
are providing is authentic. This project resolves the trust issue by
maintaining a distributed public ledger of all the transactions
creating a distributed application using blockchains by happening in the network regarding data generated by sensor
distributing the trust factor to the entire network instead of nodes. The key concepts used in the projects are explained
trusting a single entity [5]. This system provides authenticity of further.
data generated by sensor nodes in the network.
A. Distributed Ledger
Keywords—Internet of things, Distributed Ledger, Blockchain, It is a type of digital database which is replicated across
Ethereum, Smart Contracts, DAPP multiple nodes where cloning of the database is defined by a
consensus algorithm and hence a single copy of the database is
shared among all of the nodes. It is employed in peer to peer
I. INTRODUCTION network model to counter centralized server model, where
The Internet of Things is nothing but connection of variety network resilience is of crucial importance.
of objects not limited to industrial machines to wearable B. Blockchain
devices. These devices by means of integral sensors collect
A blockchain is a type of data structure considered to be a
data and perform required task [2]. This data gathered by IOT
distributed ledger, which is cryptographically secured using
sensors is of critical value to many companies as they use this
consensus protocol [2]. It is created and maintained so as no
data for analysis to drive their business needs. The data
entity can tamper with the blockchain data without the
generated by sensors is ubiquitous, keeping track of its
approval of majority of the network. Blockchain in itself is
origination and trusting the data obtained from third party data
nothing but chain of blocks in which each block is a list of
generators is merely impossible without a system in place to
transactions along with the hash, timestamp and other
handle this issue. And even a central authority cannot be
metadata minted inside each one of them.
trusted to a great extent and another issue is that as the number
of devices in the network grows, the central server also needs C. Ethereum
to be upgraded exponentially. So we need a better solution to Ethereum is a blockchain platform that provides a global
address this problem of trusting the authenticity of data and infrastructure for creating and deploying distributed
management of the whole network in an efficient manner. applications on it [7]. It is most widely used platform for
Therefore, to provide data authenticity in a distributed distributed applications because it provides developers to
manner we have created a blockchain based distributed deploy turing complete code on the blockchain which are
application. A blockchain is cryptographically secured known as smart contracts and the language used to code the
distributed ledger which keeps on growing continuously and is contract is solidity. We can also create private blockchain
network easily using this platform. The infrastructure can within their own local network. And the global blockchain
move value around and represent the ownership of property. maintains a distributed ledger of data trading among the farm
managers and bidders. Inter-farm interaction happens only in
Below listed are some terminologies used for in-depth
the global blockchain by the farm managers of the respective
explanation of project implementation:
blockchains where data bidding takes place. The global
● Farm: It is a network of Iot nodes which generally blockchain consists of farm manager nodes only and there is
includes a number of Raspberry pis (or some data only one such blockchain in the entire network. In the global
collecting and computing device) as sensor nodes and blockchain, a normal user who is only interested in buying
full-fledged computer nodes as user nodes. sensor data can also take part, whom we may call as bidder.
● Farm Manager: This is the machine in the network This entire architecture is summarised in figure [1]. In the
which essentially acts as a data collector and and is mentioned figure, there are 4 different sensor farms, farm
the farm head who maintains and holds responsibility managers representing respective farms and 2 bidders. The
for the farm. farm manager is the only node which is involved in both local
● Bidders: A user who does not manage any farm but is and global blockchains. It carries the information back and
interested in buying the data. forth between local and global blockchain.
● Tokens: It is a representation of real world data
chunk inside the blockchain and the process creating
such instance of data is called tokenization. III. IMPLEMENTATION
To develop our distributed application we have created
II. ARCHITECTURE some private blockchains using ethereum platform. We
created 5 blockchains in total, 4 local and 1 global. In each
It is a distributed peer to peer modeled architecture. The
farm, there are 2 to 3 Raspberry Pis which collect and publish
network architecture of our implemented system is
sensor data to their respective farm managers and this is
hierarchical which has two levels of blockchain network viz
registered as a transaction in the blockchain. So the local
local and global. The purpose of having two levels of
blockchain contains information about who generated what
blockchain network is to make it more scalable in an
data and the essential attributes of the data and not the data
organised manner. All the networks implemented are private
itself because storing the data in the blockchain would mean
by design. There are multiple local farms each having their
exponential growth in the size if the blockchain which would
own unique blockchain and a farm manager in it who manages
require large amount of storage for the sensor nodes. So all the
the entire farm. And then there is one global blockchain which
trading takes place by tokenizing the data captured by sensor
connects all the farm managers from each farm.
nodes for a particular period of time. In local blockchain the
The local farm blockchain maintains a distributed ledger raspberry pis themselves perform the mining work and hence
of data interaction between sensor nodes and farm manager the sensor nodes themselves compete to add a block in the

Figure 1. Network Architecture of the Project DAPP


blockchain. While, farm managers only queries the local for denoting a particular node and private keys are used for
blockchain for sensor data and links that data to the external signing transactions broadcasted by them [4].
global blockchain, they perform mining in the external global
Once the farm manager receives the tokenized data, it
blockchain where data bidding takes place.
registers the new tokenized data on the global blockchain
For the functioning of the system we have written two which is done by interacting with the smart contract deployed
smart contracts [6] one for local data interaction where the on it. Once that data token is registered it is then enlisted in
origination of the data and their attributes are tokenized and the available for bidding section, where other farm managers
registered in the local blockchain and another for global data and bidders can bid and hence buy that data. Further there is a
bidding where farm managers and bidders sell and buy that limited time frame for which the bidding is open, after that the
tokenized data. Once the data is bought by the bidder, the bidding is closed by the owner farm manager and the
actual data is transferred to the buyer. All the interaction code ownership of that data is transferred to the highest bidder for
is written using solidity language and compiled and deployed the exchange of money. After that buyer gets the actual data.
on the blockchain. The code once deployed cannot be altered If no one bids on the data, the data is kept with the owner farm
by anyone and hence the actions performed on the tokenized manager itself. This is the flow of data in our private network.
data is registered in this immutable ledger.

Figure 2. Data Token in Smart Contract

The tokenized data in contract is shown in figure [2], in


Figure 3. Dapp Node Architecture
which the essential attributes of data are stored and all the
functions of the contract work on this data. Both the contracts For interfacing with this distributed blockchain application
have similar data attributes for the consistency of it across we have designed a web application which makes API calls
local and global blockchain. over RPC web protocol provided by each blockchain node
running in the network, so the API calls are local to the
machine itself as shown in figure[3]. All the calls are
IV. WORKING javascript based backend calls, hence the general user only
In our project we have some farms having their own deals with an elegant graphical. If the API call is ought to
individual local blockchain and global blockchain for inter- change the state of the blockchain then it results in a
farm interaction. The local smart contract is to record the data transaction and that transaction is then published in the
source. This is where the data production node is registered network for the miners to validate the transaction and add that
along with its unique data identification attributes. Once the transaction to the next block the mine. Once a miner mines the
data instance is tokenized and registered in the blockchain block, the block is added to the local copy of the blockchain of
using smart contract which is deployed on the same that node and the change is propagated to the entire network.
blockchain i.e local blockchain, it is then sent to the farm Other nodes in the network add that block to their blockchain
manager and the same transaction is registered in the local copy only after validating the block. If the consensus builds
blockchain. All the nodes participating in the network have a for the same change in the blockchain then that becomes the
public key and a private key associated with them. That key new state of the chain. And this happens for all the
pair acts as their ethereum account for ether storage and transactions initiated in the network. This process of block
transfer which has monetary value in it. Public keys are used mining, validation and propagation is carried out by the
miners in the network. While mining, the job of the miner is to
add transactions for its new block creation and perform a provided in the application can deal with any type of mass
certain mathematical proof of work. Proof of work requires produced data set trading on a large scale where the data could
time to solve as huge amount of computation is involved to be anything from general environment data to body sensor
solve it and it is in place to keep the miners honest because data, in our case it is pollution data. Such integration of
even if a miner wants to add an invalid transaction in the blockchain in IOT domain will solve scaling and data tracking
block, it has to invest its computation power to calculate the problems of the nodes in the network.
proof of work, after that it has to propagate the mined block
then that propagated block is checked for validation by other REFERENCES
miner nodes in the network before adding that block to their [1] S. Huh, S. Cho and S. Kim, "Managing IoT devices using blockchain
blockchain copy and they don’t do it as it contains an invalid platform," 2017 19th International Conference on Advanced
Communication Technology (ICACT), Bongpyeong, 2017, pp. 464-467.
transaction but instead they keep on mining for a new block,
[2] M. Conoscenti, A. Vetrò and J. C. De Martin, "Blockchain for the
hence the consensus does not build on the invalid block and Internet of Things: A systematic literature review," 2016 IEEE/ACS
the dishonest miner wasted its energy on nothing. And also the 13th International Conference of Computer Systems and Applications
ones who are the honest miners get rewarded for mining a (AICCSA), Agadir, 2016, pp. 1-6.
valid block. This is how the proof of work plays a crucial role [3] A. Dorri, S. S. Kanhere and R. Jurdak, "Towards an Optimized
in blockchain technology. BlockChain for IoT," 2017 IEEE/ACM Second International Conference
on Internet-of-Things Design and Implementation (IoTDI), Pittsburgh,
PA, 2017, pp. 173-178.
[4] A. Dorri, S. S. Kanhere, R. Jurdak and P. Gauravaram, "Blockchain for
V. CONCLUSION IoT security and privacy: The case study of a smart home," 2017 IEEE
International Conference on Pervasive Computing and Communications
By building a hierarchical blockchain we have created an Workshops (PerCom Workshops), Kona, HI, 2017, pp. 618-623.
easy to scale solution for data trading with trust being [5] Blockchain based trust & authentication for decentralized sensor
decentralised to the entire network. The design complies with networks. Axel Moinet, Benoit Darties, and Jean-Luc Baril
the intuitive nature of large scale data production https://arxiv.org/pdf/1706.01730.pdf
environments and caters to the need of data trading from the [6] Smart Contracts written and used for data transaction and bidding.
https://github.com/shvmpthk/ProjectSmartContracts
ones who capture it from remote location and sell it for
[7] https://github.com/ethereum/go-ethereum/wiki
research and other purposes to the ones who need it for data
[8] https://blockgeeks.com/blockchain-explained/
processing irrespective of the geographical location. And due
to the distributed nature of application, blockchain technology [9] http://chainskills.com/2017/02/24/create-a-private-ethereum-blockchain-
with-iot-devices-16/
fills the trust gap by rewarding the honest miners and
economically punishing the dishonest ones. This solution

You might also like