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 26657EVM_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
both geth and node containers are required to run a fullnode or validator
Initialize node container
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
this will create a fresh $DAEMON_HOME/config/priv_validator_state.json
, $DAEMON_HOME/config/node_key.json
and $DAEMON_HOME/data/priv_validator_key.json
. if you already have these files, you should import them by manually editing these files. otherwise, take a backup of them before proceeding.
to import your previous key files, for example the 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
Exit the container using Ctrl+D
Initialize geth container
docker compose --profile node run --rm --entrypoint /bin/bash geth
now we are inside the geth container, run the init script.
/init.sh
Exit the container using Ctrl+D
Run Node containers
you can now run node services in the background
docker compose --profile node up -d
then check logs
docker compose --profile node logs -f --tail 100 node
docker compose --profile node logs -f --tail 100 geth
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, 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
in V3 creating a validator requires at least 32 tokens and it's not straightforward at all. fortunately, there is an amazing detailed guide by one of 0G community members. check it at AstroStake just note that, whenever you need to access the 0gchaind binary, you can use the ephemeral containers as explained above.