Beruflich Dokumente
Kultur Dokumente
Technology is allowing more people to partake in the sharing economy. At the same
time, the internet of things is coming closer to become a reality. The blockchain has
shown that decentralized payment is possible without trust. Moreover, researchers sug-
gest that blockchain and IoT is a good match and that the sharing economy can make use
of blockchain based technologies. Current blockchain based sharing economy platforms
does not include data in price calculations.
This thesis reviews the top ten most valuable blockchain protocols, to further develop a
decentralized blockchain-based sharing economy platform. In addition, a user-test and an
evaluation of the platform is conducted to investigate the following research questions:
In a sharing economy platform for item sharing:
Research question 1: How can data be used in a decentralized sharing economy plat-
form to determine an accurate and fair price for both the renter and the lender?
Research question 2: How could such system provide real-time decentralized payment
through a blockchain technology?
Research question 3: How can real-time transactions with data provide real-time infor-
mation to a lender about the condition of its items?
The thesis demonstrates that it is possible to create and use a blockchain based sharing
economy platform that makes use of the power of IoT and data, along with smart contracts
and the blockchain data structure. Also, this platform makes it possible to rent and lend
items, and receive payment based on how the renter used an item during the rental period.
This data is further used to supply the renter of the item with real-time information about
the condition and whereabouts, while it is being rented. Also, the platform allows for
third parties to purchase the data generated by the users of the platform, to improve their
products.
i
Sammendrag
ii
Preface
First and foremost, I would to thank my supervisor Jingyue Li for his remarkable assis-
tance throughout the writing of this thesis.
I would also like to thank my family and Mari for providing moral support along the way.
Thanks to Chris, Rose, and Ulrik for feedback on the thesis.
This thesis concludes my five years as a student of Computer Science. And it was written
for the Department of Computer Science at Norwegian University of Science and Tech-
nology(NTNU) during the fall of 2017 and in the spring of 2018.
iii
iv
Table of Contents
Summary i
Summary ii
Preface iii
List of Tables ix
Abbreviations xiii
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Scientific contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Document Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Sharing economy 5
2.1 Sharing economy business models . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 Marketplace business model . . . . . . . . . . . . . . . . . . . . 6
2.1.2 Access based business model . . . . . . . . . . . . . . . . . . . . 8
2.1.3 On-demand service provider business model . . . . . . . . . . . 8
3 Internet of things 9
3.1 Internet of things devices . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 RFID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.2 Wireless Sensor networks (WSN) . . . . . . . . . . . . . . . . . 11
v
3.1.3 Micro processor units (MPU) and microcontroller units (MCU) . 12
3.2 Internet of things and its applications . . . . . . . . . . . . . . . . . . . . 13
3.2.1 Transportation and logistics . . . . . . . . . . . . . . . . . . . . 14
3.2.2 Health-care . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.3 Smart environment . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2.4 Personal and social . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Motivation and requirements for an IoT based sharing app with decentralized
payment 51
5.1 Limitations of existing IoT-blockchain SEPs . . . . . . . . . . . . . . . . 51
5.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.3 Research questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.3.1 Machine-to-machine economy . . . . . . . . . . . . . . . . . . . 55
5.4 Empirical study of research questions . . . . . . . . . . . . . . . . . . . 56
5.4.1 Results question 1 . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.4.2 Results question 2 . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.4.3 Results question 3 . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.4.4 Results question 4 . . . . . . . . . . . . . . . . . . . . . . . . . 58
vi
5.4.5 Notes from participants . . . . . . . . . . . . . . . . . . . . . . . 58
vii
8.3.2 Web3.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.3.3 Truffle framework . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.3.4 Ganache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
8.4 Other problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
8.4.1 Problem: Running an Ethereum client on a smart phone . . . . . 96
8.4.2 Problem: Paying for smart contract usage and data storage on the
Ethereum blockchain . . . . . . . . . . . . . . . . . . . . . . . . 96
8.4.3 Possible solutions: StorJ . . . . . . . . . . . . . . . . . . . . . . 97
8.4.4 Possible solutions: IOTA . . . . . . . . . . . . . . . . . . . . . . 97
9 Conclusions 101
9.1 Research question 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
9.2 Research question 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
9.3 Research question 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
9.4 Research question 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
9.5 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Bibliography 105
Appendix 119
viii
List of Tables
7.1 Explain variables in the the struct ”Object” that represent an item . . . . 77
7.2 Shows get functions I reused or edited . . . . . . . . . . . . . . . . . . . 78
7.3 Shows get functions that I added and the edited function ”registerObject” 78
ix
x
List of Figures
xi
6.1 How the different actors in the system are related to each other . . . . . . 62
6.2 Figure show how a user would rent an object . . . . . . . . . . . . . . . . 63
7.1 Figure showing the architecture of the prototype. All interactions with the
system included the use the smart contract’s function. Third parties read
data off the blockchain, without the need for the smart contract . . . . . . 69
7.2 Screenshot of the prototype showing registration of an item . . . . . . . . 70
7.3 Screenshot of the prototype showing a renter who are about to rent an item 73
7.4 Screenshot of the prototype showing the view for the renter after it has
started renting the item . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.5 Screenshot of the prototype showing information about a rented item . . . 75
7.6 Screenshot of the prototype showing an interface a third party would ac-
cess in order to purchase data . . . . . . . . . . . . . . . . . . . . . . . . 76
xii
Abbreviations
xiii
xiv
Chapter 1
Introduction
Sharing economy is an economic model that allows people to rent or borrow assets from
each other. The sharing economy model is often used when someone owns an asset that is
not completely utilized. Sharing economy is based on the use of peer-to-peer transactions
effectively removing intermediaries in the value chain [1]. Although sharing economy is
not a new concept, it has become increasingly popular in the past decade [2]. This increase
in popularity can be explained by the new ways of utilizing technology and the creation of
various platforms which enable sharing economy interactions [3]. These platforms have
been developed into apps and websites, making sharing economy platforms (SEP) more
accessible than ever.
In parallel to the development of SEPs, a new technology paradigm has emerged, the
Internet of Things (IoT). IoT is envisioned as physical devices connected to each other,
and interacting with each other in a global network. These devices can range from a reg-
ular computer to sensor devices and GPS technology. A device is an IoT device as long
as it is connected to a network, and can communicate with other devices. IoT is has been
recognized as one of the most critical technologies for future development, and is gaining
vast attention in various industries [4] The reason for this attention is the promise of new
interactions and the integration of different actions in companies processes. This will al-
low a company to investigate the efficiency, profitability and other aspects of its processes,
more precise and thorough. Ultimately, IoT enables a company to run its operations with
vast knowledge of each of its processes.
1
Chapter 1. Introduction
blockchain itself, and its properties have inspired many new cryptocurrencies and systems,
for instance, Ethereum. The Ethereum blockchain allows for more than just keeping track
of transactions. The Ethereum blockchain allows its users to put code on it and run it. This
feature allows for the creation of smart contracts, which have many useful applications.
Another example is IOTA, not using a blockchain, but a Directed Acyclic Graph (DAG)
named Tangle. A DAG has many of the same properties as the blockchain. However, due
to its structure, it allows for other interesting interactions, especially regarding IoT devices
(hence its name) on the transport layer.
1.1 Motivation
Time-sharing (for profit) has been a concept in sharing economy platforms for some time
now. For instance, AirBnb, a SEP for renting out your property when you are not using
it, i.e., fully utilizing your property. Nabobil (neighbor car) is a SEP that allows for your
neighbors to share a car together. Also, another trend is the use of Tool Libraries, a library
where you lend tools instead of books, in turn, you do not need to buy your tools to get a
job done, lend them instead. It is the concept of time-sharing in SEPs I want to address
in this thesis, along with the possibilities blockchain technologies and IOT can give SEPs.
Blockchain technologies allow for peer-to-peer transactions, sharing economy is based on
peer-to-peer transactions. Blockchain technologies can be used with IoT devices, and IoT
devices can be used in sharing economy platforms. I want to combine these to make a SEP
for renting out none-utilized tools. However, where does IoT come in?
On AirBnb platform you rent property on a daily basis, on the Nabobil platform you rent
the car on an hourly basis, and in the tool libraries, you can borrow a tool for week [6]. I
found it interesting that tool libraries have such long lending time. Because in some cases
you only need to use a tool for a few hours. With the case of tool libraries you also need to
get to the tool library. And what if your neighbor or someone nearer than the tool library
has the exact tool you need? Why couldn’t you borrow it from them instead, saving the
C02 emission you would spend on getting to the tool library along with other expenses.
Also, if you only use your tool for a couple of hours, or minutes, why should you need to
hold it for a full week? Of course, tools get worn down, and since you are borrowing the
tool from a private person, it is fair that the person should get compensated. But for how
much? A days use? But what if you use your tool for only 25 minutes, then a days use is
not fair. This is part of the problem I want to address.
Researchers have already combined the blockchain and sharing economy, however, not
with IoT and data [7]. A start-up has also tried the combination with IoT, but without
using data generated from IoT devices in their system [8]. I want to enable renting and
lending of items without the need for centralization, like tool libraries. Making a system
that allows for decentralized item renting and sharing. I want people to lend items to oth-
ers, and get compensated for the exact usage of the item. This is where IoT comes in. I
want to place sensors on items to measure how they are being used while being rented.
And with the data generated from the items while being rented, take it into the price cal-
culations. In turn the lender can be paid by the data, and the renter pays an accurate price
2
1.2 Objectives
and fair price. I also want this data to be sent in real to the lender of the item. For making
the lender be able to continuously monitor the condition of its items. I want to develop an
SEP that calculates exact item usage and make payment through blockchain technology,
essentially allowing everyone to become a tool library, and profit from it. Also, I want to
make use of the data that is generated, and enable third parties to purchase data generated
by the item’s IoT device.
Therefore, I want to make a prototype of a sharing economy platform for item sharing
and show:
Research question 1: How can data be used in a decentralized sharing economy plat-
form to determine an accurate and fair price for both the renter and the lender?
Research question 2: How could such system provide real-time decentralized payment
through a blockchain technology?
Research question 3: How can real-time transactions with data provide real-time infor-
mation to a lender about the condition of its items?
1.2 Objectives
The overall objective of the thesis is to assess the research questions. Also, show that the
combination of IoT, blockchain and sharing economy is possible.
• Demonstrating how a blockchain technology can be used in an SEP using data gen-
erated from IoT devices for its cost calculation.
• Demonstrating how sending and storing of data on a blockchain can allow for close
to real-time monitoring of items
3
Chapter 1. Introduction
1.4 Method
In order to assess the research questions, I perform a review of blockchain protocols. Next,
I perform a comparison of the blockchain protocols to find a suitable protocol to develop
a SEP with. To further assess the research questions I develop an SEP, which uses data
for price calculations, and can send real-time decentralized payment and data, and enable
third parties to purchase the data generated in the SEP. In addition, I perform a user-test
and an evaluation of the SEP, discussing its difficulties and challenges.
1.5 Limitations
Research material and papers are gathered exclusively from NTNU school library [9],
Google.com, and scholar.google.com.
State of the art of blockchain technologies is limited to the top 10 most valuable cryptocur-
rencies on coinmarketcap.com as of 16.01.2018 [10].
Price calculation of cryptocurrencies in this thesis is limited to the timeframe of 01.02.2018-
01.06.2018 unless another date is explicitly stated.
4
Chapter 2
Sharing economy
The internet have seen many stages of development since its beginning in 1995. They
include different steps of evolution in electronic, mobile and social businesses. In addition
to creating new business models, social networks have emerged making for a paradigm
shift from owning to using goods and services. Sharing economy, unlike the traditional
market model, is based on the use and sharing of products and services among others. This
model has been around for ages in many different domains. Sharing resources in business
is known as business-to-business (B2B) sharing, examples of these could be the sharing
of machinery in industries. Another model is known like the business-to-consumer (B2C)
like video, video game and car rentals, along with libraries and swimming pools. And the
sharing economy has recently spread to the consumer-to-consumer (C2C) model.
• Social networks and electronic markets: Due to people linking themselves with oth-
ers through social media, consumers are able to find people who are willing to share
their goods and resources among each other. Along with electronic market platforms
that reduce the formerly high search and transaction cost.
• Mobile devices and electronic services: Due to mobile platforms high accessibility,
have enabled devices to access the ”app economy.” Making it convenient to access
different applications made for consumer-to-consumer interaction, accompanied by
the use of electronic devices such as key cars, or other technology.
Along with the rise in popularity of the sharing economy, comes a survey promising high
revenue gains with this financial model. The survey from 2015 [14], of American con-
sumers suggest that sectors within travel, car sharing, finance, staffing, music and video
streaming will increase their revenues by 320 billion USD from 15 billion USD within
5
Chapter 2. Sharing economy
few years. The survey also states that in 2014, 21% of American consumer used sharing
economy based services, and this number is expected to increase to 45% in 2015. Start-up
companies stand for a large proportion of innovation in the sharing economy [14]. These
companies usually have the role as an intermediary between consumers, allowing for a
convenient method for sharing resources and services. Examples of these start-ups could
be Uber: a platform for consumers and companies with a car to run a taxi service. Another
one could be AirBnB, a platform for renting out your property to others. Also, WeWork,
a platform for sharing workspaces with others. All of the above mentioned start-ups are
currently worth more than 1 billion USD. However, start-ups are not the only ones making
sharing economy platforms. IKEA has for instance made an online platform, allowing
their customers to exchange used furniture over their website. Some companies also co-
operate with start-ups, like General Motors who invested 3 million USD in the car rental
start-up Turo. Also, non-profit organizations are starting to explore the sharing economy,
by further developing their previous model. Among these are the tool libraries. Instead of
lending books, you can lend tools instead.
Sharing economy is gaining popularity, and is becoming a profitable market model for
many. As described, the large adoption of sharing economy services is mainly due to de-
velopment in technology, allowing consumers to take part in the sharing economy easier.
Allowing consumers to participate in the sharing economy have also made a change in
consumer behaviour, and people are seeking out new ways to use sharing economy [11].
In the next section I will discuss relevant sharing economy models and platforms.
6
2.1 Sharing economy business models
[15]
Figure 2.1: Sharing economy business models sorted by industry
7
Chapter 2. Sharing economy
the supply or the demand side, through their platform to make money. In the platforms of
marketplace business model based SECs, customer relationships are typically automated
or semi-automated. The marketplace business model can be divided into three sub-classes:
pure marketplace, community marketplace, and service marketplace. The variations be-
tween these sub-classes depend on what role the SEC take in its platform. In the pure
marketplace, the SEC’s role is only to provide the platform for the users. In the service
marketplace, the SEC provide additional services to both parties. In the community mar-
ketplace, the SEC offers extra benefits for using their platform, to build a good community
surrounding the services in the marketplace [15].
8
Chapter 3
Internet of things
The expression Internet of things have several meanings, but they all revolve around the
same concept: that IoT includes a global and dynamic network of interconnected ob-
jects with capabilities like sensing, communication, networking, and processing that links
the virtual world with the physical world. The expression was first coined about objects
with radio frequency identification (RFID) connected to the internet, by Kevin Ashton
in 1999 [16]. RFID may contain different types of information; however, all RFID in-
struments contain a uniquely identifiable identification. Therefore, an IoT device is a de-
vice that is uniquely identifiable, connected to the internet and have the capabilities listed
above. The development of IoT is fueled by technology like Bluetooth, RFID, WiFi, em-
bedded sensors and actuator nodes. The internet led people to connect to each other, and
now the next revolution is things connecting to each other. Over the past years, the number
of IoT devices have accumulated quickly, reaching over 9 billion interconnected devices
in 2011. This number is still growing, and it is expected that the population of intercon-
nected devices will reach at least 24 billion by 2020. The internet of things will provide
automation and new business models in many business areas and industries [13].
IoT can be divided into three visions: things-oriented, network-oriented, and semantic-
oriented. The network-oriented vision refers to the infrastructure and connectivity aspects
resulting from the web of things. The things-oriented vision is related to physical items
like embedded devices or things such as sensors and actuators that respond to stimuli in
their environment. These include items such as RFID, near field communication (NFC),
sensing platforms, and wireless identification. The semantic vision includes the process-
ing and analysis of data gathered by these devices, along with storing and management of
this data. These three visions are what makeup IoT [12]. How the different visions overlap
and makeup IoT can be seen in figure 3.1.
9
Chapter 3. Internet of things
[12]
Figure 3.1: The different visions that IoT consists of
3.1.1 RFID
RFID is a key component in IoT. RFID usually consist of one or more readers and many
RFID tags. A tag is characterized by the ability to uniquely identify the objects, the things,
and even living beings the tag is applied to. A reader can trigger the transmission of the
RFID tag. The then reader receives the tag and is by that able to identify the object the tag
is on. The reader does not need to be in the line of sight to the RFID tag, to read it. Thus
RFID let us map real-world items into the virtual world, and allow us to monitor objects in
real time that is out of sight. These features can be used in wide range of applications, in
different sectors and business areas. Physically, an RFID tag is a small microchip attached
to an antenna. This antenna may both receive and transmit signals. The microchip and the
antenna are packed together into what look like an adhesive sticker (see figure 3.3). RFID
tags come in many different sizes, with the smallest one being as small as 0.4 mm x 0.4
mm x 0.15 mm, in comparison a grain of rice is approximately 512 mm long and 23 mm
thick [17] (see figure 3.2). An RFID tag can be either passive, semi-active or active. The
most common of the three is passive. A passive RFID tag is not able to transmit its ID by
itself but is in need of harvesting the energy an RFID reader emits. When the RFID tag has
sufficient energy, it will send its ID. This interaction between a passive RFID tag and the
RFID reader may take place with up to five meters of distance between the two. The active
and the semi-active RFID tags have batteries of their own and is, therefore, able to supply
themselves with power during the interaction with an RFID reader, however they use their
batteries differently. The difference between an active RFID tag and a semi-active tag is
that the semi-active tag uses power from its battery while receiving a signal but still harvest
10
3.1 Internet of things devices
[18]
Figure 3.2: A small RFID tag with a grain of rice for scale. This type of small tag can be implanted
in household animals
energy when sending one. An active tag draws powers from its battery when sending and
receiving signals [12].
Wireless sensor networks is also an important technology in play when it comes to IoT.
Sensor networks can cooperate with RFID systems to track the status of things better, like
the location, movement, and temperature of certain objects. The sensor networks interact
with the environment surrounding the items tagged with the RFID and act as a further
bridge between the physical and digital world. Sensor networks consist of any number
of sensing nodes communicating wirelessly in a multi-hop fashion. These sensors use
low-power, low bit rate communications in a wireless personal area network (WPAN) to
communicate their data. Multi-hop means that the sensors use each other to relay their
information further. There may be a very high amount of sensors in a sensor network. A
node in a sensor network may be a sensor, or special nodes called sinks. Each of the nodes
in the network reports their sensing to the sinks in the network. Research suggests that
there is great potential in combining RFID and sensor networks [12].
11
Chapter 3. Internet of things
[19]
Figure 3.3: An RFID tag
[20]
Figure 3.4: A microcontroller unit produced by Arduino. This board have built-in WiFi, and can
run Linux
Sensors and actuators are required in the IoT to form the link between the digital and
physical world. As we know, a sensor senses, and converts the surrounding environment
12
3.2 Internet of things and its applications
into analog or digital signals, while an actuator interacts with the environment based on
a sensors signals. An example of an actuator could be an automatic fire extinguisher,
acting on a signal sent from a fire detector. However, this signal needs to be processed
first. The next step in the architecture of the IoT is the MPUs and MCUs units that bridge
the sensors and the actuators together, by receiving signals, computing them, and sending
signals back or to somewhere else. In the fire extinguisher scenario, the signal from the
fire detector is first sent to an MCU or an MPU, which determine if it wants to send a
signal to the actuator to activate it or not. Both MPUs and MCUs are specifically designed
for real-time systems. Typically MPUs and MCUs are designed to perform a specific task,
meaning that input and output to and from the MCU or the MPU are predefined [21]. The
difference between an MCU and MPU is that the MCU has integrated Ram, CPU, Rom
(and more..), while the MPU only contain a CPU, thus needing the addition of peripherals,
and other components to perform its tasks (see figure 3.5).
[22]
Figure 3.5: The difference between a microcontroller unit (MCU) and a micro processor unit (MPU)
• Healthcare domain
13
Chapter 3. Internet of things
Some of these applications are directly applicable or close, however many applications
may not apply to our society until a later time (see fig 3.6). This is due to our societies and
technology are not ready for deployment. In these sections, I will only describe short to
medium term applications of IoT [12].
[12]
Figure 3.6: Applications domains and relevant major scenarios for IoT
Assisted driving is another application of IoT in this domain. Cars, trains, and buses
may be equipped with sensors. Roads and rails may also be equipped with sensors and
processing power resulting in better safety and navigation for all participating in the rail or
14
3.2 Internet of things and its applications
road system. Examples of functions could be collision avoidance systems, automatic park-
ing, and automatic driving on highways for cars. This is a functionality that exist in for
instance most Tesla cars [23]. This technology could also benefit governmental services
in both tracking of illicit activities, but as well as roadmap optimization in relation to ex-
panding the road networks. Also in relation to transportation, information about the state
of the local traffic, may allow transportation handlers to choose optimal routes for delivery.
Monitoring and adjustment of food can be done with IoT. Keeping food fresh on its travel
to the store, making sure no food has gone bad during its travel by adjusting different pa-
rameters concerning the surrounding environment of the food items. This will improve the
efficiency of the food supply chain.
Mobile ticketing and augmented maps for tourist are also applications that could be possi-
ble in this domain [12].
3.2.2 Health-care
The key benefits of IoT en health-care is the tracking of people (staff and patients) and
objects, identification and authentication of people, automatic data collection and sensing.
Identification of patients with IoT could prevent incidents harmful to the patients. Ex-
amples of harmful incidents could be wrong drug, dose or procedure given to a patient.
Or in other scenarios, loss of identification of infants. Identification and authentications
through IoT would also make hospitals safer inf the matter of the security: of patients,
personnel, important instruments and products.
In relation with data collection in hospitals, IoT aims to reduce time spent on manual
data registration, reducing workload on the hospitals staff, enabling them to do more im-
portant tasks. This functionality also relates to the integration of RFID technology with
health information, and the hospitals facilities.
Lastly, sensing in health care system could provide valuable information concerning pa-
tients health and diagnostics. Sensors could provide real-time monitoring of patients health
indicators. This could be combined with monitoring of patients compliance with different
medication, and could be used to adjust the well being of the patient. This monitoring
could be done remotely, enabling patients to be treated remotely [12].
15
Chapter 3. Internet of things
Making homes and offices more comfortable could be achieved by installing sensors and
actuators in them. These sensors and actuators could control different aspects of these
environments based on sensing in them. Room temperature, air quality, room lighting can
be controlled by the sensors and actuators in relation with outdoor weather changes. An
example could be to have light shine brighter in the day. Also, it could make it easier to
adjust these factors to users own preferences. Monitoring of energy usage and adjusting
to it could also be done. An example could be that in tall building, heat tend to build up in
the upper floors, with sensors and actuators in place, the building may distribute the heat
evenly across all floors, instead of using energy to heat lower floors and using energy to
cool upper floors.
In industrial plants, deploying RFID tags on the objects being processed could supply
valuable information about bottlenecks of production, do in production quality control.
In addition, such system could acquire other information about the production, in order
to give staff better assessment basis in their decisions, especially in potential emergency
situations.
Other uses in relation to smart environments could be smart museums and smart gyms. In
smart gyms exercise machines could record your sets and repetitions automatically for the
user, eliminating the hassle of manually recording such information themselves. Also this
information could be view by a personal trainer afterwards, and could be used in order to
give better guides to the exerciser. In museums scannable tags could be placed near the
different attractions, making for a more interactive museum visit. In addition, actuators
could be activated in order to heat or cool rooms to what experience the museum wants
to give its visitors. An exhibition about the ice age could have a colder and windy inside
environment, and an exhibition about the pyramids, could have a warm and dry inside
environment [12].
IoT may become an enabler of social networking. The idea is to have automatic updates
about our real-life activities posted on social media like Twitter or Facebook. RFID may
generate events about people or places, these events are further posted to social media in
order to give users real-time updates about what is happening around them and with the
people they know. These events will allow users to more closely follow their friends ac-
tivities, and participate in them
16
3.2 Internet of things and its applications
By having RFID tags on our things, people can easier identify things they have lost, or
things that have gotten stolen from them. The RFID tags can be activated by RFID readers
in our surroundings, ultimately this will allow us to check where we last had a thing before
we lost it. Concerning theft, sensors may know where the user usually is, so if readers read
an item from the user at a location the user normally wouldn’t find itself, the user will be
notified [12].
17
Chapter 3. Internet of things
18
Chapter 4
State of the art of blockchain
technologies
The overall goal of in this thesis is to develop and make a sharing economy platform using
IoT and blockchain technology. To answer the research question the thesis, I had to do a
review of relevant blockchain technologies. This review will be done on the most valuable
blockchain technologies by their market cap. There are several different implementations
of the blockchain, each with its framework for using their technology. Researchers have
reviewed some of these technologies, but the majority is not researched at all, making ref-
erences for each technology of varying quality. I will research the different blockchain
technologies applications, and how they work. Along with other technologies that rely
on the blockchain data structure. Also, I will look into the blockchains use cases, and its
uses with IoT technology and devices. In other words, I want to understand the different
blockchain technologies to find which one I deem the most useful for the goal of this the-
sis. To do this, I have made five Questions for the review of blockchain protocols:
• Question 4.1: How is the blockchain used with IoT in a sharing economy context?
Structure of chapter 3:
Section 4.1 give some background information needed to understand how the blockchain
works. Section 4.2 discuss the search process in general for this chapter. Section 4.3, 4.4,
19
Chapter 4. State of the art of blockchain technologies
4.5, 4.6 and 4.6.1 answers the different question. Section 4.3 include a comparison matrix
of the different blockchain technologies written about in its section. Also, at the end of
each section, you may read about how I found the references I needed to answer each of
the questions.
4.1 Background
4.1.1 Cryptocurrencies
Coinmarketcap.com is a website that lists different cryptocurrencies. So far coin market
cap lists over 1300 different cryptocurrencies. Usually, each currency has their own pur-
pose and usage. The first cryptocurrencies were focused on simple peer-to-peer payments,
however, later on, there has been a rise in currencies which does more than just that. There
are currencies for tracking of pharmacy products with IoT devices like Modum [24], and
there are currencies like Dentacoin [25] which focuses on improving dental care around
the world, making it affordable through crowd power, the currency Tron aims to build a
tipping service for social media content, entertainment content, and streaming [26]. Cur-
rencies like Bitcoin, Litecoin, Bitcoin Cash, Dash and Monero and others, focus on de-
centralized peer-to-peer payments with each having their very own implementation of the
blockchain. Currencies like Ethereum, Cardano, NEO, RootStock, and Namecoin also
allow for decentralized peer-to-peer payment, but also focuses on the usage of smart con-
tracts, which allows their users to store code on their blockchain and have it run for a fee.
Many cryptocurrencies use the blockchain in some way or another; however, there are
exceptions. IOTA for instance uses a direct acyclic graph (DAG) in order to do transac-
tions [27]. The currencies usually have a surrounding system enabling the functionality
they promise to serve. Some of the currencies are coins, meaning that they have their very
own blockchain, some of the currencies are tokens which depend on another currencies
platform to operate, usually being Ethereum. All of these currencies’ tokens or coins are
traded at an open market and prices for each can be view at coinmarketcap.com [28].
20
4.1 Background
[31]
Figure 4.1: A message M is hashed by hash function H, and a hash value h is returned. h can
uniquely identify M.
able to recalculate the fingerprint of the data, to check if it matches the old fingerprint. If
the fingerprints match, the integrity of the data is not impaired in any way. A cryptographic
hash function is not the same as encryption. A cryptographic hash function only makes a
”digest” of the original data in a one-way function, making retrieval of the original data
not possible. In a symmetric encryption function, one will be able to retrieve the original
data [32].
[31]
Figure 4.2: How a data integrity check is performed with hashing algorithms
21
Chapter 4. State of the art of blockchain technologies
To conduct the study of the different blockchain technologies I started by using each tech-
nologys white paper, to then look for other research, to then look for articles, to then look
for news articles if no sufficient research were found. Many of these technologies are fairly
new; thus not much research exists on them. The release date of the technology is pos-
sibly a good limiter while searching for information on each of the papers. For instance,
Ripple and its coin XRP was released in 2012, no research on ripple was found before its
release. In addition to the technologies being new, many of the names of the technologies
have similar names to other research topics. Ripples is listed as its own topic in the NTNU
school library research database [9], and contains 1944 hits. Looking through 15 pages
of results, not a single paper was found on Ripple. Searching for just NEO in the NTNU
school library yielded 200 000 hits. I tried searching for NEO blockchain which yielded
86 hits. Of the 86 hits, only eight were peer-reviewed, and of these eight none were about
NEO. Of the 86 hits, 69 of them were newspaper articles; however, these were actually
discussing NEO. This is a general problem when researching the topic of cryptocurrencies
and blockchain technologies. Bitcoin, blockchain and Ethereum yield relevant papers and
research when searching in the NTNU school library databases [9], this is most likely due
to their age, they are no longer newcomers in the crypto and blockchain world. Also, the
names of these technologies are unique compared to the other technologies, yielding more
relevant search results. Another problem was the names of the different blockchain tech-
nologies. IOTA, for instance, is not solely related to IOTA as a blockchain technology but
also related to ultrasound technology [34], quantum physics [35] and more making it more
difficult to find relevant research even with different filters in place.
As the search results vary from technology to technology, so does the quality of the sources
I am using to research the different technologies. Each technology’s white paper was dis-
covered using Google with this string [Blockchain technology] white paper. The source
of each white paper is from the official company or foundation that owns the blockchain
technology. Some scientific papers were found on Bitcoin and Ethereum by searching
using their names as search words in the NTNU school library databases. In addition to
research other technologies making use of the blockchain I used these strings in Google:
blockchain-based applications, blockchain applications, and blockchain apps. And lastly, I
22
4.3 Question 1: How does the blockchain work?
used the string [Blockchain technology] IOT in NTNU school library [9], Google Scholar,
and Google.com to research blockchain technologies and IoT. To find more information
about the different blockchain and chain technologies the search word: ”[Blockchain tech-
nology] overview” was used. Further, references used in this information was also taken
into account when assessing their functionality and features. Also, official developers
guides from the blockchain technologies were used to supplement the information from
the white papers. This was done because the white papers usually describe a vision for the
blockchain technology, not the actual implementation, or at least not the state the technol-
ogy is in at the current time. The white papers are several years old, and changes may have
been done in the meantime.
• Was the first cryptocurrency and the first implementation of the blockchain
• Is mineable
• Does not have a smart contract platform, has a high adoption in the crypto sphere,
and is capable of maximum seven transactions per second.
The Blockchain was first presented in the paper Bitcoin: A Peer-to-Peer Electronic Cash
System in 2009 by an unknown author under the pseudonym Satoshi Nakamoto [5]. It
describes a peer-to-peer currency system that allows for secure cash transaction over the
internet without the need for a financial institution as a middleman. This made possible
by a new data structure, also describe in Satoshi’s paper, named the Blockchain. The
blockchain enables the cryptocurrency Bitcoin (and others) to exchange its coins securely
across the internet. Like in the name, the blockchain consists of blocks that are chained
together. This is done by hashing the data of the new block, with the hash of the previous
block. Each block contains transactions in the Bitcoin network and each block in the chain
is linked to the previous block. With the creation of a new block, it is appended to the last
one, forming the blockchain. An easy way to look at the blockchain, is to look at it as an
immutable (except for the block thats forming to be added to the blockchain) transparent
database that contains the entire transaction history of all Bitcoins ever made, which in
turn enables the users to know what balance of coins each of its users has.
A user in the Bitcoin blockchain consist of a key-pair. A Bitcoin address consist of ran-
domly generated keys, a private one and a public one. The public one is the users Bitcoin
address. Other users of the Bitcoin protocol use their public address to receive Bitcoins.
And the private key to send Bitcoins. For sending Bitcoins, a user signs the transaction
with its private key. The other users verify the transaction by using the public key of the
23
Chapter 4. State of the art of blockchain technologies
user that sent the Bitcoins. The blockchain consist of blocks of transactions chained to-
gether. All of the blocks are structured by the same rules, and it is this structure that allows
for the chaining. A block consists of primarily four fields: Block size, block header, trans-
action counter and transactions. The block size field is 4 bytes, the block header field is
80 bytes, transactions counter field is from 1 to 9 bytes, and the transactions field vary
with how many transactions there are in the block 4.1. The block header field is calculated
based on six other fields 4.2. The block size field describes how large the block is with 4
bytes. The block header is the identifier of the block and is made up of a hash. The hash
is generated with the Secure Hash Algorithm (SHA-256) [36]. The SHA-256 generate an
almost unique fixed-size 256-bit hash. SHA-256 is a strict one-way function and is always
a 256-bit binary value.The block header is 80 bytes and is calculated based on three sets of
block meta-data. The first one is a reference to the last block in the blockchain and is the
hash of the previous block, effectively linking the new block to the last one. The second
set is data related to the mining competition: the difficulty, timestamp, and nonce. The
third piece of meta-data is the Merkle root tree of the current blocks transactions. The data
structure is used to effectively summarize all transactions in the current block into a hash.
When a block is going to be added to the blockchain, it needs to mined. Mining is done
by a mining node in the Bitcoin network. The mining node is responsible for compiling a
block based on the definitions of the Bitcoin blockchain protocol. The mining node needs
to fill out the two tables 4.1 and 4.2 to mine a block onto the blockchain. First, the node
needs to add the version number describing the block structure version. Next, the node
needs to add the hash of the Previous block, and this is the hash of the previous block’s
header. Next, the mining node acquires a number of un-mined transactions and generated
a Merkle tree for these transactions, to then store the Merkle tree root of the result. The
24
4.3 Question 1: How does the blockchain work?
Merkle tree root summarizes all the transactions of the block. Then the mining node will
add the timestamp encoded as UNIX epoch timestamp. As Satoshi et al [5] describes, a
block should take at least 10 minutes to mine. Moreover, to keep the block mining time
at 10 minutes, the difficulty has to be adjusted accordingly. The difficulty target is set
according to what mining power there is in the network at the current time, that will result
in a 10 minute mining time of a block. So, the next for the mining node is to add the
difficulty based on the power of the network. The last step is to add the nonce, which is
initialized to zero. With all the fields filled, the mining process can start. The goal of the
mining process it to find a value for the nonce that results in a block header hash that is
less than the difficulty target. Brute forcing different nonce values to do this process. A
mining node typically needs to test billions to trillions of nonce values before finding a
satisfactory value. This is done by incrementing the nonce, to then hash the block header
repeatedly. By doing this, you are doing the proof of work described by Satoshi et al. [5].
When the right hash is found, it is broadcast to the network, verified by the network, and
the block is added to the blockchain [37]. Following the block header, comes the transac-
tions counter described with 1-9 bytes, and after that is all of the blocks transactions.
From this description it may seem that it only takes 10 minutes to do a transaction with the
Bitcoin protocol. However this is not the case. Because of latency in the system, not all
miners will receive the same transactions at once. Meaning that miners will try mining dif-
ferent blocks onto the blockchain. It is not allowed to add a transaction to the blockchain
that is all ready on the blockchain. Meaning that a miner may spend unnecessary com-
puting power on mining a block with a transaction that becomes added to the blockchain
before the miner is done finding the right nonce value. Another possibility is that two
blockchains are formed, when two miners add two different blocks at once. The Bitcoin
protocol have rule to solve such problem. When two or more blockchains are formed, it
is the longest blockchain that is valid. When the blockchains are equally long but with a
different block at its tip, it is up to the miners to decide which blockchain they want to con-
tinue the mining process with. When either one of the blockchains gets a block attached
before the other one, this blockchain becomes longest one, and miners will choose this one
to continue mining with. However, dual blockchains makes it possible that transactions
that were mined onto the blockchain that not became the longest one, becomes invalid be-
cause they are not on the longest blockchain. This means that they have to be mined onto
the new blockchain to become valid. As a safeguard for this, a transaction is only consid-
ered confirmed when it is at a six block depth. Meaning that a user must at least wait an
hour (10 minutes x 6 blocks) to be certain that its transaction if confirmed. A scenario like
this is also possible in other blockchain technologies, where block size and block mining
time is different. For instance, in the Ethereum blockchain a block takes on average 14
seconds to mine, making a scenario of having several blockchains in the network more
likely. Therefore users have to wait 12 blocks in order to be sure that their transaction is
confirmed. There are also other mechanisms in Ethereum mining that are more optimized
than in the mining of the Bitcoin Blockchain.
In summary, users make transactions, miners gather transactions into blocks, make calcu-
lations with the blocks finding the right hash for the block, getting the network of miners
to verify that their calculations are correct, add the block to the blockchain.
25
Chapter 4. State of the art of blockchain technologies
This is in the core of the blockchain data structure. However, different blockchain based
technologies may have different implementations of the blockchain. Variations could be in
block size, block structure, the proof that the miners need to perform, hashing algorithm,
difficulty, having mining and not having mining, mining time and more.
In general Blockchain protocols usually consists of nodes in a network. Nodes are ei-
ther worker/miner nodes or just normal user nodes. All nodes in the network have a public
address, and a secret private address. A blockchain protocol usually has a token or a coin
to do transactions with. Also, the addresses of the users are used to sign transactions to
show proof of ownership and the origin of the token/coin. However, this is not enough to
conduct a transaction. To do transactions, the worker nodes in the network must first form
transactions into blocks, and conduct some kind of proof in order to reach a consensus of
which blocks that should be added to the blockchain. This process is called mining. De-
pending on what consensus algorithm a blockchain protocol has uses, is what decides how
the worker nodes are reaching a consensus of which blocks and essentially which transac-
tions to add to the blockchain. The blockchain is an open ledger accessible to all nodes
in the network, and combined with a consensus algorithm is what makes the blockchain
protocols decentralized.
[38]
Figure 4.3: Simplified Bitcoin Blockchain
• Is blockchain based
26
4.4 Question 2: How does popular blockchain protocols work?
A contracts account have an address on the Ethereum blockchain and are made by do-
ing a transaction with code inside it, with no recipient address. The code is put on the
Ethereum blockchain. After that, you can send Ether to the transaction with the code in-
side of it to have it run by the Ethereum network, more specifically the Ethereum Virtual
machine. The Ethereum protocol has the capability of executing a virtual computer in a
distributed and open manner. This is the Ethereum Virtual Machine (EVM). The programs
run by the EVM are called Ethereum smart contracts. The EVM that runs the Ethereum
smart contracts is made up of all the computers mining the smart contracts of the Ethereum
blockchain. The Ethereum smart contracts are put onto the Ethereum blockchain, making
the code immutable and public. This makes the smart contracts and its code trustworthy.
The smart contracts can be written in different programming languages. Among this are
Solidity, LLL, and Serpent with Solidity being the most popular programming languages
for the EVM. The code written in any of these three languages is not directly put on the
Ethereum blockchain. First, it’s compiled into EVM bytecode, and then the bytecode is
put onto the Ethereum blockchain. It is possible to write EVM bytecode directly; how-
ever, this is rarely done. Running your code on the EVM is not free, you have to pay some
Ethereum, known as gas, each time your contracts run. The gas price to run contracts on
the EVM fluctuates with the demand for computing power from the EVM [39]. The gas is
paid to the nodes in the Ethereum network that runs the contracts on the EVM.
A big difference in Ethereum from Bitcoin is the smart contracts. However, there are
also other differences. Ethereum uses a different hashing algorithm called Ethash, instead
of Bitcoins SHA256. Also, Ethereum’s mining algorithm is set up in a way that requires
the miners of Ethereum to fetch random data from the EVMs state, computing transactions
selected randomly, from the last N block in the blockchain and returning the hash of the
result. Due to this, Ethereum miners need to able to compute any kind of computation, and
27
Chapter 4. State of the art of blockchain technologies
they need to store the entire state of the Ethereum blockchain. Ultimately this removes the
possibility to make specialized hardware to mine Ethereum, enabling more people to take
part in the mining process, which in turn makes Ethereum more decentralized. Ethereum
does not have a block size for its blocks. Ethereum’s gas price decides the block size, and
the miners decide the gas price. If there are many un-mined transactions in the network,
block size will increase, gas price will go up because miners have to do more work, if
there are few transactions in the network block size may be decreased, and gas price will
go down because there is less work for the miners [40].
[41]
Figure 4.4: Smart contract system
4.4.2 Ripple
Ripple overview
• Name of coin: Ripples (XRP)
• Consensus algorithm: Federated Byzantine Agreement (FBA)
• Not mineable due to consensus algorithm
• Does not have a smart contract platform, high adoption in the crypto sphere, and is
capable of 1500 transactions per second.
• Banks want to use it for the international transfer of money
Ripple is a money transfer and payment system inspired by the blockchain [42, p. 24]. The
purpose of Ripple is to challenge the current global payment systems, which according to
28
4.4 Question 2: How does popular blockchain protocols work?
Ripple ledger or the XRP ledger is a shared, global ledger open to every participant in
the ripple network. And each participant can trust the XRP ledger because its made by
already trusted nodes. This shared ledger is a series of individual ledgers, which each of
the Ripple nodes keep locally. Transactions in the ripple network update the different ac-
count’s balances, then the balances are stored in the Ripple ledgers. This is unlike Bitcoin,
where only transactions are stored, and each user has to calculate the balance of Bitcoin
the other users have themselves. When new transactions are added, a new ledger is made,
this ledger is called an open ledger. After some time the open ledger is closed and awaits
confirmation from the network. When the consensus algorithm confirms the closed ledger
it becomes validated, it is at this time the information in the ledger is guaranteed to be cor-
rect and immutable [43]. Each of these ledgers functions like a block in the blockchain.
They have some sort of unique ID and a unique hash which identifies the content of the
ledger. The ledger is connected to the last ledger, like in the blockchain, with the hash of
the previous ledger. And when a ledger is validated by the consensus of the nodes in Rip-
ples network, it is added to the global ledger of validated ledgers. You can say that Ripple
is a ledger-chain. Because Ripple’s way of consensus does not include mining, makes the
Ripple network capable of handling 1500 transactions per second. Ripple also makes for
the possibility to make private networks within the Ripple network. This is done by hav-
ing two or more parties trusting each other in sending and receiving among themselves.
If nodes in the Ripple network can give assurance that they have a stable balance of other
types of currencies than XRP, they can send these type of assets across the Ripple network,
if the receiving party trusts them [44].
In summary, Ripple is a tool to move XRP or different assets globally without the need
for expensive bank systems. Ripple is not mineable. Instead, it uses trust among its users
to confirm transactions, with the Ripple consensus algorithm, which in turn make it less
decentralized than Ethereum and Bitcoin. Ripple focuses on well-established institutions,
which wants to move assets across borders inexpensively.
4.4.3 Cardano
Cardano overview
29
Chapter 4. State of the art of blockchain technologies
• Does not have a smart contract platform yet, but will in the future
• Medium adoption in the crypto sphere, and is currently capable of 5-7 transactions
per second.
The motivation behind Cardano is to change the way cryptocurrencies are designed and
developed. Cardano wants to make a sustainable ecosystem for its users and systems want-
ing to integrate blockchain technology. Cardano is an open source project and started with
a list of ideas, design, and engineering best practices. From this list of ideas and practices,
the Cardano team set out to research cryptocurrency literature, resulting in an extensive
library of research papers. And then again, resulting in a decentralized public blockchain,
with the cryptocurrency ADA. Because of their extensive research, Cardano deems them-
selves as a platform that is based on a scientific philosophy. The Cardano cryptocurrency
is similar to Ethereum in the way that Cardano is also a smart contract platform. However,
Cardano seeks to deliver more advanced features and to eliminate the problems they see
with Ethereum. Bitcoin was the first generation blockchain, Ethereum the second, and
Cardano is the third generation blockchain. What this means is that Cardano have the
advantage of hindsight, learning from earlier adoptions of the blockchain, making the Car-
dano platform better suited for handling issues of the past blockchain protocols. Resulting
in a different blockchain protocol than for instance Ethereum.
Cardano’s first difference with Ethereum and Bitcoin is that it makes use of another con-
sensus algorithm. Cardano uses a Proof of stakes algorithm called Ouroboros, instead
of proof of work. Ouroboros is mathematically proven to be secure, and have been ex-
tensively peer-reviewed with many Universities taking part in its development [45] [46].
Ouroboros works that the Cardano network selects a node randomly to confirm the next
block. This node gets a reward from confirming this block. The selection process is based
on how many Cardano tokens you hold. The more tokens you have, the more likely you
are to be selected for the block confirmation. This also allows for token holders to pool
their tokens together to increase their chances of getting selected for the block confirma-
tion and getting the block reward. So instead of having a lot of processing power, like with
the proof of work, you need to have many tokens to confirm blocks. Proof of stakes does
not require the computational power race to get to confirm a block, along with little need
for large-scale computing resources, making PoS more scalable and energy efficient [47].
In Ethereum smart contracts and normal transactions are not separated, in Cardano, this is
not the case. Cardano is separated into two layers, The Cardano Settlement Layer (CSL)
and the Cardano Control Layer. The Cardano Settlement Layer is responsible for handling
the token economics and user account’s balances. In other words, the Cardano settlement
30
4.4 Question 2: How does popular blockchain protocols work?
layer is made for handling Cardano’s token, ADA, and its users, the basic value trans-
fer. The Cardano Control Layer is where all the smart contract functionality of Cardano
exist, along with other functionality like digital identity. The advantages of separating
Cardano into these two layers is that you do not need metadata for doing transactions, like
in Ethereum and others. Moreover, it allows for updating the two layers separately, not
putting the other layer at risk [48].
4.4.4 NEM
NEM overview
• Is blockchain based
NEM stands for the New Economy Movement and is blockchain protocol intended to sup-
port the blockchain economy. In its basic form, NEM is just another blockchain based
cryptocurrency. However, it integrates technologies from other cryptocurrencies such as
Bitcoin and academic research in network theory, with a coin named XEM. The primary
contribution NEM gives in the landscape of cryptocurrencies, is NEM’s consensus algo-
rithm named Proof of Importance (PoI). Proof of Importance consensus algorithm also
seeks to eliminate the difficulties and challenges of Bitcoin’s and Ethereum’s proof of
work. Ultimately making the NEM blockchain protocol environmental friendly and sus-
tainable concerning Bitcoin’s scaling and power issues. NEM’s PoI is similar to Cardanos
PoS, except it does not solely rely on the balance of the nodes confirming the transactions
in the network. PoI wants to rewards other behaviors in the network that are believed to be
positive for the economy of NEM. The NEM protocol wants to reward active nodes in the
network at the expense of the inactive ones, along with dampening the effect that the rich
would get richer, which is usually the case with PoS. Also, NEM wants to function as the
core ledger of data systems. NEM does not have smart contract functionality [49, p. 16]
[50, p. 1].
The way of making a block with the NEM protocol is called harvesting. To harvest trans-
actions into blocks, the miner must prove its importance. First off a node needs to have at
least 10,000 XEM to eligible to be a part of the PoI calculation. Next, the account must
have transferred an amount of at least 1000 XEM, and this must have happened within the
last 30 day or 43200 blocks. Also, the 10,000 XEM must be vested, which means it must
have stayed at the same address for some time. Your XEM becomes vested at a rate of
31
Chapter 4. State of the art of blockchain technologies
10% per day, which means that for instance, 20000 non-vested XEM in your wallet will
become 10000 vested XEM within seven days. When a transaction is made the first node
in the network notify nearby nodes about the transaction. At some time the information
about these transactions will reach a node with at least 10000 vested XEM, this node will
then generate a block and receive the transaction fee that the block pays. The more trans-
actions a node completes, the higher importance the node gets, which in turn enable the
node to harvest and create new blocks [51] [50, p.27].
NEM also allows for messaging across its network in three different ways: encrypted, un-
encrypted or hex messaging forms. No XEM transaction needs to be done for the message
to reach its recipient in the XEM network. This could be used for secure communication
and other blockchain-based applications. However, to send these messages, you must pay
at least 1 XEM in fees, or more if the messages are encrypted. NEM also allows for Mul-
tisignature transactions. This means that a certain transaction from a certain account needs
to be signed by a given number of accounts associated with the account to broadcast the
transaction to the network and to ultimately become confirmed and put on the blockchain.
The account that eventually does the transactions after enough of the associated accounts
signs, is called a Multisignature account. Since a Mulitsignature account requires other
accounts to sign its transactions, means that if one account associated with the Multisig-
nature accounts loses its wallet through a hack, no XEM can be spent from that wallet
without the other accounts, which are associated with the Mulitsignature account, signing
transactions from it. This is also useful for protecting community-held funds, in the way
that many users must agree upon where the funds should, if the majority does not agree,
the transaction do not get enough signatures, and is therefore not sent [50, p.12-13].
4.4.5 Stellar
Stellar overview
• Was originally a fork of the Ripple protocol
• Name of coin: Stellar Lumens (XLM)
• Consensus algorithm: Federated Byzantine Agreement (FBA)
• Not mineable due to consensus algorithm
• Does not have a smart contract platform
• Low adoption in the crypto sphere, and is capable of 4000 transactions per second
The background for the creation of Stellar is similar to Ripples. Stellar wants to make
a fast financial network open to everyone which solves the problems with the current
financial systems. Stellar describe the current financial systems as a system with slow
transaction speed, high cost, and high maintenance. Stellar wants to solve this with the
power blockchain technology, their new model for consensus called federated Byzantine
agreement (FBA), along with the Stellar Consensus Protocol (SCP). Stellar also state that
their protocol avoids problems that the Bitcoin protocol has, especially in relation to en-
ergy consumption and high latency of transactions. Also similar to Ripple, Stellar want to
32
4.4 Question 2: How does popular blockchain protocols work?
let financial institutions issue tokens representing fiat currency [52, p.1]. Many similarities
can be drawn to Ripple, when it comes to Stellar, Trustlines are one of these. Trustlines
in Stellar is a relation between two or more actors. A trustline is made when an actor can
guarantee for a certain asset, like fiat, Lumens (Stellars native coin), gold or other physical
assets, and the other party trust this actor [53]. Trustlines between more parties is called
a Quorum slice. Within the quorum slice, the actors can trade assets between each other
without the consensus of the entire Stellar network. The entire network of nodes is called
the Quorum, hence the name Quorum slice which is just parts of the network [52, p.4].
Trustlines and Quorum slices and the consensus protocol (with variations) is also found in
the Ripple Protocol. This is likely because the first implementations of stellar was a fork
of the Ripple network, and had a high resemblance to the ripple protocol [54] Stellar also
allows for Multisignature accounts like with the NEM protocol, apart from that Stellar has
only minor smart contract alike functionality, due to its designers believing that smart con-
tracts with high functionality like Ethereum could expose the Stellar network to security
and instability issues [55]. Their philosophy is that users of the network will use the Stel-
lar Protocol and network as backbone infrastructure for asset transfers within applications,
this is another reason for the Stellar protocols few smart contract options [56].
4.4.6 IOTA
IOTA overview
• Not blockchain based, instead it is based on a directed acyclic graph named The
Tangle
• Low adoption in the crypto sphere, and may be capable of 71 000 transactions per
second with higher adoption.
The creation of IOTA has similar motivation as many other cryptocurrencies: to eliminate
flaws with the Bitcoin protocol. IOTA is focused on eliminating flaws in the Bitcoin proto-
col concerning transaction fees, transaction speed, scalability, and other problems related
to Bitcoin’s crypto mining-economy. IOTA have a coin, named IOTA, which is specifi-
cally designed for the IoT industry. Along with their coin comes their surrounding system
allowing for making transactions, named the Tangle. The tangle is not blockchain based.
The Tangle is a Directed Acyclic Graph (DAG). In Tangles DAG nodes only have edges
directed to older nodes than themselves. Each node has two edges pointing to two older
nodes in the tangle. Moreover, each node in the Tangle is a transaction, where the newest
node, confirms the second newest nodes and so on. When a node has at least to two edges
from a newer node, it is confirmed. The tangle will always have tips or a tip. A tip is
an unconfirmed node. When new transactions are added, they will make an edge/edges
33
Chapter 4. State of the art of blockchain technologies
pointing at the old tip/tips. When the old tip gets two or more edges from new nodes/-
transactions, it is confirmed. This is what makes IOTA scalable. The more transactions
that are getting added to the tangle, the faster transactions will get confirmed, unlike the
Bitcoin protocol where the transaction speed is static, and you may wait a long time be-
fore your transactions get confirmed. In Bitcoin, you have to wait for at least six blocks
mined to be sure that your transaction is legitimate. In IOTA you measure the integrity of
each transaction by its nodes cumulative weight. The cumulative weight is the sum of all
nodes in the network pointing directly or indirectly to a specific transaction. This means
that the more transactions that get added, the more integrity, the older transactions get.
Due to transactions confirming the latter once, IOTA does not need mining and therefore
have no fees for doing transactions in its network [27, p.1-3]. However, to do a transaction
with the Tangle the sender of a transaction must do a PoW. This PoW is only done once,
and only by the sender of the transaction. This type of PoW is not the same as the BTC
or Ethereum PoW. Since the PoW is only done by one actor, and not the entire network,
no computational power is left unspent. This small PoW in IOTA is done to attach the
transaction to previous ones and to prevent malicious spamming of the Tangle [57],
[58]
Figure 4.5: This is how IOTAs DAG, the Tangle, looks like. Each node represent a transaction. And
the green ones are confirmed transactions, and the red ones are awaiting confirmation. A transaction
is confirmed only if all tip nodes (the grey nodes) directly or in-directly point to it.
34
4.4 Question 2: How does popular blockchain protocols work?
and other machines. The data is sent in transactions in The Tangle with IOTA’s coin,
with practically no cost [59]. IOTA also promise the ability to transfer data securely and
un-tamperable through the Tangle [60] [61]. There are rumors that IOTA will have some
Smart contract functionality, something IOTA does not have at its current state [62].
4.4.7 NEO
NEO overview
• Medium adoption in the crypto sphere, and may be capable of 10 000 transactions
per second
NEO is a blockchain protocol, formerly known as Antshares [63], with the goal of trans-
forming real-world assets into digital ones. NEO wants to do asset record keeping with
e-contracts. With Bitcoin the goal is to transfer values, NEO wants to bridge values and
financial systems with the digital world. NEO promises a long list of features, with the
most notable ones being Smart Contracts, Digital identity, and digitally programmable as-
sets [64]. Some of these features are also found in the Ethereum protocol, and the two is
therefore often compared with each other. NEOs smart contracts have great variety in how
many programming languages you can write them in. Some of them are C#, Java, C/C++,
JavaScript, and Python. The reason for this is NEOs goal of making digital assets avail-
able to everyone [65]. The smart contracts run on NEO’s Universal Lightweight Virtual
Machine, NeoVM, similar to Ethereums EVM. NEO also has its own tokens called NEO
(NEO), and NeoGas (GAS). NeoGas is distributed to the holders of NEO over a period
of 22 years. The GAS tokens are meant for making an economic incentive for the users
in the NEO economy to the different services that users supply. These services could be
bookkeeping, storage of tokens, and the execution of smart contracts. Similar to Ethereum
you pay gas for your contracts to be executed, or your transactions to be confirmed with
Ethereum, in NEO they made an individual token for this type of actions [64].
NEO uses Delegated Byzantine Fault Tolerance (dBFT) algorithm to reach consensus in
their network. It is somewhat similar to the PoS algorithm in the way that it is the token
holders who confirm transactions. However, in NEO, token holders select a bookkeeper
that they support by voting for it. This is the delegation process. The most voted for book-
keepers, through Byzantine Fault Tolerant, reach consensus and generate new blocks. In
the NEO dBFT, the generation of a new block takes about 15-20 seconds, giving a transac-
tion throughput of 1000 transactions per second. However, the NEO team states that with
more optimization the NEO dBFT could reach a transaction per second of 10000. The
35
Chapter 4. State of the art of blockchain technologies
NEO dBFT combines digital identity technology, which allows bookkeepers in the NEO
ecosystems to have real name identities associated with individuals or institutions. This
can allow for interactions like freezing, revoking, inheriting, and retrieving assets due to
judicial decisions regarding the assets. This is what makes NEO capable to register digital
assets [64].
36
Name Bitcoin Ethereum Ripple Cardano NEM Stellar IOTA NEO
Blockchain based Yes Yes No Yes Yes No No Yes
Consensus algorithm PoW PoW FBA PoS PoI FBA N/A dBFT
Transactions pr second (TPS) 2,3 [66] 8,5 [66] 11,81 [67] 5-7 [68] N/A 1000-3000 [69] 2,4 [70] 1000 [71]
120-71 000
TPS max 7 [72] 15 [73] 1500 [67] N/A 3000 [49, p. 7] 4000 [69] 10 000 [78]
[74] [75] [76] [77]
Transaction fees Yes Yes Yes Yes Yes Yes No Yes
Mineable Yes Yes No No No No No No
Smart contracts No Yes No Not yet No No No Yes
Adoption High High High Medium Low Low Low Medium
Scalability Low Medium High High High High Very high Very high
Explanation for Blockchain based: This describes if the protocol is blockchain based or
not. The exceptions in this section are Ripple, Stellar and IOTA. Ripple and Stellar use
a structure very similar to the blockchain structure but are technically not blockchains.
IOTA uses a DAG.
Explanation for Consensus algorithm: Some of the different blockchain and chain pro-
tocols use different algorithms to reach consensus in their network. PoW: Proof-of-Work,
FBA: Federated Byzantine Agreement, PoS: Proof-of-Stake, PoI: Proof-of-Importance,
DAG: Directed acyclic graph, dBFT: Delegated Byzantine Fault Tolerance
Explanation for transactions per second and TPS max: Each blockchain protocol has a
theoretical max transactions per second and a current transactions per second. There are
usually variations in block size and consensus algorithm that are the deciding factors when
calculating the theoretical max transaction speed. Some protocols may reach the theoreti-
cal max speed, and some protocols may never reach it. Bitcoin’s theoretical max is seven
transactions per second, and this is the number you get when you assume that a transac-
tion only has one input and one output (which is usually not the case [79]), however during
Bitcoins lifetime, this transaction speed has never been observed [80]. This is also because
priority is given to transactions that yield higher transaction fees, making transactions pay-
ing lower fees left out of blocks, and may therefore never get confirmed. On the contrary,
we have Ripple. Ripple has a theoretical max transactions speed of 1500 transactions per
second. However, the transactions in the Ripple network has so far never needed this high
throughput [67]. Because of the differences between theoretical transactions speed and
maximum transaction speed I have decided that the table describes the current transaction
speed of the blockchain protocol, as well as their theoretical max. It is also important to
note that the transaction per second does not reflect when users receive coins through the
different blockchain systems. With Bitcoin, for instance, a user must wait for at least six
blocks after its transaction is confirmed to be certain that the transaction will stay on the
blockchain. As we know, block confirmation time on the Bitcoin blockchain is usually
around 10 minutes, making a user wait at least 60 minutes to receive its coins.
Explanation for transaction fee: Most blockchain and chain protocols usually have some
transaction fee to get your transaction confirmed. Some transaction fees are insignificant,
like with the Stellar protocol, where sending XLM only costs 1/100000XLM ∗ number
of operations of your transaction (One XLM is currently worth 0.23 USD) [81]. In con-
trast, historical data on Bitcoin transaction fees show that the average transaction fee has
fluctuated between 1 dollar and 55 dollars during 03.2017-03.2018 [82].
Mineable or not: The definition of Mining is doing a proof of work [83]. Other coins
have mining alike functionality, however, it is technically not mining. For instance, with
the Cardano protocol, you can confirm transactions by staking your coins, you receive an
amount of ADA for doing so. The amount you receive is the transaction fee. However, no
new token is generated by this. Also, confirming transactions in PoS does not require any
significant amount of computing power or calculation.
38
4.4 Question 2: How does popular blockchain protocols work?
Explanation for smart contracts: Simply stating whether or not a blockchain protocol has a
smart contract platform or not. Ethereum and NEO are the only blockchain protocols with
smart contract functionality at the current state. Cardano is developing a smart contract
platform, but this is yet to be released.
Explanation for adoption: the adoption level is estimated by highest transaction volume
and highest trade volume in dollars. The best indicator would likely be transaction vol-
ume, however for many of the blockchain protocols these numbers were hard to come by.
Bitcoin, Ethereum, and Ripple had the highest adoption of all of the blockchain protocols,
both in the transaction volume and trade volume [84] [28]. When taking trade volume
into considerations for the other protocols Cardano and NEO had approximately double
the trading volume of NEM, four times the trading volume of Stellar and IOTA, with IOTA
having the lowest volume. The trading volume gives us an idea of adoption. However, a
protocol could have a higher transaction volume without an increase in trade volume.
Explanation for scalability: Scalability is likely one important factor to run an IoT plat-
form on top of a blockchain protocol. The easiest way to determine scalability lies in the
potential transaction max. Again, some of these numbers are unlikely ever to be reached
by its blockchain protocol, and other numbers are from statements or white papers from
the blockchain protocols developers.
39
Chapter 4. State of the art of blockchain technologies
Stellar Lumens: searched for ”stellar white paper” found white paper at official site [52].
IOTA: searched for ”iota white paper” found white paper at official site [27].
NEO: searched for ”neo white paper” found white paper at official site [64].
4.5.2 Governance
The governance category covers the functionality of blockchain protocols or blockchain
based systems that goes beyond pure financial related usage. After the release of the Bit-
coin protocol, most innovations in the blockchain sphere have happened in this category.
Subcategories of Governance blockchain applications can be Data Storage, Smart Con-
tracts, Digital identity and Voting systems. These applications are not strictly tied to its
subcategory and may share functionality with other protocols. An example could the be
the usage of Ethereum smart contracts to do voting [95]. Usually, blockchain protocols do
have some kind of token or coin, which makes it possible to transfer value with all of them.
However, in many of these protocols, the tokens or coins are needed to make transactions,
and the transactions are needed to make use of the functionality that the blockchain proto-
col offers. For instance, with the Ethereum protocol, you need Ethereum to activate smart
contracts. This is not unique to Ethereum. There are blockchain protocols like Emere-
coin (a fork off litecoin) that have many different services aimed to be decentralized, all of
which you have to pay for with their Emercoin. Some of Emercoins services are decentral-
ized -storage, -advertising, -SSL based authentication, and -SSH management and access
control. Among its users are Deloitte Ukrainian office, which develops an Emercoin-based
40
4.5 Question 3: What are current applications of blockchain protocols?
document management system. The Russian Railways uses the Emercoin blockchain to
record data for the Russain Railways freight shipping e-marketplace [96]. Emercoin also
offers a decentralized storage solution. This functionality is found in other blockchain
protocols as well, like Storj, Sia, and Maidsafe. They all work in a way that somewhat
similar to striping in a NAS, except it is across other peoples computers and disks, instead
of your local disks. So in the different networks with the different blockchain protocols,
each user make their disk space available for storage, in turn, they get tokens or coins.
There are different cryptographic algorithms in store for each of the protocols, making the
data stored for the users inaccessible to the people that host the data. This is made possible
with the use of the blockchain. This description is a general explanation of decentralized
storage and may vary from protocol to protocol [92].
The smart contract approach in the blockchain sphere is based on the idea that the net-
work of nodes connected to the protocols blockchain is running code from the blockchain
together. There are different approaches for running smart contracts in the different pro-
tocols like described with Ethereum and NEO. And smart contracts is at the core of other
interesting functionality in blockchain technology. For instance electronic voting. There
are several issues, and problems with e-voting, one of them are storing and tallying cast
votes. As we know, the data on a blockchain is to a high degree immutable, making it op-
timal for storing votes. This would mean that if the blockchain were to be mined correctly
and safely, the integrity of the votes stored on it would be very high. Moreover, due to the
nature of the blockchain being transparent, people would be able to follow the voting pro-
cess, and other important principals in voting would be fulfilled. Also, blockchain voting
with smart contracts would allow for even better security, and integrity when voting [97].
This has been tested by Patrick McCory and his team showing that smart contracts on
Ethereum can do electronic voting securely with high integrity on a small scale [95]. This
is a great example of how smart contracts enable different usage of the blockchain, and
blockchain protocols.
4.5.3 Other
There are also blockchains protocols that fall outside of these two groups. Example of
these could be the blockchain based systems Omni and Bitmessage. These blockchain
protocols are made for message sending, in a decentralized and secure manner [98] [99].
Other protocols could be OpenBazaar which is a fully decentralized marketplace, with no
fees for its users, and all payment is made through cryptocurrencies. GridCoin is another
blockchain protocol which serves a scientific purpose. It is based on the idea that the
computation done on the Bitcoin blockchain is a waste of energy, and that this energy and
computing power could be used for something better. With the GridCoin protocol you lend
your computing power to different scientific project that can make use of decentralized
computing power. In turn you get GridCoins. The GridCoin protocol have been used in
calculations for cancer research, AIDS and malaria related medicine research, the mapping
of the Milky Way and cracking of Enigma machine codes. GridCoin uses a combination of
Proof-of-stake and Proof-of-Research in order to reach consensus in its network [100] [92,
p. 241].
41
Chapter 4. State of the art of blockchain technologies
42
4.6 Question 4: How is the blockchain used or can be used with IoT in particular?
The blockchain could be included in the different perspectives of IoT, namely internet-
oriented and semantic-oriented, i.e., in the infrastructure of IoT and data handling and
analysis [13]. Researchers and companies have realized this, and have in turn started to
investigate and develop its possible usages. What these researchers and companies have
investigated is what I will write about in this section.
”Blockchains and Smart Contracts for the Internet of Things” is a paper from IEEE dis-
cussing the possible use and usages of Blockchain in IoT solutions [101]. It is stated that
IoT should make a shift towards a decentralized architecture, in order to be sustainable.
Because the current centralized IoT models have a high cost due to maintenance. Es-
pecially considering the distribution of firmware and software updates after the devices
have been discontinued by their manufacturers [102]. There is also a lack of transparency
and trust between users and IoT devices. For instance with smart TVs sharing viewing
habits without the user knowing of it [103]. Veena Pureswaran proposes that IoT de-
vices integrated with a blockchain would make for a trustless peer-to-peer model, and
with the blockchain would be able to operate transparently, and transfer and distribute
data securely [102]. Based on some of these problems and ideas, ”Blockchains and
Smart Contracts for the Internet of Things” propose and discuss IoT systems integrated
with blockchains and smart contracts. Already existing systems and their ideas include
firmware authentication system for IoT devices, a device to device economy, smart con-
tracts connected to physical locks, supply chain security and distributed power generation,
all with the help of the blockchain [101].
One of the ideas of the paper is about firmware and software updates of IoT devices.
A common problem in the IoT sphere is non updated IoT devices not cooperating properly
with other devices, along with the issues that non-up-to-date firmware or software on a
device is a security risk. To solve this problem IEEE writers propose the idea of connect-
ing all devices in an IoT system to a blockchain. Then the manufacturer would make and
deploy a smart contract on this blockchain, allowing the devices to store the hash of the
latest firmware update. The devices would need to check if their firmware is up to date
with another smart contract in the network. This is done by using the smart contract to get
the hash of the latest firmware update, if the devices hash does not match the hash returned
by the smart contract, the devices would need to update. The first devices to update would
receive the update straight from the manufacturer, and the other devices would only need
to connect to other devices with the hash of the new firmware, which they got from the
smart contract, and receive the update from them. This means that if a device is segregated
from the network, it would be able to join the network and get the newest update of the
firmware. This would all happen automatically, without the need for user interaction. And
with the use of a blockchain with a cryptocurrency, the devices with the newest firmware
could charge the other devices with older firmware for sending them the newest version,
effectively making a device-to-device economy and market. IoT devices connected to a
blockchain with a cryptocurrency would be equivalent to giving IoT devices a bank ac-
43
Chapter 4. State of the art of blockchain technologies
count. IoT devices could then expose their resources to other devices and the user making
money from their abilities, like in the example above [101, p.2298].
Slock.it is another interesting IoT blockchain interaction. Slock stands for smart elec-
tronic lock, and it is the combination of smart contracts and physical locks. If you have a
device that carries the right token, you can physically open the door with the Slock on it.
Such token can be bought on the Ethereum blockchain. A Slock can be placed on cars, on
doors to real estate, on lockers, or anything else that uses a lock. So let’s say a user wants
to rent a car or a house, he would buy a token or get a hold of one through a smart contract
that counts time use for instance. Then the user would use the token on the Slock to gain
access to the house or the car. Afterward price for the rental is calculated, and the user
spends his Ether [8].
To turn away from fossil fuel and non-environmental energy, neighborhoods over a wide
area in Brooklyn, New York has started to use solar panels to power their homes. Also,
the solar panels of the different neighborhoods are connected to the Ethereum blockchain.
The idea is that, that not all solar panels are getting shone upon every time of the day, this
lost energy would need to be compensated for by using other sources of energy. However,
in the Brooklyn case, solar panels that generated more power than was consumed, can
sell their excess power to households who have less efficient panels. These transactions
and transfers of energy are done automatically by the devices, with smart contracts on the
Ethereum blockchain [104].
Wabi is a crypto token especially designed for securing consumer products. Wabi was
made as an answer to various food scandals, production of fake goods and fake pharma-
ceuticals in third world countries [105]. Among the food scandals that inspired the product
is the Chinese milk scandal in 2008, where six babies died, and 54,000 babies were hos-
pitalized, and the reputation of Chinese food exports was damaged. At some point in the
supply chain of the milk products, the organic compound Melamine was added to the milk.
Melamine is sometimes illegally added to food products to increase their apparent protein
content [106]. Melamine can cause kidney stones and renal failure and is not approved by
the Worlds health organization or national authorities [107]. The addition of illegal sub-
stances to food products, replacement of real products with fake once, and the production
of fake products are problems tied or solvable with adequate supply chain security, and
this is what Wabi wants to do. Wabi is divided into two parts, a blockchain, and a physical
RFID label with anti-copy functionality, connected to their blockchain. The idea is that
for each step in the supply chain the Wabi RFID label is scanned, and a transaction is done
on the Wabi blockchain, with the RFIDs chips unique id. The scanner of the product is
the one mining the Wabi blockchain and is awarded Wabi tokens. When the product is
scanned throughout its way in the supply chain, consumers can scan the label when the
product is in the store shelf, to check the origin of the product, and whether or not the
product is compromised. The label is also made in such a way that it becomes secure to
tampering by easily breaking when handled too roughly [108].
44
4.6 Question 4: How is the blockchain used or can be used with IoT in particular?
[108, p.11]
Figure 4.6: Backside of the tamper-proof Wabi label
IBM has been researching IoT with blockchain integration at least since 2016 [109].
IBM states that even though blockchain has gained a lot of attention in the financial sphere,
the blockchain may be the way to go in order develop decentralized IoT solutions, coor-
dinating devices as well as facilitating transactions between them. IBM see a lot of new
possibilities by combining IoT and blockchain, pointing out possibilities in different indus-
tries. The different industries were Supply chain, automotive, energy and utilities, health-
care, home automation and other industries. Other companies like Chain of things [110]
and filament [111] have also identified some of these possibilities, along with the other
companies previously discussed IoT blockchain solutions [112]. The automotive indus-
try is already implementing IoT devices in their products. One of these could be the use
of sensors in users cars. The sensor measure how good the driver of the car is driving
regarding their insurance policy. The sensors measure different aspects of the driving to
calculate a risk score for the driver. What the sensors measure could be anything from
position, acceleration, retardation, and revolutions per minute of the vehicle, along with
speed concerning speed limits in the area the driver is in and speed variations over time.
The data is put on the blockchain, in turn, the insurance company, can adjust the pricing of
your insurance. IBM is also imaging that authorities can view the data as well. The author-
ities can take action against illicit traffic activity, and fine traffic violations by looking at the
data [113]. This technology already exists, however, there is latency to such system. IBM
proposes that by integrating a blockchain with such system, the insurance company could
make real-time decisions related to pricing of their customer’s insurance. The way that a
blockchain would be integrated with such system would be to send the car sensor data in a
transaction. Different parties connected to the blockchain would, in turn, be able to see the
transaction and its data as soon as the transaction is confirmed and added to the blockchain.
45
Chapter 4. State of the art of blockchain technologies
IBM has also looked into possible uses of the IoT blockchain combination in the health-
care sector. By using blockchain in the healthcare data systems, data may be stored in a
distributed ledger securely, along with real-time trusted health data of the patients. Which
in turn can be accessed and used by insurance companies to easier release payments to
their customers. This could also be useful for the hospitalized person’s peers, and such
system would allow peers of the patient to be able to check in on them remotely [112].
Chain of things is a company that is also developing blockchain and IoT integration. One
of their case studies suggests that the blockchain may be a key component in securing IoT
assets. Chain of things proposes many applications of the blockchain in context of IoT se-
curity. One of them is similar to the firmware update service, already discussed. Another
possible usage that Chain of things suggests is using the blockchain for integrity checking
of messages in a network between IoT devices. If a device wants to send some kind of
data or a message to another device, it hashes this message or data and places the hash
onto a blockchain. The devices receive the message and hash it. For the device to check
the integrity of the message received, it can match the hash of the message with the hash
put onto blockchain by the sender. If the hash of the received message is the same as the
hash on the blockchain, the devices can be certain that the message has not been tampered
with [114].
Ali Dorri, Marco Steger, Sali S. Kanhere, and Raja Jurdak et al. [115] state the vehi-
cles are becoming increasingly connected, and especially to the internet, making cars part
of the IoT. However, they argue that security of these connected cars not be adequate at its
current state, giving examples of hackers gaining full control of vehicles core functionality
and steering remotely [115, p.1] [116]. The fact that hackers can exploit security vulnera-
bilities in cars to take control of them does not only make this a security issue but a safety
issue as well, putting drivers at higher risk. They propose to use a blockchain in order for
vehicles to communicate securely, along with the high grade of privacy due to public key
pairs associated with the cars, stored on a blockchain. Also, they state that the right imple-
mentation of the blockchain with IoT and cars is more scalable than today’s solution [115,
p.2]. Their proposal is similar to other security solutions for IoT discussed so far, however,
their proposal include safety of people, which show great trust in the blockchain and that
it may be applied to real life uses.
Another research team has shown that it is possible to combine the Ethereum blockchain
with physical devices. Also, they proved that it was possible to control these devices with
smart contracts on the Ethereum blockchain [117].
46
4.6 Question 4: How is the blockchain used or can be used with IoT in particular?
• Healthcare, storing data distributed to giving patients peers a way to monitor their
loved ones easily
4.6.1 Question 4.1: How is the blockchain used with IoT in a sharing
economy context?
I have already discussed different applications of the blockchain, along with various ap-
plications of IoT with blockchain technology. And touched upon the combination of the
sharing economy, IoT and Blockchain briefly with the New York-based, solar energy shar-
ing company solution. The model of solar panel selling excess electricity would not im-
mediately fit the goal of the thesis. However, the system could in later versions allow for
connection between devices and items without the need for human interaction.
Much closer is the decentralized sharing app by researchers Andreas Bogner, Matheiu
Chanson and Arne Meeuw et al. [7]. Their application is a web application, combined
with a smart contract on the Ethereum blockchain, which allows for decentralized payment
when lending and renting items to and from other users without a trusted third party. A
user can register an item for lending by making a QR code label, scanning it with the web
app and setting rental conditions. Afterward, the label is put on the item. When scanning
the QR code with the web application the second time, the option to rent the item with
the conditions set is shown, and the option to rent the item is displayed to the user in the
form of a ”Rent Object” button. To rent an object with the system, users are required
to have an Ethereum public address with sufficient amount of Ether on it to pay the de-
posit the item requires. A transaction with the deposit goes to the smart contract, and the
user is now renting the item. When the renter is done renting the item, the user presses a
”Stop renting” button. This activates another function of the smart contract. To calculate
the how much of the deposit the user will receive back, the time stamp from the activa-
tion of the contract is subtracted with the time stamp of when the smart contract receives
the stop renting action. This sum is sent back to the renter, and the rest is sent to the lender.
Slock.it is a German startup that focuses on making a free and open source infrastructure
for renting, selling and sharing items called the Universal Sharing Network (USN) [8].
Their idea springs out of a survey done by The Nielsen Company [118]. The survey states
that 66% of the world is willing to share their assets for financial gain, with the same figure
being as high as 94% in China [118, p. 4]. Slock stands for smart electronic lock and is
the combination of smart contracts and physical locks. If you have a device that carries
the right token, you can physically open the door with the Slock on it. Such token can
be bought on the Ethereum blockchain. A Slock can be placed on cars, on doors to real
estate, on lockers, or anything else that uses a lock. So let’s say a user wants to rent a
car or a house, he would buy a token or get a hold of one through a smart contract that
counts time use for instance. Then the user would use the token on the Slock to gain access
to the house or the car. Afterward price for the rental is calculated, and the user spends
his Ether [8]. It is the combination of the Slock and their USN that is their service. By
this Slock.it believe that there is an untapped opportunity in sharing un-utilized items and
47
Chapter 4. State of the art of blockchain technologies
[7, p. 177]
Figure 4.7: Figure of Andreas Bogner, Matheiu Chanson and Arne Meeuw’s decentralized appli-
cation with caption:”DAPP in use: The owner of the smart contract registers device by scanning a
barcode with a numerical id (left screen). After scanning the same barcode on a registered device,
the app displays the rental conditions to the interested renter (right screen).”
assets, and it is possible to do this with higher automation than today. The USN is con-
necting IoT devices with Ethereum smart contract access control mechanisms to mobile
phones. They want to apply the USN in many different industries and markets, including,
but not limited to: The Sharing Economy, Supply chain management, maritime contracts
and the shipping container industry, energy, and smart homes [119]. When it comes to
the implementation of the USN in the sharing economy, the idea is to put items behind a
”slock” (smart electronic lock), pay for it with Ethereum, and access the item. The slock
will open when you scan your phone onto it, and it sees that the transaction made on the
Ethereum blockchain was from your Ethereum account on your phone. They describe the
process of renting an item like this: you open their app, find the object, pay for the item
and then use it. When you have paid for the item, an IoT device on the item will unlock
the item, and then you can use it. When you put the item back, you pay for how long you
rented the item. An illustration of such scenario with a bicycle can be seen in figure 4.9.
48
4.6 Question 4: How is the blockchain used or can be used with IoT in particular?
[8]
Figure 4.8: The figure shows how many percents of people are willing to share their assets for
financial gain per continent.
4.6.2 Search process IoT and Blockchain, and IoT, blockchain and
sharing economy
To answer question 4 and to find information about blockchain and IoT implementations,
and use cases I searched with the string ”blockchain and iot” at Google.com. Limiting
ourselves to use only hits on the first page, the paper: ”Practical comparison of distributed
ledger technologies for IoT” [120] was found. The paper itself was not used further, but
it lead to the finding of the paper ”Blockchains and Smart Contracts for the Internet of
Things” [101]. This paper led to several other papers including:”Device democracy: Sav-
ing the future of the Internet of Things” [102], ”Own a Vizio Smart TV? Its Watching
You” [103], ”The USN” [8]. Also, this led us to find out about transactive grids [104],
but I found this citation from Google instead of the paper due to lack of information in
the cited ones. Information about the Wabi token was discovered while looking for infor-
mation about other cryptocurrencies on Coinmarketcap.com [28], and it matched question
4, so I decided to include it. The rest of the references was found by using the string
”blockchain IoT” in Oria on the first pages, ”automotive blockchain iot,” and ”blockchain
sharing economy” in Google.
49
Chapter 4. State of the art of blockchain technologies
[8]
Figure 4.9: How Slock.it picture bike rental through the USN
50
Chapter 5
Motivation and requirements for an
IoT based sharing app with
decentralized payment
I also believe that their system is not exploiting the blockchains full potential. I believe
that time spent renting an item does not accurately enough reflect the price the user has to
pay for using the item. I also believe that this is not fair to the lender of the item. I believe
there should be more ways than just time spent renting an item, to determine how much a
renter in this scenario would have to pay for the rented item. Like previously discussed,
the idea of using IoT for accurate pricing is already being done by insurance companies
related to the car insurance they provide their customers. Slock.it and Andreas B’s team
does not use the blockchain to send data about the condition and whereabouts of the item
in their platform. This further limit the possibility of selling data generated by usage of
the items.
51
Chapter 5. Motivation and requirements for an IoT based sharing app with decentralized
payment
Limitations listed:
5.2 Motivation
I believe that utilizing the power IoT with the blockchain, would give an option for a more
diverse price calculation for renting and lending items. I want to determine the price by
equipping items with an IoT device. Also, with this IoT device on and connected to the
item, use the data it gathers to make a more accurate and fair price for both parties. Also
to start renting an item, you would scan the IoT device instead of the QR code.
Figure 4.7 in the right frame shows a user having the option to rent a power drill. Why
would we need to connect an IoT device to this item to determine the final price for renting
it? One reason is that a renter of the drill would not necessarily spend the entire time rent-
ing the drill actually drilling with it. This is unfair to the renter. A more fair price would
be if the renter paid a lower price for the time spent having the drill, along with paying
more for the electricity spent from the batteries of the drill, essentially paying for the ac-
tual usage of the drill. The reason for keeping time as a measure is to limit the renter of
the drill to let other people rent the drill as well. At this stage, we can determine the actual
usage of the drill. However, we are not able to determine how the drill is used. Users may
interact differently with the same item. Some people may handle the drill roughly, while
others may handle it delicately. An IoT device could measure this with impact sensors
and different movement sensors. The data from these sensors would also make an impact
on how much the renter would have to pay for renting the item. Let’s say the IoT device
detects an impact that would damage the drill, the IoT device would, in turn, charge the
renter more. On the other hand, if the IoT device detects that the item is handled delicately,
it will reward the renter by giving a lower price. There are many possibilities with IoT and
sharing of devices with data. Therefore I have made tables for a couple of items (including
the drill) to show what could be measured by IoT devices to determine the price for renting
items (table 5.1). Having an IoT device on a non-electrical item is possible; however, the
item’s IoT device would need frequent charging. The scenario is more viable when the IoT
device and its sensors have constant access to power, i.e., used with items with batteries or
other sources of power. These lists are just some examples of some classes of items that
could use IoT sensors to be rented out for an accurate price. The lists are not complete,
and there are possibilities of using different sensors for different items and usages. Some
items may also share the same sensors across classes, like for instance with an unmanned
aerial vehicle or drone. A drone would be an electronic device, but should share many of
the same sensors as vehicles to determine an accurate price.
Another possibility not discovered by these two actors is the possibility of utilizing the
52
5.2 Motivation
Types
1. Hand held tools - Drill, chainsaw, concrete breaker, lawnmower, and similar
• Time
• Consumed power from battery
• Accelerometer
• Impact sensor
• And more..
2. Vehicles - Cars, motorbikes, bicycles, excavators, and similar
• Time
• Distance
• Gas consumption
• Impact sensor
Including a driving monitor like Autologger [113] which include data about how the driver is:
• ..accelerating the car
• ..braking and the braking distance
• ..driving in different weather conditions
• ..turning - driver turning to hard is at higher risk
• ..and more
3. Electronic devices - Computers, gaming systems, cell phones, and similar
• Time
• Consumed power and/or consumed power from battery
• Accelerometer
• Impact sensor
• And more..
53
Chapter 5. Motivation and requirements for an IoT based sharing app with decentralized
payment
Summarized:
• Use data from IoT devices to determine an accurate and fair price when renting and
lending items in a SEP
• Payment in the system shall be decentralized by having users pay with cryptocur-
rency
• Enable real-time monitoring of items through a blockchain
• Enable selling of data generated by items, stored on a blockchain to third parties
This result in the following research questions:
Research question 1: How can data be used in a decentralized sharing economy plat-
form to determine an accurate and fair price for both the renter and the lender?
54
5.3 Research questions
Research question 2: How could such system provide real-time decentralized payment
through a blockchain technology?
Research question 3: How can real-time transactions with data provide real-time infor-
mation to a lender about the condition of its items?
An example could be an automated taxi service. The car is self-driven and drives
55
Chapter 5. Motivation and requirements for an IoT based sharing app with decentralized
payment
around picking up customers, the sensors of the car measure every aspect of the car. Sud-
denly low tire pressure is measured, the car places an order in an open marketplace for car
services. The service provider with the lowest cost comes to aid the car with an automated
drone. The drone fixes the cars tier, and charge the car for this service, and the drone
flies off to assist other cars or other vehicles. When the drone needs new parts for fixing
other vehicles, it can fly to another machine to purchase the parts it needs. Alternatively,
when the drone needs to recharge or replace its own parts, this can again be purchased
from other machines. In this system, the machines would charge people for the data they
generate while using this vehicle.
This is a future vision, and I believe that it will take several years to reach this kind of
automation. However, a system enabling people to interact with items through their phone
could be tweaked into letting machines interact with or other machines, essentially allow-
ing for a machine to machine interactions. It is likely that machines would exchange some
kind of information between them to interact with each other. This could be done through
a system as I propose. However, these things would also need to pay each other for their
services. This is where the blockchain comes in. The blockchain is interesting in many
different aspects, many of which I have already shed light upon in this thesis, however
one of the most interesting features related to the sharing economy and IoT, is that the
blockchain could allow everyone and everything to have a ”bank” account. And when
everything can have a bank account, then everything can pay other things, i.e., machine-
to-machine economy. The system I want to make is a Sharing economy platform (SEP).
A SEP where users of the system can rent items from each other, with blockchain as a
base for data distribution and payment. So I believe that the system I am presenting in
this thesis could be applied in a machine-to-machine scenario in the future. This is not my
main motivation.
• Q1: What do you think about the systems way of using data to calculate renting
prices?
• Q2: What do you think about the systems way of making users use cryptocurrency
to pay each other?
• Q3: What do you think about the systems way of giving lenders real-time informa-
tion about their items when they are rented?
56
5.4 Empirical study of research questions
• Q4: What do you think about the possibility the system gives the lenders in regards
to making extra income from selling data generated by their items to third parties?
By having open questions I could get an explanation of what the participant like or disliked
about the research questions. When processing the data from the survey, I first read through
all of the answers to make categories for the answers. This resulted in five categories:
The participant is positive to the question, the participant is negative to the question, the
participant is positive to the question and concerned regarding users privacy, the participant
is negative and concerned regarding users privacy, and the participant was neither positive
or negative, to the question. GDPR was mentioned several times in the data set; therefore
I needed the categories regarding privacy. Also, some participants were unsure of what
to answer to some of the questions; therefore I added the ”unsure” category. In order to
classify the answers, I read through each of the answers once more and marked the answers
with one of the categories. The data is available online [121].
57
Chapter 5. Motivation and requirements for an IoT based sharing app with decentralized
payment
privacy concerns and stood for 20,8% of the answers. They answered that the amount of
surveillance in the system would make them uncomfortable using it. 4,2% answered that
they were uncertain or not interested, therefore their answers were classified as unsure.
58
Chapter 6
High level architecture and design
59
Chapter 6. High level architecture and design
income by deducting a small fee from every transaction made in the system. Also, the
platform may sell the IoT devices to put on the items.
• RFID tag
• GPS tracker
• Accelerometer
• Impact sensor
• Gyro sensor
• Water detector
RFID is important to many IoT based systems, including my system. RFID would give an
item an id, and make it possible to read this id from the RFID tag. An RFID tag would
give the interface in order to connect the physical device to the renters and the lenders of
the system. An RFID tag would also be able to do some sensing, data based on the sensing
could be included in the calculation of price, along with information to lenders and third
parties. The GPS tracker would give information about the whereabouts of the item to the
renter, and if put on vehicles calculate how far items have traveled. The accelerometer
would give information about sudden movements and combined with a gyro sensor could
give insight into how renters are using the device. The impact sensor would give the renter
an insight in how harshly the item is rented.
• Items
60
6.4 System actors and roles
• Third parties
• Renters
• Blockchain
• The items role is to be rented, generated data, and transmit data to a renter.
• The renter’s role is to rent items, relay data from the item, and pay the item owners.
• The lenders’ role is to lend items, keep track of their items condition and where-
abouts, receive payments from renters and sell the data their items generate to third
parties.
• Third parties role is to make offers for the lenders’ items data and purchase this data.
• The blockchains role is to calculate the price for renting items and charge the renter
accordingly, relay payments from renter to lender and store data generated by items.
(1)
This is the relation between the lender and its items. The lender owns the item and puts it
up for rent.
(2)
This is the relation between the third parties in the system and the lenders in the system.
The third party pays the lenders to access the data generated from the items they rent.
(3)
This is the relation between the item, the renter, and the items indirect relation to the
blockchain in the system. The renter scans the items sensors, and the item then sends
a signal to the phone activating a smart contract, which starts the process of billing the
renter’s account. The item sends data to the owner’s phone, and the owner’s phone con-
veys this information forward to the blockchain, along with payment for renting the item.
The lender specifies the frequency of this action. The relation between item, renter and
blockchain are further described in figure 6.2.
61
Chapter 6. High level architecture and design
Figure 6.1: How the different actors in the system are related to each other
(4)
The relation the lender has with the blockchain is divided into two. First, the lender re-
ceives payments made by renters. Secondly, the lender can access the data generated by
its items. This data is transferred along with transactions made from the item, through the
renter’s phone, originally meant for calculation of the price the renter is paying for using
the item. However, this data is also useful for the lender. This data lets the lender know
the location of the item, condition, and events that have occurred with it (as long as there
are sensors on the item measuring this).
(5)
After a third party has paid a lender to access the data generated by the lenders’ items, the
third party get information about the which transactions items has made on the blockchain.
The third party can then identify an items transaction, and read the data encapsulated inside
each transaction off the blockchain. The third party may further use this data in order make
improvements to their products or other usages for the data.
(6)
The renters’ relation to the blockchain is conveying data from the item in transactions
including payments to a smart contract on the blockchain.
62
6.4 System actors and roles
Figure 6.2: Figure show how a user would rent an object
63
Chapter 6. High level architecture and design
• Users shall be able to sell the data their items generated while being rented
• Payment and billing in the system shall be decentralized with the help of a cryp-
tocurrency
• System shall use data from IoT devices to calculate the cost of usage of an item
4. Information is sent to a smart contract, and the item is now able to be rented
64
6.6 Use cases
4. Scans item’s IoT device with phone and pays a deposit to the smart contract auto-
matically
1. Within a time interval, the IoT device on the item sends data to renter’s phone
3. Smart contract calculate how much the renter needs to pay in relation to the data
received
4. The smart contract deducts an amount of the deposit on in the smart contract and
sends it to the owner of the item
65
Chapter 6. High level architecture and design
4. This information renders a map of the whereabouts of the item, along with ”last
events” of the item
3. Third party uses the search field in order to look up an item it is interested in
4. Results show different items, and how much data is stored
5. Third party pays for the data and can read data of all transactions regarding the item
66
Chapter 7
Detailed design and implementation
• Code is inspired by Andreas Bogner, Matheiu Chanson and Arne Meeuw’s work [7]
• System is using Truffle development framework for binding JavaScript and Solidity
• System is using node package manager for dependencies, installing and running my
code
• Systems user interface’s HTML is based on a template [125] and used with JQuery
67
Chapter 7. Detailed design and implementation
A smart contract is code place on a blockchain, in our case on the Ethereum blockchain.
To put a smart contract onto the Ethereum blockchain, you have to make a transaction
with no recipient, which contains the code you want to place on the blockchain. To run
the code, you must send an amount of ether to the contract. When paying for transactions
or paying for having your smart contracts ran, is called paying Gas. The amount of gas
you pay is a fee you have to pay for your smart contract or transaction to be either ran or
confirmed. The Gas price fluctuate based on the supply and demand for code execution or
transaction confirmations, meaning that if there are many actors sending transactions, or
in need of executing their smart contracts, the price of gas will rise. The Gas price will be
lower in the opposite scenario. This means that usually, you will not pay the same amount
for running a smart contract or getting your transactions confirmed every time. The Gas
you pay goes to the miners in the Ethereum network because they are the one confirming
transactions and running the smart contracts. A user have to send an amount of Ether to its
smart contract’s address for the Ethereum network to run it. It cost Gas to run, and write
to the Ethereum blockchain, however reading data from the blockchain is free.
The smart contract in the system’s purpose is to handle all logic users, payments, and data.
A user only needs an Ethereum address to use the smart contract. A user must register
the item in the user interface, information regarding the item is sent to the smart contract.
The item is now registered and is ready to be rented. I have not built an IoT device with
the system, for now, a renter has to know about the id of the object to rent it. When the
user accesses the items Id in the user interface, the renter press the rent item button. The
renter then pays a deposit to the smart contract, and the renting process begins. The smart
contract receives data from the item through the renter’s phone, and calculates the cost in
regards to different data and time spent, and deducts this from the deposit. This process
stops when the renter delivers the item back, and the lender presses the stop renting button
for the items id in the user interface. When this button is pressed, the smart contract stops
charging the renter.
The data generated by the users of the system is stored on the blockchain. This data may
be valuable to third parties. Third parties may be manufactures of the items rented and lent
in the system. The data these item generate while being rented may give a manufacturer
valuable insight in how their products are used. Item generated data is therefore for sale
in the prototype. Making a third party able to purchase the generated in the system from
lenders in the system.
68
7.2 System implantation user interface
Figure 7.1: Figure showing the architecture of the prototype. All interactions with the system
included the use the smart contract’s function. Third parties read data off the blockchain, without
the need for the smart contract
69
Chapter 7. Detailed design and implementation
70
7.3 Smart contract implementation and code: Data structures and functions
71
Chapter 7. Detailed design and implementation
struct Client {
address cliAddress;
uint since;
bool exists;
}
And
struct Object {
uint objId;
string description;
uint deposit;
Client client;
uint created;
address owner;
bool exists;
In order to use data for payment in the system I added the arrays ”dataWeights”, data”, the
variable ”lastPaid”, and the variable depositReset to the Object-struct looking like this:
struct Object {
uint objId;
string description;
uint deposit;
Client client;
uint created;
address owner;
bool exists;
uint[] dataWeights;
uint[] data;
uint lastPaid;
uint depositReset;
72
7.3 Smart contract implementation and code: Data structures and functions
Figure 7.3: Screenshot of the prototype showing a renter who are about to rent an item
73
Chapter 7. Detailed design and implementation
Figure 7.4: Screenshot of the prototype showing the view for the renter after it has started renting
the item
74
7.3 Smart contract implementation and code: Data structures and functions
Figure 7.5: Screenshot of the prototype showing information about a rented item
75
Chapter 7. Detailed design and implementation
Figure 7.6: Screenshot of the prototype showing an interface a third party would access in order to
purchase data
76
Variable type Variable name Usage
uint objId This is the Id of the object
string description Description of the object
uint deposit Holds the current deposit of a user while the item is rented
Client client Which client is currently in possession of the item
7.3 Smart contract implementation and code: Data structures and functions
uint created What time the item was registered
address owner Address of the client owning the item
Checks if the items exist, and
bool exists
to check if the item is rentable or not
An array containing weights that will be multiplied with data received
uint dataWeights
from the items sensors
uint data An array containing the data generated by an item
uint lastPaid A variable that shows previous amount of ether from the renter
Holds the original value of the deposit set by the renter, used
uint depositReset
to reset the deposit variable after the item has been used
Table 7.1: Explain variables in the the struct ”Object” that represent an item
77
78
Table 7.3: Shows get functions that I added and the edited function ”registerObject”
7.3 Smart contract implementation and code: Data structures and functions
• rentObject(uint objId)(edited)
• reclaimObject(uint objId)(edited)
• payData(uint objId, uint[] data)
Important to notice is that I have not made an IoT device for this thesis. Therefore regis-
tration of items, renting of items, and sending of data is done in the user interface.
79
Chapter 7. Detailed design and implementation
to the user interface. This function enables the use of the functions: ”reclaimObject,” and
”payData.”
This function is made available for the lender once one of the lender’s items becomes
rented. This function is used when the lender of the item receives the item back from
the renter of the item. More specifically when the lender presses the ”Take back object”
button. This activates the function on the smart contract. First, the function asserts that the
object is rented and that the activator of the function is, in fact, the owner of the object.
Next, the function sends back the rest of the deposit to the renter. Next, it sets the deposit
back to original state with the help of the original deposit. This is because the deposit
gets lowered during the time it is rented, and it is calculated with the ”deposit” variable in
the object. And lastly, the function sets the object as rentable again and returns the value
”true” to the user interface.
80
7.3 Smart contract implementation and code: Data structures and functions
In order to calculate a price with the data, the system would have weights for the different
data. The sensor would add data of the same type together over a set time period, and then
data would be done calculations on. I picture a calculation like this:
Data A x weight for data type A + Data B x weight for data type B...etc.
The different data should make a different impact on the price the renter pay. Time spent
using an item would always be taken into consideration when using an item, and would
be simple to calculate, and would have a low weight. However, a weight for impact data
should be high for fragile items and lower for more sturdy items. If data from the impact
sensor suggest that the item is broken, the renter would likely lose its entire deposit. This
could be similar to the water detector. This is what the function ”payData” do.
This is the most important function of the prototype and the thesis. This function en-
ables the object that is rented to charge the user based on the data it sends to the user’s
phone, and further to the smart contract. This function is activated on a timely basis de-
cided by the owner of the item. The function receives the id of the object, along with the
data it has generated in a transaction to the smart contract. Then the function iterates over
the data wights, multiplying and adding each data weight with the data of the correspond-
ing type. This is stored in the variable ”dataPrice,” that holds the amount the renter has to
pay the data received from the object that is being rented. Then the renter sends an amount
of Ether equal to the ”dataPrice” variable to the owner of the item, and the data price is
deducted from the deposit of the object. This function along with the data structures re-
garding the data is what makes the pay-by-data functionality possible In the prototype, I
assume that the data is sent in the same order as the data weights are structured in the
”dataWeights” array.
if ( !objects[_objId].owner.send(dataPrice) ) {
revert();
}
objects[_objId].deposit = objects[_objId].deposit - dataPrice;
return true;
}
81
Chapter 7. Detailed design and implementation
7.3.3 web3.js
I made and reused JavaScript functions as well, however the interesting functions are in the
smart contract. I decided to include some JavaScript code to show how to call functions
in the smart contract. Here is an example of JavaScript code that calls the smart con-
tract function ”payData.” For readability, and following the conventions of reused code,
I named my JavaScript functions the same as the smart contract functions. This function
gets the user input data from the user interface with Jquery and sends an array of data as
an argument to the ”payData” function, the account that activated the contract’s function
along with the gas required to process the function in the deployed smart contract.
function payData() {
var rentable = RentableObjects.deployed();
var dataWeightsTime =
parseInt(document.getElementById("_dataTime").value);
var dataWeightsGps =
parseInt(document.getElementById("_dataGps").value);
var dataWeightsAccel =
parseInt(document.getElementById("_dataAccel").value);
var dataWeightsImpact =
parseInt(document.getElementById("_dataImpact").value);
var data = new Array(dataWeightsTime, dataWeightsGps,
dataWeightsAccel, dataWeightsImpact);
rentable.then(function (instance) {
return instance.payData(objectId, data, {
from: account,
gas: 1000000
}).then(function (success) {
if (success) {
setStatus("Object paid data");
}
else {
setStatus("object did not pay");
}
switchPageView();
})
}).catch(function (e) {
console.log(e);
setStatus("Error paying object; see log.");
});
}
82
Chapter 8
Evaluation and discussion
8.1 User-testing
To get feedback on my prototype, I conducted a user-test of the prototype. The user-test
was inspired by methodology from the book ”Researching information systems and com-
puting” [126]. The users tried each role of the prototype, as a renter, as a lender, and as
a third party. After each role was tested, the participants were interviewed with the goal
of understanding how they liked the prototype, uncover problem areas of the prototype
and get suggestions on how to improve the prototype. Three user-tests were held. I chose
participants who had responded to the survey for the research questions. I chose previous
participants of the survey because they would have more insight into how the prototype
function and what technology the prototype uses. I also chose students with a background
in computer science, in the last year of their degree, because my assumption is that their
general understanding of technology could offer better answers than less experienced tech-
nologists. I decided on dividing the results of the user-tests into each role of the prototype.
Further, each role is divided into what the participant answered, related to the research
questions. Lastly, a section of general comment follows.
I used an item and simulated that it had an IoT sensor attached to it, along with the proto-
type running on a computer, and acted out the different scenarios with the participant, in
order to make the testing as realistic as possible.
83
Chapter 8. Evaluation and discussion
Participants stated that the prototype lacked information about how much it usually costs
to rent an item. The price listed was for each type data, which made it difficult for the
renter to make an estimate how much it would cost to rent the item. Users suggested
that an average price based on previous rentals should be displayed for the renter. Also,
displaying price comparisons of other lenders lending similar items was also suggested.
Automatic payment
The participants did not mind that transactions are running while using the item. A partici-
pant stated that this was a nice feature that would give the renter more flexibility in relation
to how long the renter wants to rent the item. This participant gave the example of a renter
needing to extend the rental period. The renter would not have to worry about giving the
item back before the renter were finished using the item. Another participant suggested
that the system should include a refund program if an item breaks while using it, and it is
not renters fault. One of the participants stated that using a cryptocurrency to pay seemed
foreign, therefore the prototype should include a user-friendly gateway between Ethereum
and fiat currency. If this gateway functioned well, the participants would be more positive
towards using the system. The participants expressed concerns about the renter having to
pay transaction fees both for the transaction fees for storing data generated and for activat-
ing the smart contract on the blockchain. Nevertheless, it was stated that they would use
the system if these fees were not too high.
The participants did not like the GPS monitoring of items. This was also reflected in the
results of the survey regarding my research questions. The participants felt that the GPS
monitoring was uncomfortable, because it intruded upon their privacy. However, the par-
ticipants stated that the other monitoring of the item was good. The participants said that
they would handle an item with more care when it is monitored because this would be
reflected in the cost. A participant stated that the monitoring assigns a greater responsibil-
ity to the renter. Another participant stated that the monitoring was fine, but would have
preferred not being monitored at all, especially the monitoring of their location. Another
participant underlined the importance of informing the renter about the monitoring. A par-
ticipant noted that it would helpful to get a notification if the renter handled an item too
roughly.
Data purchase
Participants did not mind that data was purchased by a third party, as long as the data was
anonymized beforehand. However, a participants found problems in the ownership of the
data in the prototype. And asked: Who owns the data, the owner of the item, or the renter?
84
8.1 User-testing
Automatic payment
Nothing particular were stated about the automatic payment aspect of the prototype from
the lender perspective.
Real-time monitoring
Regarding the real-time monitoring feature of the system, privacy was once more of con-
cern for the participants. One participant found the monitoring the renter’s position un-
comfortable. However, all the participants were positive to the other monitoring aspects
of the prototype. Stating that as lender it is a good feature that would make them feel safer
about lending their items’. And that it was nice to see if the item were treated well or
badly. A participant stated that if the prototype was a real system, the participant would be
more likely to rent its things. Another participant said that the monitoring could be source
of stress for the lender. And said that a lender could become occupied by always monitor-
ing items, worrying more about the items’ condition, than they would without monitoring
in place. A participant stated that it would make it more comfortable to rent things to
strangers with the monitoring in place. The same participant suggested a reputation sys-
tem for the prototype. Which would keep track of renters previous experiences with other
items. And based on this how well a renter had treated previous items, be able to determine
if the lender wants to lend its items to that specific person.
85
Chapter 8. Evaluation and discussion
Data purchase
The participants were positive to the idea of selling the data, as long as the data is anonymized.
However, some participants wondered about how much you would actually make by sell-
ing the data of your items. Also, a participant wondered who are owner of the data in the
prototype: the renter or the lender?
Data purchase
Participants stated that purchase of user data is a good opportunity for a third party, and
a helpful way to improve their products. Once more, problems regarding privacy were
pointed out. And that data should be anonymized before a third party is allowed to pur-
chase the data. The question regarding who owns the data was also raised again. A partic-
ipant asked who should be allowed to purchase data, who can be a third party? Moreover,
the participant said that it would only sell data to serious actors because the participant
was afraid that an actor could use the data maliciously.
86
8.2 Discussing the prototype
Data Weights
Testers had difficulties setting the weights for each data type in the prototype. It is not
surprising, because testers lack experience in data-price calculations. It is understandable
that the weights are difficult to set. Different items would require different weights, and
people would lack experience in making such calculations. For instance, a fragile item
would need a higher weight for its impact data than a though item would need to reflect
the cost of tear and wear. However, what could be a viable method for setting the weights
in the prototype?
First, we would have to find a starting point for the weights. To define a starting point for
the weights, testing would have to be done on different types of items with the IoT device
87
Chapter 8. Evaluation and discussion
attached to it. Several tests would have to conducted in order make a good estimation of
what the different weights could be. The testing would start by finding items that could
represent most items of the same type. Then, we would have to test and use the items
in different scenarios. These scenarios could include: testing normal usage of the items,
rough usage of the items, breakage, and similar tests. We would then be able to make an
estimation of the weights derived from the data generated by these tests. The goal of the
initial tests would be to find weights that would pay an amount of Ether that is equal to
the items cost when the item becomes depleted. With weights that generate a zero-sum
cost of renting an item, the weights could be tuned into generate profit for lenders. The
system would recommend these weights, but should allow lenders to tweak them to their
liking. After some time, the system could use the data generated by the items’ IoT device
to tweak the weights more accurately for specific items. Finding the estimates for the
weights would be a tedious process. There would be many different items to test, and
it would take a lot of time and resources to do so. It is likely that some manufacturers
do tests on their products and are aware of what durability their product has. Therefore,
another approach could be to gather item durability data from different manufacturers of
items and then apply weights based on their data. Another idea would be to give the users
the possibility to set the weights themselves and let the open market decide by itself, what
the weights should be. Making the market decide the weights themselves could be, as
discovered in the user-tests, difficult for the users. Hopefully, users would be able to learn
how to set good weights over time. Another possibility of helping the users set accurate
and good weights, could be to show the users average weights set on different items over
time. The average weights could be a good reference for the users.
Paying for smart contract usage and data storage on the Ethereum blockchain
Renters in the prototype have to pay fees for the prototype to functional well. This was a
concern for the testers and is also a general problem of the prototype. Making payments
and running software decentralized on the Ethereum blockchain is not free. Moreover, it
is the renters in the prototype that have to pay most of these costs. Renters of the system
have to pay Gas each time they send data to the blockchain for calculation and storage.
Gas is a unit of measuring of the computational work needed for running a smart contract
and making transactions in the Ethereum network. The price for Gas is paid in wei; one
wei is 1 ∗ 10− 18 Ether. The price of Gas varies in the Ethereum network, and the current
(25.05.2018) [127] average Gas price is 7 Gwei (1 Gwei is 1 ∗ 109 wei). The variations in
Gas price are decided by the supply and demand for computing power in the Ethereum net-
work. According to Ethereum’s yellow paper [128], the fee for storing a 256-bit word on
the Ethereum blockchain costs 20 000 Gas. Meaning that if a renter where to send 1kB of
256 bit words of data, generated by the IoT device on an item, to the blockchain, it would
cost a renter 0.004375 Ether (8000/256 = 31,25 256 bit words in one kilobyte and 31,25*
20 000 gas = 625000 gas and 625000 gas * 7 Gwei = 0.004375 ETH) which is about 2.6
USD (25.05.2018). The prototype only sends four uints which are 256 bits each. Meaning
that a renter would have to pay about 0.34 USD (4 ∗ 20000 ∗ 7Gwei = 0.00056Ether)
for sending data with the current implementation of the prototype. However, there might
be items that need to send more data, and therefore the price for sending data could vary
in the prototype. Sending 8-bit [129] ints to the smart contract is possible. 8-bit ints have
88
8.2 Discussing the prototype
a lower cost to send. However, not all data would be able to fit an 8-bit int.
What the calculation comes down to is how often a renter must send data. The more often
a renter sends data, the more accurate becomes the data stored on the blockchain. How-
ever, the renter would pay more fees in Gas the more often the renter sends data. It is up
to the lender to decide how frequent it wants information about the condition of its items.
Therefore the lender decides how often a renter must send transactions. For instance, let’s
say that the renter needs to send data every minute. The IoT device would send an average
of all data gathered in that minute for each type of data. The renter would have to pay Gas
each time it sends the data. Sending data on a minute basis would give the lender frequent
updates about the condition of its items. In contrast, data sent on a 30-minute basis would
give the lender information about its items only every 30 minutes. In addition, data could
become less useful for third parties if data was based on 30-minute averages. In total,
the price for the renter to send data varies by these factors: the frequency of how often
the lender requires information about its items, the type of data the renter sends (8-bit or
256-bit), and what the current price for Gas is in the Ethereum network. Renters should,
therefore, be informed about the extra costs of frequent data sending before renting an
item.
89
Chapter 8. Evaluation and discussion
should expect to pay higher fees while renting valuable items. I believe this is fair, because
the lender takes a larger risk by lending an item that is worth more.
Real-time payment
Participants stated that real-time payment in the prototype was useful feature. Real-time
payment, gives the renter the possibility to extend their rental period if they need to. How-
ever, testers of the lender role did not mention this feature as either good or bad. My
opinion on the real-time payment feature is that it is also a good feature for the lenders. By
giving renters the possibility to extend their rental periods, will generate additional profit
for the lenders. However, the system could have allowed for renters to pay the lender after
the device was used. This would be in a scenario where the lender would not require any
information about its item’s condition during the rental period. Instead of sending data
during the rental process, all data would be calculated in one final transaction. However,
sending and calculating all of the data generated after the rental period is over would give
less accurate data for a data purchaser.
Regarding sending transactions in real-time in the prototype, comes down to how effi-
cient the Ethereum network is to confirm transactions. How fast a transaction is confirmed
in the Ethereum network comes at the cost of how much Gas a renter would pay to get its
transaction confirmed quickly. On average, a block in the Ethereum network is confirmed
every 17 seconds [130]. However, the transactions are valid until the block it is in, reaches
a certain depth on the Ethereum blockchain. Vitalik Buterin, the founder of Ethereum,
explains in a blog post [131] that users of Ethereum have to wait for at least 12 blocks in
order to be certain that their transaction is valid. Meaning that if a high enough amount of
gas is paid along with the transaction, and that the transaction gets put in the next block, it
would take about three minutes to get the transaction confirmed. This means the prototype
fastest transaction speed of Ether is about three minutes. And this would be the closest the
prototype could get to providing real-time payments.
90
8.2 Discussing the prototype
should not be a problem for the users. However, before releasing a system based on the
prototype, information about how and where to get Ether should be included.
There is a solution to the privacy problem in the prototype. The solution should be im-
plemented in the prototype before a potential release of a complete system. The solution
to the problem impacts how data is stored on the Ethereum blockchain and how users in
the prototype will be able to sell their data. As we know, the blockchain is completely
transparent. All users of Ethereum have access to all information stored on the Ethereum
blockchain. Meaning that all transactions made by all of Ethereum’s users are accessible
to anybody. However, users of Ethereum are anonymized by their public address. To use
the prototype, users only need an Ethereum address. And as long as users of the prototype
do not reveal their real identity, no one would be able to connect users real identity to their
address. As long as no one makes this connection, their privacy is safe. However, this is
difficult in the prototype. It is likely that a renter has to meet the lender in person to rent
an item. Therefore a lender would be able to identify the renter and connect the Ethereum
address to the person. The lender would only have to check which Ethereum address sent
the payment for the rental. A renter would also be able to identify the lenders Ethereum
address with a similar method. After the lender has made the connection between a renter’s
real identity and its address, the lender could identify all transactions made by this person,
by looking up the renter’s address on the blockchain. Information about the compromised
renter could include all transactions containing data made by the renter, meaning that by
identifying a renter someone would be able to access all the data that a renter has gener-
ated. The lender would also be able to see all previous transactions made with the renter’s
address. A possible solution is for the renter to use a different Ethereum address each time
it rents an item. This would mitigate the risk of a lender finding the complete rental, and
transaction history of the renter. However, this solution is inconvenient for the renter.
Because of the transparent nature of the blockchain, the data that is transferred to and
stored on the blockchain in order to be calculated by the smart contract is also publicly
available. This is a problem for the renters because if a user were able to identify the
renter, the user would be able to get the renters entire history of transactions, and all previ-
ous data generated by this user. This is also a problem for the lender, if the data is publicly
91
Chapter 8. Evaluation and discussion
available, a third party would not need to purchase the data. A third party could use the
system once as either renter or lender, store the bytecode of the smart contract from the
blockchain, and look up the bytecode on the blockchain. Then, the third party could iden-
tify all contracts made with the prototype, and identify all transactions made to each of the
smart contracts. Making the third party able to access all of the data, of all of the trans-
actions, from all of the items in the system without paying for it. This problem is created
because the prototype calculates the price of the data on the blockchain.
It is not possible to communicate encrypted with a smart contract, because a smart contract
is on the blockchain, and all information on the blockchain is transparent. In order to com-
municate encrypted with a smart contract, the smart contract would have to generate a key
pair and store it on the blockchain. However, when these keys are stored on the blockchain,
they would be accessible to everyone, ultimately destroying the purpose of creating them.
A solution to this problem would be to do the calculation with the data off-chain, meaning
that the calculation would take place on the IoT device of the item or the user’s client.
When the price calculation is complete, the IoT device or the user’s client will proceed
to encrypt the data. The encrypted data would be sent along with the unencrypted result
of the cost calculation to the smart contract on the blockchain. By encrypting the data
before sending it, would result in the data being stored on the blockchain encrypted. This
would mean that in the scenario when someone got a hold of the Ethereum address of a
user and identified the owner of it, they would not be able to get any useful information.
However, by encrypting the data from the renter would leave the lender blind, not able to
get information about the condition of its items. This would remove the functionality of
real-time monitoring of the system. However, there is a way to solve this problem as well.
To enable real-time monitoring with encrypted data in the prototype, the prototype would
need to establish an encrypted connection between the renter and the lender. The two par-
ties would, in turn, exchange the keys used for encrypting the data, making the lender’s
client able to decrypt the data of its items on the blockchain. The key exchange could, for
instance, be done over Ethereum’s Whisper protocol, which is a decentralized, encrypted
communication channel for decentralized applications [133]. To ensure that a lender can-
not access data of previous rentals made by the renter, the renter would need to generate
new encryption keys and exchange these keys with the lender for each time renting an
item. Making only the renter and the lender able to decrypt their renting sessions. Also,
by encrypting the data before storing it on the blockchain, would mitigate the risk of a
third party acquiring the data without paying for it.
In relation to the selling of the data in the prototype, the users of the system would have
to store their keys used in for encrypting the different rental sessions. A third party would
pay for the encryption keys of these rental sessions, to access their data. Moreover, to keep
privacy even better, the process of purchasing data should include a step to anonymize the
data before the third party receives it.
Cryptography in the prototype could also give the possibility of allowing users to encrypt
more aspects of information in the prototype. Encrypting more information about an item
could give the possibility of renting an item with only one specific user, and fully anony-
mous to other parties than the renter and lender. To achieve an anonymous rental session,
92
8.2 Discussing the prototype
the lender could encrypt the item’s description, deposit, and id, sharing the encryption key
with the other user. The only data visible to a third party would be the sending of Ether
between the lender’s and renter’s addresses.
Other features that could be implemented to give users more control of their privacy could
be to let lenders decide what data they need for monitoring of their items. Meaning that
if a lender does not care about the GPS location of its items, it could turn it off. The
lender’s exclusion of different data monitoring could, in turn, attract renters that are more
concerned with privacy, and the lender could make a bigger profit. The data could still
be valuable for third parties, and the lender would still receive information (except for the
excluded data types) about the condition of its items.
Usefulness of data
A participant in the user-test asked an important question regarding data purchase in the
prototype. The question was: How useful is the data generated by the items to a manufac-
turer? My answer to this question: It is likely that manufacturers test their items before
mass production. So for larger manufacturers who do thorough testing of their products,
the data might not be useful. However, this depends on the needs of the manufacturers.
Smaller manufacturers with fewer resources for testing of their products may want to pur-
chase data related to the item they produce.
Other third parties than manufacturers could also make use of the data generated by items.
For instance, state institutions like the ministry of transport could make use of GPS data
of vehicles to locate hold-ups in traffic and optimize roadmaps.
A problem related to the usefulness of the data that the prototype generates is the quality
93
Chapter 8. Evaluation and discussion
of the data. As discussed in section 8.2.1, the frequency of data transmission determines
the quality of data. If the quality of the data is not adequate for the manufacturers, this
feature could see little use.
This section is listed twice because privacy and security of data touch upon aspects of
research question 3 and 4. A discussion and a solution to problems related to privacy and
security of data are found in section 8.2.4 and applies to both questions.
A general take from the user-tests was that the participants wanted more information in
the different user interfaces for the different actors in the prototype. Giving users more
information about average rental prices of items, weights set for similar items. Information
like this should be implemented in the prototype before a potential release of the system.
A reputation system could be difficult to create due to the privacy of users. However, the
prototype could allow users to decide on how much information they are willing to reveal
from previous rental sessions. This feature could result in a system with different kinds of
users. Ranging from entirely anonymous users to users that wants to share their reputation
with other users. It would be the lender’s choice to decide which renters it would trust to
rent its items. Renters could choose if they want to partake in the reputation system or
not. A benefit of partaking in the reputation system could be that lenders would be more
willing to lend their items to renters that partake in the program. This comes at the cost of
letting lenders know about some of the data from previous rentals, thus reducing privacy
for the renter. With a reputation system in place, anonymous renters could have a harder
time getting to rent items, because they could be perceived as less trustworthy.
8.3.1 Ethereum
Of the reviewed blockchain technologies in the state of the of blockchain technologies,
there was only two blockchain technologies, Ethereum and NEO, with the possibility to
run smart contracts. Making the prototype run solely on a smart contract would make
the system more decentralized. The only part that is centralized is the serving of the
prototype’s user interface. I chose Ethereum over NEO for several reasons:
94
8.3 Choice of technology
• Ethereum has high maturity and have been in use for several years, NEO on the
other hand is fairly new in comparison (Ethereum was released in 2014, NEO was
released in 2017)
• Because of Ethereum’s longevity, the protocol has been tested and used for many
years. As a result of its age, Ethereum is better tested and more used than NEO.
Besides, Ethereum has a bigger community of developers, which in turn gives de-
velopers more resources on how to use the technology.
• NEO is currently in need of validator nodes to run its smart contracts. To become a
validator node in the NEO network, users have to stake at least 10 000 GAS, costing
approximately 19 000 dollars at today’s (25.05.2018) GAS price [134]. This is a cost
out of reach for most people. The high cost of becoming a validator node, results
in a smaller amount of miners, making NEO more centralized, and more prone to
DDoS attacks. Some sources even claim that all validator nodes in the NEO network
run by the NEO foundation, making the smart contract feature of NEO completely
centralized [135]. There no formal requirements of becoming validator node in the
Ethereum network. In fact, every miner in the Ethereum network is mining both
transactions and smart contracts, making Ethereum more decentralized than NEO.
Another factor in the choice of blockchain protocol is that Andreas Bogner, Matheiu Chan-
son, and Arne Meeuw’s (BCM) [7] had proved that it is possible to run an SEP on the
Ethereum blockchain. Moreover, since their proof of concept also revolves around the
sharing of items, I could use their proof of concept to learn how to write code for Ethereum
efficiently and have the possibility reuse parts of their code.
8.3.2 Web3.js
BCM’s proof of concept was also using Web3.js. Web3.js is officially supported and de-
veloped by the Ethereum foundation. I did a search for alternatives to web3.js and found
other Ethereum libraries. These were: ethers.js and ethjs.js. However, Web3.js had far
better documentation compared with the others. At the same time, it felt safer using an
API officially supported by Ethereum. To determine popularity and usage of the different
libraries, I did a lookup on different libraries on the knowledge sharing platform for de-
velopers, ”Stack Overflow”. Searching for the Web3js yielded 218 results, the other two
yielded no results. The result of the lookup was a good indicator of usage. Also, I could
have reviewed the different technologies, and compared them with each other, but overall
web3.js seemed like the best choice based on the factors mentioned.
95
Chapter 8. Evaluation and discussion
of code on GitHub. Other sources found also suggested that Truffle was the framework of
choice [140] [141]. However, what it came down to was the adoption of Truffle compared
to the others. Because I am new to programming with Ethereum, the choice landed on
Truffle. Because of its popularity, I assumed that there would be more resource on how
to use the framework. Also, it gave me the opportunity to learn even more from BCM’s
proof of concept.
8.3.4 Ganache
For testing and simulation of Ethereum blockchain and nodes, I chose Ganache, because
it is a part of the Truffle suit.
8.4.2 Problem: Paying for smart contract usage and data storage on
the Ethereum blockchain
The main problem of using Ethereum in the prototype is the cost of transactions for the
users. Ethereum has fees for conducting value transfer, for storing data and deploying
smart contracts. It is not possible for any actor of the prototype to avoid paying fees in
the prototype. The renter would have to pay fees for deploying the smart contract and
adding items to it. A third party would have to pay fees when purchasing data. However,
the actor of the prototype that would have to pay the most significant cost is the renter.
The renter has to pay fees for sending payments to the lender and pay fees for storage
of the data generated by the IoT device on the item of the lender. Also, as discussed,
the fees for storing data can become quite high. The reason for the high cost of storing
data on the Ethereum blockchain is that the data stored on the blockchain is stored on it
forever. This is due to the nature of the blockchain, once data is put on the blockchain,
it can never be deleted. Comparing the price for data storage on a blockchain with a data
96
8.4 Other problems
storage service like Dropbox would yield a huge difference in price. This price difference
is because Dropbox can delete data from their disks. However, on the blockchain, you pay
one time for storing your data forever. If we do the maths on calculating a price for sending
and storing 1 KB of data on the Ethereum blockchain and scale it to 1 GB instead, would
result in a price of 4375 Ether per GB (8 000 000 000/256 = 31250000 256 bit words in one
gigabyte and 31250000* 20 000 gas = 625000000000 gas and 625000000000 gas * 7 Gwei
= 4375 ETH). 4375 Ether converts to 2 627 349.375 USD (at today’s price of Ethereum
26.05.2018). The price would be even higher, because it would take several transactions
to send the data, adding a fee for each transaction. This calculation shows that storing
data on the Ethereum blockchain is expensive and must be taken into consideration when
developing systems with Ethereum. It is worth noting that the prototype deals with much a
smaller size of data. Considering the costs calculated in section 8.2.1 shows that system is
viable, but costly to use when minutely monitoring is required by the lender. Ethereum is
planning to change consensus algorithm to Proof of stake. The changing of the consensus
algorithm may result in lower transaction fees in the Ethereum network [142].
97
Chapter 8. Evaluation and discussion
it becomes few Permanodes in the IOTA network, this feature will become less decentral-
ized. The CTO of IOTA, David Sønsterbø, proposed a similar business model like StorJ
and Sia [145] to have a sustainable ecosystem surround the Permanodes [146]. Optionally,
users of IOTA could download and store the snapshots themselves.
If the prototype were implemented with IOTA, data would need to sold before each snap-
shot, or the users of the prototype would have to store the data themselves or to pay to get
the data from Permanodes.
At the time writing (26.05.2018) IOTA is not decentralized and is using what they call
a ”Coordinator,” which is a node in the IOTA network, owned by the IOTA foundation,
validating all transactions in the IOTA network. IOTA is newer, without smart contract
functionality, and is less tested and used than Ethereum. Also, MIT researchers found
several security vulnerabilities in the IOTA protocol: IOTA uses a trinary system instead
of binary system, which could introduce new vulnerabilities compared to the well tested
binary systems. IOTA was running their self-made cryptographic functions. New crypto-
graphic functions usually undergo a test period of several years before they are put to use,
but IOTA’s cryptographic function did not. The cryptographic problems have later been
fixed, but the use of trinary remains in IOTA [147] [148]. It is also worth noting that IOTA
has implemented a decentralized data marketplace for the Tangle. If the prototype were
implemented with IOTA, the selling and purchasing of data would take place in IOTA’s
data marketplace instead of taking place in the prototype [149].
98
8.4 Other problems
99
Chapter 8. Evaluation and discussion
100
Chapter 9
Conclusions
Technology is allowing more people to partake in the sharing economy. At the same time,
the internet of things is coming closer to becoming a reality. The blockchain has shown
that decentralized payment is possible without trust. Researchers suggest that blockchain
and IoT is a good match and that the sharing economy can make use of blockchain based
systems. In this thesis, I suggest that a combination of sharing economy, IoT, data and the
blockchain in a decentralized sharing economy platform is possible. And I have shown that
this is possible by researching blockchain technologies, IoT and developing a prototype.
I have investigated four research questions and the conclusions of the research questions
are as follows:
I have demonstrated that it is not possible for a sharing economy platform based on
Ethereum to provide real-time payment. Because of Ethereum’s transaction speed, the
101
Chapter 9. Conclusions
users of the prototype will, at best, only be able to receive payment of Ether every three
minutes.
I have demonstrated that the sharing economy platform is able to provide information
to lenders regarding their items when they are in use. The system is capable of delivering
information regarding lenders items in 34 seconds intervals at best.
I have demonstrated that by using a blockchain to store data, makes it possible for third
parties to purchase data from users of the sharing economy platform. This is made possi-
ble because every transaction with data is stored on the Ethereum blockchain. By storing
the data on the blockchain, makes it possible for a third party to access the data.
In addition, finding appropriate weights to make price calculation based on data proved
to be a challenge in the user tests. As described in section 8.2.1, finding high-quality
weights is a difficult problem in general. And good weights is crucial for the prototype to
make accurate and fair price calculations. In addition, the IoT is and will generate substan-
tial amounts of data, therefore a model for calculation of cost based on data could prove
useful in other data-based systems.
I did not use an IoT device, for gathering data in this thesis. Instead, data was manually
inserted. Therefore to build a device with sensors that may give appropriate information
102
9.5 Future work
As discussed, IOTA would be the optimal choice of technology for the prototype, if the
technology was more mature. Therefore future work can be to develop the prototype with
IOTA as the fundamental technology, show how it was done, and compare it to the proto-
type of this thesis.
In summary:
• Do a review and comparison of blockchain protocols with smart contract function-
ality
• Build an IoT device that may give appropriate information about an item’s condition
and whereabouts
• Develop the prototype using IOTA as the fundamental technology, show how it was
done, and compare it to the prototype of this thesis.
103
Chapter 9. Conclusions
104
Bibliography
[1] Juliet B Schor and Connor J Fitzmaurice. 26. collaborating and con-
necting: the emergence of the sharing economy. Available at: http:
//www.bc.edu/content/dam/files/schools/cas_sites/
sociology/pdf/SchorElgarHandbook.pdf, 2015. Accessed on
2.12.2017.
[3] Georgios Zervas, Davide Proserpio, and John W Byers. The rise of the sharing
economy: Estimating the impact of airbnb on the hotel industry. Journal of Mar-
keting Research, 2014.
[4] Kyoochun Lee In Lee. The internet of things (iot): Applications, investments,
and challenges for enterprises. Available at: https://ac.els-cdn.
com/S0007681315000373/1-s2.0-S0007681315000373-main.
pdf?_tid=580e88d6-d76a-11e7-a8b9-00000aab0f02&acdnat=
1512223920_1d7b4d17369646be6e28919a82c51949, 2015. Accessed
on 10.12.2017.
[5] Satoshi Nakamoto. Bitcoin: A peer-to-peer electronic cash system. Available at:
https://bitcoin.org/bitcoin.pdf, 2008. Accessed on 18.11.2017.
[6] Ottawa tool library. Ottawa tool library faq. Available at: http://
ottawatoollibrary.com/faq/, 2017. Accessed on 02.12.2017.
[7] Andreas Bogner, Mathieu Chanson, and Arne Meeuw. A decentralised shar-
ing app running a smart contract onthe ethereum blockchain. Available at:
https://www.researchgate.net/publication/310396688_A_
Decentralised_Sharing_App_running_a_Smart_Contract_on_
the_Ethereum_Blockchain, 2016. Accessed on 18.02.2018.
105
[9] Oria. Oria.no research databases. Available at: https://
bibsys-almaprimo.hosted.exlibrisgroup.com/primo_
library/libweb/action/search.do?vid=NTNU_UB&openFdb=
true&searchType=AZ&searchTerm=A&prefLang=no_NO#, 2018.
Accessed on 20.04.2018.
[16] Aditi Sarkar Alain Chong M S Balaji, Sanjit Kumar Roy. User ac-
ceptance of iot applications in retail industry. Available at: https:
//www.researchgate.net/publication/308643074_User_
Acceptance_of_IoT_Applications_in_Retail_Industry, 2016.
Accessed on 24.03.2018.
106
[18] Wikipedia contributors. Radio-frequency identification - wikipedia. Avail-
able at: https://en.wikipedia.org/w/index.php?title=
Radio-frequency_identification&oldid=836773617, 2018.
Accessed on 03.05.2018.
[20] Zoe Romano. Arduino blog welcome arduino yn the first board combining arduino
with linux. Available at: https://blog.arduino.cc/2013/05/18/
welcome-arduino-yun-the-first-member-of-a-series-of-wifi-products-c
atb, 2018. Accessed on 03.05.2018.
[21] Jan Newmarch. The internet of things - a techie’s viewpoint. Available at: https:
//jan.newmarch.name/IoT/Micros/Introduction/, 2018. Accessed
on 04.05.2018.
107
[31] Tutorialspoint.com. Cryptography hash functions. Available at: https:
//www.tutorialspoint.com/cryptography/cryptography_
hash_functions.htm, 2018. Accessed on 19.03.2018.
[32] Douglas R. Stinson. Cryptography: Theory and practice, third edition.
Available at: http://www.ksom.res.in/files/RCCT-2014-III-CM/
CryptographyTheoryandpractice(3ed).pdf, 2014. Accessed on
04.12.2017.
[33] Andreas M. Antonopoulos. Mastering bitcoin. Available at: http://chimera.
labs.oreilly.com/books/1234000001802/ch07.html, 2015. Ac-
cessed on 10.12.2017.
[34] Dirk Timmerman Peter Schwrzler. Iota-modelle zur beurteilung von adnexbefun-
den. Available at: https://link.springer.com/article/10.1007/
s00129-017-4193-1, 2018. Accessed on 02.02.2018.
[35] Saikat Guha Dawei Ding. Noisy feedback and loss unlimited private communi-
cation. Available at: https://arxiv.org/abs/1801.03996, 2018. Ac-
cessed on 15.01.2018.
[36] Ahmed Ben Ayed. A conceptual secure blockchain- based electronic voting system.
Available at: http://aircconline.com/ijnsa/V9N3/9317ijnsa01.
pdf, 2017. Accessed on 03.12.2017.
[37] Andreas M. Antonopoulos. Mastering bitcoin: Structure of a block. Available
at: http://chimera.labs.oreilly.com/books/1234000001802/
ch07.html#_structure_of_a_block, 2015. Accessed on 10.12.2017.
[38] Bitcoin.org. Developer guide - bitcoin. Available at: https://bitcoin.org/
en/developer-guide#block-chain, 2018. Accessed on 19.03.2018.
[39] Yoichi Hirai. Defining the ethereum virtual machine for interactive theorem provers.
Available at: https://link.springer.com/content/pdf/10.1007%
2F978-3-319-70278-0_33.pdf, 2017. Accessed on 23.01.2018.
[40] Vitalik Buterin. A next-generation smart contract and decentralized application
platform: Mining. Available at: https://github.com/ethereum/wiki/
wiki/White-Paper#mining, 2014. Accessed on 17.11.2017.
[41] Aad van Moorsel Maher Alharby. Blockchain based smart contracts : A sys-
tematic mapping study. Available at: https://www.researchgate.net/
publication/319603816_Blockchain_Based_Smart_Contracts_
A_Systematic_Mapping_Study, 2018. Accessed on 23.01.2018.
[42] Ripple. Ripple solution overview. Available at: https://ripple.com/
files/ripple_solutions_guide.pdf, 2018. Accessed on 19.01.2018.
[43] Ripple. Ripple documentation: Ledger format. Available at: https://ripple.
com/build/ledger-format/, 2017. Accessed on 19.01.2018.
108
[44] Ripple. Ripple documentation: Money in xrp ledger. Available at:
https://ripple.com/build/money-xrp-ledger/, 2017. Accessed
on 19.01.2018.
[45] David B. Oliynykov R Kiayias A., Russell A. Ouroboros: A provably secure
proof-of-stake blockchain protocol. Available at: https://link.springer.
com/chapter/10.1007/978-3-319-63688-7_12, 2017. Accessed on
06.02.2018.
[46] David B. Peter G. Kiayias A., Russell A. Ouroboros praos: An adaptively-secure,
semi-synchronous proof-of-stake blockchain. Available at: https://eprint.
iacr.org/2017/573.pdf, 2017. Accessed on 06.02.2018.
[47] Cardano. Why we are building cardano: Proof-of-stake. Available at: https:
//whycardano.com/#proof-of-stake, 2015. Accessed on 23.01.2018.
[48] Cardano. Why we are building cardano: Cardano-computation-layer. Avail-
able at: https://whycardano.com/#cardano-computation-layer,
2015. Accessed on 23.01.2018.
[49] LON WONG. Nem catapult white paper. Available at: https://nem.io/
wp-content/themes/nem/files/catapultwhitepaper.pdf, 2016.
Accessed on 23.01.2018.
[50] NEM. Nem technical reference. Available at: https://bitcoin.org/
bitcoin.pdf, 2018. Accessed on 23.01.2018.
[51] Finder.com. Nem for beginners: A step-by-step guide to xem. Available at:
https://www.finder.com/no/nem, 2018. Accessed on 07.02.2018.
[52] DAVID MAZIERES. The stellar consensus protocol: A federated model
for internet-level consensus. Available at: https://www.stellar.org/
papers/stellar-consensus-protocol.pdf, 2016. Accessed on
23.01.2018.
[53] Stellar Organization. Assets — stellar developers. Available at: https://www.
stellar.org/developers/guides/concepts/assets.html, 2017.
Accessed on 11.02.2018.
[54] Stefan Thomas. Why the stellar forking issue does not af-
fect ripple. Available at: https://ripple.com/dev-blog/
why-the-stellar-forking-issue-does-not-affect-ripple/,
2014. Accessed on 11.02.2018.
[55] Stellar Organization. Multisignature — stellar developers. Available
at: https://www.stellar.org/developers/guides/concepts/
multi-sig.html, 2017. Accessed on 11.02.2018.
[56] Stellar Organization. Using stellar for icos. Available at: https://www.
stellar.org/blog/using-stellar-for-ico/, 2017. Accessed on
11.02.2018.
109
[57] IOTA foundation. Pow on the tangle - iota docs. Available at: https://dev.
iota.org/introduction/tangle/proof-of-work, 2018. Accessed
on 12.02.2018.
[59] IOTA Foundation. Iota - next generation blockchain. Available at: https://
iota.org/, 2018. Accessed on 12.02.2018.
[63] basiccrypto. (almost) everything you wanted to know about neo (part 1 of 2). Avail-
able at: https://steemit.com/cryptocurrency/@basiccrypto/
almost-everything-you-wanted-to-know-about-neo-part-1-of-2,
2017. Accessed on 15.02.2018.
[64] NEO. Neo white paper: A distributed network for the smart economy. Avail-
able at: http://docs.neo.org/en-us/index.html, 2014. Accessed on
23.01.2018.
[66] Blocktivity. Block’tivity: The real value of blockchains. Available at: http:
//www.blocktivity.info/, 2018. Accessed on 08.03.2018.
[68] Trustnodes. Cardano eyes ethereum smart contracts, grabs half a billion mar-
ket cap. Available at: https://www.trustnodes.com/2017/10/02/
cardano-eyes-ethereum-smart-contracts-grabs-half-billion-market-cap
2017. Accessed on 08.03.2018.
110
[69] Lumenauts. How many transactions per second can stellar pro-
cess? Available at: https://www.lumenauts.com/blog/
how-many-transactions-per-second-can-stellar-process,
2018. Accessed on 08.03.2018.
[71] CryptoCoinMastery. Neos reddit ama top 10 questions and answers. Available
at: https://cryptocoinmastery.com/neo-reddit-ama/, 2017. Ac-
cessed on 09.03.2018.
[72] Ittay Eyal Adem Efe Gencer Ari Juels Ahmed Kosba Andrew Miller Pra-
teek Saxena Elaine Shi Emin Gn Sirer Dawn Song Kyle Croman, Chris-
tian Decker and Roger Wattenhofer. On scaling decentralized blockchains.
Available at: http://www.comp.nus.edu.sg/˜prateeks/papers/
Bitcoin-scaling.pdf, 2016. Accessed on 08.03.2018.
[77] CaptainPatent. Theoretical maximum tps for iota assuming bandwidth and node
performance limitations. Available at: https://www.reddit.com/r/
Iota/comments/7kdkcc/theoretical_maximum_tps_for_iota_
assuming/drdmjgz/, 2018. Accessed on 09.03.2018.
[78] Mark Schwarz. Transaction speeds: Which crypto is the fastest? Available
at: https://www.abitgreedy.com/transaction-speed/, 2018. Ac-
cessed on 09.03.2018.
111
[80] Blockchain.info. Average number of transactions per block. Available at: https:
//blockchain.info/charts/n-transactions-per-block?
timespan=all, 2018. Accessed on 08.03.2018.
[81] Stellar. Fees — stellar developers. Available at: https://www.
stellar.org/developers/guides/concepts/fees.html#
transaction-fee, 2018. Accessed on 10.03.2018.
[82] Bitinfocharts. Bitcoin avg. transaction fee historical chart. Available at: https:
//bitinfocharts.com/comparison/bitcoin-transactionfees.
html, 2018. Accessed on 15.03.2018.
[83] bitcoin.it. Mining. Available at: https://en.bitcoin.it/wiki/Mining,
2018. Accessed on 09.03.2018.
[84] Bitinfocharts. Bitcoin, ethereum, ripple avg. transactions historical
chart. Available at: https://bitinfocharts.com/comparison/
transactions-btc-eth-xrp.html, 2018. Accessed on 15.03.2018.
[85] Vitalik Buterin. A next-generation smart contract and decentralized application
platform. Available at: https://github.com/ethereum/wiki/wiki/
White-Paper, 2014. Accessed on 17.11.2017.
[86] Vitalik Buterin. Devcon1: Understanding the ethereum blockchain protocol
- vitalik buterin. Available at: https://www.youtube.com/watch?v=
gjwr-7PgpN8, 2016. Accessed on 23.01.2018.
[87] Arthur Britto David Schwartz, Noah Youngs. The ripple protocol consensus algo-
rithm. Available at: https://ripple.com/files/ripple_consensus_
whitepaper.pdf, 2014. Accessed on 19.01.2018.
[88] Ripple. Ripple solution overview. Available at: http://
whitepaperdatabase.com/ripple-xrp-whitepaper/, 2017. Ac-
cessed on 19.01.2018.
[89] Cardano. Why we are building cardano. Available at: https://whycardano.
com/, 2015. Accessed on 23.01.2018.
[90] Cardano. Cardano academic papers. Available at: https://www.
cardanohub.org/en/academic-papers/, 2016. Accessed on
23.01.2018.
[91] NEM. Nem general information. Available at: http://docs.nem.io/en,
2016. Accessed on 23.01.2018.
[92] Majlinda Zhegu F. Xavier Olleros. Research handbook on digital transfor-
mations. Available at: https://books.google.no/books?hl=en&
lr=&id=1_QCDQAAQBAJ&oi=fnd&pg=PA225&dq=applications+
using+blockchain+technology&ots=s-32DzJHP1&sig=
lkvLiZxuDGUG2U9uuQwhX8eNATU&redir_esc=y#v=onepage&q=
112
applications%20using%20blockchain%20technology&f=false,
2016. Accessed on 19.02.2018.
[94] Christina Garman Matthew Green Ian Miers Eran Tromer Madars Virza Eli Ben-
Sasson, Alessandro Chiesa. Zerocash: Decentralized anonymous payments from
bitcoin (extended version). Available at: http://zerocash-project.org/
media/pdf/zerocash-extended-20140518.pdf, 2014. Accessed on
19.02.2018.
[95] Feng Hao Patrick McCorry, Siamak F. Shahandashti. A smart contract for board-
room voting with maximum voter privacy. Available at: https://eprint.
iacr.org/2017/110.pdf, 2017. Accessed on 25.11.2017.
[97] Christian Meter. Design of distributed voting systems. Available at: https:
//arxiv.org/pdf/1702.02566.pdf, 2015. Accessed on 20.02.2018.
[98] Omni Layer. Omni layer: An open source, fully-decentralized asset platform on
the bitcoin blockchain. Available at: http://www.omnilayer.org/, 2018.
Accessed on 25.02.2018.
[102] Paul Brody Veena Pureswaran. Device democracy: Saving the future of the
internet of things. Available at: http://www-935.ibm.com/services/
us/gbs/thoughtleadership/internetofthings/, 2014. Accessed on
28.02.2018.
[103] Julia Angwin. Own a vizio smart tv? its watching you.
Available at: https://www.propublica.org/article/
own-a-vizio-smart-tv-its-watching-you, 2015. Accessed on
28.02.2018.
113
[104] Sebastian Malo. In new york, neighbors trading solar en-
ergy electrify community. Available at: https://www.
reuters.com/article/us-energy-usa-blockchain/
in-new-york-neighbors-trading-solar-energy-electrify-community-idUS
2017. Accessed on 28.02.2018.
[105] NZPA. Rush to find extent of nz melamine contamination. Avail-
able at: http://www.stuff.co.nz/national/644196/
Rush-to-find-extent-of-NZ-melamine-contamination, 2009.
Accessed on 06.03.2018.
[106] CW Chan EYY Chan, SM Griffiths. Public-health risks of melamine
in milk products. Available at: https://ac.els-cdn.com/
S0140673608616049/1-s2.0-S0140673608616049-main.pdf?
_tid=95bf42f4-1b04-46fe-a1e3-62f90a67451c&acdnat=
1520329440_af4f8ae396e0205370e78b4f13b8b227, 2008. Accessed
on 06.03.2018.
[107] WHO. Emergencies preparedness, response: Questions and answers on melamine.
Available at: http://www.who.int/csr/media/faq/QAmelamine/
en/, 2018. Accessed on 06.03.2018.
[108] Wacoin.io. Wabi - crypto token for safe consumer products. Available at: https:
//resources.wacoin.io/WaBI_Whitepaper_ENG.pdf, 2017. Ac-
cessed on 27.02.2018.
[109] Joseph Young. Ibm invests $200 million in iot blockchain, partners with
unionpay. Available at: https://cointelegraph.com/news/
ibm-invests-200-million-in-iot-blockchain-partners-with-unionpay,
2016. Accessed on 07.03.2018.
[110] Chain of things. Advancing innovation in blockchain & iot. Available at: https:
//www.chainofthings.com, 2018. Accessed on 07.03.2018.
[111] Filament. Enabling the future of iot. Available at: https://filament.com/,
2018. Accessed on 07.03.2018.
[112] Joy Patra Amitranjan Gantait and Ayan Mukherjee. Implement-
ing blockchain for cognitive iot applications, part 1: Integrate de-
vice data with smart contracts in ibm blockchain. Available at:
https://www.ibm.com/developerworks/cloud/library/
cl-blockchain-for-cognitive-iot-apps-trs/, 2017. Accessed on
07.03.2018.
[113] Autologger. Autologger for trygg kjoreadferd. Available at: https://www.
autologger.no/, 2018. Accessed on 07.03.2018.
[114] Chain of things. Case study 1: Chain of security. Available at: https:
//www.chainofthings.com/cs1chainofsecurity/, 2018. Accessed
on 07.03.2018.
114
[115] Salil S. Kanhere Ali Dorri, Marco Steger and Raja Jurdak. Blockchain: A dis-
tributed solution to automotive security and privacy. Available at: https://
arxiv.org/ftp/arxiv/papers/1704/1704.00073.pdf, 2017. Ac-
cessed on 01.03.2018.
[116] Chris Valasek Charlie Miller. Remote exploitation of an unaltered passenger vehi-
cle. Available at: https://securityzap.com/files/Remote%20Car%
20Hacking.pdf, 2015. Accessed on 01.03.2018.
[117] Soohyung Kim Seyoung Huh, Sangrae Cho. Managing iot devices using blockchain
platform. Available at: http://ieeexplore.ieee.org/stamp/stamp.
jsp?tp=&arnumber=7890132, 2017. Accessed on 20.02.2018.
[122] Alistair Cockburn. Writing effective use cases. Available at: http://
alistair.cockburn.us/get/2465, 2001. Accessed on 11.04.2018.
[123] CONSENSYS. Truffle suite - your ethereum swiss army knife. Available at: http:
//truffleframework.com/, 2018. Accessed on 01.05.2018.
[126] Briony J. Oates. Researching information systems and computing, 2006. Accessed
on 11.05.2018.
[127] ETH Gas station. Eth gas station. Available at: https://ethgasstation.
info/, 2018. Accessed on 25.05.2018.
115
[128] DR. GAVIN WOOD. Ethereum: A secure decentralised generalised transaction
ledger eip-150 revision, ethereum project yellow paper. Available at: http://
gavwood.com/paper.pdf, 2014. Accessed on 25.05.2018.
[129] Solidity. Types - soliditt 0.4.21 documentation. Available at: http://
solidity.readthedocs.io/en/v0.4.21/types.html, 2018. Ac-
cessed on 23.04.2018.
[130] Etherscan. Ethereum average blocktime chart. Available at: https://
etherscan.io/chart/blocktime, 2018. Accessed on 25.05.2018.
[131] Vitalik Buterin. On slow and fast block times. Available at: https://blog.
ethereum.org/2015/09/14/on-slow-and-fast-block-times/,
2015. Accessed on 25.05.2018.
[132] Wikipedia contributors. Facebookcambridge analytica data scandal. Available at:
https://en.wikipedia.org/w/index.php?title=Facebook%E2%
80%93Cambridge_Analytica_data_scandal&oldid=842502787,
2018. Accessed on 24.05.2018.
[133] Ethereum community Vitalik Buterin. Whisper. Available at: https:
//github.com/ethereum/wiki/wiki/Whisper, 2018. Accessed on
23.05.2018.
[134] Coinmarketcap.com. Gas (gas). Available at: https://coinmarketcap.
com/currencies/gas/, 2018. Accessed on 25.05.2018.
[135] Tyson O’Ham. Neo blockchain goes down after a single node dis-
connects temporarily. Available at: https://bitsonline.com/
neo-blockchain-tanks/, 2018. Accessed on 25.05.2018.
[136] Ethereum. Populus: The ethereum development framework with the most cute
animal pictures. Available at: https://github.com/ethereum/populus,
2018. Accessed on 26.05.2018.
[137] Embark-framework. Embark: Framework for serverless decentralized applications
using ethereum, ipfs and other platforms. Available at: https://github.com/
embark-framework/embark, 2018. Accessed on 26.05.2018.
[138] Aragon. Aragon nest. Available at: https://github.com/aragon/nest,
2018. Accessed on 26.05.2018.
[139] Trufflesuite. Truffle: The most popular ethereum development framework. Avail-
able at: https://github.com/trufflesuite/truffle, 2018. Ac-
cessed on 26.05.2018.
[140] Dave Kajpust. The best way to start coding in solid-
ity. Available at: https://medium.com/@davekaj/
solidity-tips-and-tricks-for-beginners-building-their-first-dapp-on
2017. Accessed on 25.05.2018.
116
[141] ConsenSys. A 101 noob intro to programming smart contracts on
ethereum. Available at: https://medium.com/@ConsenSys/
a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c
2015. Accessed on 25.05.2018.
[142] Ethereum. Proof of stake faq. Available at: https://github.com/
ethereum/wiki/wiki/Proof-of-Stake-FAQ, 2018. Accessed on
26.05.2018.
[143] StorJ. Decentralized cloud storage - storj. Available at: https://storj.io/,
2018. Accessed on 26.05.2018.
[148] IOTA. Consensus on the tangle - iota docs. Available at: https://docs.iota.
org/introduction/tangle/consensus, 2018. Accessed on 26.05.2018.
[149] IOTA. Iota data market. Available at: https://data.iota.org/, 2018. Ac-
cessed on 26.05.2018.
117
118
Appendix
lstlisting breaklines=true
119
120
Appendix A
Smart contract code
contract RentableObjects {
struct Client {
address cliAddress;
uint since;
bool exists;
}
struct Object {
uint objId;
string description;
uint deposit;
uint[] dataWeights;
uint[] data;
Client client;
uint created;
address owner;
bool exists;
uint lastPaid;
uint depositReset;
}
mapping (uint => Object) objects;
address owner;
function RentableObjects() {
owner = msg.sender;
}
121
if ( !(objectIsRegistered(_objId)) ) {
Client memory nilClient = Client({cliAddress: 0, since: now,
exists: false});
objects[_objId] = Object({objId: _objId, description: _descr,
deposit: _deposit, dataWeights: _dataWeights, client:
nilClient, created: now, owner: msg.sender, exists: true,
lastPaid: 0, data: _data, depositReset: _deposit});
return true;
}
revert();
}
122
uint dataPrice = 0;
for(uint i = 0; i < getDataWeightsLength(_objId); i++){
dataPrice += _dataWeights[i]*_data[i];
}
objects[_objId].lastPaid = dataPrice;
if ( !objects[_objId].owner.send(dataPrice) ) {
revert();
}
objects[_objId].deposit = objects[_objId].deposit - dataPrice;
return true;
}
123
}
function getObjectData(uint _objId) returns (uint[]) {
return objects[_objId].data;
}
function getDataWeightsLength(uint _objId) returns (uint) {
return objects[_objId].dataWeights.length;
}
function getDataLength(uint _objId) returns (uint) {
return objects[_objId].data.length;
}
function getLastPaid(uint _objId) returns (uint) {
return objects[_objId].lastPaid;
}
function () {
revert();
}
124
Appendix B
User interface code
"use strict";
var accounts;
var account;
var objectId;
var contractOwner;
var balance;
var finney = 1 / 1000;
var wei = 1 / 1000000000000000000;
125
});
}
}, 30000);
if (accs.length === 0) {
alert("Couldn’t get any accounts! Make sure your Ethereum
client is configured correctly.");
return;
}
initState();
accounts = accs;
refreshBalance();
126
function initState() {
var rentable = RentableObjects.deployed();
rentable.then(function (instance) {
return instance.getContractOwnerAddress.call({from: account});
}).then(function (value) {
contractOwner = value;
if (!contractOwner) {
throw "Expected contractOwner to be defined!";
}
127
document.getElementById("notFoundPage").style.display =
"none";
document.getElementById("dataInsertion").style.display
= "block";
document.getElementById("mapInformation").style.display
= "none";
}
else if (account === contractOwner) {
// account is owner -> show reclaimPage
console.log("Account owns this (rented) object.");
document.getElementById("ownersPage").style.display = "
none";
document.getElementById("reclaimPage").style.display =
"block";
document.getElementById("rentOverview").style.display =
"none";
document.getElementById("rentingPage").style.display =
"none";
document.getElementById("objectInformation").style.
display = "block";
document.getElementById("registerPage").style.display =
"none";
document.getElementById("notFoundPage").style.display =
"none";
document.getElementById("dataInsertion").style.display
= "none";
document.getElementById("mapInformation").style.display
= "block";
}
else {
// account is third party -> show object information
document.getElementById("ownersPage").style.display = "
none";
document.getElementById("reclaimPage").style.display =
"none";
document.getElementById("rentOverview").style.display =
"none";
document.getElementById("rentingPage").style.display =
"none";
document.getElementById("objectInformation").style.
display = "block";
document.getElementById("registerPage").style.display =
"none";
document.getElementById("notFoundPage").style.display =
"none";
document.getElementById("dataInsertion").style.display
= "none";
document.getElementById("mapInformation").style.display
128
= "none";
}
});
}
else {
// object is unrented
if (account === contractOwner) {
// object is unrented -> show stats for owner
document.getElementById("ownersPage").style.display = "
block";
document.getElementById("reclaimPage").style.display = "
none";
document.getElementById("rentOverview").style.display = "
none";
document.getElementById("rentingPage").style.display = "
none";
document.getElementById("objectInformation").style.
display = "block";
document.getElementById("registerPage").style.display = "
none";
document.getElementById("dataInsertion").style.display =
"none";
document.getElementById("mapInformation").style.display =
"none";
}
else {
// account is not owner -> show rentingPage
document.getElementById("ownersPage").style.display = "
none";
document.getElementById("reclaimPage").style.display = "
none";
document.getElementById("rentOverview").style.display = "
none";
document.getElementById("rentingPage").style.display = "
block";
document.getElementById("objectInformation").style.
display = "block";
document.getElementById("registerPage").style.display = "
none";
document.getElementById("notFoundPage").style.display = "
none";
document.getElementById("dataInsertion").style.display =
"none";
document.getElementById("mapInformation").style.display =
"none";
}
}
});
129
}
else {
// object is unregistered
if (account === contractOwner) {
// account is contract owner -> show register screen
document.getElementById("ownersPage").style.display = "none
";
document.getElementById("reclaimPage").style.display = "none
";
document.getElementById("rentOverview").style.display = "
none";
document.getElementById("rentingPage").style.display = "none
";
document.getElementById("objectInformation").style.display =
"none";
document.getElementById("registerPage").style.display = "
block";
document.getElementById("notFoundPage").style.display = "
none";
document.getElementById("dataInsertion").style.display = "
none";
document.getElementById("mapInformation").style.display = "
none";
}
else {
// -> show not found screen
document.getElementById("ownersPage").style.display = "none
";
document.getElementById("rentOverview").style.display = "
none";
document.getElementById("reclaimPage").style.display = "none
";
document.getElementById("rentingPage").style.display = "none
";
document.getElementById("objectInformation").style.display =
"none";
document.getElementById("registerPage").style.display = "
none";
document.getElementById("notFoundPage").style.display = "
block";
document.getElementById("dataInsertion").style.display = "
none";
document.getElementById("mapInformation").style.display = "
none";
}
}
});
};
function get(name) {
130
if (name = (new RegExp(’[?&]’ + encodeURIComponent(name) +
’=([ˆ&]*)’)).exec(location.search))
return decodeURIComponent(name[1]);
}
setStatus("");
function setStatus(message) {
var status = document.getElementById("status");
status.innerHTML = message;
}
function setLoading(show) {
if (show) {
document.getElementById("loadingDiv").style.display = "inline";
}
else {
document.getElementById("loadingDiv").style.display = "none";
}
}
function refreshBalance() {
var addressElement = document.getElementById("address");
addressElement.innerHTML = formatAccountAddress(account);
function viewRegisterPage(state) {
var registerPage = document.getElementById("registerPage");
131
var unregisterPage = document.getElementById("unregisterPage");
if ((registerPage !== null) && (unregisterPage !== null)) {
if (state) {
registerPage.style.display = "none";
unregisterPage.style.display = "block";
}
else {
registerPage.style.display = "block";
unregisterPage.style.display = "none";
}
}
}
rentable.then(function (instance) {
return instance.objectIsRegistered.call(objId, {from: account})
;
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error getting objectIsRegistered()");
});
}
rentable.then(function (instance) {
return instance.objectIsRented.call(objId, {from: account})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error getting objectIsRented()");
});
}
rentable.then(function (instance) {
return instance.getObjectDeposit.call(objId, {from: account})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
132
setStatus("Error executing getObjectDeposit()");
});
}
rentable.then(function (instance) {
return instance.getObjectDescription.call(objId, {from: account
})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectDescription()");
});
}
rentable.then(function (instance) {
return instance.getObjectClientAddress.call(objId, {from:
account})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectClientAddress()");
});
}
rentable.then(function (instance) {
return instance.getObjectClientTime.call(objId, {from: account
})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectClientTime()");
});
}
rentable.then(function (instance) {
133
return instance.getObjectDataWeights.call(objId, {from: account
})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectDataWeights()");
});
}
rentable.then(function (instance) {
return instance.getObjectData.call(objId, {from: account})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectData()");
});
}
function getObjectLastPaid(objId, callBack) {
var rentable = RentableObjects.deployed();
rentable.then(function (instance) {
return instance.getLastPaid.call(objId, {from: account})
}).then(function (value) {
callBack(value);
}).catch(function (e) {
console.log(e);
setStatus("Error executing getObjectDataWeights()");
});
}
function refreshStatus() {
134
}
viewRegisterPage(value);
});
function refreshDetails() {
135
(4);
});
function registerObject() {
var rentable = RentableObjects.deployed();
var deposit = parseInt(document.getElementById("_deposit").value
) / wei;
var description = document.getElementById("_description").value;
var dataWeightsTime = parseInt(document.getElementById("
_dataWeightsTime").value) / wei;
var dataWeightsGps = parseInt(document.getElementById("
_dataWeightsGps").value) / wei;
var dataWeightsAccel = parseInt(document.getElementById("
_dataWeightsAccel").value) / wei;
var dataWeightsImpact = parseInt(document.getElementById("
_dataWeightsImpact").value) / wei;
var dataWeight = new Array(dataWeightsTime, dataWeightsGps,
dataWeightsAccel, dataWeightsImpact)
var data = [0,0,0,0];
console.log(rentable);
console.log(deposit);
console.log(description);
console.log(objectId);
console.log(dataWeight);
rentable.then(function (instance) {
return instance.registerObject(objectId, description, deposit,
dataWeight, data, {
from: account,
gas: 1000000
})
}).then(function (regSuccess) {
console.log(regSuccess);
if (regSuccess) {
setStatus("New object registered successfully.");
136
}
else {
setStatus("Object registering not possible. Please try again
.");
}
switchPageView();
}).catch(function (e) {
console.log(e);
setStatus("Error registering object; see log.");
});
}
function unregisterObject() {
var rentable = RentableObjects.deployed();
rentable.then(function (instance) {
return instance.unregisterObject(objectId, {from: account, gas:
1000000}).then(function (success) {
if (success) {
setStatus("Object removed successfully.");
}
else {
setStatus("Unregistering object not possible. Please try
again.");
}
refreshStatus();
})
}).catch(function (e) {
console.log(e);
setStatus("Error unregistering object; see log.");
});
}
function rentObject() {
setStatus("Renting object... (please wait)");
getObjectDeposit(objectId, function (deposit) {
var rentable = RentableObjects.deployed();
console.log("Renting object with objId=%s", objectId);
rentable.then(function (instance) {
var objId = Number(objectId);
return instance.rentObject(objId, {from: account, value:
deposit, gas: 1000000}).then(function (success) {
if (success) {
setStatus("Object successfully rented.");
}
else {
setStatus("Renting object not possible. Please try again
137
.");
}
switchPageView();
})
}).catch(function (e) {
console.log(e);
setStatus("Error renting object; see log.");
});
});
}
function payData() {
var rentable = RentableObjects.deployed();
var dataWeightsTime = parseInt(document.getElementById("
_dataTime").value);
var dataWeightsGps = parseInt(document.getElementById("_dataGps
").value);
var dataWeightsAccel = parseInt(document.getElementById("
_dataAccel").value);
var dataWeightsImpact = parseInt(document.getElementById("
_dataImpact").value);
var data = new Array(dataWeightsTime, dataWeightsGps,
dataWeightsAccel, dataWeightsImpact);
console.log(data);
rentable.then(function (instance) {
return instance.payData(objectId, data, {
from: account,
gas: 1000000
}).then(function (success) {
if (success) {
setStatus("Object paid data");
}
else {
setStatus("object did not pay");
}
switchPageView();
})
}).catch(function (e) {
console.log(e);
setStatus("Error paying object; see log.");
});
}
function reclaimObject() {
console.log("Reclaiming object with objectId=" + objectId);
setStatus("Returning object... (please wait)");
138
1000000}).then(function (success) {
if (success) {
console.log("Object with objectId=" + objectId + "
successfully reclaimed.");
setStatus("Object successfully reclaimed.");
}
else {
console.log("Reclaiming object objectId=" + objectId + " not
possible. Please try again.");
setStatus("Reclaiming object not possible. Please try again
.");
}
switchPageView();
})}).catch(function (e) {
console.log(e);
setStatus("Error returning object; see log.");
});
}
function formatAccountAddress(account) {
return account.substr(0, 32) + ’...’;
}
module.exports = {
initWindow: initWindow,
toggleAccounts: toggleAccounts,
setObjectId: setObjectId,
switchPageView: switchPageView,
registerObject: registerObject,
rentObject: rentObject,
unregisterObject: unregisterObject,
reclaimObject: reclaimObject,
payData: payData
};
window.addEventListener(’load’, function () {
if (typeof web3 !== ’undefined’) {
console.warn("Using web3 detected from external source. If you
find that your accounts don’t appear or you have 0 MetaCoin
, ensure you’ve configured that source properly. If using
MetaMask, see the following link. Feel free to delete this
warning. :) http://truffleframework.com/tutorials/truffle-
and-metamask");
// Use Mist/MetaMask’s provider
window.web3 = new Web3(web3.currentProvider);
} else {
console.warn("No web3 detected. Falling back to http://
localhost:8545. You should remove this fallback when you
139
deploy live, as it’s inherently insecure. Consider
switching to Metamask for development. More info here: http
://truffleframework.com/tutorials/truffle-and-metamask");
// fallback - use your fallback strategy (local node / hosted
node + in-dapp id mgmt / fail)
window.web3 = new Web3(new Web3.providers.HttpProvider("http://
localhost:8545"));
}
});
140