Machu Picchu: Persistent IPFS node on Raspberry Pi3 — Part 1
version of September 7, 2021
The following is an explanation of how I installed a Raspberry Pi 3 Model B+ to serve as a persistent IPFS node in Machu Picchu. My Vision: Machu Picchu, Tech4Good
This document is composed of 3 parts, and a bonus:
- Part 1 explains the Raspberry Pi and why it interests Machu Picchu. You may want to read it to get acquainted with this Single Board Computer and its very helpful community. It might also give you ideas how to use it for your own project. This is what you are reading.
- Part 2a is a hands-on list of steps to install and deploy IPFS on the Raspberry Pi. It describes the first steps, until and including when changing the hostname and
ssh
password. - Part 2b is the rest of the steps to finish establishing a
ssh
session and the Solid State Disk, to install and deploy IPFS on the Raspberry Pi. - Bonus is the same as Part 2a but installs the system in 64-bit mode with Ubuntu, instead of 32-bit mode with Raspbian.
- Bonus of October 2024: Raspberry Pi introduced a Hardware Adaptation Top (HAT) to connect directly a SSD to the NVME bus. Much faster and cheaper than a Samsung USB https://www.raspberrypi.com/documentation/accessories/m2-hat-plus.html
Although I’m doing my best to explain each step, at some point you might need to do a Google search for more details. Your lifesaver, whenever you are puzzled by an error message in the installation, is to paste in Google the text of the error message followed by “Stackexchange”.
Machu Picchu Tech4Good, IPFS & blockchain
Machu Picchu is why I’m installing this IPFS node. Here is a quick description of concepts used in Machu Picchu if you are new to it. [Nov 2021, Machu Picchu in 40": https://youtu.be/MRz5oKHRg-8]
- IPFS is an Internet protocol to decentralize storage of data.
- The persons-in-need can publish their profile data and their needs using IPFS. Like what we do on LinkedIn, but here each person keeps ownership of the data, and it’s spread over peers, not stored on any central server.
- The credentials of data ownership of these persons are stored on a blockchain. Any blockchain supporting smart contracts should do.
- All humanitarians can read the profiles and optimize their assistance programs. They may also use this blockchain to check the quality of data and to manage these assistance programs.
- The better the data, the more assistance a person can expect. This motivates the person to maintain quality data.
- When national central banks will issue digital money (CBDCs), humanitarians can use Machu Picchu to distribute CBDCs directly as Cash & Voucher Assistance, and people can use it to pay the foods, the tools, their education, medical services etc.
Machu Picchu is open source and collaborative.
Raspberry Pi, briefly
Raspberry Pi is a complete computer in the size of a credit card. Its name comes from the tradition of naming computers by fruits, like Apple, Macintosh, Orange, Blackberry, Acorn and Apricot. It was launched by the BBC in February 29th, 2012. The initial purpose was to provide a low-cost, hackable computer to educate children in computers. Nine years later, the target audience expanded from U.K. children to people of all ages in all countries. More than 38 million units have been sold.
https://en.wikipedia.org/wiki/Raspberry_Pi
https://www.tomshardware.com/news/raspberry-pi-9th-birthday
The CPU has a RISC architecture of 32 and 64 bits, with ARM instruction set and is clocked between 0.7 Ghz and 1.5 Ghz, depending on the model. It has from 521 MB and up to 8 GB of memory. It can run Linux, Windows 10 IoT Core and many other OS. The latest version has Wi-Fi, Gigabit Ethernet, Bluetooth, USB, HDMI.
The major difference with the usual consumer computers is that it is very modular, its starting price is very low and its target user is the kind of person who is ready to learn by doing.
For example the price can be as low as 22 EUR VAT and shipping included, for the Raspberry Pi Zero 2W. Despite this low price, this board has quad-core CPU, 512 MB RAM, Wi-Fi, Bluetooth for the mouse and keyboard, 1 mini HDMI connector for the display, 2x micro USB connectors, 1 micro-SD slot (for the memory boot program). The user still has to add a Bluetooth keyboard and mouse, a display screen and a power supply.
As a final note, the IBM 360 series of my youth in 1974 topped at 10 MFlops and the RPi 3 is benchmarked at 192 MFlops, 20 times faster.
Raspberry Pi and Machu Picchu
As a full size computer with programmable outputs, the Raspberry Pi has been used to build many weird and/or ambitious projects. The International Space Station has 2 Raspberry Pi running every year kid programming contests driving scientific experiments. It is normal that Machu Picchu intends to use a Raspberry as its IPFS node.
The requirements for an IPFS node for use by Machu Picchu in a remote village are:
- Internet access
- Low cost
- Low power consumption
- USB port to plug a mass storage, typically a Solid State Disk
- CPU of moderate power and moderate RAM, sufficient to compute and verify crypto signatures
- No need of keyboard, mouse nor display (headless configuration).
There are 7 Raspberry Pi models that satisfy these requirements.
Selection from this table:
- For Machu Picchu, Wi-Fi is enough, we require no Ethernet.
- Storing profiles of persons-in-need, the data throughput of USB 2 is enough, USB 3 could be nice to have.
- One person gave me a feedback that he experienced an out-of-memory with 1 GB RAM when storing on IPFS a video of 250 MB, and had no more issue when running the IPFS node on a 8 GB-Raspberry Pi4 Model B.
- We can try with 1 GB RAM since a profile takes less than 10 MB totalling all files.
- Most OS on Raspberry have images built with 32-bit, the images with 64-bit have been less thoroughly tested.
For the above reasons, we selected to start with the Pi3 Model B+, because of its low power consumption and its dual-band Wi-Fi. If more RAM is needed we could upgrade to the Pi4 Model B. On the opposite, if a lower performance is enough, we may try the Pi Zero 2W [Nov 2021] with 512 MB RAM.
Additional reading: https://www.elecrow.com/blog/differences-between-raspberry-pi-b-b-a-2b-3b.html
Official Raspberry Pi typical power requirements: https://www.raspberrypi.org/documentation/computers/raspberry-pi.html#typical-power-requirements
A RPi Zero 2W would run for more than a week on a 12V lead-acid battery: https://www.youtube.com/watch?v=lPyDtuzYE5s
Install the IPFS node
Part 2a and Part 2b contain the step-by-step guide to build the Raspberry Pi3 kit and install the IPFS node. Each step has been checked during the redaction of this article.