We recommend the following hardware specifications:
sudo apt updatesudo apt install curl git make jq build-essential gcc unzip wget lz4 aria2 -y
cd $HOME && \ver="1.22.0" && \wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \sudo rm -rf /usr/local/go && \sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \rm "go$ver.linux-amd64.tar.gz" && \[ ! -f ~/.bash_profile ] && touch ~/.bash_profile && \echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.bash_profile && \source ~/.bash_profile && \go version
cd $HOMErm -rf 0g-chaingit clone https://github.com/0glabs/0g-chain.gitcd 0g-chaingit checkout v0.4.0git submodule update --initmake install0gchaind version
echo "export WALLET='josephtran'" >> $HOME/.bash_profileecho "export MONIKER='JosephTran'" >> $HOME/.bash_profileecho "export OG_CHAIN_ID='zgtendermint_16600-2'" >> $HOME/.bash_profileecho "export OG_PORT='26'" >> $HOME/.bash_profilesource $HOME/.bash_profile
0gchaind config keyring-backend os0gchaind config chain-id $OG_CHAIN_ID0gchaind init $MONIKER --chain-id $OG_CHAIN_ID0gchaind config node tcp://localhost:${OG_PORT}657
rm ~/.0gchain/config/genesis.jsonwget -P ~/.0gchain/config https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json
sed -i -e "s%:1317%:${OG_PORT}317%g;s%:8080%:${OG_PORT}080%g;s%:9090%:${OG_PORT}090%g;s%:9091%:${OG_PORT}091%g;s%:8545%:${OG_PORT}545%g;s%:8546%:${OG_PORT}546%g;s%:6065%:${OG_PORT}065%g" $HOME/.0gchain/config/app.toml
sed -i -e "s%:26658%:${OG_PORT}658%g;s%:26657%:${OG_PORT}657%g;s%:6060%:${OG_PORT}060%g;s%:26656%:${OG_PORT}656%g;s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${OG_PORT}656\"%;s%:26660%:${OG_PORT}660%g" $HOME/.0gchain/config/config.toml
SEEDS="81987895a11f6689ada254c6b57932ab7ed909b6@54.241.167.190:26656,010fb4de28667725a4fef26cdc7f9452cc34b16d@54.176.175.48:26656,e9b4bc203197b62cc7e6a80a64742e752f4210d5@54.193.250.204:26656,68b9145889e7576b652ca68d985826abd46ad660@18.166.164.232:26656,8f21742ea5487da6e0697ba7d7b36961d3599567@og-testnet-seed.itrocket.net:47656"PEERS="90490155eb1e28a00cb9000657ef53cf9822e9e2@185.245.182.248:12656,6d0e4af8b817dbb81266d6c6710033896f1d65cb@158.220.103.216:12656,881b2297ac90fdf6803136101c1b33eeb52a0bcc@213.199.37.74:12656,2de20431412255201b960a0713c3a3f6fdbeb7e7@173.249.19.219:12656,9b6346424a9b1357bae659a51dbbb8d1c4d1366f@173.249.58.134:12656,055e3e65fd72102f389372564e0107e3ee5022fa@167.86.95.218:12656,0ada3d654c01607d585793943b37335a97a56691@213.239.195.210:12656,3f4ee55632cbd8694c7e5d173f10d7d7b23a5ec1@138.201.185.45:12656,2d780e7cae16cf25dfb992e294d5f672ae8a65ac@185.190.140.189:12656,85eec3750270e50ea73c46b1caa72e7110fa7b1b@156.67.81.129:12656,d619b3c8a0cc49b52ce68b45d8ebe2b9060a3f0a@149.50.111.193:12656,6ea4a3942152a33a50c54cc60aa311fd43cc71d7@144.91.93.99:12656,d7c847d92cf2714d3018cecd6476b6ef86b4240b@66.94.113.206:12656,85f1a5c5e62bbe59d9764453bf4624dc261a53f7@38.242.237.56:12656,1754dac0846c42ebe21fe1935eda0311d567d6a9@45.14.194.144:12656,7e49c7c5d8cf1a4f79d3a2c4a2c3597d144e638e@156.67.81.135:12656,80fa309afab4a35323018ac70a40a446d3ae9caf@og-testnet-peer.itrocket.net:11656"sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \ -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.0gchain/config/config.toml
PEERS=$(curl -s -X POST https://0gchain.josephtran.xyz -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"net_info","params":[],"id":1}' | jq -r '.result.peers[] | select(.connection_status.SendMonitor.Active == true) | "\(.node_info.id)@\(if .node_info.listen_addr | contains("0.0.0.0") then .remote_ip + ":" + (.node_info.listen_addr | sub("tcp://0.0.0.0:"; "")) else .node_info.listen_addr | sub("tcp://"; "") end)"' | tr '\n' ',' | sed 's/,$//' | awk '{print "\"" $0 "\""}') sed -i "s/^persistent_peers *=.*/persistent_peers = $PEERS/" "$HOME/.0gchain/config/config.toml" if [ $? -eq 0 ]; then echo -e "Configuration file updated successfully with new peers"else echo "Failed to update configuration file."fi
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchain/config/app.tomlsed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchain/config/app.tomlsed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.0gchain/config/app.toml
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.00025ua0gi"|g' $HOME/.0gchain/config/app.tomlsed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchain/config/config.tomlsed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml
sudo tee /etc/systemd/system/0gd.service > /dev/null <<EOF[Unit]Description=0G NodeAfter=network.target[Service]User=$USERType=simpleExecStart=$(which 0gchaind) start --home $HOME/.0gchainRestart=on-failureLimitNOFILE=65535[Install]WantedBy=multi-user.targetEOF
sudo systemctl daemon-reload && \sudo systemctl enable 0gd
cp ~/.0gchain/data/priv_validator_state.json ~/.0gchain/priv_validator_state.json.backup && \0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain --keep-addr-book
#install toolssudo apt-get install wget lz4 aria2 pv -y#download snapshotcd $HOMErm -f light_0gchain_snapshot.lz4aria2c -x 16 -s 16 -k 1M https://josephtran.co/light_0gchain_snapshot.lz4
#decompress snapshotlz4 -dc light_0gchain_snapshot.lz4 | pv | tar -xf - -C $HOME/.0gchain
cp ~/.0gchain/priv_validator_state.json.backup ~/.0gchain/data/priv_validator_state.json
sudo systemctl start 0gd && sudo systemctl status 0gd
Check log
tail -f ~/.0gchain/log/chain.log
0gchaind status | jq '{ latest_block_height: .sync_info.latest_block_height, catching_up: .sync_info.catching_up }'
while true; do local_height=$(0gchaind status | jq -r .sync_info.latest_block_height); network_height=$(curl -s https://0gchain.josephtran.xyz/status | jq -r '.result.sync_info.latest_block_height') blocks_left=$((network_height - local_height)); echo -e "\033[1;38mYour node height:\033[0m \033[1;34m$local_height\033[0m | \033[1;35mNetwork height:\033[0m \033[1;36m$network_height\033[0m | \033[1;29mBlocks left:\033[0m \033[1;31m$blocks_left\033[0m"; sleep 5;done
0gchaind keys add "wallet_name" --eth
0gchaind keys add "wallet_name" --eth --recover
0gchaind keys unsafe-export-eth-key "wallet_name"
0gchaind q bank balances $(0gchaind keys show "wallet_name" -a)
0gchaind tx staking create-validator \ --amount=100ua0gi \ --pubkey=$(0gchaind tendermint show-validator) \ --moniker="Your_node_name" \ --chain-id=zgtendermint_16600-2 \ --commission-rate="0.10" \ --commission-max-rate="0.20" \ --commission-max-change-rate="0.01" \ --details="0G to the moon" \ --min-self-delegation="1" \ --from="wallet_name" \ --gas=auto \ --gas-adjustment=1.4 \ --gas-prices 0.00252ua0gi \ -y
0gchaind q staking validator $(0gchaind keys show "wallet_name" --bech val -a)
0gchaind tx staking delegate $(0gchaind keys show "your_wallet" --bech val -a) 1000000ua0gi \--from "your_wallet" \--chain-id=zgtendermint_16600-2 \--gas=auto \--gas-adjustment=1.4 \--gas-prices 0.00252ua0gi \-y
cd $HOMEsudo systemctl stop 0gdsudo systemctl disable 0gdsudo rm /etc/systemd/system/0gd.servicesudo systemctl daemon-reloadsudo rm -f $(which 0gchaind)sudo rm -rf $HOME/.0gchainsudo rm -rf $HOME/0g-chain