How to Setup a Terra (LUNA) Validator Node
By: Christian Lanz
Tags: Tech, Terrahighlight, Payments, Blockchain, Bitcoin

Sync Node

First initialize your node so all the necessary terra files and directories get created

(validator)$ terrad init {MONIKER}

Moniker: The name of your validator (e.g. “block42”)

Then download the genesis file of the columbus-3 network:

To speed up the sync process head over to chainlayer.io and get the latest “normal” Terra snapshot for the columbus-3 network.

Terra snapshot by chainlayer.io

Download the latest snapshot to the .terrad directory onto your machine:



(validator)$ wget DATE.TIME.tar.lz4 (validator)$ cd ~/.terrad(validator)$ wget http://quicksync.chainlayer.io/terra/ columbus-3..tar.lz4

⚠️ Make sure to download the latest snapshot available at the time when you are reading this setup guide!

→ This will take some time, so feel free to grab a coffee. ☕

Before unpacking the snapshot you need to install the necessary tool:

(validator)$ sudo apt-get install wget liblz4-tool -y

Then, unpack it:

(validator)$ cd ~/.terrad

(validator)$ lz4 -d columbus-X.DATE.TIME.tar.lz4 | tar xf -

→ This will also take while, so you probably go and grab some more coffee. ☕

When everything is done, the snapshot should have been unpacked into your ~/.terrad/data directory.

Don’t forget to delete the snapshot archive, you don’t need it any more and it requires a lot of disk space.

Specify Seed Nodes

Open up your ~/.terrad/config/config.toml file:

(validator)$ vi ~/.terrad/config/config.toml

and set the seeds config to the following value:

seeds = "20271e0591a7204d72280b87fdaa854f50c55e7e@106.10.59.48:26656,3b1c85b86528d10acc5475cb2c874714a69fde1e@110.234.23.153:26656,49333a4cb195d570ea244dab675a38abf97011d2@13.113.103.57:26656,7f19128de85ced9b62c3947fd2c2db2064462533@52.68.3.126:26656"

Get Address Book

Download the latest address book so your node is able to find other nodes:

Now let’s start up your Terra node:

(validator)$ cd ~

(validator)$ terrad start

terrad start

Don’t worry about the red error logs (those are from failed connections to other nodes), you should soon start to see your node syncing blocks. Just wait for a minute or so for your node to start syncing.

The error logs should disappear after a while and your console output should look something like this (errors could still appear from time to time though):

terrad start, no more errors

Now stop the node before proceeding with the next step.

Run Terra Node via pm2 Process Manager

You can use whatever process manager you prefer, I usually go with pm2. Now let’s install all prerequisites and run the Terra node via pm2 in the background:

# Install nodejs, npm and pm2

(validator)$ sudo apt-get install nodejs npm -y

(validator)$ sudo npm i -g pm2

Create a bash script to run the Terra node:

(validator)$ cd ~

(validator)$ touch runNode.sh

(validator)$ chmod +x runNode.sh

Put in the following content:

#!/bin/sh

terrad start

Create another file:

(validator)$ touch terra-node.ecosystem.config.js

Put in the following content:

module.exports = { apps : [ { name: "terra-node", script: "/home/{USER}/runNode.sh", exec_mode: "fork", exec_interpreter: "bash"} ] }

User: The name of the unix user you created previously

Start the Terra node as a pm2 process:

pm2 start ./terra-node.ecosystem.config.js

Execute the following two commands, so your node is auto restarted upon failure and system restart:

(validator)$ pm2 save

(validator)$ pm2 startup

Check status or logs with those commands:

# Check status

(validator)$ pm2 status # Check logs

(validator)$ pm2 logs

Now your Terra node should be running in the background as a pm2 process.

Terra node running as pm2 process

Leave your node running until it synced to the latest block height. You can check the latest height at e.g.: https://terra.stake.id

You can also check if your node is still syncing via:

(validator)$ curl -Ss localhost:26657/status | jq -er “.result.sync_info”

You might need to install jq beforehand:

(validator)$ sudo apt-get install jq -y

This will give you something like that:

Terra node status

Watch for the “catching_up” — this needs to be “false”. Then your node is fully synced. You can also take the latest block height from here and compare it with the one in the block explorer to see how far your node is still away.

⚠️ Syncing your node could take several hours or even days. Make sure to wait until it’s fully synced before continuing with the next step!