IOTA Tangle is a Blockless Distributed Ledger for the Internet of Things – Running a IOTA Full Node on Rock64 Board

Orange Pi Development Boards

A lot of efforts is going into distributed ledger technologies like the blockchain, and while I keep hearing blockchain is the future, there’s a lot of hype, and so far I have not seen that many practical use cases.

But recently I saw Open Source Foundries – a new company announced at Linaro Connect US 2017 – participated in the IOTA blockchain BoF at the OpenIoT Summit 2018 showing a demo publishing sensor data to the IOTA Tangle.

So maybe we have a practical application here… Sadly, there’s no video recording of the IOTA blockchain BoF, so instead let’s go to the IOTA website to find out more.

What is IOTA?

That’s the short description of the solution:

An Open-Source Distributed Ledger

The first open-source distributed ledger that is being built to power the future of the Internet of Things with feeless microtransactions and data integrity for machines.

The key technology behind IOTA (Internet of Things Applications) is called the Tangle:

IOTA is a revolutionary new transaction settlement and data transfer layer for the Internet of Things (IoT). It is based on a new distributed ledger technology, the Tangle, which overcomes the inefficiencies of current Blockchain designs and introduces a new way of reaching consensus in a decentralized peer-to-peer system. Using IOTA, for the first time ever, people and machines can transfer money and/or data without any transaction fees in a trustless, permissionless, and decentralized environment. This means that even nano-payments are possible without the need for a trusted intermediary of any kind.

Blockchaing vs Tangle
Blockchaing vs Tangle

IOTA’s crypto-currency is called MIOTA and is listed on coin exchange websites. If you want to read the actual science / math behind the technology, you’ll find several academic papers.

Everything still feels  a little abstract after reading the introduction, and description, but the summary of the talk at OpenIoT Summit explains some of the potential application of this type of technology:

Blockchain based protocols can be utilized to solve difficult problems in the IoT and Embedded spaces. In this BoF we will discuss how to use this technology to establish a decentralized root of trust, that allows device control, ownership, and secure data transfer for devices with constrained footprints. In addition to blockchain, we will delve into new distributed ledger technology, and zero-knowledge proofs which allow one party (the prover) to prove to another (the verifier) that a statement is true, without revealing any information beyond the validity of the statement itself. This is important for anonymous machine to machine transactions to occur with very little compute resources.

The latter appears to refer to IOTA without directly mentioning it.

You’ll read in many places that IOTA is the ideal solution for the Internet of Things, but others have a different opinion. Only time will tell.

The best way to start understanding how it works is to experiment with it, and while IOTA website has a getting started guide, I recently saw information about using IOTA on Rock64 board.

Installing IOTA Full Node on Rock64 board

The work was done by muXxer, and is described as “docker-compose.yml for IOTA IRI on ROCK64 including Nelson.cli, Nelson.gui and Field.cli”.

This is all alpha and beta software with four main components used:

  • IOTA IRI – IOTA Reference Implementation
  • CarrIOTA Nelson.cli – Allows auto-discovery (P2P) for IOTA-Fullnodes while at the same time protecting the network against attacks
  • CarrIOTA Nelson.gui – Web based UI for Nelson.cli
  • CarrIOTA Field.cli – Proxy for your IRI that sends regular statistics to the Field server, and optionally accepts jobs from the server’s load balancer

The first think it do is to download and flash ayufan Ubuntu Bionic containers image. At the time of writing, the latest release was bionic-containers-rock64-0.6.41-227-arm64.img.xz,and I just flashed with Etcher to my eMMC flash module, but a micro SD card would do. In case you don’t know how to perform that step, read Rock64 Ubuntu review. As we’ll see below you’ll also need a USB hard drive or SSD to store the Tangle, unless you have a large (64GB+) eMMC module or micro SD card.

Now we can insert the eMMC flash module or micro SD card int othe board, boot it up, and login via SSH or the serial terminal using rock64/rock64.  Now we can make sure our system is up-to-date:

You may want to change the default password, or use public/private keys to login via SSH without a password.

We now need to mount our external hard drive and redirect the docker directory. I’ll use the EXT4 partition (volume name USB3_EXT4) on my USB drive. Let’s find out the UUID / PARTUUID:

Create a target directory for the external drive

and add the drive to your /etc/fstab:

All all storage devices,  & check our drive are mounted correctly:

The next step is to redirect docker containers to our external drive with a symlink:

The instructions recommend to setup 8GB swap for Rock64 with 4GB RAM. Instead I tried to enable ZRAM first, but while the current Ubuntu 18.04 image comes with a kernel with ZRAM module, and zram-config is installed, the zram swaps are not configured automatically. So instead I just configured 2GB swap for my Rock64 1GB RAM board:

Let’s check it’s properly enabled:

Good, now we can add to /etc/fstab:

and adjust some swap settings in /etc/sysctl.conf:

This will only make the system use swap if RAM is low, and try to keep more memory for applications instead of cache. The parameters are explained in details here.

We can reload the settings…

and get the IOTA Full node code for Rock64:

Some scripts and documentation can be found in the folder:

The first configuration step is to change the Nelson config in volumes/nelson.cli/config.ini file to match our requirements. I just changed the name, but as you can see there are plenty of other parameters in the file:

It mostly define some network & IRI (IOTA Reference Implementation) parameters, database path, etc…

Then we have to change the Field config in volumes/field.cli/config.ini. Again I only changed the name:

You’ll likely want to change the address to you own IOTA address for donations, otherwise you can leave the default to give donations to muXxer (the developer).

Generating your own IOTA address

If you want to generate your own address, you’ll need to download and install the IOTA Wallet on your computer to create one.

IOTA-Wallet-Light-Node-vs-Full-NodeThe first time we launch the wallet, we’re being asked to select between light node or full node. Now we can better understand that we are dong… Full node download the complete tangle database, while light node will only connect to a remote mode. It looks like the equivalent of nodes and gateways found in any IoT networks. A few more details here.

I went with the Light Node, and was asked to select a host from  list:IOTA-Wallet-Host
The next screen asks you to login. You can do that with your Seed. But how to create one? Easy… just type a random string of 81 characters with uppercase Latin characters and the number 9 only in a text editor, safely save it (you’ll also all your token if you don’t),  copy and paste it in the “Seed” filed and login.

Click to Enlarge

You should then able to check your receive address and QR code, which you can share publicly. Just don’t do that with our Seed address, which must remain private. You can insert your receive address in volumes/field.cli/config.ini.

Back to IOTA Full node installation

Time to download the Tangle (database), about 12.5GB large for now:

The script will also decompress the files after which the download space used by the directory will be 17GB, after the 12.5GB compressed archives are deleted at the end. That means you need a least 29.5GB free space for this to work, and explains why we need to use a hard drive, although I’d assume a 64GB eMMC module or good micro SD card might do too.

You may have to open the following ports for Rock64 IP address in your firewall:

  • 14600 UDP – IOTA/IRI UDP connection port
  • 15600 TCP – IOTA/IRI TCP connection port
  • 16600 TCP – Nelson.cli TCP connection port
  • 21310 TCP – Field.cli TCP connection port

We can now start our IOTA full node in docker:

The first time many files will be downloaded, and extracted.

IOTA-Fullnode-DownloadOnce all the update are done, we’ll be brought back to the command line, where we can check the status of the container:

as well as the IRI logs…

…and Nelson logs:

We can also access the Nelson GUI in a web browser using http://rock64_ip:5000.

IOTA Nelson Monitor
Click to Enlarge

This is what it looks like with a few (2) peers connected.

IOTA Nelson Monitor Peer Connected
Click to Enlarge

A full IOTA node is not exactly designed to run on ultra low end hardware:

All my 1GB of RAM and 2GB of swap were quickly filled up, which must be why the instructions where for a Rock64 with 4GB RAM with 8GB swap space setup on a SSD… Sometimes while logging with SSH I could also see the following message:

System information disabled due to load higher than 4.0

At this point , I restarted the IOTA Wallet on my computer, edited the Node Configuration to see if it would connected to my full node.

Click to Enlarge

And it did, you just need to use the API port in the address / URL.

I wanted to try to send sensor data to the Tangle, but I ran out of time for this first look. Some resources to look at would be the official documentation to send a transaction and a Raspberry Pi Project combining IOTA and MQTT.  I can see companies can post data streams to the IOTA marketplace, and users/customers can pay tokens to access sensor data.

Some of the use cases are discussed on Medium here and there  with benefits including:

  • Tamper-proof, quantum resistant and fast
  • No fees involved
  • IOTA tokens are not needed to transfer the data – the data is packed into the transaction and can be sent to whatever recipient is chosen. So you can send 0 IOTA and still deliver the data for free
  • IOTA will be able to handle thousands of transactions per second with each transaction containing valuable data  without fees involved

Based the answer to Reddit post, the Tangle does not actually store sensor data, but instead establish a connection and verifies integrity. So you’d still have your own database to store the data, so I understand IOTA just makes it easier to share securely with or without payment.

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Citrullin Recent comment authors
newest oldest most voted
Notify of

Hey, I am an active Community Developer. We are working on a C library: I am working on the refactor-transfer branch. I want to implement a simple compression algo. So if somebody wants to help, everybody is welcomed! 🙂 Currently it is a bit on ice, since I don’t have enough time for it.