Sign inSign up

nwbower/pi-kaspad

By nwbower

•Updated almost 4 years ago

arm64 Kaspa Node for Raspberry Pi 4 Model B

Image
1

10K+

nwbower/pi-kaspad repository overview

⁠Containerized Kaspad for Raspberry Pi 4 Model B.

Kaspa Node in Docker on a Raspberry Pi 4 Model B 8GB - arm64

Buy me a coffee: kaspa:qqz5xkyz36hj2pu9srdzd46wzlz2v24qf7mkgxtg44lnzl2gpxkp7jezgjf6z

Yes, you can run a Kaspa Node on your Raspberry Pi 4 Model B. I'm using an 8GB version and it's been working great! The 8GB version is required as the node idles around 4.5gb of mem when synced. I'm booting to Ubuntu 22.04.1 LTS on a 512GB SSD.

Shout out to supertypo⁠ for the detailed readme and his x86-64 and amd64 versions, supertypo/kaspad⁠. I have copied some of his readme, but modified as appropriate here for this build image on a pi. Thank you supertypo!

There is also a great CLI reference for setting up a Kaspa node in docker⁠ on the kaspawiki.


Kaspa is an ancient Aramaic word for “silver” and “money.” Kaspa aims to become the most resilient, robust and fastest PoW BlockDAG in the world.
https://kaspa.org⁠

Kaspad release binaries are unaltered from the corresponding official version at:
https://github.com/kaspanet/kaspad⁠ (ISC licensed)

The loadbalancer, HAProxy, is GPLv2 licensed.
http://www.haproxy.org/⁠

Build source for this image is available at:
https://github.com/nwbower/pi-docker-kaspad⁠

Credit to supertypo for the loadbalancer and supporting readme reference available at:
https://github.com/supertypo/docker-kaspad⁠


⁠Quickstart:

⁠Make sure your system is update to date first (this example is for Ubuntu 22.04.1 LTS)
sudo apt update && sudo apt dist-upgrade -y

Reboot now if you're told to after the updates have been installed.

⁠Install docker (this example is for Ubuntu on a Raspberry Pi)

I used detailed instructions for installing on rpi here⁠.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
⁠Make sure Docker is started at boot
sudo systemctl enable docker
⁠Create datadir and set correct permissions
sudo mkdir -p /var/kaspad && sudo chown 51591 -R /var/kaspad
⁠Start Kaspad container
sudo docker run --pull always -d --restart unless-stopped -v /var/kaspad/:/app/data/ -p 16110:16110 -p 16111:16111 --name kaspad nwbower/pi-kaspad:latest

Thats it! The node will take some time to sync. For a Raspberry Pi this can take several hours.
Check the logs to know when it's ready.

⁠Tail logs:
sudo docker logs -n 1000 -f kaspad

The node is fully synced when it prints lots of "Accepted block ..." lines.

⁠View kaspad disk usage
sudo docker system df -v
⁠Later, when you want to upgrade to the newest kaspad
sudo docker rm -f kaspad
sudo docker run --pull always -d --restart unless-stopped -v /var/kaspad/:/app/data/ -p 16110:16110 -p 16111:16111 --name kaspad nwbower/pi-kaspad:latest
⁠To clear database and resync (if needed)
sudo docker stop kaspad
sudo rm -r /var/kaspad/.kaspad
sudo docker start kaspad

⁠Opening Connections:

By forwarding port 16111 on your router (unless configured otherwise) to the machine running kaspad, your node becomes a public node which other members of the network can use to sync. Even though private nodes can still mine, it is encouraged that you make your node public for the general health of the network. Like any other decentralized systems, Kaspa works best when there are many public nodes. Additionally, forward 16110 for utxo mining access.


⁠Prerequisits for building this image on your Pi:

You will need an arm64 compatible version of golang. Install GO on your pi by executing these steps one by one.

curl -OL https://golang.org/dl/go1.20.linux-arm64.tar.gz
sha256sum go1.20.linux-arm64.tar.gz

Confirm output from the last command looks like this:

17700b6e5108e2a2c3b1a43cd865d3f9c66b7f1c5f0cec26d3672cc131cc0994  go1.20.linux-arm64.tar.gz
sudo tar -C /usr/local -xvf go1.20.linux-arm64.tar.gz
sudo nano ~/.profile

Add following to end of the file and use ctl+x to save

export PATH=$PATH:/usr/local/go/bin

Refresh your profile.

source ~/.profile 

Logout of ubuntu and then back in again to force a profile refresh. Check the version of go that is installed

go version

The version output should read as

go version go1.20 linux/arm64

That's it! You should be able to clone this repo and build your own Kaspa Docker image.


⁠Build and run the docker image on your pi

git clone https://github.com/nwbower/pi-docker-kaspad.git

Change directory

cd pi-docker-kaspad

Build the image

docker build -t kaspad .

When you are ready, run the container to start the node

docker-compose up -d

⁠*Pro Tip

Raspberry Pi gets hot if it’s enclosed in a case without heat sinks. Use a proper heat sink with good ventilation to keep temperatures under control. There are some great cases built as a heat sink. I use and really like the flirc⁠.

You can check the temperature as well as the clock speed in ubuntu to investigate overheating and or potential thermal throttling issues. I've not had any issues with the flirc case.

⁠Check temperature:

(result example 53069 means 53ºC)

sudo cat /sys/class/thermal/thermal_zone0/temp
⁠Check clock speed (MHz):

(result example 1500000 means 1500Mhz)

sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

⁠Advanced: Run 2 independent instances, persistent storage and a load balancer using Docker Compose

HAProxy is used as loadbalancer, and the configuration is included in the kaspad_loadbalancer image (see git repo for details).
The HAProxy stats page is mapped to 9000 per default.

docker-compose.yaml:

version: "3"

services: kaspad1: container_name: kaspad1 image: nwbower/pi-kaspad:latest restart: unless-stopped volumes: - kaspad1:/app/data/ # command: /app/kaspad --utxoindex --enablebanning --whitelist=192.168.1.0/24

kaspad2: container_name: kaspad2 image: nwbower/pi-kaspad:latest restart: unless-stopped volumes: - kaspad2:/app/data/ # command: /app/kaspad --utxoindex --enablebanning --whitelist=192.168.1.0/24

kaspad_loadbalancer: container_name: kaspad_loadbalancer image: supertypo/kaspad_loadbalancer:latest restart: unless-stopped ports: - "9000:9000/tcp" - "16110:16110/tcp" - "16111:16111/tcp" links: - kaspad1 - kaspad2

volumes: kaspad1: kaspad2:

Run/upgrade with: sudo docker-compose pull && sudo docker-compose up -d

⁠Resync example (resync node nr. 1 - without downtime)
sudo docker rm -f kaspad1
sudo docker volume rm docker-kaspad_kaspad1
sudo docker-compose up -d

Tag summary

Content type

Image

Digest

sha256:671404128…

Size

27.1 MB

Last updated

almost 4 years ago

docker pull nwbower/pi-kaspad