In this blog post, we will guide you through the process of setting up a Celestia Validator Node. Following these steps, you will be able to participate in the consensus and have your node up and running.
Hardware Requirements
Before getting started, ensure that your machine meets the minimum hardware requirements for running the validator node:
- Memory: 8 GB RAM
- CPU: 6 cores
- Disk: 500 GB SSD Storage
- Bandwidth: 1 Gbps for Download/1 Gbps for Upload
Install the dependencies
First, ensure you’ve set up your instance and SSH into it to start installing the necessary dependencies.
Update and upgrade your operating system with the following command:
APT: sudo apt update && sudo apt upgrade -y
YUM: sudo yum update
Next, install the essential packages required for executing tasks like downloading files, compiling, and monitoring the node:
APT: sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential git make ncdu -y
YUM: sudo yum install curl tar wget clang pkg-config libssl-dev jq build-essential git make ncdu -y
Install Golang
The Celestia-app and celestia-node are written in Golang, so it is necessary to install Golang to build and run them.
First, execute the following commands to download and install the desired version of Golang:
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, add the /usr/local/go/bin
directory to $PATH
:
For bash users:
bash: echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
zsh: echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.zshrc
source $HOME/.zshrcFor zsh users:
To verify if Golang has been installed correctly, run:
go version
The output should display the installed version:
go version go1.19.1 linux/amd64
Install celestia-appd
Building the Celestia-Appd Binary
The steps below will create a binary file named celestia-appd
inside the $HOME/go/bin
folder, which will be used later to run the node. Be sure to select the correct network to install the binary for.
Execute the following commands to build the binary:
cd $HOME
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app/
APP_VERSION=v0.11.1
git checkout tags/$APP_VERSION -b $APP_VERSION
make install
To verify if the binary was successfully compiled, run the binary using the— help flag:
celestia-appd --help
You should see a similar output with helpful example commands:
Start celestia-app
Usage:
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.
Configuring Ports for the Validator Node
When interacting with a Celestia node, you may need to open ports on your machine to allow communication between nodes, such as bridge nodes. It is essential that specific ports are accessible. Make sure that your firewall allows connections to the correct ports.
If you run a node on a cloud server, ensure that the ports are open on the server’s firewall. If you run a node at home, ensure that your router allows connections to the correct ports.
For example, validator ports 9090 and 26657 need to be accessible by the bridge, and port 26656 is required to be open to the world for P2P connections
Celestia App Nodes Ports:
Set up the P2P networks
Clone the networks repository and initialize the network with your desired node name and the — chain-id parameter set to “mocha”. Note that the chain-id might change if a new testnet is deployed. Replace the genesis.json file with the one for the mocha network and set the seeds and peers.
cd $HOME
rm -rf networks
git clone https://github.com/celestiaorg/networks.git
celestia-appd init "node-name" --chain-id mocha
cp $HOME/networks/mocha/genesis.json $HOME/.celestia-app/config
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
You can find more peers here.
Configure pruning (optional)
To reduce disk space usage, we recommend setting up pruning with the following configurations. You can modify these settings to fit your pruning preferences.
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
Syncing
By default, a consensus node will sync using block sync. For quicker syncing, you can choose between State sync and Quick sync.
Quick sync (recommended)
To use Quick sync, download the entire data directory from a third-party provider.
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/
State sync
Set up State sync by configuring rpc_servers, trust_height, and trust_hash fields in the $HOME/.celestia-app/config/config.toml file. Make sure to provide at least two different RPC endpoints.
rpc_servers = ""
trust_height = 0
trust_hash = ""
Start the celestia-app
Start your validator node by running the celestia-appd start command. Make sure to check the ports section for information on which ports need to be open on your machine.
celestia-appd start
Recommended: start the validator node 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=$(which 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-app
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.
Set up your wallet
Create an Application CLI Configuration File
First, create an application CLI configuration file by running the following command:
celestia-appd config keyring-backend test
Choose a Wallet Name and Create a Wallet
You can pick any wallet name you prefer. In our example, we use “validator” as the wallet name:
celestia-appd keys add validator --interactive
Make sure to save the mnemonic output, as it is the only way to recover your validator wallet in case you lose it.
Check Your Wallets
To view all your wallets, run the following command:
celestia-appd keys list
Fund Your Wallet
To fund your wallet, use the public Celestia address provided. You can fund the wallet via Discord by sending a message to either the #mocha-faucet or #arabica-faucet channel:
$request celestia1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Wait for a confirmation indicating that the tokens have been successfully sent.
Verify Token Receipt
To check if tokens have arrived successfully to your wallet, run the following commands, replacing the public address with your own:
# With the celestia-appd service running
celestia-appd query bank balances celestia1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Delegate stake to a validator
Create an environment variable for the address and delegate tokens to the celestiavaloper validator.
VALIDATOR_WALLET=<validator-wallet-name>
In order to allocate additional stake to any validator, including your own, you’ll require the validator’s celesvaloperaddress. If you wish to delegate more to your local validator wallet, you can retrieve its celesvaloper address by executing the following command:
celestia-appd keys show $VALIDATOR_WALLET --bech val -a
After entering the wallet passphrase you should see a similar output:
Enter keyring passphrase:
celesvaloper1q3v5cugc8cdpud87u4zwy0a74uxkk6u43cv6hd
To delegate tokens to the celestiavaloper validator, as an example you can run:
celestia-appd tx staking delegate \
celestiavaloper1q3v5cugc8cdpud87u4zwy0a74uxkk6u4q4gx4p 1000000utia \
--from=$VALIDATOR_WALLET --chain-id=mocha
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.
Deploy the Celestia Node (bridge node)
Install Celestia Node
- Install the same dependencies like before as well as the Golang
- Install the celestia-node
cd /data
rm -rf celestia-node
git clone https://github.com/celestiaorg/celestia-node.git
cd celestia-node/
git checkout tags/v0.9.3
make build
sudo make install
make cel-key
Verify that the binary is working and check the version with the celestia version command:
$ celestia version
Semantic version: v0.9.3
Commit: 7f556f06e175267e0dd60b444a68554f592710a0
Build Date: Thu Dec 15 10:19:22 PM UTC 2022
System version: amd64/linux
Golang version: go1.20.2
The following ports are used by Celestia nodes:
Initialize the bridge node
Run the celestia bridge init command with the IP address of thAe core node (the validator you just set up in the previous step).
celestia bridge init --core.ip <ip-address>
Run the bridge node
Start the bridge node by running the celestia bridge start command.
celestia bridge start
Optional, but recommended: start the bridge node with SystemD
Create Celestia Bridge systemd file:
sudo tee <<EOF >/dev/null /etc/systemd/system/celestia-bridge.service
[Unit]
Description=celestia-bridge Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which celestia) bridge 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-bridge.service
Enable and start celestia-bridge daemon:
sudo systemctl enable celestia-bridge
sudo systemctl start celestia-bridge && sudo journalctl -u \
celestia-bridge.service -f
Now, the Celestia bridge node will start syncing headers and storing blocks from celestia-app.
Note: At startup, we can see the multiaddress from Celestia Bridge Node. This is needed for future Light Node connections and communication between Celestia Bridge Nodes
Example:
NODE_IP=<ip-address>
/ip4/$NODE_IP/tcp/2121/p2p/12D3KooWD5wCBJXKQuDjhXFjTFMrZoysGVLtVht5hMoVbSLCbV22
You should be seeing logs coming through of the bridge node syncing.
Set up QGB keys
This step helps get you prepared for when the Quantum Gravity Bridge is enabled. You would still need to go through this step before running a validator to configure an extra key.
evm-address: This flag should contain a 0x EVM address. Here, you can add any Ethereum-based address to this flag. You can also modify it later if you decide to switch addresses.
You can set this value to the above flag as an environment variable:
EVM_ADDRESS=<EVM_ADDRESS>
Remember to add the value for your address in the above environment variable before setting it.
Run a validator node
After completing all the necessary steps, you are now ready to run a validator! In order to create your validator on-chain, follow the instructions below. Keep in mind that these steps are necessary ONLY if you want to participate in the consensus.
Pick a moniker
name of your choice! This is the validator name that will show up on public dashboards and explorers. VALIDATOR_WALLET
must be the same you defined previously. Parameter --min-self-delegation=1000000
defines the amount of tokens that are self delegated from your validator wallet.
Now, connect to the network of your choice.
You have the following option of connecting to list of networks shown below:
Here are the steps to connect your validator to Mocha:
MONIKER="your_moniker"
VALIDATOR_WALLET="validator"
celestia-appd tx staking create-validator \
--amount=1000000utia \
--pubkey=$(celestia-appd tendermint show-validator) \
--moniker=$MONIKER \
--chain-id=mocha \
--commission-rate=0.1 \
--commission-max-rate=0.2 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1000000 \
--from=$VALIDATOR_WALLET \
--evm-address=$EVM_ADDRESS \
--keyring-backend=test
You will be prompted to confirm the transaction:
confirm transaction before signing and broadcasting [y/N]: y
Inputting y should provide an output similar to:
code: 0
codespace: ""
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: <tx-hash>
You should now be able to see your validator from a block explorer like here.
Run the QGB Orchestrator
All validators need to run the QGB orchestrator to sign attestations once the QGB is enabled for Blockspace Race (BSR). Follow the instructions in the docs to run the QGB orchestrator.
Conclusion
You have successfully set up a Celestia Validator Node and can now participate in the network. Remember to keep an eye on your node’s performance and adjust the settings as needed to ensure optimal operation.