Fullnode & Validator
Learn how to run your 0G-ZeroGravity Node or Validator with Cosmovisor support out of the box
Prerequisites
You have completed Getting Started with ZeroGravity
Set environment variables
open .env
file with your editor
nano .env
edit variables under 0G Node Config
section. set your desired variables.
MONIKER
A name for your node, will be public to othersWALLET_NAME
can be any name, stored locallySEEDS
address of seed nodesPERSISTENT_PEERS
comma separated list of persistent peersWALLET_NAME
can be any name, stored locallyEXTERNAL_IP
your server public IP addressP2P_PORT
set a valid, non-busy port - default is 26656RPC_PORT
set a valid, non-busy port - default is 26657API_JSON_RPC_PORT
EVM RPC public port. set a valid, non-busy port - default is 8545LCD_PORT
API port. set a valid, non-busy port - default is 1317
Initialize network
run and exec into an ephemeral container:
docker compose --profile node run --rm --entrypoint /bin/bash node
now we are inside the container, run the init script.
this will download genesis files and set required configs for this container to work
/init.sh
if you want to modify config files further edit the config manually
nano $HOME/.0gchain/config/config.toml
then create a new wallet or import one
0gchaind keys add $WALLET_NAME --recover --eth
to import your previous node_key.json or other files you can either :
- use
docker cp
command in another terminal to copy your files - or manually edit files using
nano
and replace the content of your keys with your backups
Now exit the container using Ctrl+D
Run Node container
and run node service in background
docker compose --profile node up -d
then check logs
docker compose --profile node logs -f --tail 100
Run commands inside the node container
to run any commands using 0gchaind
, just exec into running node container
docker compose --profile node exec node bash
then run any commands you want normally, like 0gchaind status
.
when you are done, exit the container using ctrl+D
0gchaind
binary to run some commands like
creating a wallet or query the blockchain, you can use ephemeral containers (they live as long as you are inside them, then will get removed)docker compose --profile node run --rm --entrypoint /bin/bash node
Become Validator
to become validator, first make sure your node is fully synced. first enter the container by running:
docker compose --profile node exec node bash
check sync status
0gchaind status | jq
get your wallet EVM address
echo "0x$(0gchaind debug addr $(0gchaind keys show $WALLET_NAME -a) | grep hex | awk '{print $3}')"
use this address on faucet website.
create validator, replace <staking_amount>
with your desired amount. e.g. 10ua0gi
0gchaind tx staking create-validator \
--amount=<staking_amount>ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker="$MONIKER" \
--chain-id=zgtendermint_16600-2 \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--from=$WALLET_NAME \
--gas=auto \
--gas-adjustment=1.4