How to become a validator?

Hardware requirements:

Node
CPU
RAM
Storage
Type

Validator

8 cores

16 GB

500 GB

Minimum

Validator

8 cores

32GB

upto 2 TB

Recommended

Build Tools

sudo apt-get update
sudo apt-get install -y make gcc

Install Go

  • Download the latest version of go Lang for Linux from here.

  • We are using version 1.19.3 for this tutorial.

curl -OL https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xvf go1.19.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin

Install Binaries

  • The following commands will install the gaia binaries onto your system.

  • You can always check for the latest version of gaia from here.

  • For this tutorial we are using the 7.1.0 version of gaia.

https://github.com/cosmos/gaia.git
git reset --hard 5db8fcc9a229730f5115bed82d0f85b6db7184b4
cd gaia && make install

Join the public testnet

  • For this tutorial we are configuring our node to run on the theta-testnet-001.

  • When you are ready you can join the mainnet from here.

Configuration and setup

  • The following commands will configure our node files in order to join the testnet.

  • For up to date values on joining the testnet you can always visit the testnet repository.

cd gaia
make install
gaiad init <custom_moniker>

wget https://github.com/hyphacoop/testnets/raw/add-theta-testnet/v7-theta/public-testnet/genesis.json.gz
gzip -d genesis.json.gz
mv genesis.json $HOME/.gaia/config/genesis.json

cd $HOME/.gaia/config
sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.001uatom"/' app.toml
sed -i 's/seeds = ""/seeds = "639d50339d7045436c756a042906b9a69970913f@seed-01.theta-testnet.polypore.xyz:26656,3e506472683ceb7ed75c1578d092c79785c27857@seed-02.theta-testnet.polypore.xyz:26656"

State Sync

  • State sync is a endpoint provider which serves the snapshots at every 1000 blocks.

  • Using state sync enables us to quickly sync our node to the latest block height.

cd $HOME/.gaia/config
sed -i 's/enable = false/enable = true/' config.toml
sed -i 's/trust_height = 0/trust_height = <LATEST_BLOCK_HEIGHT - 1000>/' config.toml
sed -i 's/trust_hash = ""/trust_hash = "<LATEST_BLOCK_HASH - 1000>"/' config.toml
sed -i 's/rpc_servers = ""/rpc_servers = "rpc.sentry-01.theta-testnet.polypore.xyz:26657,rpc.sentry-02.theta-testnet.polypore.xyz:26657"/' config.toml

Start the node in the background

  • Once we are done configuring our files. We can start running our node which can sync to the latest blockheight.

  • To start the node as a service. Perform the following steps.

cd /home/ubuntu/ && sudo nano cosmos.service
[Unit]
Description=service file to run gaia
After=network.target

[Service]
ExecStart=/home/ubuntu/go/bin/gaiad start --x-crisis-skip-assert-invariants
Restart=on-failure
RestartSec=10
Type=simple
User=ubuntu
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target

Enable and start the node as a service

sudo systemctl enable cosmos.service
sudo systemctl start cosmos.service

Check logs

journalctl -fu cosmos.service

Check sync status

curl http://localhost:26657/status | grep "catching_up"
  • If the above command returns false. This means your node is synced to the latest block height.

  • Now, you can run the command to become a validator.

You cannot perform any transaction on the cosmos blockchain if your node is not synced to the latest block height.

Become a validator

Note: You need to have a full node running and synced before you become a validator.

Setting up gaiad

  • In this tutorial we are running our own node, so we will configure tcp://localhost:26657 for our validator.

  • Paste the following command

gaiad config node tcp://localhost:26657
gaiad config chain-id theta-testnet-001

Generate a key to sign blocks

  • The following command will generate a key file which will be used to sign blocks onto the cosmos blockchain

cd /home/ubuntu/.gaia
gaiad keys add <Name_For_Your_Key>

Note: A mnemonic seed phase will be generated when you create a key. We can then use this seed phase to import our account into keplr wallet.

Import account into Keplr Wallet

Prerequisites:

Steps to import your account

  1. Open the keplr wallet chrome extension.

  2. Click on add account.

  3. Select import existing account.

  4. Enter the seed phase that was generated in the previous step.

  5. Done, you have now successfully imported you account into the keplr wallet.

Create a validator

We need to keep the following things in mind before sending a transaction for becoming a validator:

  • We need to stake at least 1 atom.

  • Before sending the transaction the full node we are using should be synced to the latest block height.

  • Once create-validator transaction is sent, we cannot withdraw atoms for next 21 days. This is also referred to as lock up period.

gaiad tx staking create-validator \
  --amount=1000000uatom \
  --pubkey=$(gaiad tendermint show-validator) \
  --moniker="choose a moniker" \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1000000" \
  --fees=25000uatom \
  --from=<key_name>

Check validator signing info

gaiad query slashing signing-info $(gaiad tendermint show-validator)\
  --chain-id=theta-testnet-001

Theta Testnet: https://testnet.cosmos.bigdipper.live/

Cosmoshub-4 Mainnet: https://cosmos.bigdipper.live/

Last updated