How do I run a TurtleCoin node on PI?
In the Reflecting Back: Getting that slow-hash to work on aarch64 we have shared our journey to get TurtleCoin to work on SBCs, such as Raspberry PI, Orange PI or Rock64 boards.
Today, you can read how to set up your own at home.
First, you need a suitable single-board ARM computer. Yes, you can use 64 Raspberry PI 3b(+), and we know these are quite popular among you folks. However, it is not the most suitable hardware.
Apart from a suitable board, you will need a good-quality, fast and reliable USB FlashDrive, such as SanDisk Ultra Fit USB 3.1 Flash Drive. We use the 128 GB version that gives us enough breathing room for the coin blockchain to grow.
For both boards, grab the Linux OS of your choice. We recommend to either use Armbian, or in case of OrangePI you can grab the legacy-kernel Ubuntu Server 16.04 supplied by the manufacturer of these boards.
Once you have your OS flashed to a microSD card or emmc (both boards come optionally with EMMC storage, which we recommed you to use for long-term, production use) and your board booted up and networking set up, start with updating the system:
sudo apt update sudo apt upgrade
Create a partition and file system on your 128GB USB Flash Drive. Find out the device name /dev/sdX, use fdisk to create a new partition and create a new file system.
In our case the device name is /dev/sda, we will create a /dev/sda1 primary partition on it.
Now we will create the file system.
mke2fs -t ext4 -O ^has_journal /dev/sda1
We will add the new file system to /etc/fstab to mount at each boot of your node. First we will find out the UUID of the /dev/sda1 device.
Our partition has the UUID 57f8f4bc-abf4-655f-bf67-946fc0f9f25b. We will use it to mount in the /etc/fstab
Mount the file system before using of course.
mount /dev/sda1 /root/.TurtleCoin
Now that we have the storage ready for TurtleCoin blockchain, we will download the latest release of the TurtleCoin daemon for aarch64 platform. You can download the latest release from TurtleCoin Github. To download the file directly to your directory, use wget.
root@OrangePi:~# wget https://github.com/turtlecoin/turtlecoin/releases/download/v0.14.0/turtlecoin-v0.14.0-aarch64.tar.gz --no-check-certificate
Un-GZ-tar the archive using tar xvzf command and cd into the turtlecoin directory.
tar xvzf turtlecoin-v0.14.0-aarch64.tar.gz
In the TurtleCoin directory run wget to download the latest Checkpoints.
wget https://github.com/turtlecoin/checkpoints/raw/master/checkpoints.csv --no-check-certificate
Run the daemon for the first time, load checkpoints for faster blockchain sync. This step could take very long when done from scratch, at the time of writing, TurtleCoin blockchain height (block number) is 1447359. Depending on your internet connection, this could take 1-3 days.
Please note in the command below, we set the TurtleCoin log file location from the default TurtleCoin working directory to the directory where we store blockchain on the USB FlashDrive. It is not necessary to do this if you use EMMC storage to run your operating system, however, if you use microSD card, this is highly adviseable to prevent wearing out your microSD card over the next months you will run your node.
./TurtleCoind --log-file /root/.TurtleCoin/TurtleCoind.log --load-checkpoints checkpoints.csv
Come back in a few days. Check regularly.
Alternatively, if you don’t want to wait for the blockchain sync from scratch, and in case you already run your node on your laptop or a computer, just copy the .TurtleCoin directory with the blockchain to the Flash Drive USB drive.
Once you have a fully synced blockchain, stop the TurtleCoin daemon by typing exit and wait for it to stop fully.
If you want to run you TurtleCoin node as a public node for serving other user’s wallets (and earning some extra TRTL in transaction fees), open the port 11898 on your firewall and start the TurtleCoin daemon with the following parameters. If you are on your home broadband and need to connect externally, you need to find out your external IP address. How to do this is out of scope of this article, and surely Google will help you.
In the example below, change the <your TRTL address> with your actual TurtleCoin wallet address to recieve TRTL and specify your desired transaction fee. In our example, we charge 19 TRTL fee (must be specified in TRTL atomic units, which is 2 decimal places, therefore 1900 shells = 19 TRTL)
nohup ./TurtleCoind --data-dir /root/.TurtleCoin --log-file /root/.TurtleCoin/TurtleCoind.log --log-level 2 --enable-blockexplorer --rpc-bind-ip 0.0.0.0 --rpc-bind-port 11898 --p2p-bind-ip 127.0.0.0 --p2p-bind-port 11897 --fee-address <your TRTL address> --fee-amount 1900 &
This example allows only TRTL wallet connections via RPC, and does not allow other nodes to connect to your node for blockchain synchronization via peer-to-peer connection.
In order to improve high-availability of your node and almost “plug & forget”, you may want to install turtlecoin-ha scripts and PM2. How to do this is described in the Readme in the TurtleCoin-ha repo in the TurtleCoin GitHub.
You can now connect with the wallet of your choice to your own TurtleCoin node running on Pi!