Page cover

Celestia Testnet - Mocha

Guide to setting up Validator Node, Bridge Node, and Light Node on Celestia

Install dependencies

sudo apt -q update sudo apt -qy install curl git jq lz4 build-essential sudo apt -qy upgrade

sudo rm -rf /usr/local/go curl -Ls https://go.dev/dl/go1.23.5.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local eval $(echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee /etc/profile.d/golang.sh) eval $(echo 'export PATH=$PATH:$HOME/go/bin' | tee -a $HOME/.profile)

Clone project repository

cd $HOME rm -rf celestia-app git clone https://github.com/celestiaorg/celestia-app.git cd celestia-app git checkout v3.3.1-mocha

Build binaries

make build

Prepare binaries for Cosmovisor

mkdir -p $HOME/.celestia-app/cosmovisor/genesis/bin mv build/celestia-appd $HOME/.celestia-app/cosmovisor/genesis/bin/ rm -rf build

ln -s $HOME/.celestia-app/cosmovisor/genesis $HOME/.celestia-app/cosmovisor/current -f sudo ln -s $HOME/.celestia-app/cosmovisor/current/bin/celestia-appd /usr/local/bin/celestia-appd -f

Set node configuration

celestia-appd config chain-id mocha celestia-appd config keyring-backend test

Initialize the node

celestia-appd init $MONIKER --chain-id mocha-4

Add seeds

sed -i -e "s|^seeds =.|seeds = \"3f472746f46493309650e5a033076689996c8881@celestia-testnet.rpc.kjnodes.com:12059\"|" $HOME/.celestia-app/config/config.toml

Set commit timeout

sed -i -e "s|^target_height_duration =.|timeout_commit = \"11s\"|" $HOME/.celestia-app/config/config.toml

Set minimum gas price

sed -i -e "s|^minimum-gas-prices =.|minimum-gas-prices = \"0.002utia\"|" $HOME/.celestia-app/config/app.toml

Set pruning

sed -i \ -e 's|^pruning =.|pruning = "nothing"|' \ $HOME/.celestia-app/config/app.toml

Set configuration for v3

sed -i -e "s|^recv_rate =.|recv_rate = 10485760|" -e "s|^send_rate =.|send_rate = 10485760|" -e "s|^ttl-num-blocks =.|ttl-num-blocks = 12|" $HOME/.celestia-app/config/config.toml

Enable bbr

sudo modprobe tcp_bbr echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf sudo sysctl -p

1. Create a wallet

First of all we will need to create wallet for our validator. You have two options for that.

Option 1 - Create new wallet

celestia-appd keys add wallet

Option 2 - Recover existing wallet

celestia-appd keys add wallet --recover

Save the mnemonic output as this is the only way to recover your validator wallet in case you lose it!

To list your wallets use command below

celestia-appd keys list

Fund a wallet

To create validator you have to fund the previously created wallet via Discord by sending this message to the #mocha-faucet channel:

$request celestia1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

To check wallet balance use command below

celestia-appd q bank balances $(celestia-appd keys show wallet -a)

Create validator

Please make sure you have adjusted moniker, identity, details, website to match your values.

celestia-appd tx staking create-validator \
--amount 1000000utia \
--pubkey $(celestia-appd tendermint show-validator) \
--moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id mocha-4 \
--commission-rate 0.05 \
--commission-max-rate 0.20 \
--commission-max-change-rate 0.05 \
--min-self-delegation 1 \
--from wallet \
--gas-adjustment 1.4 \
--gas auto \
--gas-prices 0.005utia \
-y

SystemD

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

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.celestia-app"
Environment="DAEMON_NAME=celestia-appd"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.celestia-app/cosmovisor/current/bin"

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable celestia-testnet.service

Install Bridge Node

Official documentation: https://docs.celestia.org/nodes/bridge-node

Download and build binaries

cd $HOME 
rm -rf celestia-node 
git clone https://github.com/celestiaorg/celestia-node.git 
cd celestia-node
git checkout v0.21.5-mocha
make build
sudo mv build/celestia /usr/local/bin
make cel-key
sudo mv cel-key /usr/local/bin

Add Bridge wallet

Generate new wallet

cel-key add bridge-wallet --node.type bridge --p2p.network mocha

Recover existing wallet

cel-key add bridge-wallet --node.type bridge --p2p.network mocha --recover

Fund the wallet with testnet tokens

Once you start the Bridge Node, a wallet key will be generated for you. You will need to fund that address with Testnet tokens to pay for PayForBlob transactions

Initialize Bridge node

celestia bridge init \
  --keyring.keyname bridge-wallet \
  --core.ip http://localhost \
  --core.port 12090 \
  --p2p.network mocha \
  --rpc.port 12058 \
  --gateway.port 12059

Create service

sudo tee /etc/systemd/system/celestia-bridge.service > /dev/null << EOF
[Unit]
Description=Celestia Bridge Node service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which celestia) bridge start \\
--keyring.keyname bridge-wallet \\
--core.ip http://localhost \\
--core.port 12090 \\
--p2p.network mocha \\
--rpc.port 12058 \\
--gateway.port 12059 \\
--metrics.tls=true \\
--metrics \\
--metrics.endpoint=otel.mocha.celestia.observer \\
--archival
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment=GODEBUG="asynctimerchan=1"

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable celestia-bridge.service

Start Bridge node

systemctl restart celestia-bridge.service

Check Bridge node logs

journalctl -fu celestia-bridge.service -o cat

Useful commands

Get Bridge Node ID

AUTH_TOKEN=$(celestia bridge auth admin --p2p.network mocha)
curl -s -X POST -H "Authorization: Bearer $AUTH_TOKEN" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":0,"method":"p2p.Info","params":[]}' http://localhost:12058 | jq -r .result.ID

Get Bridge node key

cel-key show bridge-wallet --node.type bridge --p2p.network mocha -a | tail -1

Check Bridge node wallet balance

celestia-appd q bank balances $(cel-key show bridge-wallet --node.type bridge --p2p.network mocha -a | tail -1)

Upgrade Bridge Node

Stop Bridge node

sudo systemctl stop celestia-bridge.service

Download and build binaries

cd $HOME 
rm -rf celestia-node 
git clone https://github.com/celestiaorg/celestia-node.git 
cd celestia-node
git checkout v0.21.5-mocha
make build
sudo mv build/celestia /usr/local/bin
make cel-key
sudo mv cel-key /usr/local/bin

Check Bridge node version

celestia version

Install LightNode

cd $HOME
rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node/
git checkout tags/v0.21.5-mocha
make build
sudo make install
make cel-key

Config and init app:

celestia light init --core.ip <RPC_NODE_IP> --p2p.network mocha

Create wallet:

KEY_NAME="my_celes_key"
cd ~/celestia-node
./cel-key add $KEY_NAME --keyring-backend test --node.type light --p2p.network mocha

(Optional) Restore an existing cel_key:

KEY_NAME="my_celes_key"
cd ~/celestia-node
./cel-key add $KEY_NAME --keyring-backend test --node.type light --p2p.network mocha --recover

You can find the address by running the following command in the celestia-node directory:

cd $HOME/celestia-node
./cel-key list --node.type light --keyring-backend test --p2p.network mocha

Create Service file and replace FULL node ip, RPC and gRPC ports:

sudo tee /etc/systemd/system/celestia-light.service > /dev/null <<EOF
[Unit]
Description=celestia light
After=network-online.target

[Service]
User=$USER
ExecStart=$(which celestia) light start \
--p2p.network mocha \
--metrics.tls=true --metrics --metrics.endpoint otel.mocha.celestia.observer
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF

Enable and start service:

sudo systemctl daemon-reload
sudo systemctl enable celestia-light
sudo systemctl restart celestia-light && sudo journalctl -u celestia-light -fo cat

Last updated