Idena on Raspberry Pi

in #idena2 years ago (edited)

As a memo.

Get the latest go from https://go.dev/dl

Clone Idena

~$ git clone https://github.com/idena-network/idena-go

Build Idena

~$ sudo ../go/bin/go build -ldflags "-X main.version=0.30.3"

~$ mv idena-go ../idena-node-arm64

~$ nano config.json

{ "IpfsConf":
{ "Profile": "server" }
}

Supervisor for autorestart

~$ sudo apt install supervisor

~$ sudo nano /etc/supervisor/conf.d/idena.conf

[program:idena]
command=/home/pi/downloads/idena/idena-node-arm64 --config=config.json
directory=/home/pi/downloads/idena/
autostart=true
autorestart=true
stderr_logfile=/var/log/idle.err.log
stdout_logfile=/var/log/idle.out.log
user=pi

~$ sudo supervisord
~$ sudo supervisorctl
supervisor> update

Get the API key

~$ cat ./datadir/api.key

Connect from the client machine

~$ ssh -L 9009:localhost:9009 pi@IP-address

To check the node status
~$ tail /var/log/idle.out.log

Bash script to check if the node is online:

#!/bin/bash
curl -s 'http://localhost:9009/' -H 'Content-Type:application/json' --data '
{"method": "dna_identity",
"params": ["0xc70c9327be7f13bf18651c2a2fbe26a69aee0c8c"],
"id": 1,
"key": "API key"
}' | grep -o ".{0,1}online.{0,6}"