0G-Chain
0G The First Modular AI Chain, Build with infinitely scalable programmable DA layer for AI Dapps. Build with the latest Web3 modular infrastructure and the most advanced tools to unlock the full potential of Web3. Leverage our state-of-the-art Data Availability and storage solution today.
website : 0G-Chain
Task : Validator
Status : Ongoing
Validator installation
Requirement
Hardware
CPU : 4 Core
Memory : 16 GB
Disk : 1 TB NVME SSD
Installation
## Install Go
cd $HOME
VERSION=1.21.3
wget -O go.tar.gz https://go.dev/dl/go$VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go.tar.gz && rm go.tar.gz
echo 'export GOROOT=/usr/local/go' >> $HOME/.bash_profile
echo 'export GOPATH=$HOME/go' >> $HOME/.bash_profile
echo 'export GO111MODULE=on' >> $HOME/.bash_profile
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && . $HOME/.bash_profile
go version
#install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
#install binary
rm -rf $HOME/.0gchain
git clone -b v0.1.0 https://github.com/0glabs/0g-chain.git
cd $HOME/0g-chain
make build
chmod +x $HOME/0g-chain/out/linux/0gchaind
mv $HOME/0g-chain/out/linux/0gchaind $HOME/go/bin
#init
0gchaind init <your_validator_name> --chain-id zgtendermint_16600-1
#Download Genesis File
wget -O $HOME/.0gchain/config/genesis.json https://raw.githubusercontent.com/Idekubaguscom/testnet/main/0g-chain/genesis.json
#Update Peers
peers=b44ff9e9eb4792bc233147dbe43f1709ad77ce43@80.65.211.223:26656,255360200854a97c65d8c1f2d7154c5dd5e54eb5@65.108.68.214:14256,feb0cc40a3009a16a62bb843c000974565107c4c@128.140.65.68:26656b2dcd3248fc4104b37568d98495466b4a2074672@65.109.145.247:1020,89189bb79a36e051abacce5f2bc1a0e6382a5a5b@185.193.67.160:26656,2e2643b638496a5b948a1ecce0d79bdc9bcf64a6@91.105.131.140:26656,258861e4032177e6f0328aa7e2e38b0298510d6c@84.247.188.240:26656,f3c912cf5653e51ee94aaad0589a3d176d31a19d@157.90.0.102:31656,535ddcc917ab5ee6ddd2259875dac6018651da24@176.9.183.45:32656,a6076b5d78b9b37fd3488af51f2b9dcc6978f9e8@185.11.251.182:47656,6b72d01e9d09d00beac1a004281cfc10833019fe@38.242.138.151:26656,59fe20be127ea2431fcf004af16f101a62269b93@38.242.144.121:266562384a34d3bd0631eb299f1d48fd3b28f3bf05c13@84.247.179.51:26656,549cb67ff1eebbea462adb4fcafcd7e4e95008f5@107.172.211.152:26656,0a0b54852a271923277b03366a1f0a1dacbcd464@109.199.102.47:26656,38ae510d30cb048caf99cf87108ec21317a4063f@82.67.49.126:26656,710f94642675d82190d43d272a77dfeb1daaf940@5.9.61.237:19656,9a6a47bd79b3a1bdb27b8df0e6f2218968d56f67@158.220.88.106:26656,7a81280d611e4f67ac631347aaea5cdfbcede5b4@62.171.154.181:16656,a25dadd5cb8feb5ad88ea39ededce5e81f90c87b@5.75.253.119:26656,45cb154a020fff3f5583d0eda2499d78ea44aea7@213.199.44.68:26656,b4bb8314c40e943f1744b5cffa61e83cfbdc6391@84.247.171.3:26656
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.0gchain/config/config.toml
# create service file
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0gchain node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which 0gchaind) start --home $HOME/.0gchain
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
#start service
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind
sudo systemctl restart 0gchaind && sudo journalctl -u 0gchaind -fo cat
Create Wallet
##Create new wallet
0gchaind keys add yourwalletname --eth
##Recovery old wallet
0gchaind keys add yourwalletname --eth --recover
Faucet
You can Request faucet here
Registering as a Validator
#check your validator status
0gchaind status 2>&1 | jq
##or you can use this
curl localhost:26657/status | jq
#make sure your node is sysnced to the latest height "catching_up: false"
####create validator
0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker="yourvalidatorname" \
--identity "your keybase.io" \
--details "Pro-stakers" \
--website "https://porto.idekubagus.com" \
--chain-id=zgtendermint_16600-1 \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--from=yourwalletname \
--gas=auto \
--gas-adjustment=1.4
Delete Node
sudo systemctl stop 0gchaind
sudo systemctl disable 0gchaind
sudo rm -rf /etc/systemd/system/0gchaind.service
sudo rm $(which 0gchaind)
sudo rm -rf $HOME/.0gchain
Cheatsheet
#Unjail validator
0gchaind tx slashing unjail --from yourwalletname --chain-id zgtendermint_16600-1 --gas 500000 --gas-prices 99999ua0gi -y
#validator aktif
0gchaind q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl
#validator inaktif
0gchaind q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl
# Delegation to validator
0gchaind tx staking delegate $(0gchaind keys show yourwalletname --bech val -a) 1000000ua0gi --from yourwalletname --chain-id zgtendermint_16600-1 -y
#check balance
0gchaind q bank balances $(0gchaind keys show yourwalletname -a)
#send tokens
0gchaind tx bank send from-wallet to-wallet 900000ua0gi --from from-wallet --chain-id zgtendermint_16600-1 --gas 500000 --gas-prices auto -y
#convert wallet to 0x
echo "0x$(0gchaind debug addr $(0gchaind keys show yourwalletname -a) | grep hex | awk '{print $3}')"
Last updated