Skip to content

Latest commit

 

History

History
 
 

cosmos

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Join our telegram Join our discord Visit our website

Deploy your VPS using our referral link to get 20€ bonus

Deploy your VPS using our referral link to get 100$ free bonus for 60 days

Deploy your VPS using our referral link to get 100$ free bonus

gaia node setup for testnet — cosmoshub-4

Official documentation:

Explorer:

Usefull tools and references

To set up monitoring for your validator node navigate to Set up monitoring and alerting for gaia validator

To migrate your validator to another machine read Migrate your validator to another machine

Hardware Requirements

Like any Cosmos-SDK chain, the hardware requirements are pretty modest.

Minimum Hardware Requirements

  • 4x CPUs; the faster clock speed the better
  • 8GB RAM
  • 100GB of storage (SSD or NVME)
  • Permanent Internet connection (traffic will be minimal during testnet; 10Mbps will be plenty - for production at least 100Mbps is expected)

Recommended Hardware Requirements

  • 4x CPUs; the faster clock speed the better
  • 32GB RAM
  • 200GB of storage (SSD or NVME)
  • Permanent Internet connection (traffic will be minimal during testnet; 10Mbps will be plenty - for production at least 100Mbps is expected)

Set up your gaia fullnode

Option 1 (automatic)

You can setup your gaia fullnode in few minutes by using automated script below. It will prompt you to input your validator node name!

wget -O gaia.sh https://raw.githubusercontent.com/kj89/testnet_manuals/main/gaia/gaia.sh && chmod +x gaia.sh && ./gaia.sh

Option 2 (manual)

You can follow manual guide if you better prefer setting up node manually

Post installation

When installation is finished please load variables into system

source $HOME/.bash_profile

Next you have to make sure your validator is syncing blocks. You can use command below to check synchronization status

gaiad status 2>&1 | jq .SyncInfo

(OPTIONAL) Disable and cleanup indexing

indexer="null"
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.gaia/config/config.toml
sudo systemctl restart gaiad
sleep 3
sudo rm -rf $HOME/.gaia/data/tx_index.db

Create wallet

To create new wallet you can use command below. Don’t forget to save the mnemonic

gaiad keys add $WALLET

(OPTIONAL) To recover your wallet using seed phrase

gaiad keys add $WALLET --recover

To get current list of wallets

gaiad keys list

Save wallet info

Add wallet and valoper address into variables

COSMOS_WALLET_ADDRESS=$(gaiad keys show $WALLET -a)
COSMOS_VALOPER_ADDRESS=$(gaiad keys show $WALLET --bech val -a)
echo 'export COSMOS_WALLET_ADDRESS='${COSMOS_WALLET_ADDRESS} >> $HOME/.bash_profile
echo 'export COSMOS_VALOPER_ADDRESS='${COSMOS_VALOPER_ADDRESS} >> $HOME/.bash_profile
source $HOME/.bash_profile

Fund your wallet

In order to create validator first you need to fund your wallet with testnet tokens. To top up your wallet join gaia discord server and navigate to:

  • #faucet to request test tokens

To request a faucet grant:

$request <YOUR_WALLET_ADDRESS>

Create validator

Before creating validator please make sure that you have at least 1 gaiax (1 gaiax is equal to 1000000 uatom) and your node is synchronized

To check your wallet balance:

gaiad query bank balances $COSMOS_WALLET_ADDRESS

If your wallet does not show any balance than probably your node is still syncing. Please wait until it finish to synchronize and then continue

To create your validator run command below

gaiad tx staking create-validator \
  --amount 10000000uatom \
  --from $WALLET \
  --commission-max-change-rate "0.01" \
  --commission-max-rate "0.2" \
  --commission-rate "0.07" \
  --min-self-delegation "1" \
  --pubkey  $(gaiad tendermint show-validator) \
  --moniker $NODENAME \
  --chain-id $COSMOS_CHAIN_ID

Operations with liquid stake

Add liquid stake

Liquid stake your ATOM on gaia for stATOM. Here's an example of how to liquid stake

gaiad tx stakeibc liquid-stake 1000 uatom --from $WALLET --chain-id $COSMOS_CHAIN_ID

Note: if you liquid stake 1000 uatom, you might only get 990 (could be more or less) stATOM in return! This is due to the way our exchange rate works. Your 990 stATOM are still worth 1000 uatom (or more, as you accrue staking rewards!)

Redeem stake

After accruing some staking rewards, you can unstake your tokens. Currently, the unbonding period on our Gaia (Cosmos Hub) testnet is around 30 minutes.

gaiad tx stakeibc redeem-stake 999 GAIA <cosmos_address_you_want_to_redeem_to> --chain-id $COSMOS_CHAIN_ID --from $WALLET

Check if tokens are claimable

If you'd like to see whether your tokens are ready to be claimed, look for your UserRedemptionRecord keyed by <your_COSMOS_account>.

gaiad q records list-user-redemption-record --output json | jq --arg WALLET_ADDRESS "$COSMOS_WALLET_ADDRESS" '.UserRedemptionRecord | map(select(.sender == $WALLET_ADDRESS))'

If your record has the attribute isClaimable=true, they're ready to be claimed!

Claim tokens

After your tokens have unbonded, they can be claimed by triggering the claim process.

gaiad tx stakeibc claim-undelegated-tokens GAIA 5 --chain-id $COSMOS_CHAIN_ID --from $WALLET

Note: this function triggers claims in a FIFO queue, meaning if your claim is 20th in line, you'll have process other claims before seeing your tokens appear in your account.

Security

To protect you keys please make sure you follow basic security rules

Set up ssh keys for authentication

Good tutorial on how to set up ssh keys for authentication to your server can be found here

Basic Firewall security

Start by checking the status of ufw.

sudo ufw status

Sets the default to allow outgoing connections, deny all incoming except ssh and 26656. Limit SSH login attempts

sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow ${COSMOS_PORT}656,${COSMOS_PORT}660/tcp
sudo ufw enable

Monitoring

To monitor and get alerted about your validator health status you can use my guide on Set up monitoring and alerting for gaia validator

Calculate synchronization time

This script will help you to estimate how much time it will take to fully synchronize your node
It measures average blocks per minute that are being synchronized for period of 5 minutes and then gives you results

wget -O synctime.py https://raw.githubusercontent.com/kj89/testnet_manuals/main/gaia/tools/synctime.py && python3 ./synctime.py

Check your validator key

[[ $(gaiad q staking validator $COSMOS_VALOPER_ADDRESS -oj | jq -r .consensus_pubkey.key) = $(gaiad status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\n\e[1m\e[32mTrue\e[0m\n" || echo -e "\n\e[1m\e[31mFalse\e[0m\n"

Get list of validators

gaiad q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl

Get currently connected peer list with ids

curl -sS http://localhost:${COSMOS_PORT}657/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'

Usefull commands

Service management

Check logs

journalctl -fu gaiad -o cat

Start service

sudo systemctl start gaiad

Stop service

sudo systemctl stop gaiad

Restart service

sudo systemctl restart gaiad

Node info

Synchronization info

gaiad status 2>&1 | jq .SyncInfo

Validator info

gaiad status 2>&1 | jq .ValidatorInfo

Node info

gaiad status 2>&1 | jq .NodeInfo

Show node id

gaiad tendermint show-node-id

Wallet operations

List of wallets

gaiad keys list

Recover wallet

gaiad keys add $WALLET --recover

Delete wallet

gaiad keys delete $WALLET

Get wallet balance

gaiad query bank balances $COSMOS_WALLET_ADDRESS

Transfer funds

gaiad tx bank send $COSMOS_WALLET_ADDRESS <TO_COSMOS_WALLET_ADDRESS> 10000000uatom

Voting

gaiad tx gov vote 1 yes --from $WALLET --chain-id=$COSMOS_CHAIN_ID

Staking, Delegation and Rewards

Delegate stake

gaiad tx staking delegate $COSMOS_VALOPER_ADDRESS 10000000uatom --from=$WALLET --chain-id=$COSMOS_CHAIN_ID --gas=auto

Redelegate stake from validator to another validator

gaiad tx staking redelegate <srcValidatorAddress> <destValidatorAddress> 10000000uatom --from=$WALLET --chain-id=$COSMOS_CHAIN_ID --gas=auto

Withdraw all rewards

gaiad tx distribution withdraw-all-rewards --from=$WALLET --chain-id=$COSMOS_CHAIN_ID --gas=auto

Withdraw rewards with commision

gaiad tx distribution withdraw-rewards $COSMOS_VALOPER_ADDRESS --from=$WALLET --commission --chain-id=$COSMOS_CHAIN_ID

Validator management

Edit validator

gaiad tx staking edit-validator \
  --moniker=$NODENAME \
  --identity=<your_keybase_id> \
  --website="<your_website>" \
  --details="<your_validator_description>" \
  --chain-id=$COSMOS_CHAIN_ID \
  --from=$WALLET

Unjail validator

gaiad tx slashing unjail \
  --broadcast-mode=block \
  --from=$WALLET \
  --chain-id=$COSMOS_CHAIN_ID \
  --gas=auto

Delete node

This commands will completely remove node from server. Use at your own risk!

sudo systemctl stop gaiad
sudo systemctl disable gaiad
sudo rm /etc/systemd/system/gaia* -rf
sudo rm $(which gaiad) -rf
sudo rm $HOME/.gaia* -rf
sudo rm $HOME/gaia -rf
sed -i '/COSMOS_/d' ~/.bash_profile