Cover photo

Celestia (mocha) validator node installing

Project Description

Celestia is a modular POS blockchain system of the L1 level (Cosmos), the purpose of which is to create a scalable level of data availability, which allows you to develop and create modular blockchains.

On May 22, the team rolled out the mamaki test network, which is still working. According to the roadmap of the project, an incentivized phase is planned in early 2023.

The 1st round of investments was only $1.5M, but Binance Labs was the investor. However, already in October of this year there was the next phase of investments totaling $55M, the lead investors in which were Polychain Capital

Minimum server requirements:

  • CPU - 4 cores;

  • RAM - 8 Gb;

  • SSD - 250 Gb;

  • Ubuntu 20.04.

Network Explorer: http://celestia.explorers.guru | https://celestiascan.vercel.app | https://testnet.mintscan.io/celestia-testnet

Denomination: utia

Website: http://celestia.org

Discord: https://discord.gg/celestiacommunity

Documentation: https://docs.celestia.org/nodes/mocha-testnet

Installation

We connect to the server via Putty or MobaXterm, and then proceed with the installation.

First, make sure to update and upgrade the OS:

sudo apt update && sudo apt upgrade -y

These are essential packages that are necessary to execute many tasks like downloading files, compiling, and monitoring the node:

sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git make ncdu -y

Install Golang

Celestia-app and celestia-node are written in Golang so we must install Golang to build and run them.

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

Now we need to add the /usr/local/go/bin directory to $PATH:

echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile

To check if Go was installed correctly run:

go version

The output should be the version installed:

go version go1.19.1 linux/amd64

Install full node

git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node
make build
sudo make install

Node types

  • Bridge nodes - relay blocks from the celestia consensus network to the celestia data availability (DA) network

  • Full nodes - fully reconstruct and store blocks by sampling the DA network for shares

  • Light nodes - verify the availability of block data by sampling the DA network for shares

  • Validator nodes - allow you to participate in consensus in the Celestia network

Run a full node

<node_type> can be bridge, full or light.

celestia <node_type> init 
celestia <node_type> start

Install full node

We need to install Celestia App first.

cd $HOME
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app/
APP_VERSION=v0.11.0
git checkout tags/$APP_VERSION -b $APP_VERSION
make install

To check if the binary was successfully compiled you can run the binary using the --help flag:

celestia-appd --help

You should see a similar output (with helpful example commands):

Start celestia appUsage:
celestia-appd [command]

Available Commands:
add-genesis-account Add a genesis account to genesis.json
collect-gentxs      Collect genesis txs and output a genesis.json file
config              Create or query an application CLI configuration file
debug               Tool for helping with debugging your application
export              Export state to JSON
gentx               Generate a genesis tx carrying a self delegation
help                Help about any command
init                Initialize private validator, p2p, genesis, and application configuration files
keys                Manage your application's keys
migrate             Migrate genesis to a specified target version
query               Querying subcommands
rollback            rollback tendermint state by one height
rollback            rollback cosmos-sdk and tendermint state by one height
start               Run the full node
status              Query remote node for status
tendermint          Tendermint subcommands
tx                  Transactions subcommands
validate-genesis    validates the genesis file at the default location or at the location passed as an arg
version             Print the application binary version information

Flags:
-h, --help                help for celestia-appd
--home string         directory for config and data (default "/root/.celestia-app")
--log_format string   The logging format (json|plain) (default "plain")
--log_level string    The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
--trace               print out full stack trace on errors

Use "celestia-appd [command] --help" for more information about a command.

Setup the P2P Networks

Now we will setup the P2P Networks by cloning the networks repository:

cd $HOME
rm -rf networks
git clone https://github.com/celestiaorg/networks.git

To initialize the network pick a "node-name" that describes your node. The --chain-id parameter we are using here is mocha. Keep in mind that this might change if a new testnet is deployed.

celestia-appd init "node-name" --chain-id mocha

Copy the genesis.json file. For mocha we are using:

cp $HOME/networks/mocha/genesis.json $HOME/.celestia-app/config

Set seeds and peers:

SEEDS="some seeds"
PEERS="some peers"
sed -i -e 's|^seeds *=.*|seeds = "'$SEEDS'"|; s|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.celestia-app/config/config.toml
sed -i -e "s/^seed_mode *=.*/seed_mode = \"$SEED_MODE\"/" $HOME/.celestia-app/config/config.toml

More peers can be found in official repo:

https://github.com/celestiaorg/networks/blob/master/mocha/peers.txt

Configure pruning

For lower disk space usage we recommend setting up pruning using the configurations below. You can change this to your own pruning configurations if you want:

PRUNING="custom"
PRUNING_KEEP_RECENT="100"
PRUNING_INTERVAL="10"

sed -i -e "s/^pruning =./pruning = "$PRUNING"/" $HOME/.celestia-app/config/app.toml
sed -i -e "s/^pruning-keep-recent =./pruning-keep-recent = "$PRUNING_KEEP_RECENT"/" $HOME/.celestia-app/config/app.toml
sed -i -e "s/^pruning-interval =./pruning-interval = "$PRUNING_INTERVAL"/" $HOME/.celestia-app/config/app.toml

Quick-sync with snapshot (optional):

Syncing from Genesis can take a long time, depending on your hardware. Using this method you can synchronize your Celestia node very quickly by downloading a recent snapshot of the blockchain. If you would like to sync from the Genesis, then you can skip this part.

Run the following command to quick-sync from a snapshot for mocha:

cd $HOME
rm -rf ~/.celestia-app/data
mkdir -p ~/.celestia-app/data
SNAP_NAME=$(curl -s https://snaps.qubelabs.io/celestia/ | egrep -o ">mocha.*tar" | tr -d ">")
wget -O - https://snaps.qubelabs.io/celestia/${SNAP_NAME} | tar xf - -C ~/.celestia-app/data/

Start the celestia-app with SystemD

SystemD is a daemon service useful for running applications as background processes.

Create Celestia-App systemd file:

sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-appd.service
[Unit]
Description=celestia-appd Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/celestia-appd start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF

If the file was created successfully you will be able to see its content:

cat /etc/systemd/system/celestia-appd.service

Enable and start celestia-appd daemon:

sudo systemctl enable celestia-appd
sudo systemctl start celestia-appd

Check if daemon has been started correctly:

sudo systemctl status celestia-appd

Check daemon logs in real time:

sudo journalctl -u celestia-appd.service -f

To check if your node is in sync before going forward:

curl -s localhost:26657/status | jq .result | jq .sync_info

Make sure that you have "catching_up": false, otherwise leave it running until it is in sync.

Working with a wallet

If you are creating/restoring a wallet manually, then first create a variable (wallet name) and write it to bash_profile for convenience:

source .bash_profile
wallet="wallet"
echo "export CELESTIA_WALLET=$wallet" >> $HOME/.bash_profile

Creating a wallet:

source .bash_profile
celestia-appd keys add $CELESTIA_WALLET --keyring-backend os

Do not forget to save the mnemonics of the wallet!

We get the wallet address and VALOPER and write them in bash_profile for convenience:

CELESTIA_ADDRESS=$(celestia-appd keys show $CELESTIA_WALLET -a --keyring-backend os)
CELESTIA_VALOPER=$(celestia-appd keys show $CELESTIA_WALLET --bech val -a --keyring-backend os)
echo 'export CELESTIA_ADDRESS='${CELESTIA_ADDRESS} >> $HOME/.bash_profile
echo 'export CELESTIA_VALOPER='${CELESTIA_VALOPER} >> $HOME/.bash_profile

Checking the wallet balance:

celestia-appd query bank balances $CELESTIA_ADDRESS

The wallet balance will be displayed only when the node is fully synchronized with the network!

To get test tokens, go to the Discord in the #mocha-faucet channel and get tokens in the format $request YOUR_ADDRESS

Working with the validator

Do not forget that we create a validator only after your node is fully synchronized with the network.

Creating a validator:

celestia-appd tx staking create-validator \
--chain-id=$CELESTIA_CHAIN_ID \
--keyring-backend os \
--commission-rate 0.05 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.1 \
--min-self-delegation "1000000" \
--amount 1000000utia \
--pubkey $(celestia-appd tendermint show-validator) \
--moniker=$CELESTIA_NODENAME \
--from=$CELESTIA_WALLET \
--evm-address=$CELESTIA_EVM_WALLET \
--orchestrator-address=$CELESTIA_ORCHESTRATOR_ADDRESS \
--fees 2000utia \
--gas-adjustment=1.4 \
--gas=auto \
-y

After that, we go to the explorer and use txhash to check the transaction for the successful creation of the validator (if Success, then the validator is correctly created).

Delegate tokens to your validator (in the example, 1 token is delegated):

celestia-appd tx staking delegate $CELESTIA_VALOPER 1000000utia --from $CELESTIA_WALLET --keyring-backend os --chain-id=$CELESTIA_CHAIN_ID --fees 1000utia -y

If successful, you should see a similar output as:

code: 0
codespace: ""
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: <tx-hash>

You can check if the TX hash went through using the block explorer by inputting the txhash ID that was returned.

Deleting a node

To remove the node, run the command (this is one command, or just run the installer, there is a command to remove the node):

systemctl stop celestia-appd && \
systemctl disable celestia-appd && \
rm /etc/systemd/system/celestia-appd.service && \
systemctl daemon-reload && \
cd $HOME && \
rm -rf .celestia-app celestia-app && \
rm -rf $(which celestia-appd)

Useful commands

A list of useful commands, useful to everyone.

Check the last synchronized block:

celestia-appd status 2>&1 | jq ."SyncInfo"."latest_block_height"

Check logs:

sudo journalctl -u celestia-appd -f -o cat

Vote for the proposal (governance) with ID=1:

celestia-appd tx gov vote 1 yes --from $CELESTIA_WALLET --keyring-backend os --f