July 5, 2024

0g Labs node [Installation guide]

Note: In order to become an active validator, you need to have more ua0gi tokens bonded than the last validator ordered by the tokens bonded (or the validator set to not be full) as well as have at least 1000000ua0gi bonded.

Installation

Use our installation script, specify a name for your node and wait for the installation to complete.

Copy

wget -q -O 0g.sh https://api.nodes.guru/0g.sh && sudo chmod +x 0g.sh && ./0g.sh && source $HOME/.bash_profile

Create a wallet, don’t forget to save the mnemonic:

Copy

0gchaind keys add wallet --eth

If you already have a wallet, you can recover with:

Copy

0gchaind keys add wallet --recover --eth

If you want to get the public address which starts with 0x, you could first run the following command to get your key’s private key. Then import the returned private key to a wallet (Metamask for example) to get the public address.

Copy

0gchaind keys unsafe-export-eth-key wallet

Request tokens at the faucet. After full synchronization, check the balance, if everything is okay, proceed to create a validator.

Copy

0gchaind q bank balances $(0gchaind keys show wallet -a)

You can also check your balance in our explorer.

Create a validator:

Copy

0gchaind tx staking create-validator \  --amount=1000000ua0gi \  --pubkey=$(0gchaind tendermint show-validator) \  --moniker="$VALIDATOR" \  --chain-id="zgtendermint_16600-2" \  --commission-rate="0.10" \  --commission-max-rate="0.20" \  --commission-max-change-rate="0.01" \  --min-self-delegation="1" \  --gas=auto \  --gas-adjustment=1 \  --from=wallet -y

Additional

View logs

Copy

sudo journalctl -u 0g -f

Restart node:

Copy

sudo systemctl restart 0g

Check node status:

Copy

curl localhost:26657/status

Find out if the node is synchronized, if the result is false – it means the node is synchronized

Copy

curl -s localhost:26657/status | jq .result.sync_info.catching_up

Find out your valoper address:

Copy

0gchaind keys show wallet --bech val -a

Delegate tokens (to increase your stake delegate to your valoper address):

Copy

0gchaind tx staking delegate YOUR_VALOPER_ADDRESS 1000000ua0gi --from wallet --chain-id zgtendermint_16600-2 --gas="500000" --gas-prices="50ua0gi"

Remove node:

Copy

sudo systemctl stop 0gsudo systemctl disable 0gsudo rm -rf $(which 0gchaind) $HOME/.0gchain

That's it! Congrats!