One of the most important market sectors for Ethereum Classic has always been cybersecurity and Internet of Things (IoT). When you have a Turing-Complete blockchain that follows the pillars of immutability of transactions and noninterventionism, you have the perfect candidate for a network that can secure IoT devices.

Imagine IoT devices being secured by a network that doesn’t hardfork to include unusual state changes because it’s protected by a strong social layer as well. That’s the promise of ETC and IoT.

I wanted to get started exploring the possibilities of IoT with ETC by getting my hands dirty building my own project. This guide will be split into several parts and will document my explorations of IoT, ETC, and all things Raspberries.

For this first part, I wanted to cover setting up your Raspberry Pi and running a cross-compiled version of Parity on it with the Classic Network. Parity is a very popular Ethereum Virtual Machine (EVM) client that can run several networks like ETC and ETH.

Hardware Requirements

Raspberry Pi 3 Model B

The following is the hardware you’ll need for this project:

Raspberry Pi 3 Model B Micro SD Card Micro SD Card Reader Ethernet Cable Micro USB Power Supply

This Raspberry Pi setup will be completely headless, so we won’t be needing USB keyboards, monitors or other gadgets. We will set it up so we can directly SSH into it when it’s starting up. You will need to be comfortable with the command line. If not, the directions and commands I give should be sufficient enough for you to explore around some more on your own if you’re curious.

This initial setup for the Raspberry Pi will happen using an OSX Machine. Other Operating Systems can find their own install setup guides from Raspberry Pi documentation.

Configuring the Raspberry Pi

In the first step, we need to download the Raspberry Pi Raspbian image, which is the Operating System used for Raspberry Pi. The Lite version is fine for download. This guide will be using Mac OS X, but there are guides for Windows and Linux.

Next, we need to erase and reformat our micro SD card. We need to plug it into our local machine for reformatting it, which I’ll be using my OSX machine for. We first insert our micro SD card into the reader as shown below, which is then plugged into our laptop.

micro SD card in micro SD card reader

Insert in your laptop

On a Mac, you reformat your SD card by using Disk Utility . I open Disk Utility and try to locate my SD card, which is empty and named to RASPBERRYPI as shown below.

Disk Utility on Mac

Next, you select Erase button and select the Format to be MS-DOS as shown below. Then you confirm by clicking Erase .

Reformatting micro SD card

Great, you have now reformatted your microSD card. It’s time to mount your Raspbian Image on it. On all OS setups, it’s best to download Etcher for mounting the image onto the SD card.

Now, unzip your Raspbian Lite file that you downloaded earlier. Popular unzip tools are 7-Zip (Windows), The Unarchiver (Mac), and Unzip (Linux).

file that you downloaded earlier. Popular unzip tools are 7-Zip (Windows), The Unarchiver (Mac), and Unzip (Linux). Unzipping it will result in a Raspbian .img file, which you’ll be mounting on to your micro SD card.

file, which you’ll be mounting on to your micro SD card. On Etcher, after installation, you then select your image that you unzipped and then the micro SD card as shown below.

Etcher micro SD card loaded

Next, you click Flash! to mount the image.

Raspbian being written to micro SD

Great, we have written our Raspbian Image onto our micro SD card!

SSH Configuration

Now that we have our mounted image installed, it’s time to prepare it for our ssh configuration and wireless setup. On a Mac, I’ll be using the command line to communicate with the Raspberry Pi and will be using Vim for any code changes and implementations shown, but feel free to use any IDE that you like.

In your terminal, try to locate your micro SD card boot directory. For Mac, it’s located here:

cd /Volumes/boot

This takes you to the boot directory of your Raspbian image. Inside it, we need to make an empty file called ssh . When Raspbian is first launched on your Raspberry Pi, it will look for this file called ssh on your boot directory, and from there enable SSH. More information on this can be found here.

To write a file in that directory, run the following command:

touch ssh

This creates an empty file called ssh inside your boot directory which will be used by Raspbian upon start up.

Installing Raspbian

Now, let’s get to the more fun part, installing Raspbian on our Raspberry Pi.

Safely unmount your micro SD card from your computer, and remove it from the micro SD card reader. Next, insert it inside the Raspberry Pi as shown below.

Insert micro SD card into Raspberry Pi

Next, we connect the Ethernet cable to the Raspberry Pi as shown below.

Connect Ethernet Cable to Raspberry Pi

After that, connect the power supply by connecting the micro USB power to turn it on.

Connecting micro USB Power Supply to Raspberry Pi

You’ll see an LED light blink, indicating it’s turning on.

While it installs, we will now try to find the IP address our Raspberry Pi is using.

Connecting to Raspberry Pi

In order to find out the IP address of our Raspberry Pi headlessly (without a monitor), we need to login into our Router IP address.

In OS X, to do that, you must first click on Network from System Preferences and then click on Advanced as shown in the image below (network names and IP address blurred out).

After clicking on Advanced , click on TCP/IP which will then show you the IPv4 and Router Address. You will need the Router address to access your Router and it will probably ask you for a username and password. I usually find those on a sticker on my router machine itself.

After going to that IP address on your browser and logging in, you should be able to find a client list connected to your router, depending on your type of router. This is mine and it has the device Raspberry Pi along with its IP address. The address is local and will most likely always start in your case with 192.168.X.Y , so look out for that, you’ll need it to ssh in to your system.

Here, we find out Raspberry Pi address to be 192.168.0.6 . The default username for Raspbian is pi and the default password is raspberry which we will need to log in.

Inside terminal, run the following command in order to ssh into your Raspberry Pi:

$ ssh pi@IPADDRESS

IPADDRESS in my case is the 192.168.0.6 I shared above, but is different than the value you’ll get.

When prompted for a password, type in raspberry . It should then ssh you into your Raspberry Pi because your shell will explicitly indicate it:

pi@raspberrypi:~ $

Notice the new shell name says pi@raspberrypi , it means you’ve successfully SSHed into your Raspberry Pi!

Now, you can setup your configuration for your Raspberry Pi by running the following command:

sudo raspi-config

This will provide you a command line menu where you can configure the settings. We will just focus on setting up Wireless Network since this is a Raspberry Pi 3 Model B. Not all devices would have a wireless network, so it may not apply to you.

First, select Network Options and then select Wifi . When you first run a new Raspbian OS install, it’ll ask you what country you’re in for regulatory purposes. After that, it asks for the SSID, which is your network name. The passphrase is the password to your WIFI network. After that, you should be good to go. More information on wireless found here.

Compiling Parity for Raspberry Pi

Docker Logo

This step will require you do the compilation locally on your laptop instead of using resources on the Raspberry Pi. It’s easy to secure-copy the binary we compile for Parity after into the Raspberry Pi.

The source code can be found in this Github repository, which we will be going over together.

The Dockerfile is shown in the gist below.

This uses Debian as the OS environment needed to cross-compile Parity (Debian is the best OS ever made). If you notice, there are references to armv7 for the targets we set for Rust to compile and the gcc and g++ compilers. If you aren’t sure what most of the content in the gist are, it’s fine, it’s not required learning for cross-compiling, since Docker does it all for you and you are just left with a binary. I leave it more for the convenience of others who are interested.

First thing we need to do is install Docker, which is what we will be using to compile Parity. The reason we can’t compile Parity locally without Docker is because we want to target the ARM architecture (armv7) for Raspberry Pi which is where Parity will be running.

For example, a binary compiled to run on an AMD architecture which is X86 won’t be able to run on an ARM architecture. This is why cross-compiling is needed in this scenario. Usually, Parity would release ARM architecture binaries whenever they have a new version, but they’ve stopped supporting it a while back, so I built my own Docker file for as shown in Github link above.

Now that Docker is installed on our machine, let’s get started!

We run the following command to get the image:



$ cd parity-arm $ git clone https://github.com/YazzyYaz/parity-arm.git $ cd parity-arm

Ok, now we are in the parity-arm directory which contains the Dockerfile that we will be compiling for parity.

We will start the build process for cross-compilation by running this following command:

$ docker build -t yazanator90:parity-arm .

This will build the image for it. It can take a while, so be you might want to go grab lunch or call a loved one while you wait for the build process to complete.

Once it’s done, you run the following commands:

$ docker run -d --name parity-arm yazanator90:parity-arm

This will run the image. After that, we enter the rest of the commands shown below in order to generate the binary that is resulted after compilation:

$ docker start parity-arm

$ docker ps

$ docker cp parity-arm:/parity-ethereum/target/armv7-unknown-linux-gnueabihf/release/parity parity-arm

$ docker stop parity-arm

$ docker rm parity-arm

This will delete the image we built but we will still have a compiled binary called parity-arm in our current directory. To verify it, run the following command:

$ ls

parity-arm

Dockerfile

README.md

LICENSE

Notice the file produced called parity-arm now. That’s the binary we will use to copy into our Raspberry Pi.

Running Parity in Raspberry Pi

Now, let’s run Parity!

We will first make sure we already have SSHed into our Raspberry Pi as we have discussed in our step above. Once SSHed in one terminal window, open a new terminal window which we will use to SCP. SCP is Secure-Copy which allows us to use SSH to copy files between machines.

Assuming you are in the parity-arm directory which we compiled our binary in, run the following command to scp Parity into Raspberry Pi:

$ cd

$ scp -r parity-arm pi@IPADDRESS:~/

This will copy the entire directory into Raspberry Pi’s $HOME folder, which is found on ~/ .

Now, let’s go to our Raspberry Pi and run Parity.

Inside the Raspberry Pi window that you’ve SSHed into, type the following:

$ cd ~/

$ ls

parity-arm/

This shows the parity-arm directory that we have copied over. Now, let’s run the Ethereum Classic chain on parity! Time to support our immutable network on this magnificent little piece of device.

Let’s cd into our parity-arm directory now:

pi@raspberrypi:~ $ cd parity-arm/

Before we run parity, we need to find our current IP address. This will be used to inform Parity about which external IP to use so that it doesn’t use the local IP address given to it by our router. The local IP address given to us by the router won’t be discoverable outside our home network, so by providing the IP address of our system to connect to, Parity can communicate across the internet with other nodes.

We can get our IP address from this website. This IP will be referred to inside the following command as EXTIP. Replace EXTIP in the command below with your IP.

Inside, we will instantiate parity for the classic chain with the following command:

pi@raspberrypi:~/parity-arm $ ./parity-arm --chain=classic --light --nat extip:EXTIP

Here, we are setting Parity to the classic chain so that we are running an ETC node. We also want it to be running the light client to go easy on disk space considering we are running it from Raspberry Pi. The --nat command informs Parity that it’s enode connects to the EXTIP we specified that we get from the website linked above.

Running Parity in Raspberry Pi

Will you look at that! We now have Parity running ETC in Raspberry Pi. Now, it’s time to let it sync up. Keep it connected to power and let Parity do all the heavy lifting for now.

In the future guides, we will explore having smart contracts (maybe in Vyper) running on ETC and communicating with the Raspberry Pi and also maybe build an IoT device for Raspberry Pi and ETC. Hope you enjoyed this guide, please feel free to share any feedback you have.