Connecting IoT with blockchain

Connecting IoT with blockchain

In the first part of a two-part blog series, Sam Davies, Lead Technologist for Creative Programmes at Digital Catapult, discusses applications for connecting IoT with the blockchain using Raspberry Pi 2 and the latest Raspberry Pi 3.

The ‘smart contracts’ work described in our previous Blockchain blog post is progressing nicely and we are about to begin user testing with 20 game development teams in the next few weeks. Off the back of this work, we began wondering about other applications within our focus areas (closed data, IoT data and personal data) where we could utilise some of this technology.

Having previously worked for an IoT data analytics company, I was quite interested in how blockchain and IoT could be used together. Internet of Things devices inherently form distributed networks; they are often decentralised device networks that either pump out data, or respond to data.


Image 1

Similarly, Distributed Ledger Technology (DLT) is also an inherently distributed network, so it seems the two technologies could fit really well together. For example, a network of temperature or art quality sensors could record their data on a blockchain by immutably and permanently recording the results. This isn’t an especially unique idea; many companies are exploring this but by building prototypes such as this we can gain a far greater understanding of the potentials and limitations of this technology.

Another alternative we’re very interested in is distributed energy generation. With the prevalence of solar energy generation and smart meters, we could use blockchain to record and trade locally generated energy (Image 1). This could be particularly impactful in regions where main power may not always be available or is unreliable; but local storage and connectivity is. These sorts of opportunities are why we’re quite interested in exploring the potential of IoT and blockchain and are keen to experiment and prototype.

At this time we were lucky enough to get hold of the new Raspberry Pi 3 and thought it could be interesting to see if this (along with a Raspberry Pi 2, which we already had) could be used to create a meaningful IoT blockchain application.

Screen Shot 2016-06-16 at 11.52.34

3D Printer making a Raspberry Pi case

One of our first steps was to print out protective cases for the two Pi devices using the Digital Catapult Centre’s 3D printer. Once the devices were up and running, installing the Ethereum software was reasonably straightforward because there are pre-built geth binaries available for ARM processors. Building SOLC (the Ethereum smart contract compiler) was pretty painless, albeit quite slow and, in all honesty not required, as we could have used either an online compiler or compiled the SOLC elsewhere.

One key issue with Pis is that they are nowhere near powerful enough to partake in mining on the Ethereum live network. However, they could be used to hold copies of the nodes and act as an interface between sensors and a blockchain. Many IoT systems (especially home IoT solutions) require a hub of some form; the sensors connect to the hub and the hub connects to the internet.

Our plan was to use the Pi as a hub and connect some real or mocked sensor to that. We also wanted to run this on our own public permission network, not the live Ethereum network, giving us two main benefits; the ability to control the gas price (the cost per transaction), thus making it effectively free (in terms of buying/spending Ether) to transact, and we can also alter the mining complexity to enable initial mining to be done by Pis.

As this network was modelling a potential real life IoT use case, we wanted to run it on a private network where anyone could join and see the transactions (the IoT data/transactions of access rights to the data). We also wanted to restrict the chain length and size by controlling who can write onto this network.

Once we had the software installed, we were able to create a private network between a Raspberry Pi2, Pi3 and MacBook Pro, with each node being used as a miner.

In the next blog we will discuss how we set up the two Pis as sensor hubs in order to begin trading access to sensor data using smart contracts.

You can follow Sam Davies, Lead Technologist for Creative Programmes, on Twitter @DigiCatapult. Don’t forget to follow IoTUK too @IoTUKNews.

Sam Davies
No Comments

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.