December 25, 2022

Node Celestia + Celestia Light Node

Celestia — первая модульная Blockchain-сеть консенсуса и данных, созданная для того, чтобы каждый мог легко развернуть свой собственный блокчейн с минимальными расходами

Upgrade to mocha

sudo systemctl stop celestia-appd

# set necessary vars
CHAIN_ID="mocha"
NODE_MONIKER=$(cat "$HOME/.celestia-app/config/config.toml" | grep moniker | grep -oP 'moniker = "\K[^"]+')

# backup priv_validator_key.json from mamaki (optional)
cp $HOME/.celestia-app/config/priv_validator_key.json $HOME/priv_validator_key.json.backup

# remove mamaki testnet data
rm -rf $HOME/.celestia-app
rm -rf $HOME/celestia-app
rm -rf networks
sudo rm "$(which celestia-appd)"

# install mocha testnet
cd $HOME || return
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app || return
git checkout v0.11.0
make install
celestia-appd version # 0.11.0

celestia-appd config keyring-backend test
celestia-appd config chain-id $CHAIN_ID
celestia-appd init "$NODE_MONIKER" --chain-id $CHAIN_ID

curl -s https://raw.githubusercontent.com/celestiaorg/networks/master/mocha/genesis.json > $HOME/.celestia-app/config/genesis.json
sha256sum $HOME/.celestia-app/config/genesis.json # 05ef265e16f37d1f5aa2ec884be3782c38d71e59a6d57957235c5ca433aa8e05

sed -i 's|^minimum-gas-prices *=.*|minimum-gas-prices = "0.0001utia"|g' $HOME/.celestia-app/config/app.toml

seeds=$(curl -sL https://raw.githubusercontent.com/celestiaorg/networks/master/mocha/seeds.txt | tr -d '\n')
peers=$(curl -sL https://raw.githubusercontent.com/celestiaorg/networks/master/mocha/peers.txt | tr -d '\n')
sed -i -e 's|^seeds *=.*|seeds = "'$seeds'"|; s|^persistent_peers *=.*|persistent_peers = "'$peers'"|' $HOME/.celestia-app/config/config.toml

# in case of pruning
sed -i 's|pruning = "default"|pruning = "custom"|g' $HOME/.celestia-app/config/app.toml
sed -i 's|pruning-keep-recent = "0"|pruning-keep-recent = "100"|g' $HOME/.celestia-app/config/app.toml
sed -i 's|pruning-interval = "0"|pruning-interval = "17"|g' $HOME/.celestia-app/config/app.toml

# restore priv_validator_key.json from mamaki (optional)
cp $HOME/priv_validator_key.json.backup $HOME/.celestia-app/config/priv_validator_key.json

sudo systemctl restart celestia-appd
sudo journalctl -u celestia-appd -f --no-hostname -o cat

Руководство пользователя

Системные требования:

CPU 4 cores
RAM 8 GB
SSD 250 GB
OS: Ubuntu 20.04

Обновляем сервер

sudo apt update
sudo apt install -y curl git jq lz4 build-essential unzip
if [ ! -f "/usr/local/go/bin/go" ]; then
  bash <(curl -s "https://raw.githubusercontent.com/nodejumper-org/cosmos-scripts/master/utils/go_install.sh")
  source .bash_profile
fi

Установка и настройка ноды

Вписываем свое имя

NODE_MONIKER="YOUR_NODE_MONIKER"

Установка ноды

cd $HOME || return
rm -rf celestia-app
git clone https://github.com/celestiaorg/celestia-app.git
cd celestia-app || return
git checkout v0.6.0
make install
celestia-appd version

Настройка ноды

celestia-appd config keyring-backend test
celestia-appd config chain-id mocha
celestia-appd init $NODE_MONIKER --chain-id mocha
curl -s https://raw.githubusercontent.com/celestiaorg/networks/master/mamaki/genesis.json > $HOME/.celestia-app/config/genesis.json
sha256sum $HOME/.celestia-app/config/genesis.json
sed -i 's|^minimum-gas-prices *=.*|minimum-gas-prices = "0.0001utia"|g' $HOME/.celestia-app/config/app.toml
peers=$(curl -sL https://raw.githubusercontent.com/celestiaorg/networks/master/mamaki/peers.txt | tr -d '\n')
bootstrap_peers=$(curl -sL https://raw.githubusercontent.com/celestiaorg/networks/master/mamaki/bootstrap-peers.txt | tr -d '\n')
sed -i.bak -e 's|^bootstrap-peers *=.*|bootstrap-peers = "'"$bootstrap_peers"'"|; s|^persistent_peers *=.*|persistent_peers = "'$peers'"|' $HOME/.celestia-app/config/config.toml
sed -i 's|pruning = "default"|pruning = "custom"|g' $HOME/.celestia-app/config/app.toml
sed -i 's|pruning-keep-recent = "0"|pruning-keep-recent = "100"|g' $HOME/.celestia-app/config/app.toml
sed -i 's|pruning-interval = "0"|pruning-interval = "17"|g' $HOME/.celestia-app/config/app.toml
indexer="null" && \ 
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.celestia-app/config/config.toml
sudo tee /etc/systemd/system/celestia-appd.service > /dev/null << EOF
[Unit]
Description=Celestia Validator Node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which celestia-appd) start
Restart=on-failure
RestartSec=10
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
EOF
celestia-appd tendermint unsafe-reset-all --home $HOME/.celestia-app --keep-addr-book
cd "$HOME/.celestia-app" || return
rm -rf data
SNAP_NAME=$(curl -s https://snapshots3-testnet.nodejumper.io/celestia-testnet/ | egrep -o ">mamaki.*\.tar.lz4" | tr -d ">")
curl https://snapshots3-testnet.nodejumper.io/celestia-testnet/${SNAP_NAME} | lz4 -dc - | tar -xf - -C $HOME/.celestia-app

Запускаем ноду

sudo systemctl daemon-reload
sudo systemctl enable celestia-appd
sudo systemctl restart celestia-appd

Проверяем логи

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

Ждем пока синхронизируется нода

curl -s localhost:26657/status

После того как увидите "catching_up": false нода синхронизировалась и можно приступать к созданию кошелька

Создаем кошелек !!! Не забываем сохранить мнемоник !!! так же попросит ввести пароль для доступа к кошельку СОХРАНЯЕМ или ЗАПОМИНАЕМ

celestia-appd keys add wallet

Запрашиваем токены в дискордев ветке "faucet" и проверяем баланс

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

Создаем ORCHESTRATOR кошелек. Не забываем сохранить мнемоник !!!

celestia-appd keys add orchestrator

Создаем eth кошелек в метамаске. И приступаем к созданию валидатора

После синхронизации создаем валидатор. Вместо YOUR_VALIDATOR_MONIKER вводим имя ноды. Вместо YOUR_ETH_ADDRESS вводим eth кошелек, YOUR_ORCHESTRATOR_ADDRESS адрес ORCHESTRATOR, которые создавали ранее

celestia-appd tx staking create-validator \
--amount=1000000utia \
--pubkey=$(celestia-appd tendermint show-validator) \
--moniker="YOUR_VALIDATOR_MONIKER" \
--chain-id=mocha \
--commission-rate=0.1 \
--commission-max-rate=0.2 \
--commission-max-change-rate=0.05 \
--min-self-delegation=1 \
--from=wallet \
--evm-address="YOUR_ETH_ADDRESS" \
--orchestrator-address="YOUR_ORCHESTRATOR_ADDRESS" \
--gas=auto \
--gas-adjustment=1.5 \
--fees=1500utia \
-y

Теперь как делегировать средства на валидатор: ( вместо значений в скобках [ ] вставляем свои данные (скобки тоже убираем), или переменные если задали)

celestia-appd tx staking delegate [VALOPER_ADDRESS] [STAKE_AMOUNT]utia --from wallet --chain-id mocha --fees 500utia 

Проверить своего валидатора

celestia-appd q staking validator $(celestia-appd keys show wallet --bech val -a)

Сохранить свою ноду

После успешного создания валидатора, вы должны забэкапить priv_validator_key.json. Без него вы не сможете восстановить валидатора. Он находится в папке .celestia-app/config

Гайд на Light Node

sudo apt update && sudo apt upgrade -y
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 $HOMEwget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"sudo rm -rf /usr/local/gosudo 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_profilesource $HOME/.bash_profile

To check if Go was installed correctly run:

go version

The output should be the version installed:

  • Ubuntu (AMD)
  • Ubuntu (ARM)
  • Mac (Apple)
  • Mac (Intel)
go version go1.19.1 linux/amd64

Install Celestia node

  • Arabica
  • Mocha
  • Ubuntu (AMD)
  • Ubuntu (ARM)
  • Mac (Apple)
  • Mac (Intel)

Installing celestia-node for Arabica Devnet means installing a specific version to be compatible with the network.

Install the celestia-node binary by running the following commands:

cd $HOMErm -rf celestia-nodegit clone https://github.com/celestiaorg/celestia-node.gitcd celestia-node/git checkout tags/v0.6.1make installmake cel-key

Verify that the binary is working and check the version with the celestia version command:

celestia versionSemantic version: v0.6.1Commit: 3a58679ed84da966d01173f32780134c7b830594Build Date: Thu Dec 15 10:19:22 PM UTC 2022System version: amd64/linuxGolang version: go1.19.1

Initialize the light node

Run the following command:

  • Arabica
  • Mocha
celestia light init --p2p.network arabica

You should see output like:

$ celestia light init --p2p.network arabica2022-12-19T21:45:00.802Z        INFO    node    nodebuilder/init.go:19  Initializing Light Node Store over '/root/.celestia-light-arabica-2'2022-12-19T21:45:00.803Z        INFO    node    nodebuilder/init.go:50  Saving config   {"path": "/root/.celestia-light-arabica-2/config.toml"}2022-12-19T21:45:00.803Z        INFO    node    nodebuilder/init.go:51  Node Store initialized

Start the light node

Start the light node with a connection to a validator node's gRPC endpoint (which is usually exposed on port 9090):

NOTE: In order for access to the ability to get/submit state-related information, such as the ability to submit PayForData transactions, or query for the node's account balance, a gRPC endpoint of a validator (core) node must be passed as directed below. For gateway, the default IP Address is localhost and the default port is 26659.
  • Arabica
  • Mocha
celestia light start --core.ip <ip-address> --core.grpc.port <port> --gateway --gateway.addr <ip-address> --gateway.port <port> --p2p.network arabica

For ports:

NOTE: The --core.ip gRPC port defaults to 9090, so if you do not specify it in the command line, it will default to that port. You can add the port after the IP address or use the --core.grpc.port flag to specify another port if you prefer.
  • Arabica
  • Mocha

If you need a list of RPC endpoints to connect to, you can check from the list here

For example, your command might look something like this:

celestia light start --core.ip https://limani.celestia-devops.dev --core.grpc.port 9090 --gateway --gateway.addr 0.0.0.0 --gateway.port 26659 --p2p.network arabica

Keys and wallets

You can create your key for your node by running the following command with the cel-key utility:

./cel-key add <key_name> --keyring-backend test --node.type light

You can start your light node with the key created above by running the following command:

  • Arabica
  • Mocha
celestia light start --keyring.accname <key_name> --core.ip <ip-address> --core.grpc.port <port> --gateway --gateway.addr <ip-address> --gateway.port <port> --p2p.network arabica

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

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

./cel-key list --node.type light --keyring-backend test

You have two networks to get testnet tokens from:

NOTE: If you are running a light node for your sovereign rollup, it is highly recommended to request Arabica devnet tokens as Arabica has the latest changes that can be used to test for developing your sovereign rollup. You can still use Mocha Testnet as well, it is just used for Validator operations.

You can request funds to your wallet address using the following command in Discord:

$request <Wallet-Address>

Where <Wallet-Address> is the celestia1****** address generated when you created the wallet.

Optional: run the light node with a custom key

In order to run a light node using a custom key:

  1. The custom key must exist inside the celestia light node directory at the correct path (default: ~/.celestia-light/keys/keyring-test)
  2. The name of the custom key must be passed upon start, like so:
  • Arabica
  • Mocha
celestia light start --core.ip <ip-address> --core.grpc.port <port> --keyring.accname <name_of_custom_key> --gateway --gateway.addr <ip-address> --gateway.port <port> --p2p.network arabica