> For the complete documentation index, see [llms.txt](https://meganodes-validator.gitbook.io/mega-node-validator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://meganodes-validator.gitbook.io/mega-node-validator/getting-started/celestia-mainet.md).

# Celestia Mainet

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

#### Install dependencies <a href="#install-dependencies" id="install-dependencies"></a>

**Update system and install build tools**

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

**Install Go**

```
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)
```

#### Download and build binaries <a href="#download-and-build-binaries" id="download-and-build-binaries"></a>

```
# 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

# 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

# Create application symlinks
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
```

```
Create service
sudo tee /etc/systemd/system/celestia.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.service
```

#### Initialize the node <a href="#initialize-the-node" id="initialize-the-node"></a>

```
# Set node configuration
celestia-appd config chain-id celestia
celestia-appd config keyring-backend file

# Initialize the node
celestia-appd init $MONIKER --chain-id celestia

# Add seeds
sed -i -e "s|^seeds *=.*|seeds = \"400f3d9e30b69e78a7fb891f60d76fa3c73f0ecc@celestia.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 custom ports
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:12058\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:12057\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:12060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:12056\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":12066\"%" $HOME/.celestia-app/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:12017\"%; s%^address = \":8080\"%address = \":12080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:12090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:12091\"%; s%:8545%:12045%; s%:8546%:12046%; s%:6065%:12065%" $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
```

```
sudo systemctl start celestia.service && sudo journalctl -u celestia.service -f --no-hostname -o cat
```

## Set up validator <a href="#set-up-validator" id="set-up-validator"></a>

Official documentation: [https://docs.celestia.org/nodes/validator-node](https://docs.celestia.org/nodes/validator-node/)

#### 1. Create a wallet <a href="#id-1-create-a-wallet" id="id-1-create-a-wallet"></a>

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
```

#### 2. Top up wallet with tokens <a href="#id-2-top-up-wallet-with-tokens" id="id-2-top-up-wallet-with-tokens"></a>

You can buy tokens at [app.osmosis.zone](https://app.osmosis.zone/)

To check wallet balance use command below

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

#### 3. Create validator <a href="#id-3-create-validator" id="id-3-create-validator"></a>

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 celestia \
--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
```

Save the \~/.celestia-app/config/priv\_validator\_key.json file as this is the only way to recover your validator signing key in case you lose it!

## Install Bridge Node <a href="#install-bridge-node" id="install-bridge-node"></a>

Official documentation: [https://docs.celestia.org/nodes/bridge-node](https://docs.celestia.org/nodes/bridge-node/)

#### Download and build binaries <a href="#download-and-build-binaries-1" id="download-and-build-binaries-1"></a>

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

#### Add Bridge wallet <a href="#add-bridge-wallet" id="add-bridge-wallet"></a>

**Generate new wallet**

```
cel-key add bridge-wallet --node.type bridge --p2p.network celestia
```

**Recover existing wallet**

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

#### Fund the wallet with testnet tokens <a href="#fund-the-wallet-with-testnet-tokens" id="fund-the-wallet-with-testnet-tokens"></a>

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 <a href="#initialize-bridge-node" id="initialize-bridge-node"></a>

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

#### Create service <a href="#create-service" id="create-service"></a>

```
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 celestia \\
--rpc.port 12058 \\
--gateway.port 12059 \\
--metrics.tls=true \\
--metrics \\
--metrics.endpoint otel.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 <a href="#start-bridge-node" id="start-bridge-node"></a>

```
systemctl restart celestia-bridge.service
```

#### Check Bridge node logs <a href="#check-bridge-node-logs" id="check-bridge-node-logs"></a>

```
journalctl -fu celestia-bridge.service -o cat
```

### Useful commands <a href="#useful-commands" id="useful-commands"></a>

#### Get Bridge Node ID <a href="#get-bridge-node-id" id="get-bridge-node-id"></a>

```
AUTH_TOKEN=$(celestia bridge auth admin --p2p.network celestia)
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 <a href="#get-bridge-node-key" id="get-bridge-node-key"></a>

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

#### Check Bridge node wallet balance <a href="#check-bridge-node-wallet-balance" id="check-bridge-node-wallet-balance"></a>

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

## Upgrade Bridge Node <a href="#upgrade-bridge-node" id="upgrade-bridge-node"></a>

#### Stop Bridge node <a href="#stop-bridge-node" id="stop-bridge-node"></a>

```
sudo systemctl stop celestia-bridge.service
```

#### Download and build binaries <a href="#download-and-build-binaries-2" id="download-and-build-binaries-2"></a>

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

#### Check Bridge node version <a href="#check-bridge-node-version" id="check-bridge-node-version"></a>

```
celestia version
```

#### Node upgrade <a href="#node-upgrade" id="node-upgrade"></a>

To upgrade Celestia Bridge node you have two options

**Option 1 - Soft upgrade**

This option will only update attributes of configuration files without deleting any data.

Update configuration file

```
celestia bridge config-update --p2p.network celestia
```

**Option 2 - Hard upgrade**

This option will clear data store and re-initialize the node. Keys will not be deleted.

Clear data store and remove configuration file

```
celestia bridge unsafe-reset-store --p2p.network celestia
rm -rf $HOME/.celestia-bridge-celestia/config.toml
```

Initialize Bridge node

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

#### Start Bridge node <a href="#start-bridge-node-1" id="start-bridge-node-1"></a>

```
sudo systemctl start celestia-bridge.service
```

#### Check Bridge node logs <a href="#check-bridge-node-logs-1" id="check-bridge-node-logs-1"></a>

```
journalctl -fu celestia-bridge.service -o cat
```

<br>
