Running a Filecoin (Lotus) node on Raspberry Pi 4
The new Raspberry Pi 4 offers a lot of really cool opportunities in a small, cheap package — especially if you max out the memory offering at 8GB. Sure, you can run an IBM mainframe on a Raspberry Pi Zero, but 8GB of RAM and the new ARM CPU (that you can overclock significantly) means that for $75 you can really punch above your weight.
One of the cool things you can do with it is run Filecoin, an emerging distributed cloud storage system. Mind you, you can’t mine Filecoin with this, or host storage — unless you’re a wizard that can mod an RPi to have 128GB+ of RAM.
That said, it’s great to learn more about the project or to hack on it, and as with any distributed system, the more nodes running on the network, the better. Filecoin is still in development, and new updates can break architecture functionality, but as of 11/30/20, this was working great.
What you’ll need:
Hardware:
- Raspberry Pi 4
- SD Card with a fair amount of storage (for syncing the Filecoin chain)
- A fast internet connection (a wired connection to the RPi helps)
Software:
- Raspbian OS, 64-bit version (more below)
- Lotus (the specific Filecoin project) dependencies
- Go (the language)
- Rust (the language)
Now jump right in:
- Get your SD card formatted and Raspbian installed. NOTE that these instructions are generic, and 64-bit Raspbian is still (as of time of writing) in beta. I use Raspberry Pi Imager, as it’s a small program, fast, and dependable, and you will need to use one of the 64-bit images.
Already have an RPi with 32-bit Raspbian installed? As per these instructions, all you’ll need to do is
sudo apt updatesudo apt full-upgrade
Done that? Welcome to the bleeding edge!
The next step of the process will be following Filecoin’s instructions:
- Install the dependencies
- Install Rust. Both Rust and Go installations can be tricky; make sure you are installing for the correct architecture and the correct version of both languages as per Filecoin’s specifications.
- Install Go. As stated above, this can be tricky. I found these two articles to be essential: this outlines the process well, whereas this gives you a fast and surefire way to do it. Be very careful that you are ‘wget’-ing the correct package for the correct architecture. This can be confusing.
- Ensure that both Go and Rust are in your PATH
- Clone Lotus repo:
git clone https://github.com/filecoin-project/lotus.git
And then run the Lotus build commands. I used the optional environmental variables, forcing a fresh compile of Lotus:
export RUSTFLAGS="-C target-cpu=native -g"
export FFI_BUILD_FROM_SOURCE=1
The build commands themselves:
make clean all
sudo make install
‘make clean all’, in particular, might take a while; make a cup of tea. Look out the window. Ponder life.
Provided that there are no errors, you’re ready to move on to the next section, wherein we sync the blockchain and get the Lotus daemon running. If you do have problems, and you’re striking out with problem solving via forums etc., the Lotus team on Github is very responsive.
At the end of the day, this is what you’re looking for:
Happy hacking!