본문 바로가기
Blockchain/Eng

Run a 0G Validator Node

by GrayChoi 2024. 4. 11.
반응형

This is a 0G Labs project, not OG,

which means ZeroGravity

 

0G Labs has raised $35M in a pre-seed round

with the participation of Animoca, OKX Ventures, and other investors

 

In this installment, we'll run a validator node.

 

 

System Requirements

CPU: 4 cores

Memory: 8GB RAM

Disk: 500GB NVMe SSD

Bandwidth: 100mbps

 

 

 


 

 

1. Prepare your VPS

 

We'll be using Contabo VPS

Click above image and go to the contabo

 

Select VPS2 and 400 or 600GB SSD

+ Ubuntu 22.04

 

Wondering how to initially set up and connect to your VPS?

(But it's Korean version only. use translator)

[기초] VPS 구매, 접속하기

[기초] VPS ssh 접속하기 with Termius

 

2. Install required packages

sudo apt update

 

sudo apt install curl git jq build-essential gcc unzip wget lz4 -y

It takes a little while for the installation to complete.

 

3. Install Go

wget https://go.dev/dl/go1.22.2.linux-amd64.tar.gz

 

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz

 

echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile

source $HOME/.bash_profile

go version

rm -rf go1.22.2.linux-amd64.tar.gz

 

4. Install evmosd via CLI

git clone -b testnet https://github.com/0glabs/0g-evmos.git

 

./0g-evmos/networks/testnet/install.sh

 

source .profile

 

5. Set Chain ID

evmosd config chain-id zgtendermint_9000-1

 

6. Initialize Node

// replace <your_validator_name> with the name you want to use
evmosd init <your_validator_name> --chain-id zgtendermint_9000-1

Remove the <your_validator_name> part and replace it with the name you want to use,

referring to the first line in the photo above

 

 

7. Copy the Genesis File

rm .evmosd/config/genesis.json

wget -P ~/.evmosd/config https://github.com/0glabs/0g-evmos/releases/download/v1.0.0-testnet/genesis.json

 

evmosd validate-genesis

 

8. Edit Seeds

nano .evmosd/config/config.toml

seeds = "8c01665f88896bca44e8902a30e4278bed08033f@54.241.167.190:26656,b288e8b37f4b0dbd9a03e8ce926cd9c801aacf27@54.176.175.48:26656,8e20e8e88d504e67c7a3a58c2ea31d965aa2a890@54.193.250.204:26656,e50ac888b35175bfd4f999697bdeb5b7b52bfc06@54.215.187.94:26656"

Scroll down and you'll see P2P, which is where the seeds are.
Change the existing seeds to the ones shown above.

When you're done,
press Ctrl + x, Y, Enter to save.

 

9. Snapshot Download

wget https://rpc-zero-gravity-testnet.trusted-point.com/latest_snapshot.tar.lz4

 

cp $HOME/.evmosd/data/priv_validator_state.json $HOME/.evmosd/priv_validator_state.json.backup

evmosd tendermint unsafe-reset-all --home $HOME/.evmosd --keep-addr-book

lz4 -d -c ./latest_snapshot.tar.lz4 | tar -xf - -C $HOME/.evmosd

mv $HOME/.evmosd/priv_validator_state.json.backup $HOME/.evmosd/data/priv_validator_state.json

 

10. Start Testnet

apt install screen

screen -S 0g

When you start a node, you can't use other windows,

so we use screen to manage them separately.

 

 

evmosd start

If you see a screen like the one above, and the block is going up nicely, you've succeeded.
You can exit the screen by pressing Ctrl + a + d.

 

*If an error occurs

If you get an error like the one above

 

rm -rf .evmosd 0g-evmos

After entering the above command
Go back to step 4 of this post and start from the beginning again.

 

11. Create wallet

// <key_name> replace with the name you created above
evmosd keys add <key_name>

After typing 'Enter keyring passphrase (attempt 1/3):'

in the you can enter the password you want to use.


After entering it, you can enter the same password in the next 'Re-enter keyring passphrase'.

 

Once you've set your password, you'll see your wallet address, public key, and seed phrase.

Be sure to save them separately.

 

12. Add to Metamask

// <key_name> replace with the name you created above
evmosd keys unsafe-export-eth-key <key_name>

After entering the above command
and add it to the metamask using the private key that appears.

 

Under Import account, paste your private key and click Import
After importing, you'll need to add the 0G testnet network

 

Open Metamask - Three top right dots - Settings - Network - Add network

 

Click Add network directly

0G Testnet 정보

Network name: 0g Newton Testnet

New RPC URL: https://rpc-testnet.0g.ai

Chain ID: 9000

Currency symbol: A0GI

Block explorer URL: https://scan-testnet.0g.ai/

 

 

13. Get a testnet token from Faucet

https://faucet.0g.ai/

Go to the site above and claim 0G testnet token

with the metamask address you just added using your private key.

 

0.1 should come in

 

14. Create Validator

You can proceed from the above steps after the block synchronization is complete.

evmosd status | jq .SyncInfo

Left) Before block synchronization, Right) After block synchronization

You can check block synchronization with the above command, and you should see that
catching_up should be false as shown in the picture on the right.
You can check the current block height on your VPS with "latest_block_height".
If it is synchronized, proceed to the next step.

Or

screen -r 0g

After reconnecting to the screen using the above command, check that the block height and the
0G testnet's latest block height before proceeding.

 

http://dashboard-0g.trusted-point.com/

 

You can check the latest block heights on the above site and
In the picture above, you can see that it's 679,523
It takes quite a while to synchronize the latest block, so take your time

We used a snapshot, so the synchoronization will be done quickly

 

// Replace <your_validator_name> and <key_name> with the names you used above.
evmosd tx staking create-validator \
  --amount=80000000000000000aevmos \
  --pubkey=$(evmosd tendermint show-validator) \
  --moniker="<your_validator_name>" \
  --chain-id=zgtendermint_9000-1 \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1000000" \
  --gas="5000000" \
  --gas-prices="30aevmos" \
  --from=<key_name>

Replace the <your_validator_name> part of line 4 and
the <key_name> part of the last line with the name you used above.
Hit enter, and then enter your password.

 

Enter y

In the above, note the validator address under pubkey
We'll need it later to check the validator registration in Discord

 

If the txhash pops up without any errors, you're done

 

15. Check Validator

https://explorer.validatorvn.com/OG-Testnet/staking

Go to the above site and go to Inactive
If you search for your registered name, you'll see it as shown above.

 

Or 0G discord connection - after get a Testnet Validator role
node-status channel, you can check the status by typing "!val validator address".

This is how to run the Validator Node.
Next time, I will post how to run a Storage Node.

 

 

Please credit the source when reposting.

 


 

 

Node outsourcing and other inquiries

graychoi0920@gmail.com


 

NodeGray Telegram Announcement Channel

 

노드그레이

그레이의 50가지 노드 그림자

t.me

 

NodeGray Telegram Chat Channel

 

노드그레이 채팅방

공지방 : https://t.me/nodegray

t.me

 

 

반응형

댓글