[Part One] Building an Ethereum Node on a Raspberry Pi 3B

Lucas Moore
Feb 20, 2018 · 6 min read

Why Host an Ethereum Node?

Ethereum is the most promising decentralized blockchain tech, in my humble opinion. It allows the execution of applications called Smart Contracts. You can read more Ethereum here. Lets talk about how to build your own Ethereum node.

As a decentralized technology, the code which contains the history of the chain is hosted on each and every node.

Similar to how a torrent is downloaded from many peers at once, the nodes on the Ethereum network contain the information of the history and state of the chain. By running a node, you help keep the network decentralized and trusted among peers. Running a node is a way to participate in this network directly, getting your hands dirty in some cutting edge technology. Plus, it’s fun!

Why do this on a Raspberry Pi?

My Pi Node

A Raspberry Pi is a perfect fit for running a node, since it can be left running all the time. Sure, you could run a node on your computer but there is a dedicated computing and storage cost. Instead of leaving my laptop running all the time, I’d rather have my node on dedicated hardware.

I’ve tried to host a node on AWS with a dedicated EC2 instance, but I don’t want to pay for recurring monthly cloud storage costs. For the price of a few months in AWS bills, I figured I could own dedicated hardware for a node. Plus, by the end of this tutorial, we’ll set up our node to allow us to securely ssh into it from anywhere, just like we could with an EC2 instance.

Full List of Hardware (~$110)

My research into Raspberry Pi setups was in depth. I did not want to buy a standard kit because I can build a better one myself for about the same price. I’ve found this setup to be suitable so far.

  • Raspberry Pi 3B+ — this is the latest full model, which has wifi and bluetooth built in.
  • An External Hard Drive— a 500G+ external SSD is reasonable. I got this Toshiba Canvio 1TB drive. You may need a power supply for other drives, but this one has run fine just with its own USB power.
  • A quality case and heatsinks — For a constantly running node, you’ll need a great case with a fan and heatsinks to keep the temperature low. It only took me two tries to set this Miuzei Raspberry Pi Case up correctly. Plus, the click-button power chord is snazzy as heck.
  • 32G+ microSD card — I think 32 gigs is enough, but you can go bigger if you’d like. We’re storing the chain data on the hard drive, so only need enough memory to run the operating system.

Things you might have laying around

The initial setup of the Pi will require a monitor and keyboard. To begin, you’ll need:

  • HDMI chord and a display
  • A Keyboard and a Mouse
  • Ethernet chord (optional)

First: Choosing an Operating System

There are many trade-offs when choosing an operating system. Here’s a few options and some thoughts about them, as well as my choice in this project. Luckily, it’s easy to switch if you want to go a different path. These are all Linux operating systems.

  • Ubuntu Mate [my choice] — This version of Ubuntu is also adapted to run well on a Pi. It’s a full blown Ubuntu image, with plenty of other programs installed.
  • Raspian — This is a dedicated Raspberry Pi Debian-based operating system. It’s tailored to run well on a Raspberry Pi and would be a good option for starting most Pi projects.
  • EthRaspbian — This is a modification of the Raspian OS that comes pre-installed with Parity or Geth as an Ethereum client. I wanted to work with Go Ethereum and install it all myself, so I didn’t go this route.
  • EthEmbeded — This site is all about building your own Ethereum node on connected devices. It’s so far untested on RPI 3. It also abstracts much of the details away, so I’d rather build this by hand myself.

I chose Ubuntu Mate because it’s a more general purpose operating system. If I wanted to run other programs or projects, my Raspberry Pi will not be overly specialized. Heads up, this tutorial will be specific to Ubuntu at certain points, but you can certainly adapt the steps to a different distribution of Linux.

Next: Install the OS on the Pi (from a Mac)

The best part of a Raspberry Pi is that it runs on a simple microSD card. In the event you ruin the whole operating system, you can easily erase and write over the operating system image. There are two ways you could install the operating system onto the SD card from your Mac.

Using an application

Etcher is a straight forward application to flash operating system images on a SD card. Just do what it says: select your operating system image, plug in your SD card and flash it. When it’s done, plug into your Pi and boot it.

Using the command line

If you want to be a bit more in depth about what’s happening, you can use the command line to move the disk image onto your SD card. Be careful though, pointing the command at the wrong disk could cause a serious headache.

Here’s the commands I used after downloading the OS image and plugging in my SD card to my Mac.

$ diskutil list
Show the current disks on your system. Identify the storage that ‘s the size and format of your SD card. Remember the location, it should be something like /dev/disk2, which I’ll use from now on. Replace that with your correct path though.

$ diskutil unmountdisk /dev/disk2 (or whatever)
Unmount that drive, using the location from the command above.

$ man dd
This is the manual page for the dd command. Read about what we’re using to flash the operating system image on to the disk. It’s important to get this command right the first time. Writing to the wrong disk, like your current hard drive, would have some serious consequences, as I mentioned above. Hit “q” to exit by the way.

$ dd if=path/to/the.img of=/dev/disk2 bs=2m
Now actually copy the image onto our SD card!

When the card is ready, plug it into the Pi and boot it up!

Configuring Ubuntu on the Pi

We’ll use apt-install to get a few important pieces of software that will be outlined in the next article. These include tmux, openSSH and vim.

$ apt get install tmux

$ apt get install openSSH — this should already be installed, but just make sure. We’ll approach this in the final part of this tutorial.

$ apt get install vim or you can install your favorite editor.

Installing Geth on Your Raspberry Pi

While making this project, I found no good answers (and one Stackoverflow question) about installing the Go Ethereum client (“geth”) on a Raspberry Pi. After much digging, I finally found Kevin Owocki’s article. You can see all the distributions of Go Ethereum here.

Here’s seven steps to install Geth

  1. Find the latest arm7 geth binary here. We want geth 1.8.1 because it fixed a bug in the light client in older versions.
  2. The link address of the file is harder to track down, but it’s https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.8.1-1e67410e.tar.gz
  3. Download from your Pi with
    $ wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.8.1-1e67410e.tar.gz
  4. Untar it with $ tar -xvf geth-linux-amd64-1.7.3-4bb3c89d.tar.gz
  5. Then cd geth-linux-amd64-1.7.3-4bb3c89d
  6. Move the binary into your /bin with $ sudo mv geth /usr/local/bin/ You might want to move other interesting binaries like puppeth or swarm but I won’t be writing about those in this tutorial.
  7. Then make sure you’ve got it working with $ geth license or $ geth h

Ok, that’s a lot of hacking away. If you’ve gotten this far, congrats! In part two of this article series, we’ll cover syncing the Ethereum blockchain and securing the node.

That’s All For Now! Part Two Coming Soon.

Please share this article. If you have any questions or want to send me a photo of your Raspberry Pi setup, or the successful geth version command, say hi on Twitter at @thelucasmoore.

Lucas Moore

Written by

Software Engineer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade