Celestia Consensus Node Setup

Install dependencies

Install all required packages for building and running the node (compilers, utilities, monitoring tools, compression libraries).

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

Install Go

Make sure you set the correct version.

export GOVER="1.24.1"

Install Go (programming language required for building the node).

cd $HOME
wget "https://golang.org/dl/go$GOVER.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$GOVER.linux-amd64.tar.gz"
rm "go$GOVER.linux-amd64.tar.gz"

Clone repository and build

Set current release version.

export VER=

Download the source code, switch to the desired version, and build the binary.

git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app
git checkout $VER
make build

Configure the setup

Set network parameters.

export CHAIN_ID=mocha-4

Set your node moniker (name).

export MONIKER=

Set your node folder name:

export FOLDER=".celestia-app"

Initialize the node.

$HOME/celestia-app/build/celestia-appd init $MONIKER --chain-id $CHAIN_ID

Create folder structure for releases and copy binary

Organize binaries by version, move the built binary, and create a symlink for the active release. ℹ️ During the next upgrade, create a new subfolder for the new binary inside the releases folder and simply update the active-release symlink to point to this new binary’s folder. This approach is convenient for both automatic and manual updates, as well as for quickly rolling back to the previous version. Read more

mkdir -p $HOME/$FOLDER/releases/$VER/bin
mv $HOME/celestia-app/build/celestia-appd $HOME/$FOLDER/releases/$VER/bin
ln -sfn $HOME/$FOLDER/releases/$VER $HOME/$FOLDER/active-release

Set PATH environment

Add the active-release binary folder to your PATH so you can run celestia-appd from anywhere.

echo "export PATH=${HOME}/${FOLDER}/active-release/bin:\$PATH" >> $HOME/.bash_profile
source $HOME/.bash_profile

Custom ports

If you run multiple nodes on the same server, set a custom port prefix or leave it default 266.

export CUSTOM_PORT_PREF=266

Update ports in config.toml.

sed -i.bak \
  -e "s|^\([[:space:]]*\)proxy_app *=.*|\1proxy_app = \"tcp://127.0.0.1:36658\"|g" \
  -e "s|^\([[:space:]]*\)laddr *= \"tcp://127.0.0.1:26657\"|\1laddr = \"tcp://127.0.0.1:${CUSTOM_PORT_PREF}57\"|g" \
  -e "s|^\([[:space:]]*\)grpc_laddr *=.*|\1grpc_laddr = \"tcp://127.0.0.1:${CUSTOM_PORT_PREF}98\"|g" \
  -e "s|^\([[:space:]]*\)laddr *= \"tcp://0.0.0.0:26656\"|\1laddr = \"tcp://0.0.0.0:${CUSTOM_PORT_PREF}56\"|g" \
  -e "s|^\([[:space:]]*\)external_address *=.*|\1external_address = \"$(wget -qO- eth0.me):${CUSTOM_PORT_PREF}56\"|g" \
  -e "s|^\([[:space:]]*\)prometheus_listen_addr *=.*|\1prometheus_listen_addr = \"127.0.0.1:${CUSTOM_PORT_PREF}60\"|g" \
  -e "s|^\([[:space:]]*\)pprof_laddr|\1#pprof_laddr|g" \
  -e "s|prometheus = false|prometheus = true|g" \
  $HOME/$FOLDER/config/config.toml

Update ports in app.toml.

sed -i.bak \
  -e "s%^\([[:space:]]*\)address = \"tcp://localhost:1317\"%\1address = \"tcp://127.0.0.1:${CUSTOM_PORT_PREF}17\"%g" \
  -e "s%^\([[:space:]]*\)address = \"localhost:9090\"%\1address = \"127.0.0.1:${CUSTOM_PORT_PREF}90\"%g" \
  -e "s%^\([[:space:]]*\)address = \"0.0.0.0:9091\"%\1address = \"127.0.0.1:${CUSTOM_PORT_PREF}91\"%g" \
  $HOME/$FOLDER/config/app.toml

Update client RPC address in client.toml.

sed -i.bak \
  -e "s%^\([[:space:]]*\)node = \"tcp://localhost:26657\"%\1node = \"tcp://localhost:${CUSTOM_PORT_PREF}57\"%g" \
  $HOME/$FOLDER/config/client.toml

Set pruning

Enable pruning to reduce disk usage by deleting old blocks.

sed -i -e "s/^\([[:space:]]*\)pruning *=.*/\1pruning = \"custom\"/" $HOME/$FOLDER/config/app.toml
sed -i -e "s/^\([[:space:]]*\)pruning-keep-recent *=.*/\1pruning-keep-recent = \"100\"/" $HOME/$FOLDER/config/app.toml
sed -i -e "s/^\([[:space:]]*\)pruning-interval *=.*/\1pruning-interval = \"10\"/" $HOME/$FOLDER/config/app.toml

Enable bad peer filtering.

sed -i -e "s/^\([[:space:]]*\)filter_peers *=.*/\1filter_peers = \"true\"/" $HOME/$FOLDER/config/config.toml

Set chain-id

Configure chain-id for the client.

sed -i.bak -e "s/^\([[:space:]]*\)chain-id *=.*/\1chain-id = \"${CHAIN_ID}\"/;" $HOME/$FOLDER/config/client.toml

Set keyring-backend [optional]

Change key storage backend (e.g., use os instead of file).

sed -i.bak -e "s/^\([[:space:]]*\)keyring-backend *=.*/\1keyring-backend = \"os\"/;" $HOME/$FOLDER/config/client.toml

Set minimal gas-price

Define the minimum gas price for transactions.

sed -i.bak -e "s/^\([[:space:]]*\)minimum-gas-prices *=.*/\1minimum-gas-prices = \"0.0025utia\"/;" $HOME/$FOLDER/config/app.toml

Turn off RPC indexing [optional]

Disables transaction indexing to save disk space.

export STATUS="null"
sed -i -e "s/^indexer *=.*/indexer = \"$STATUS\"/" $HOME/$FOLDER/config/config.toml

Add live peers

Add peers to config.toml for network connectivity.

Hightower peer:

972b7bce73f08d4654fa102e8c8a67cd4f38224d@208.73.202.78:10356

ℹ️ We scan our nodes for live peers and select up to 15 of the best ones.

PEERS=""
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/$FOLDER/config/config.toml

Turn on snapshot [optional]

Enable automatic state snapshot creation every N blocks.

export INTERVAL=1000
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$INTERVAL\"/" $HOME/$FOLDER/config/app.toml

Download genesis

Download the network genesis file.

wget -O $HOME/$FOLDER/config/genesis.json https://snapshot01.at.htw.tech/celestia/testnet/genesis.json --inet4-only

Download addrbook

Download the network addrbook file.

wget -O $HOME/$FOLDER/config/addrbook.json https://snapshot01.at.htw.tech/celestia/testnet/addrbook.json --inet4-only

Donload Snapshot

Download the latest network snapshot here.

Create systemd service

Create a systemd service file for auto-start and managing the node.

tee /etc/systemd/system/celestia-appd.service > /dev/null <<EOF
[Unit]
Description=Celestia Testnet node
After=network-online.target

[Service]
User=$USER
LimitNOFILE=1000000
ExecStart=$HOME/$FOLDER/active-release/bin/celestia-appd start
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF

Start the node

Reload systemd configs, enable the service at boot, start the node and follow logs.

systemctl daemon-reload
systemctl enable celestia-appd
systemctl restart celestia-appd && journalctl -o cat -fu celestia-appd