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

Front. Comput. Sci.

https://doi.org/10.1007/s11704-018-6524-3

SMER: a secure method of exchanging resources in


heterogeneous internet of things

Yu ZHANG1 , Yuxing HAN 2


, Jiangtao WEN 1

1 Computer Science and Technology Department, Tsinghua University, Beijing 100084, China
2 Engineering College, South China Agricultural University, Guangzhou 510642, China


c Higher Education Press and Springer-Verlag GmbH Germany, part of Springer Nature 2018

Abstract The number of IoT (Internet of things) connected percent in 2015. Although a large amount of IoT devices can
devices increases rapidly. These devices have different oper- help people better perceive and communicate with world, at
ation systems and therefore cannot communicate with each present, vast majority of IoT devices are connected to their
other. As a result, the data they collected is limited within own server or clouds and have their own system. As a result,
their own platform. Besides, IoT devices have very con- computing power, storage and band width of these devices
strained resources like weak MCU (micro control unit) and or servers are not fully utilized and they are idle for most
limited storage. Therefore, they need direct communication of the time. This is mainly caused by the following factors:
method to cooperate with each other, or with the help of 1) Heterogeneous devices cannot communicate or exchange
nearby devices with rich resources. In this paper, we pro- resources directly with each other. 2) Even if they can com-
pose a secure method to exchange resources (SMER) be- municate directly, resources of these devices cannot be pro-
tween heterogeneous IoT devices. In order to exchange re- vided for free, because they will cost energy, band width and
sources among devices, SMER adopts a compensable mech- storage spaces etc. 3) Even if resources can be offered with a
anism for resource exchange and a series of security mecha- price, the major concern is how to make resource exchange
nisms to ensure the security of resource exchanges. Besides, between two less trustable devices successful and reliable.
SMER uses a smart contract based scheme to supervise re- In order to exchange these resources, some researches have
source exchange, which guarantees the safety and benefits of been done [1–3]. In these researches, IoT devices act as inde-
IoT devices. We also introduce a prototype system and make pendent economic entities and transfer encrypted coins with
a comprehensive discussion. each other with encrypted coins as a value scale in P2P re-
Keywords Internet of things, P2P resource exchange, source exchanges. However, not only did their work not dis-
blockchain, smart contract cuss about resource exchange problems, but also the secu-
rity model and other abnormal conditions are not involved.
Motivated by such challenges, we propose a secure method
1 Introduction of exchanging resources in heterogeneous Internet of Things
(SMER). SMER system can support heterogeneous IoT de-
It is estimated that there are more Than four billion mobile
vices to exchange resources directly with each other. It is
devices used as sensors today. The number of fixed sensors
based on encrypted coins and Blockchain, which guarantees
is even larger. Consulting company Gartner said the number
the security of resource exchanges and resource exchange
of processors, sensors and communications would rise to 36.2
rules from malicious tampers. Specifically, it includes follow-
Received November 14, 2016; accepted September 7, 2017 ing features:
E-mail: yuxinghan@scau.edu.cn Compatibility: SMER system allows heterogeneous IoT
2 Front. Comput. Sci.

devices to communicate with each other on a P2P network. of heterogeneous devices can exchange resources in a prof-
That is to say, they do not have to transfer their resources itable, secure and private environment. Every device in this
to a central server which may incur data loss or latency. It system is an independent economic entity that can offers
also supports automatic, rapid and secure transfer between its resources and buy resources from other devices. What’s
devices without support of central organization. more, every device in SMER will strictly obey the resource
Security: SMER system uses blockchain as infrastructure exchange rules, and smart contract mechanisms of SMER
of resource exchange rules and trade records, which not only system ensure the exchange rules cannot be tampered or de-
supports resource exchange between two less trustable de- stroyed. Besides, security and privacy of all devices are well
vices, but also ensure the openness and non-tampering fea- protected.
ture of resource exchange.
Privacy: Resource exchanges are within several local de- 2.2 Challenges
vices so that data is not sent to any remote server or cloud.
Based on above motivations, in this subsection we discuss
This guarantees the privacy of data and devices.
various issues and challenges in creating a large resource ex-
As depicted above, we need to study SMER and realize se-
change system, which can support massive heterogeneous de-
curity, rapid and automatic resource exchange. Our target is
vices.
to take full advantage of idle resources among heterogeneous
Resource exchange network Because central server
devices.
based systems would introduce huge latency and bring about
The reminder of this paper is structured as follows. In Sec-
problems of low performance and security problem, we have
tion 2, we look into the motivation and challenges in build-
to build a secure P2P network as foundation. Besides, this
ing such a system. Section 3 provides a discussion of related
system has to serve as a fundamental financial platform. This
research works. SMER system and its architecture are pre-
is because participants in resource exchanges have to act as
sented in Section 4. In Section 5, we introduce the operational
independent financial entities that have their own wallets, ad-
model. Section 6 discusses implementation details and evalu-
dresses and private keys for automatic selling and buying.
ation results of SMER and Section 7 discusses overall system
and comments on security and privacy aspects. We conclude Heterogeneous devices Because the resource (e.g., com-
the paper and briefly discuss our future work in Section 8. puting power, storage or bandwidth) of a single device is
limited, it is meaningless to exchange resource among a few
homogeneous devices. In order to take full advantage of re-
2 Motivation and challenges source exchange, there must be a lot of heterogeneous de-
vices, and their resources (e.g., ARM MCU, CPU, and GPU)
2.1 Motivation
can be combined to complete one task. As a result, how to
Resource exchange between devices will bring significant distribute and manage these resources is a big challenge.
benefits to the development of Internet of things. Firstly, as Resource exchange mechanism In the human world,
discussed in Section 1, many devices (including both IoT de- people use paper contracts to define rules of resource ex-
vices and servers) are idle for most of time. Therefore, an ef- change with an authority department in charge of the compul-
ficient resource exchange mechanism can prevent these idle sory execution part. However, in IoT, there are no third parties
resources from being wasted. Secondly, the number of IoT involved in P2P based resource exchanges. Therefore, exist-
devices is very large, so central network is not suitable. But ing models cannot be taken as references. We need to design
P2P network can give full play to the potential of Internet of a new mechanism which has the following functions: 1) Re-
things. SMER system is a P2P network in which every de- source exchange rules are transparent to all devices involved.
vice is an independent economic entity. They can sell their 2) A single device cannot modify or destroy the content of
own resources or buy resources provided by other devices. exchange rules. 3) Judgment of these rules is compulsory. 4)
And since there is no central node, SMER system has unlim- This rule provides a scale that can price the resources.
ited scalability in theory. Thirdly, because resource provided Security problem Security problem is always the weak-
by other devices are not priced, we need a “currency” to price ness of Internet of things. People are concerned about
those resources. Besides, this mechanism can encourage de- whether their smart devices are controlled or monitored by
vices to offer their resources. crackers. Security problems are more serious in resource ex-
In our work, we created a P2P system that a huge amount change. We have to ensure the money of devices is not stolen
Yu ZHANG et al. SMER: a secure method of exchanging resources in heterogeneous internet of things 3

by others and malicious devices who do not pay for the re- It can also automatically pay for them after the transaction
source. Besides, we have to prevent resource exchange rules is successful. In [8], EC Ferrer propose a method that can
from being modified. In a word, we must guard interest and combine blockchain with other distributed systems, such as
security of both resource providers and resource buyers. robotic swarm systems, to provide necessary capabilities to
make robotic swarm operations more secure, autonomous,
flexible and profitable. Sikorski et al. etc. [9] introduce appli-
3 Related work cations of blockchain technology related to the 4th Industrial
Revolution (Industry 4.0) and present an example to employ
The resource exchange of devices. Authors in [2–5] work
blockchain to facilitate machine-to-machine (M2M) interac-
on issues and challenges in existing distributed application
tions. However, these studies are only discussed about the
processing frameworks (DAPFs) in developing, implement-
payment function between devices. The issue of resource ex-
ing, and executing computational intensive mobile applica-
change between heterogeneous devices is not involved. In [1],
tions within mobile cloud computing (MCC) domain. The
Dominic Worner in Zurich university described a prototype in
authors in [6] integrated resource of idle IoT devices and
2014 that take bitcoin as the measurement for sensors. Their
use map reduce mechanism to allocate tasks. He also built
prototype are build on the bitcoin network that every device
a prototype system that is consisted of a controller, an an-
have a bitcoin account. And they use bitcoin script to iden-
droid phone and several sensors installed with Contiki OS.
tify these devices and realize simple information exchanges.
The controller receives missions from a phone and allocate
Christidis et al. [10] describes a framework to create a mar-
them to IoT devices according to a map reduce based al-
ketplace of services between devices.
gorithm. At last, controller will transmit results back to the
However, these works just simply use payment function of
phone.
the Blockchain. In practical, there are many complex rules
Although these studies have discussed about how to recon- in resource exchange among devices, some even attached to
stitute idle IoT devices to a cloud that can provide computing one another . As a result, a comprehensive model are needed
power and storage, these services are free of charge. That is to realize a security, profitable and automatic resource ex-
to say, resource provider devices cannot get paid in resource change between heterogeneous IoT devices under low trust
exchanges. The authors in [7] propose an incentive model conditions, and ensure effective usage of idle resources.
to encourage idle mobile phones to offer their resources ac-
tively and participate in resource exchanges. However, There
are no third parties to monitor whether these incentive mech- 4 SMER architecture
anisms are followed, or to prevent these mechanisms from
being modified by malicious devices. What’s more, strange SMER is a secure system of exchanging resources in het-
resource provider devices and resource demander devices do erogeneous Internet of Things. In this section, we start with
not trust each other. As a result, it is an important problem an introduction of basic concepts in the combination of IoT
about how to exchange resources under low-trusted condi- and Blockchain. Then a layered architecture is specified. At
tions. last, based on this architecture, we propose the framework of
SMER and introduce mechanisms of each module.
IoT devices on blockchain Business value department of
IBM propose “Empowering the edge” and a white paper of 4.1 The relationship between IoT and blockchain
“ADEPT: An IoT Practitioner Perspective” in 2014. The au-
thor of “Empowering the edge” argues that Internet of things Resources of devices come at a price. They include comput-
should not be composed of several central servers and many ing power, spaces for storage, bandwidth and energy con-
small devices. Instead, it should be a P2P network that are sumption etc. Free resource supply is only suitable within a
comprised by a lot of edge devices. ADEPT is an IoT finan- company, but it is not suitable for the entire eco-system of IoT
cial platform that give every device an independent account, resource exchanges. Therefore, we need a mechanism that
so that they can send bills to each other. Other functions in- can compensate resource providers. However, the currency
clude the exchange of messages and files. They also designed in human world is issued and controlled by banks. A single
a prototype washing machine and displayed it on CES2015. device cannot open an account in a bank. What’s more, the
The washing machine can automatic contact customer ser- transaction could be fully controlled by banks. As a result,
vices or retailers when it is in trouble or short of laundry. it is impossible to meet the requirement of a large amount
4 Front. Comput. Sci.

of devices to exchange resources. Therefore, SMER system account security and transaction records are also within its
uses an encrypted currency and Blockchain as the basis for responsibility.
resource transaction.
Encrypted currency In this paper, encrypted currency
is used as the API of a uniform value measuring methodol-
ogy. Because both encrypted currency and resource exchange
rules of IoT devices are programs, encrypted currency is de-
signed for IoT devices. Each device has a unique public key
and an unique private key. Public key records the wallet ad-
dress so that others can transfer money to the owner. Private
key is only known by the device itself and is used to authorize
transactions. On the other side, because different resources of
devices come at different prices, the resource demander de-
vice needs encrypted currency as a scale to pay the resource
provider device fairly.
Fig. 1 The layered architecture of SMER system
Blockchain It is the basis of encrypted currency. In es-
sential, Blockchain is a P2P distributed database. Each de-
Exchange rules layer is designed to regularize resource ex-
vice is free to register an account on Blockchain. Transfer
changes. Like a contract, it specifies behaviors of resource
between devices are free, and without any third-party re-
providers and resource demanders, as well as penalty for vio-
strictions. Transfer records of encrypted money will be writ-
lating rules. Resource exchange rules in this layer can link to
ten into a block, which will be appended to Blockchain by
device accounts in financial infrastructure layer, and then op-
computing powers. After being added to Blockchain, transfer
erate these accounts according to pre-defined content. In ad-
records will not be revoked. Then it is visible to all devices.
dition, this layer is also responsible for security of the rules.
As a result, an unilateral modification will not change any
The resource exchange layer is responsible for managing
information in Blockchain.
heterogeneous devices and their resources. It offers uniform
Blockchain can also be understood as a general ledger, so
and standard interface for both devices and their resources.
balance of a device can be calculated by Eq. (1):
As a result, devices in this layer only need to ask or offer their
balance = totalrevenue − totalexpenditure. (1) resources, but do not have to care about the communication
When a resource demander device asks for a checkout, problem of heterogeneous architecture.
Blockchain will traverse all blocks to compute the balance The hierarchical architecture brings huge benefits to
so as to check whether deals can be completed. Similarly, SMER system. That is to say, SMER system will not specify
resource exchange rules can be written into Blockchain. Ac- the type or way of devices to exchange resources, but through
cording to the principles of P2P distributed database, resource the content of rules in exchange rules layer to restrict their be-
exchange rules are copied to all devices and any unilateral havior, and arbitrate the result of the resource exchange. That
modification is illegal. This ensures the security and trans- is to say, exchange of resource can be achieved by any means,
parency of resource exchange. What’s more, resource ex- as long as it can be monitored and verified by exchange rules.
change rules and device accounts are in a same Blockchain. Therefore, heterogeneous IoT devices can exchange their re-
Hence rules can operate directly on device accounts accord- sources directly and freely in SMER system.
ing to results of resource transactions so as to complete the
4.3 Framework
financial part.
Corresponding to the layered architecture, we propose the
4.2 Layered architecture
framework of SMER system. Three levels of layered archi-
As shown in Fig. 1, SMER system is constituted of a financial tecture from bottom to top correspond to devices’ account
infrastructure layer, an exchange rules layer and a resource module, resource exchange rules module and IoT devices
exchange layer. Financial infrastructure layer is the basis of module, respectively. As shown in Fig. 2, SMER system is
resource exchange. It is responsible for creating and manag- consisted of two parts: IoT devices and the Blockchain.
ing accounts for each IoT device. Besides, transfer accounts, The IoT devices part This part is divided into re-
Yu ZHANG et al. SMER: a secure method of exchanging resources in heterogeneous internet of things 5

source exchange devices and Blockchain maintenance de- party financial supervisor. The resource exchange rules mod-
vices. Resource exchange devices can be divided into re- ule is made up of a series of smart resource exchange con-
source provider devices and resource demander devices. The tracts. Different smart contracts have different content, like
resource exchange is conducted through the P2P network and resource exchange rules of computing power, storage, data,
without any third party interferences. As long as these actions and so forth. It gives a detailed description on the actions
can be monitored and verified by the Blockchain, the way of of two sides in the process of resource exchange. Only if
resource exchanges can be various. For example, the comput- content in smart contracts have been fulfilled (e.g., resources
ing power can be provided via map reduce way, the storage have been provided), actions (e.g., transfer the money) that
space can be provided through distribute storage mode, data specified in advance in contracts will be enforced. The smart
can be exchanged even by a direct transmission, etc. contract also stipulate appropriate measures to take if these
terms have not been fulfilled. In human world, the contract is
handed over to a third party (e.g., a lawyer) and enforced by
law. However, there are no third parties in the world of de-
vices. Therefore, on the one hand, these smart contracts have
to be written into the Blockchain to ensure its security and
anti-tamper, on the other hand, they need the permission to
operate directly on devices’ accounts.

5 Operational model
In SMER system, a manufacturer will write unique ID,
accounts and hardware information of devices into the
Fig. 2 The framework of SMER system
Blockchain presenting their beginning of life when they are
at the factory. Once registered, these devices will become a
Blockchain maintenance devices are also known as miners.
unique entity in the Blockchain throughout its life. What’s
In PoW mechanism, they provide computing power to sup-
more, because of the security mechanism of the Blockchain,
port normal operation of the Blockchain. In PoS mechanism,
information of devices cannot be modified. This means the
devices that have a higher stake at the currency (i.e., hold a lot
Blockchain itself becomes the most trustworthy database.
of coins) can determine the next block. Precisely because of
Therefore, as shown in stage 1 of Fig. 3, heterogeneous de-
the support of these devices, transaction records and resource
vices with an authentic and unique identity can take part in
exchange protocols of the whole network can be constantly
basic financial activities on the Blockchain, which acts a third
written into the Blockchain. Logically speaking, resource ex-
party supervisor here.
change devices are separated from Blockchain maintenance
devices, they may be on a same physical device in real world
applications. But it should be noted that most IoT devices
have very constrained computation power to maintain the
Blockchain in PoW mechanism. In practical, there are some
special devices suitable for Blockchain maintenance. In PoS
mechanism, poor computer power is not a problem.
The Blockchain part From the perspective of the archi-
tecture model of SMER, this part is superimposed on IoT de-
vice network. And it is constituted by accounts of devices
and resource exchange rules. The account module is respon-
sible for managing informations for all IoT devices, as well as Fig. 3 The operation model of SMER system
mechanisms of transfer, security and other aspects. The role
of account module is similar to a bank, but it is not attached Because of the complexity of the resource exchange’s pro-
to any third party and exist on all devices. By means of co- cess that contains many stages and possibilities, only simple
regulatory mechanisms, account module virtualizes a third transfer between devices’ accounts cannot meets the needs of
6 Front. Comput. Sci.

the resource transaction. Hence we need a mechanism that puting power for this data processing service, it will send a
with contract functions and the enforcement power to ensure request to this smart contract. After receiving the request, the
the resource exchange to go smooth. In Fig. 3, phase 2 and contract inquires informations of this device in Blockchain
phase 3 are actually performed simultaneously. IoT devices to check whether its capacity and credit are enough for data
are in constant interaction with the smart contract. If a condi- processing. If it could, as shown in phase 2 of Fig. 4, the
tion in a smart contract is reached, then a corresponding ac- contract will return a acceptance, a unique ID and its status.
tion will be triggered. In the mean time, the status of this con- The ID is the identity of this resource provider in resource
tract is changed and a new condition will be presented. This exchange, and the status is responsible for recording which
process will continue until the contract is finished. SMER stage the contract is at and what actions should be taken. In
system takes a resource exchange smart contract as a state this contract, initial status is IDLE which means data process-
machine. Both sides of resource exchange are depending on ing service is available now. There may be a lot of resource
status of contracts to decide the next move. provider devices and resource demander devices in real sit-
Any person or even devices can create a smart contract uation. In order to clearly describe this process, we assume
with a unique address. Once the address of a contract is that there are only one resource provider and one resource
known by people or devices, content of this contract is visible demander.
to them too. Thus the resource exchange contract is transpar- Getting the resource provider devices list As shown in
ent to everyone, and each device has right to decide whether phase 3 of Fig. 4, the resource demander sends a request to
to participate in the contract. the smart contract to fetch lists of resource provider devices.
The type and content of the resource exchange smart con- In phase 4, the smart contract returns a list which contains
tract cover many aspects. For clarity, we use the example of a IDs and details of available resource provider devices. Then
data processing contract. As shown in Fig. 4, there are three the resource demander will choose one provider in that list
virtual participant in this smart contract: a resource provider, according to their credit in a reputation system. This problem
a resource demander and a smart contract. It should be no- is out of the scope of this paper and not be covered here.
ticed that the smart contract itself is not an independent en- Data processing preparation stage Because it is a data
tity in P2P network. In fact, it is existing in all devices across processing contract, the resource demander device has to
network, and the mechanism of Blockchain ensures its safety send raw data to a specified address according to the contract
and enforcement power. In this paper, we assume both sides (The specified address is a encrypted address on the Internet,
in this resource exchange know the address of the smart con- which is designed by the resource demander and can be ac-
tract and agree content of it. cessed by the resource provider). Then, as shown in phase 5
of Fig. 4, the resource demander sends a request to the con-
tract asking it to check the data. The contract will change
the status to CHECKING_DATA after receiving the request.
After monitoring status changes of the smart contract (Phase
6), the resource provider will check the data in specified ad-
dress and change status of the contract according to the re-
sult (Phase 7). If the result of raw data checking is passed,
the resource provider device will send a request to the smart
contract asking it to change status to READY. Otherwise the
status will change back to IDLE. After submitting raw data,
the resource demander device will keep listening to the status
of the contract (Phase 8). If the status changes to READY,
it could move to the next step. If the status changes back to
IDLE, it indicates that the data checking is failed, and it has
to check whether the raw data is correct and re-upload it later.
Fig. 4 The process of the resource exchange Data processing stage After the status becomes READY,
the resource demander device will send a request to the con-
Registering the resource provider device As shown in tract asking for processing the raw data (Phase 9). Along with
phase 1 of Fig. 4, if a device is willing to provide its com- the request, the processing fee is sent to the smart contract at
Yu ZHANG et al. SMER: a secure method of exchanging resources in heterogeneous internet of things 7

the same time. The smart contract will host the processing berry Pi, a mac-book, a laptop and 3 servers. All devices are
fee and check whether it has reached the minimum of data in a local area network (LAN). The purpose of using differ-
processing cost that predefined in the contract. If the fee is ent types of devices is to simulate resource exchange between
enough, the contract will change the status to PROCESSING heterogeneous devices.
which means that the resource provider device can start pro- Table 1 The devices list
cessing the raw data (Phase 10). Once the resource provider Device CPU GPU RAM OS
is finished, the resource provider will send the processed data RaspPi Cortex-A7 900MHz \ 1GB Linux 3.18
to a predefined address, besides, it will also send a request to Laptop Inter core2 1.2GHz \ 2GB Window 7
the contract asking it to change status to FINISH (Phase 11). server1 Inter XeonE3 3.5GHz \ 32GB Linux 3.16
server2 Inter XeonE3 3.5GHz \ 32GB Linux 3.16
Checking and payment stage When the resource de-
server3 Inter XeonE3 3.5GHz GTX240 1.34GHz 32GB Linux 3.16
mander device finds the status turns to FINISH (Phase 12), mac Inter core i5 1.4GHz \ 4GB MacOS X
it will check the processed data at a specified address. If the
checking is passed, it will send requests to the contract asking The Blockchain is build by Ethereum. Ethereum is a decen-
it to change status to IDLE and pay for the resource provider tralized platform that runs smart applications exactly as pro-
device. Otherwise, the status will be changed back to PRO- grammed without any possibility of downtime, censorship,
CESSING (Phase 13). Once finding the status of the contract fraud or third party interference. And the language of smart
has changed back to PROCESSING, the resource providing contract is solidity. In this experiment, we create a private
device will re-process the raw data. If the status steps for- Blockchain in local network.
ward to IDLE, the resource provider is available again and it In this prototype, the type of resource exchange is comput-
can continue to serve other resource demander devices. ing power. Specifically, a resource demander device have a
It is not difficult to find that the smart contract is largely number of raw pictures with 24-bits BMP format and want
played a role of a state machine. Heterogeneous devices do resource provider devices to compress them to JPEG format.
not need to communicate with each other directly, they just Specifically, this experiment used the PIL library of Python to
have to perform an appropriate action depending on the sta- complete image process tasks, the JPEG quality values is 50.
tus of the contract. This solves the communication problem All network adapters and switches are in a same LAN, and
between heterogeneous devices. On the other side, since the all of them support a maximum transfer rate of 100 Mbps.
device in the Blockchain is unique, the smart contract can The resolution of one raw picture is 800×600 and its size is
easily determine corresponding permissions of each device. 1.4MB.
As a result, devices cannot modify the status of the contract The purpose of this experiment is to verify the validity of
arbitrarily. For instance, a resource provider device is not able the proposed resource exchange model and progress. Security
to change the status from FINISH to IDLE and get the host- and fraud problems are discussed in next section.
ing fee from the contract. Only the resource demander device In the first place, we used Ethereum to set up a private
can perform this operation. Blockchain on a LAN and connect all devices to it. In or-
In practical, there is no way every device in resource ex- der to understand the experimental process, we built a Web
change abides by the law like they do in this example. There page to monitor the whole experimental process. As shown in
must be some malicious devices or people that focus on find- Fig. 5, there are six devices in the Blockchain and the average
ing vulnerabilities to obtain improper benefits. Besides, the network hash rate was 500Mhz.
processing time is also necessary to be specified because we
cannot allow data processing for too long or with unlim-
ited retries after it failed. These contents are discussed in
Section 7.

6 Implementation and evaluation

In order to verify the validity of the model in this paper, we


have created a proof of concept implementation of SMER.
As shown in Table 1, our prototype system includes a Rasp- Fig. 5 Show the devices’ list
8 Front. Comput. Sci.

Then we create a resource exchange smart contract accord- As shown in Fig. 6, the time needed by the server is the
ing to the procedure in Section 5. It contains following func- shortest, and the Pi is significantly slower than the server be-
tions: “call for processing”, “finish” and “confirmation”. cause its hardware limitations. Due to data transfer times and
confirmation times of the Blockchain, the speed of SMER
Algorithm 1 Smart contract: call for processing
system for one bmp compression is the lowest. Besides, the
1: function callForProcess(id)
2: if msg.value >= 6 then
number of resource exchange devices is very small (i.e., only
3: tr.status=“PROCESSING” 4), so average confirmation time of one block is 29.4s. While
4: else normal confirmation time ranges from 9s to 18s (These re-
5: send coins back sults are based on the Ethereum official Blockchain records
6: end if that has already been opened to public).
7: end function

In function “callForProcess”, the contract receives the pro-


cessing fee from a resource demander device and check if it
is no less than 6 eth. If the fee is sufficient, the contract will
change its status to PROCESSING and a resource provider
device will start processing data. What’s more, processing fee
is hosted by the contract until the exchange is complete.

Algorithm 2 Smart contract: finish


function finish(id)
2: if msg.sender == resourceproviderdevice then
change the status of Smart Contract to “FINISHED”
4: end if
end function Fig. 6 1 BMP

In function “finish”, the contract will change its status to The next step is dealing with multi-pictures. Figure 7(a)
FINISHED only if this request is coming from the resource to Fig. 10 show comparison from 10 pictures to 200 pictures
demander device. respectively.

Algorithm 3 Smart contract: confirmation


function confirm(id)
if msg.sender == resource demander device and tr.status ==
“FINIS HED” then
3: change the status of Smart Contract to “CONFIRM”
Smart Contract send bitcoins to resource provider device’s wallet
end if
6: end function

In function “confirm”, when the status is FINISHED and


the message sender is the resource demander device, the con-
tract will send entrusted fee to the resource provider device.
In this experiment, Raspberry Pi is a resource deman-
der device, and server1 is the resource provider device. The Fig. 7 10 BMP
Raspberry Pi has a raw picture of BMP format and wants
the server to compress it to JPEG format. All remaining de- We can find that the more pictures contained in one task,
vices are responsible for maintaining normal operations of the more efficient the SMER system will be. When one task
the Blockchain. For the purpose of a contrast analysis, we contains 50 bmp pictures, average time of SMER system is
recorded the processing times of the Pi, the server and SMER equal to that of the Pi. When the quantity grows to 100 and
system independently for 50 times. Figure 6 shows compari- 200, the advantage of SMER system is obvious.
son among three ways. We can conclude that SMER system is fit for heavy calcu-
Yu ZHANG et al. SMER: a secure method of exchanging resources in heterogeneous internet of things 9

lation task. Because the data transfer time and confirmation device. The following experiment includes three resource
times of the Blockchain can be ignored as compared to pro- provider devices (i.e., one server with GPU, one server with-
cessing time. And when encountering a task that requires low out GPU and one laptop in Table 2), and the raw data include
computation, the device with weak MCU can complete itself. 200 bmp pictures. In this experiment, there are three com-
So in this situation, there is no need to use SMER system. puting architectures (i.e., CPU, GPU and ARM MCU), two
operation systems (i.e., Linux and Windows). However, due
to the compatibility feature of the SMER system, a resource
demander does not need to care about the problem brought
by these heterogeneous devices. In other words, this process
is transparent to resource demander devices. SMER system
can assign tasks automatically to all resource provider de-
vices and processing fee will be allocated according to the
proportion of completed tasks.
The configuration of resource provider device is shown in
Table 2, and concrete calculating methods of their computing
power are as follows: there are 4 cores and 2 threads in Inter
Xeon E3 CPU, and its basic frequency is 3.5GHz, then the
computing power of this CPU is 28GHz (3.5 × 4 × 2). There
Fig. 8 50 BMP
are 96 cores in NVIDIA GTX 240 GPU, and its processor
clock is 1.34GHz, then the computing power of this GPU is
128.64GHz (1.34 × 96), and the sum of computing power of
this server is 156.64GHz. Computing power of all devices are
listed in Table 2.
Table 2 The devices list
Device CPU GPU Computing power
Laptop Inter core2 1.20GHz \ 2.40GHz
server1 Inter XeonE3 3.5GHz \ 28GHz
server3 Inter XeonE3 3.5GHz GTX240 1.34GHz 156.64GHz

The proportion of final rewards is shown is Fig. 11. By


comparing computing powers in Table 2 and proportion in
Fig. 11, we can find that rewards are closely related to the per-
Fig. 9 100 BMP
formance of devices, which proof that SMER system can hide
heterogeneity among different resource providers and pro-
vides a virtual device for resource demander. What’s more,
devices providers can get paid in proportion to their comput-
ing power contribution, regardless of their heterogeneity.
The time consumption and its comparison are shown in
Fig. 12. From the result we can find that overall computing
time is reduced from 1050 seconds to 625 seconds. SMER
system is fit for multi-task, because several servers can deal
with these tasks in parallel.
In this experiment, we use JPEG compression to simulate
computing power exchange between devices. For verifying
the validity of processed data, we use both feature points
Fig. 10 200 BMP matching results and file parameters.
On the one hand, SMER system randomly chooses some
The above results are based on single resource provider raw pictures and their corresponding processed pictures, and
10 Front. Comput. Sci.

then extract SIFT features [11] from these pictures. In order However, the focus of this experiment is not data valida-
to measure the similarity with objective data, these two pic- tion. The JPEG compression is a schematic simulation of re-
tures are matched with FLANN algorithm [12]. As shown in source exchange. The situation may be more complicated in
Fig. 13, the similarity result between raw data and processed practical.
data is 97.8%. The result of our experiment on all 200 pic-
tures indicates that the average similarity result is 98.2%, the
maximum result is 99.8%, and the minimum result is 96.6%.
7 Discussion
Based on these results, we set the minimum similarity thresh- Security problem SMER system takes a resource exchange
old to 96%. smart contract as a state machine. Both sides of resource ex-
change are depending on the status of contracts to decide the
next move. But in Section 5, we notice that in stage 13, the
status of the contract has set to FINISH by resource deman-
der. This operation must be completed by the demander itself.
If other people or devices can access this operation, then the
result is disastrous. To avoid other similar problems, SMER
system will record ID and addresses of resource provider de-
vices and resource demander devices at the start of the re-
source exchange. As we discussed in Section 5, the iden-
tity of a device is recorded in the Blockchain at the factory
and can not be modified. Then each message that received by
Fig. 11 Time comparison the contract will include the identity of the sender device, so
the contract can strictly control the operation of each device
based their identities.
In order to validate the security of SMER system, we
have deployed the smart contract in Section 6, which trans-
action hash in the top of Fig. 14(a). As shown in Fig.
14(b), We can find relevant informations (e.g., Block height,
transaction hash etc.) of the smart contract in Ethereum
Blockchain data query system. Besides, we can also get
the address of the smart contract in the fifth row (i.e.,
0xad9d4a791A3dc19f6B7CfEf816868982836A13b7).

Fig. 12 Income comparison

Fig. 13 Image matching result

Fig. 14 Deploy the smart contract into Blockchain. (a) Contract deploy
On the other hand, SMER system also checks processed transaction; (b) contract information
file header blocks and file size to check the compression rate.
As described in the beginning of this section, we have set the Then, we call the function “finish” in this smart contract
JPEG quality values to 50, and the compression ratio for test (i.e., algorithm 3 in Section 6), but the message sender is
images in this experiment is around 15:1. the resource provider device instead of the resource deman-
Yu ZHANG et al. SMER: a secure method of exchanging resources in heterogeneous internet of things 11

der device. In function “finish”, the status of the task can hosted coins to either a provider or a demander. Obviously,
be changed to FINISH, but only the resource demander de- such third party significantly reduces efficiency of resource
vice has the right to do so. When a device send a request to exchange because it is opposed to quick and easy principle of
this function (as shown in Fig. 15(a)), the smart contract will resource exchange between devices. However, in normal cir-
match the public key between this message sender and the re- cumstances, devices will perform strictly in accordance with
source demander device, if it does not match, this request is requirements of the smart contract and resource provider de-
considered invalid. As shown in Fig. 15(b), we can not find vice also has the self-test mechanism to avoid interferences of
relevant informations of the request in the Blockchain. the third party. Therefore, the involvement of the third party
is mainly to prevent some malicious devices.
Privacy problem In order to exchange resources
with world wide devices, smart contracts can be ac-
cessed by all devices in SMER system. However, each re-
source exchange smart contract has an unique address like
“0x8a82740b5b528475e34c5b2bf342554c06c10e56”. Con-
tents of contracts can only be known if you have their address,
and device’s ID is similar to that format. Therefore, although
theoretically all smart contracts and devices are visible to the
Fig. 15 Invalid request. (a) The transaction of the request; (b) query results whole network, other devices cannot find them if they do not
in Blockchain
know their addresses. Besides, if you want to change these
addresses, you just need to re-issue a smart contract.
Another important security problem is about the
Failed to fulfill an contract There are many cases that a
Blockchain of SMER system. If a malicious device that has
comprehensive contract should consider. In addition to suc-
more than 51 percent computing power than whole network,
cessful resource exchanges, there are many counter exam-
it can trick the Blockchain by a double payments. Specifi-
ples. For example, a resource provider device may fail to pro-
cally, this malicious device pays a resource provider device
vide resources, or a device is suddenly offline. In general, the
with some coins and gets resources, then it quickly completes
smart contract will specify a range of codes of conduct for
another resource transaction and pay another device some
both sides in advance. For instance, there is no way for a re-
coins. Next, it provides full computing power to package the
source provider device to get paid until it completes the task.
latter transaction to the Blockchain and ignore the first one.
And it must complete tasks or provide resources within stipu-
The consequence is that malicious devices get resources in
lated time. Besides, the third party will be introduced to cope
the first resource exchange without paying. However, this
with distributes. On the other hand, a resource demander de-
bitcoin network’s problem is not difficult to solve in SMER
vice will lose its coins if it terminate the contract after the
system. Because all devices in real-name system of SMER
provider’s task is done.
will have a formal identity at the factory (i.e., a real-name
registration system), the resource exchange smart contract
can automatically determine whether a device is qualified
8 Conclusion
for resource exchange. Besides, when a large number of de-
vices are involved in SMER system, it is very difficult for a There is an increasing number of IoT devices recently. But
single device to provide more than 51 percent of the whole most of the utilization rate of devices are very low, resulting
network’s computing power. in a lot of waste of resources. Therefore, this paper proposes
Disputes In practical, there must be some disagreements a secure method of exchanging resources in heterogeneous
between both sides. For example, a resource provider de- Internet of things (SMER). SMER system makes it possible
vice believes there are no problems with processed data, but for devices to exchange resources in a security, profitable and
a resource demander device argues that problem is not ad- convenient way. This paper introduced a framework and an
dressed. Then we will introduce a third party to do the arbi- operational model of SMER system and designed a prototype
tration. This third party could be either an organization or a system based on mechanisms of SMER. In Section 7, we dis-
device. Authority and behavior of the third party are written cussed about security problems, privacy problems and etc. In
into smart contract in advance, which has authority to send future work, 1) we will introduce map reduce mechanism into
12 Front. Comput. Sci.

SMER system that allows devices provide their computing sion. 1999, 1150–1157
power and storage in a more precisely and convenient way. 12. Muja M, Lowe D G. Fast approximate nearest neighbors with auto-
matic algorithm configuration. In: Proceedings of International Con-
2) Resource exchanges among a large number of devices will
ference on Computer Vision Theory and Application (VISAPP), 2009,
produce large amounts of data, including resource consump- 331–340
tion data, cash flow data and etc. We will train these data
using proper models to obtain reasonable resource exchange
Yu Zhang received the master degree from
mechanisms. 3) The resource exchange at macroscopic level
information and engineering university,
lacks effective ways to model uncertain factors, environmen-
China in 2011. He is currently working
tal changes and interactions between individual devices and
toward the PhD degree in the department
therefore cannot analyze resource exchange issues in micro-
of computer science and technology, Ts-
level. Therefore we will study on some economical gamed
inghua University, China. His current re-
principle and methods such as Nash Equilibria and etc. to an-
search interests include Internet of things,
alyze and model resource exchanges issues at a micro level.
Blockchain, and E-business.
Acknowledgements The work was kindly supported by Nanjing Yunyan
Information Technology Ltd and Microsoft. Yuxing Han received her BS from Hong
Kong University of Science and Technol-
ogy, China and PhD from UCLA, both in
References
Electrical Engineering. She is currently
1. Wörner D, Bomhard V T. When your sensor earns money: exchang-
a professor in school of engineering at
ing data for cash with bitcoin. In: Proceedings of the 2014 ACM In-
ternational Joint Conference on Pervasive and Ubiquitous Computing: South China Agriculture University, China.
Adjunct Publication. 2014, 295–298 Her research area focuses on virtual reality,
2. Shiraz M, Gani A, Khokhar R H, Buyya R. A review on distributed multimedia communication over challeng-
application processing frameworks in smart mobile devices for mobile
ing networks, and big data analysis.
cloud computing. IEEE Communications Surveys & Tutorials, 2013,
15(3): 1294–1313
3. Ma X, Cui Y, Wang L, Stojmenovic I. Energy optimizations for mo- Jiangtao (Gene) Wen received the BS, MS,
bile terminals via computation offloading. In: Proceedings of 2012 2nd and PhD degrees with honors from Ts-
IEEE International Conference on Parallel Distributed and Grid Com-
inghua University, China in 1992, 1994 and
puting (PDGC). 2012, 236–241
4. Cuervo E, Balasubramanian A, Cho D K, Wolman A, Saroiu S, Chan- 1996 respectively, all in Electrical Engi-
dra R, Bahl P. Maui: making smartphones last longer with code offload. neering.
In: Proceedings of the 8th international conference on Mobile systems, From 1996 to 1998, he was a staff
applications, and services. 2010, 49–62
research fellow at UCLA, where he con-
5. Chun B G, Ihm S, Maniatis P, Naik M, Patti A. Clonecloud: elastic ex-
ecution between mobile device and cloud. In: Proceedings of the Sixth ducted cutting-edge research on multime-
Conference on Computer Systems. 2011, 301–314 dia coding and communications. Many of his inventions there were
6. Hasan R, Hossain M M, Khan R. Aura: an iot based cloud infrastruc- later adopted by international standards such as H.263, MPEG, and
ture for localized mobile computation outsourcing. In: Proceedings of
H.264. After UCLA, he served as the Principal Scientist of Pack-
2015 3rd IEEE International Conference on Mobile Cloud Computing,
Services, and Engineering (MobileCloud). 2015, 183–188 etVideo Corp., the CTO of Morphbius Technology Inc., the Director
7. Al Noor S, Hasan R, Haque M M. Cellcloud: a novel cost effective of Video Codec Technologies of Mobilygen Corp, the Senior Direc-
formation of mobile cloud based on bidding incentives. In: Proceed- tor of Technology of Ortiva Wireless and consulted for Stretch Inc.
ings of 2014 IEEE 7th International Conference on Cloud Computing
Since 2009, Dr. Wen has held a Professorship at the Department of
(CLOUD). 2014, 200–207
8. Ferrer E C. The blockchain: a new framework for robotic swarm sys- Computer Science and Technology of Tsinghua University.
tems. 2016, arXiv preprint arXiv:1608.00695 Dr. Wen is a world-renowned expert in multimedia commu-
9. Sikorski J J, Haughton J, Kraft M. Blockchain technology in the chem- nication over hostile networks, video coding and communications.
ical industry: machine-to-machine electricity market. Applied Energy,
He has authored many widely referenced papers in related fields.
2017, 195: 234–246
10. Christidis K, Devetsikiotis M. Blockchains and smart contracts for the
Products deploying technologies that Dr. Wen developed are cur-
internet of things. IEEE Access, 2016, 4: 2292–2303 rently widely used worldwide. Dr. Wen holds over 30 patents with
11. Lowe D G. Object recognition from local scale-invariant features. In: numerous others pending. As Senior Member of IEEE, Dr. Wen is
Proceedings of the 7th IEEE international conference on Computer Vi-
an Associate Editor for IEEE Transactions CSVT.

You might also like