May 14, 2023

Installing Celestia nodes, setting up Rollup

Hello, everyone on MMS airwaves!
Today we will cover the installation of all Celestia nodes (Validator, Bridge, Full, Light). We will try to understand the utility of each node, because while "Validator node" is something familiar to the Cosmos ecosystem, as validators exist in every project, it's not so straightforward and unambiguous with Bridge, Full, and Light nodes.
We will also set up our Rollup and local Celestia network, and even write a small text query to it.
All the main information is taken from official sources.

https://docs.celestia.org/
https://rollkit.dev/docs/intro/

https://docs.ignite.com/

System requirements

Validator node

  • Memory: 8 GB RAM
  • CPU: 6 cores
  • Disk: 500 GB SSD Storage
  • Bandwidth: 1 Gbps for Download/1 Gbps for Upload

Light node

  • Memory: 2 GB RAM
  • CPU: Single Core
  • Disk: 25 GB SSD Storage
  • Bandwidth: 56 Kbps for Download/56 Kbps for Upload

Bridge node

  • Memory: 8 GB RAM
  • CPU: 6 cores
  • Disk: 1 TB SSD Storage
  • Bandwidth: 1 Gbps for Download/1 Gbps for Upload

Full node

  • Memory: 8 GB RAM
  • CPU: Quad-Core
  • Disk: 1 TB SSD Storage
  • Bandwidth: 1 Gbps for Download/1 Gbps for Upload

Part 1
Validator node

Let's start with the most familiar - Validator Node, also known as Consensus Full node (just without the validator installation).
In this guide, we use default ports, but if they are occupied, you can use our guide on changing ports.
In general, there are no pitfalls here, everything is the same as in a regular project based on Cosmos.

Let's continue with installing additional packages.

After updating our server, let's install the necessary packages:

sudo apt update && sudo apt upgrade -y

Installing additional packages

sudo apt install make clang git pkg-config libssl-dev build-essential git gcc chrony curl jq ncdu bsdmainutils htop net-tools lsof fail2ban wget -y

Install go and check the version

ver="1.20.2" && \ 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" && \ echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \ source $HOME/.bash_profile && \ go version

Setting variables

CELESTIA_CHAIN="blockspacerace-0" CELESTIA_MONIKER="your_name" CELESTIA_WALLET="your_name"

Add them to .bash_profile

echo 'export CELESTIA_CHAIN='${CELESTIA_CHAIN} >> $HOME/.bash_profile echo 'export CELESTIA_MONIKER='${CELESTIA_MONIKER} >> $HOME/.bash_profile echo 'export CELESTIA_WALLET='${CELESTIA_WALLET} >> $HOME/.bash_profile source $HOME/.bash_profile

Clone the repository and build the binary

cd $HOME/celestia-app/ git clone https://github.com/celestiaorg/celestia-app.git git checkout v0.12.1 make install mv $HOME/go/bin/celestia-appd /usr/local/bin

Initialize the node

celestia-appd init $CELESTIA_MONIKER --chain-id blockspacerace-0

Download genesis.json

wget -O $HOME/.celestia-app/config/genesis.json "https://raw.githubusercontent.com/celestiaorg/networks/master/blockspacerace/genesis.json"

Pruning setup (optional)

pruning="custom" pruning_keep_recent="1000" 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

Setting the gas price

sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.001utia\"/;" ~/.celestia-app/config/app.toml

Adding seeds and peers

peers="be935b5942fd13c739983a53416006c83837a4d2@178.170.47.171:26656,cea09c9ac235a143d4b6a9d1ba5df6902b2bc2bd@95.214.54.28:20656,5c9cfba00df2aaa9f9fe26952e4bf912e3f1e8ee@195.3.221.5:26656,7b2f4cb70f04f2e9befb6ace66ce1ac7b3bea5b4@178.239.197.179:26656,7ee2ba21197d58679cfc1517b5bbc6465bed387a@65.109.67.25:26656,dc0656ab58280d641c8d10311d86627255bec8a1@148.251.85.27:26656,ccbd6262d0324e2e858594b639f4296cc4952c93@13.57.127.89:26656,a507b2bda6d2974c84ae1e8a8b788fc9e44d01f7@142.132.131.184:26656,9768290c60a746ee97ef1a5bcb8bee69066475e8@65.109.80.150:2600" sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.celestia-app/config/config.toml

seeds="0293f2cf7184da95bc6ea6ff31c7e97578b9c7ff@65.109.106.95:26656,8f14ec71e1d712c912c27485a169c2519628cfb6@celest-test-seed.theamsolutions.info:22256" sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" $HOME/.celestia-app/config/config.toml

Create a service file

sudo tee /etc/systemd/system/celestia-appd.service > /dev/null <<EOF [Unit] Description=celestia-appd After=network-online.target

[Service] User=root ExecStart=$(which celestia-appd) start Restart=on-failure RestartSec=3 LimitNOFILE=65535

[Install] WantedBy=multi-user.target EOF

We start and look at the logs

sudo systemctl daemon-reload && \ sudo systemctl enable celestia-appd && \ sudo systemctl restart celestia-appd && \ sudo journalctl -u celestia-appd -f -o cat

Create a wallet or restore

celestia-appd keys add $CELESTIA_WALLET celestia-appd keys add $CELESTIA_WALLET --recover

Add wallet address to variable and export to .bash_profile

CELESTIA_ADDR=$(celestia-appd keys show $CELESTIA_WALLET -a) echo 'export CELESTIA_ADDR='${CELESTIA_ADDR} >> $HOME/.bash_profile source $HOME/.bash_profile

Create a validator
In this testnet, only selected participants are allowed

celestia-appd tx staking create-validator \ --amount 1000000utia \ --from $CELESTIA_WALLET \ --commission-max-change-rate "0.05" \ --commission-max-rate "0.2" \ --commission-rate "0.1" \ --min-self-delegation "1" \ --pubkey $(celestia-appd tendermint show-validator) \ --moniker $CELESTIA_MONIKER \ --chain-id $CELESTIA_CHAIN

We add the address of the validator to the variable and export it to .bash_profile

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

Since the Validator node does not make much sense in this testnet (we are talking about unauthorized users), you can always make a node for RPC / API / GPRC endpoints, now we will show how this can be done
To do this, we need to enable several options in the configs, if they are disabled.
Enable API/GRPC/RPC

sed -i.bak -e "117 s/^enable *=.*/enable = true/" $HOME/.celestia-app/config/app.toml -e "183 s/^enable *=.*/enable = true/" $HOME/.celestia-app/config/app.toml && cat -n $HOME/.celestia-app/config/app.toml | sed -n '117p;183p'

sed -i.bak -e '91 s/127.0.0.1/0.0.0.0/' $HOME/.celestia-app/config/config.toml && cat -n $HOME/.celestia-app/config/config.toml | sed -n '91p'

In order to find out your endpoint, you just need to substitute your server IP to a specific port, the server IP is "32.274.125.73" it will look like this:
I remind you that we do all this on default ports, if you have custom ones, change them to your own

RPC: 32.274.125.73:26657 API: 32.274.125.73:1317 GRPC: 32.274.125.73:9090

Removing Validator node / Consensus Full node

cd $HOME/ rm /usr/local/bin/celestia-appd rm -rf .celestia-app/ rm -rf celestia-app/ rm /etc/systemd/system/celestia-appd.service

Part 2

Bridge/Full/Light nodes

Let's move on to the following types of nodes in Celestia - Light, Bridge, Full
Now we will try to briefly tell you about them.
Light node Light clients sample data availability in the Data Availability network.
Bridge node Bridge blocks between the Data Availability network and the Consensus network.
Fulll node Stores all data in the Data Availability network, but is not connected to Consensus.
Since their installation does not differ much from each other, in this guide we will simply duplicate the commands, and not write a separate section for each.

We download the repository, build a binary for nodes and cel-key to generate keys. After the "make install" command, the binary will be located along the path /usr/local/bin/celestia

cd $HOME/ git clone https://github.com/celestiaorg/celestia-node.git cd celestia-node git checkout tags/v0.9.3 make build make install make cel-key

Initialize

#Light celestia light init --core.ip https://rpc-celestia-testnet.mms.team/ --p2p.network blockspacerace #Bridge celestia bridge init --core.ip https://rpc-celestia-testnet.mms.team/ --p2p.network blockspacerace #Full celestia full init --core.ip https://rpc-celestia-testnet.mms.team/ --p2p.network blockspacerace

Wallets are created during initialization, but if you want to change it / make another one, the command will be below, if you want to restore the wallet by mnemonic, add an additional "--recover" flag to the end of the command

cd celestia-node/ #Light ./cel-key add NAME_HERE --keyring-backend test --node.type light --p2p.network blockspacerace #Bridge ./cel-key add NAME_HERE --keyring-backend test --node.type bridge --p2p.network blockspacerace #Full ./cel-key add NAME_HERE --keyring-backend test --node.type full --p2p.network blockspacerace

Create a service file

#Light sudo tee /etc/systemd/system/celestia-light.service > /dev/null <<EOF [Unit] Description=Celestia light node After=network-online.target [Service] User=root ExecStart=/usr/local/bin/celestia light start --core.ip https://rpc-celestia-testnet.mms.team/ --core.rpc.port 26660 --core.grpc.port 9090 --keyring.accname my_celes_key --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --gateway --gateway.addr localhost --gateway.port 26667 --p2p.network blockspacerace Restart=on-failure RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF

#Bridge sudo tee /etc/systemd/system/celestia-bridge.service > /dev/null <<EOF [Unit] Description=Celestia bridge node After=network-online.target [Service] User=root ExecStart=/usr/local/bin/celestia bridge start --core.ip https://rpc-celestia-testnet.mms.team/ --keyring.accname my_celes_key --core.rpc.port 26657 --core.grpc.port 9090 --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --gateway.port 26659 --p2p.network blockspacerace --gateway --gateway.addr localhost Restart=on-failure RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF

#Full sudo tee /etc/systemd/system/celestia-full.service > /dev/null <<EOF [Unit] Description=Celestia full node After=network-online.target [Service] User=root ExecStart=/usr/local/bin/celestia full start --core.ip https://rpc-celestia-testnet.mms.team/ --keyring.accname my_celes_key --core.rpc.port 26657 --core.grpc.port 9090 --metrics.tls=false --metrics --metrics.endpoint otel.celestia.tools:4318 --gateway.port 26659 --p2p.network blockspacerace --gateway --gateway.addr localhost Restart=on-failure RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF

Sometimes there may be problems with starting due to the RPC node, in this case, you can search for alternative options here and make a change in the service, in the "--core.ip" flag, and then restart the node
Turn on the service file, restart and look at the logs

#Light systemctl daemon-reload && \ systemctl enable celestia-light.service && \ systemctl restart celestia-light.service && \ journalctl -fu celestia-light.service -o cat

#Bridge systemctl daemon-reload && \ systemctl enable celestia-bridge.service && \ systemctl restart celestia-bridge.service && \ journalctl -fu celestia-bridge.service -o cat

#Full systemctl daemon-reload && \ systemctl enable celestia-full.service && \ systemctl restart celestia-full.service && \ journalctl -fu celestia-full.service -o cat

Part 3


Build/Deploy sovereign Rollup using Rollkit / Run local chain
In this part of the guide, we will try to tell you how to rollup and start a local Celestia chain.
spoiler - easier than you think
First, let's set the variables and export them to .bash_profile

BLOCKCHAIN_NAME="NAME_HERE" ADDR_PREFIX="PREFIX_HERE"

echo 'export BLOCKCHAIN_NAME='${BLOCKCHAIN_NAME} >> $HOME/.bash_profile echo 'export ADDR_PREFIX='${ADDR_PREFIX} >> $HOME/.bash_profile source $HOME/.bash_profile

Next, install Docker, a little later we will need it to start the local Celestia chain

curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh

After installing Docker, we start the local chain with a script

docker run --platform linux/amd64 -p 26650:26657 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet:v0.9.1

Check if it works with a regular request

If everything is ok, it will output this response: {"denom":"utia","amount":"999995000000000"}

curl -X GET http://0.0.0.0:26659/balance

After the blockchain is launched, we open a separate session in our terminal and go there
All this can be done through the screen software, but since the guide for this Rollup is not very long, we will do without it, if you are more comfortable working with screen, everything is in your hands ;)

Let's now deal with such a thing as the Ignite CLI:
Ignite CLI is an easy-to-use CLI tool for creating and maintaining application-specific sovereign blockchains. Blockchains built with the Ignite CLI use the Cosmos SDK and Tendermint.

If you want to get to know this software better, welcome here

Next we need to install the Ignite CLI

curl https://get.ignite.com/cli! | bash

We check that everything is OK, and at the same time the version

ignite version

Next, we set the name of our blockchain and the address prefix

Next, we will show some part with screenshots, so that there are no questions

cd $HOME ignite scaffold chain $BLOCKCHAIN_NAME --address-prefix $ADDR_PREFIX

To further understand what we are doing, we need to tell you what Rollkit is, as usual concisely, if you are interested - read here
Rollkit - is a framework for Rollup that gives developers the freedom to deploy rollups across the entire modular stack, opening up new opportunities for rapid experimentation and innovation.


Next, go to the newly created directory

In our case, this is mms-team

cd $BLOCKCHAIN_NAME

Now we need to replace various Tendermint modules with Rollkit

go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.46.7-rollkit-v0.7.3-no-fraud-proofs go mod edit -replace github.com/tendermint/tendermint=github.com/celestiaorg/tendermint@v0.34.22-0.20221202214355-3605c597500d go mod tidy go mod download

Downloading the script that will launch our blockchain

wget https://raw.githubusercontent.com/rollkit/docs/main/docs/scripts/gm/init-local.sh

Add variables and export to .bash_profile

Let's add a little explanation DENOM - this is the name of your coin BIN_FILE - this is the name of your binary file, which will be generated during the script, to find out the name of your binary file, you just need to add the letter "d" to your BLOCKCHAIN_NAME, in our case it will be mms -teamd

VALIDATOR_NAME=YOUR_VAL_NAME_HERE CHAIN_ID=YOUR_CHAIN_ID_HERE KEY_NAME=YOUR_WALLET_NAME_HERE KEY_2_NAME=YOUR_SECOND_WALLET_NAME_HERE DENOM=YOUR_DENOM_HERE BIN_FILE=YOUR_BLOCKCHAIN_NAMEd

echo 'export VALIDATOR_NAME='${VALIDATOR_NAME} >> $HOME/.bash_profile echo 'export CHAIN_ID='${CHAIN_ID} >> $HOME/.bash_profile echo 'export KEY_NAME='${KEY_NAME} >> $HOME/.bash_profile echo 'export KEY_2_NAME='${KEY_2_NAME} >> $HOME/.bash_profile echo 'export DENOM='${DENOM} >> $HOME/.bash_profile echo 'export BIN_FILE='${BIN_FILE} >> $HOME/.bash_profile source $HOME/.bash_profile

Editing it for our variables

sed -i.bak -e "s/^VALIDATOR_NAME*=.*/VALIDATOR_NAME=$VALIDATOR_NAME/" $HOME/mms-team/init-local.sh sed -i.bak -e "s/^CHAIN_ID*=.*/CHAIN_ID=$CHAIN_ID/" $HOME/mms-team/init-local.sh sed -i.bak -e "s/^KEY_NAME*=.*/KEY_NAME=$KEY_NAME/" $HOME/mms-team/init-local.sh sed -i.bak -e "s/^KEY_2_NAME*=.*/KEY_2_NAME=$KEY_2_NAME/" $HOME/mms-team/init-local.sh sed -i.bak -e "9,10 s/stake/$DENOM/" $HOME/mms-team/init-local.sh sed -i.bak -e "s/^gmd/$BIN_FILE/" $HOME/mms-team/init-local.sh

Run the script

bash init-local.sh

It will end in an error, but we have generated our working directory and now we can completely change our den, in a ready-made genesis

Who fumbles - yes, crutches will not hurt anyone :)

Our new working directory will be named the same as our BLOCKCHAIN_NAME, except that it will start with a dot ".mms-team/"


Add a variable for convenience and export to .bash_profile

WORK_DIRECTORY=.$BLOCKCHAIN_NAME

echo 'export WORK_DIRECTORY='${WORK_DIRECTORY} >> $HOME/.bash_profile source $HOME/.bash_profile

With the command we change denom "stake", to the desired

sed -i.bak -e "s/stake/$DENOM/" $HOME/$WORK_DIRECTORY/config/genesis.json

Next, run the script again

bash init-local.sh

During the execution of the script, some errors will occur, the script will also ask us about performing some actions, everywhere we answer "n"

Voila, we launched our own blockchain, with our own variables\

In order not to invent anything with service files or with screen, we go to a separate terminal session
Now your personal Rollup is at your disposal, on the local Celestia chain
You can do whatever you want, test different things that you were afraid of before in various dunets / testnets / mainnets, everything works exactly the same as in the most ordinary spacefork
Just, for example, let's see what kind of wallets we have, make sure that the prefix that we set has really changed, and also see the balance and the list of validators

#Watching wallets
$BIN_FILE keys list --keyring-backend test

#We look at the balance of one of the wallets $BIN_FILE q bank balances YOUR_ADDR_HERE

#We look at the active set of our blockchain $BIN_FILE q staking validators -o json --limit=1000 \ | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \ | jq -r '.tokens + " - " + .description.moniker' \ | sort -gr | nl

In general, here, you can make all your wildest fantasies come true.
Stopping the local Celestia chain and stopping our Rollup
Next, we need to stop the networks that we launched, for this we go to the tab with our Rollup and press the key combination "ctrl + c", after which it will stop
Stopping and Removing the Celestia Local Chain Container and Stopping Rollup
To stop the Rollup that we launched, for this we go to the tab with our Rollup and press the key combination "ctrl + c", after which it will stop

Checking active containers with the command

docker ps -a

It will look like this:

In the "Container ID" column, respectively, we see our container id, copy it. To stop and remove it, write the following commands:

docker stop YOUR_CONTAINER_ID && \ docker rm YOUR_CONTAINER_ID

Part 3.1

Phrase output

Now that we have learned how to run our blockchain and the local Celestia chain, we will make it so that an additional command is added to our binary file, with the output of some text
We will also launch
First we need to launch Celestia Light node, the installation process is described in Part 2


Create a query, answer "y" to a question from Ignite

cd $HOME/$BLOCKCHAIN_NAME/ ignite scaffold query $BLOCKCHAIN_NAME --response text

Further, in order not to produce even more variables, which are already enough, I will simply indicate where, what and how to change, with examples, in order to get to the desired file
We follow this path, it will be a little different for you, as well as the final file name, in fact, the name of your blockchain will be everywhere here. Our path looks like this:

nano x/mmsteam/keeper/query_mms_team.go For those who don't know, double tapping the "tab" button shows you what's in the directory, in this case it becomes much easier to search, use

nano x/YOUR_CATALOG/keeper/query_YOUR_FILENAME.go

When you have opened the desired file, there we need to add our text, at the very bottom
We add this text in curly braces (you will have them empty), everything in quotes, you can safely change at your discretion, we will write:
Text: "Join us https://t.me/mmsnodes Peace to all'

Text: "YOUR_TEXT_HERE"

Save changes
We are downloading a new script to launch Rollup, only this time we will no longer launch the local Celestia chain, we will communicate with the real test chain using the LIght Node, the installation of which we described above

wget https://raw.githubusercontent.com/rollkit/docs/main/docs/scripts/gm/init-testnet.sh

Modifying the script for our variables

sed -i.bak -e "s/^VALIDATOR_NAME*=.*/VALIDATOR_NAME=$VALIDATOR_NAME/" $HOME/mms-team/init-testnet.sh sed -i.bak -e "s/^CHAIN_ID*=.*/CHAIN_ID=$CHAIN_ID/" $HOME/mms-team/init-testnet.sh sed -i.bak -e "s/^KEY_NAME*=.*/KEY_NAME=$KEY_NAME/" $HOME/mms-team/init-testnet.sh sed -i.bak -e "s/stake/$DENOM/" $HOME/mms-team/init-testnet.sh sed -i.bak -e "s/^gmd/$BIN_FILE/" $HOME/mms-team/init-testnet.sh

Delete the previous binary and working directory

rm -r $HOME/go/bin/$BIN_FILE && \ rm -rf $HOME/$WORK_DIRECTORY

We go to our directory, from where we build the binary and run our converted script

cd $HOME/$BLOCKCHAIN_NAME && \ bash init-testnet.sh

Again we get the "denom" error, like last time, we change our genesis

sed -i.bak -e "s/stake/$DENOM/" $HOME/$WORK_DIRECTORY/config/genesis.json

Run the script again and answer "n" everywhere

bash init-testnet.sh

We observe a successfully launched blockchain, using Rollkit, but this time with access to the Internet, and not via a local network

And so, we have very little left, it remains to compose and give the last command that we created

Our command looks like this $BIN_FILE q mmsteam mms-team Let's explain, for each word in the command BIN_FILE - a variable with a binary file q - a standard space module for requests mmsteam - our created text request module mms-team - the request itself

$BIN_FILE q YOUR_QUERY_MODULE YOUR_QUERY

We learned how to create our own blockchain (Rollup), using the Ignite and Rollkit utilities, based on Celestia, we learned how to launch a local blockchain, as well as create our own, albeit simple (you have to start somewhere), modules for your blockchain.

Thank you very much for your attention and time
Our telegram channel on nodes - https://t.me/mmsnodes
Our telegram chat by nodes - https://t.me/mmsnodeschat
Our telegram channel on the Cosmos ecosystem - https://t.me/cosmochannel_mms

Sincerely, MMS_Team