Berry is a Cardano Stakepool on Raspberry Pi. Check out my website to see more about my stakepool. You can support me by just delegating to my pool.
This repository is a guide to setup a stakepool on a Raspberry Pi by your own.
Basically we have two different popular CPU architectures. Let's only consider 64-bit machines. Many of you know Intel and AMD. They primarily build their CPUs on a x86_64 architecture. Then there is ARM, which CPUs are built on the so called aarch64 architecture, and our Raspberry Pi has an aarch64 CPU. I don't want to dive any deeper in that, but the problem is, that the Cardano-Node setup is made for x86_64 machines and currently doesn't support aarch64 out of the box. The goal of this repository is to make it as easy as possible to run a Cardano-Node on Raspberry Pi.
- Raspberry Pi 4 with 8GB RAM (4GB version works only with Swap partition as extra RAM)
- Ubuntu 20.04 LTS 64-bit (Very easy to install with Pi Imager. For running Ubuntu on SSD, check below)
IOG is currently improving the performance of the Cardano Node on ARM devices. Join this group to find out more. I wouldn't recommend you building the node with the GHC 8.6.5 compiler for ARM any longer, like in this guide.
This guide is for the Cardano mainnet!
sudo apt-get update
sudo apt-get upgrade
You might reboot your Pi afterwards.
sudo apt-get install libsodium-dev build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 llvm -y
wget https://downloads.haskell.org/ghc/8.6.5/ghc-8.6.5-aarch64-ubuntu18.04-linux.tar.xz
tar -xf ghc-8.6.5-aarch64-ubuntu18.04-linux.tar.xz
rm ghc-8.6.5-aarch64-ubuntu18.04-linux.tar.xz
cd ghc-8.6.5/
./configure
sudo make install
cd ../
rm -r ghc-8.6.5/
Now you should have GHC 8.6.5. You can check that with ghc --version
.
wget https://github.com/alessandrokonrad/Pi-Pool/raw/master/aarch64/cabal3.2/cabal
chmod +x cabal
mkdir -p ~/.local/bin
mv cabal ~/.local/bin
You can also build your own Cabal binary for aarch64. Look here.
Open the .bashrc file in your home directory and add at the bottom:
export PATH="~/.local/bin:$PATH"
To make the the new PATH active you can either reboot the Pi or type source .bashrc
from your home directory. Then run:
cabal update
Now we are ready to build the Cardano-Node!
git clone https://github.com/input-output-hk/cardano-node.git
cd cardano-node
echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" > cabal.project.local
git fetch --all --tags
git checkout tags/1.21.1
cabal build all
cp -p dist-newstyle/build/aarch64-linux/ghc-8.6.5/cardano-node-1.21.1/x/cardano-node/build/cardano-node/cardano-node ~/.local/bin/
cp -p dist-newstyle/build/aarch64-linux/ghc-8.6.5/cardano-cli-1.21.1/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/
Finally we have our node. If everything worked fine, you should be able to type cardano-cli
and cardano-node
.
We need first of all some configuration files:
mkdir pi-node
cd pi-node
wget https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-config.json
wget https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-byron-genesis.json
wget https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-shelley-genesis.json
wget https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-topology.json
You can change "ViewMode" from "SimpleView to "LiveView" in mainnet-config.json to get a fancy node monitor.
Now start the node:
cardano-node run \
--topology mainnet-topology.json \
--database-path db \
--socket-path db/socket \
--host-addr 0.0.0.0 \
--port 3000 \
--config mainnet-config.json
That's it. Your node is now starting to sync!
Note: The syncing process for the mainnet blockchain can take really long. My node also crashed sometimes during the syncing process. Having a backup machine (x86_64) where you sync the node and just copy the db on the Raspberry Pi, makes it much easier and faster. As soon as the Pi is in sync it runs really smooth and just uses about 5% of the CPU.
If a new version is released, you can update your installed node with the following commands (replace <version>
with the latest version number):
cd cardano-node
git fetch --all --tags
git checkout tags/<version>
cabal update
cabal build all
cp -p dist-newstyle/build/aarch64-linux/ghc-8.6.5/cardano-node-<version>/x/cardano-node/build/cardano-node/cardano-node ~/.local/bin/
cp -p dist-newstyle/build/aarch64-linux/ghc-8.6.5/cardano-cli-<version>/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/
I might create a detailed guide soon, on how to register a stakepool. Anyway there are plenty tutorials out there:
I can recommend CNTools (make sure the CNTools version is compatible with the Cardano-Node version).
Otherwise I would follow the official guide of cardano.org
- Flash the Ubuntu image on your SSD and your SD card.
- Now go to to the boot partition of the SD card and change in cmdline.txt the root path to:
root=/dev/sda2
- Insert the SD card into the Pi and the SSD into one of the USB 3.0 ports. This should boot now from the SD card, but the OS will run on the SSD then.
You can check that out: Directly boot from SSD
Adding quirks to your chipset, if it's not working
If you want to build your own Cabal binary for aarch64 or a different version of Cabal, follow this guide.
Go to your router settings. You can access them via your browser with the IP address of the router (e.g. 192.168.178.1 or if you have a FritzBox with fritz.box). Then look for a option Port Forwarding. Choose the IP address of your relay node(s) and open its/their port(s). Allow TCP and UDP. Then save it and that's it.