# Celestia Testnet - Mocha

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

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

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

> ## Set node configuration
>
> celestia-appd config chain-id mocha\
> celestia-appd config keyring-backend test<br>
>
> ## 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 <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
```

#### Fund a wallet <a href="#id-2-fund-a-wallet" id="id-2-fund-a-wallet"></a>

To create validator you have to fund the previously created wallet via [Discord](https://discord.gg/celestiacommunity) 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 <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 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 <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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://meganodes-validator.gitbook.io/mega-node-validator/getting-started/celestia-testnet-mocha.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
