Skip to content

xhinis/0g-Newton-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

0G

0G Image


Community Links


💻 System Requirements

Components Minimum Requirements
CPU 4 Cores
RAM 8+ GB
Storage 400 GB SSD

☀️ Required Installations

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip clang cmake -y

☀️ Go Installation

cd $HOME
VER="1.22.3"
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:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin

☀️ Download Necessary Files

wget https://zgchaind-test.s3.ap-east-1.amazonaws.com/0gchaind-linux-v0.3.0
chmod +x ./0gchaind-linux-v0.3.0
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin
sudo cp -r ./0gchaind-linux-v0.3.0 /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin/0gchaind
mkdir -p $HOME/.0gchain/cosmovisor/genesis/bin
mv /root/0gchaind-linux-v0.3.0 $HOME/.0gchain/cosmovisor/genesis/bin/0gchaind
wget https://github.com/0glabs/0g-chain/releases/download/v0.3.1.alpha.1/0gchaind-linux-v0.3.1.alpha.1
chmod +x ./0gchaind-linux-v0.3.1.alpha.1
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin
sudo mv ./0gchaind-linux-v0.3.1.alpha.1 /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin/0gchaind

☀️ System Linking

sudo ln -s $HOME/.0gchain/cosmovisor/genesis $HOME/.0gchain/cosmovisor/current -f
sudo ln -s $HOME/.0gchain/cosmovisor/current/bin/0gchaind /usr/local/bin/0gchaind -f

☀️ Install Cosmovisor

go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]

☀️ Create a Service

sudo tee /etc/systemd/system/0gchaind.service > /dev/null << EOF
[Unit]
Description=0gchaind Node Service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --json-rpc.api eth,txpool,personal,net,debug,web3
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.0gchain"
Environment="DAEMON_NAME=0gchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.0gchain/cosmovisor/current/bin"

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind.service

☀️ Node Configuration

0gchaind config chain-id zgtendermint_16600-2
0gchaind config keyring-backend os
0gchaind config node tcp://localhost:56657

☀️ Initialize the Node

NOTE: Replace NODE-NAME with your desired node name.

0gchaind init NODE-NAME --chain-id zgtendermint_16600-2

☀️ Update Genesis and Addrbook

rm ~/.0gchain/config/genesis.json
curl -Ls https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json > $HOME/.0gchain/config/genesis.json

☀️ Add Seed Nodes

PEERS="80fa309afab4a35323018ac70a40a446d3ae9caf@og-testnet-peer.itrocket.net:11656,...(other peers)..."
SEEDS="[email protected]:26656,...(other seeds)..."
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml

☀️ Set Gas and Pruning

sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.0gchain/config/app.toml
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0ua0gi"|g' $HOME/.0gchain/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchain/config/config.toml

☀️ Indexer Configuration

NOTE: If you're setting up a storage node, you might not want to set this to null.

sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml

☀️ Set Ports

echo "export G_PORT="56"" >> $HOME/.bash_profile
source $HOME/.bash_profile
sed -i.bak -e "s%:1317%:${G_PORT}317%g; s%:8080%:${G_PORT}080%g; s%:9090%:${G_PORT}090%g; ..." $HOME/.0gchain/config/app.toml
sed -i.bak -e "s%:26658%:${G_PORT}658%g; s%:26657%:${G_PORT}657%g; ..." $HOME/.0gchain/config/config.toml

☀️ Snap Installation

🚨🚨🚨 Don’t forget to back up your priv_validator_key.json file located inside the config folder. 🚨🚨🚨

NOTE: If you want to use your own RPC on your storage node you have to use snapshot start from blockheight 0

screen -S 0g
sudo systemctl stop 0gchaind
0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain --keep-addr-book
cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json.backup
curl -L https://vps5.josephtran.xyz/0g/0gchain_snapshot.lz4 | sudo lz4 -dc - | sudo tar -xf - -C $HOME/.0gchain
mv $HOME/.0gchain/priv_validator_state.json.backup $HOME/.0gchain/data/priv_validator_state.json

☀️ Start the Node

sudo systemctl daemon-reload
sudo systemctl restart 0gchaind

☀️ View Logs

sudo journalctl -u 0gchaind.service -f --no-hostname -o cat

☀️ Check Blocks

while true; do    local_height=$(0gchaind status | jq -r .sync_info.latest_block_height);    network_height=$(curl -s https://cs-rpc-0g.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

☀️ Create a Wallet

0gchaind keys add wallet

☀️ Recover Existing Wallet

0gchaind keys add wallet --recover

☀️ Save Wallet Info

0gchaind keys show wallet -a
0gchaind keys show wallet --pubkey

☀️ Faucet

NOTE: Add your wallet to metamask from your seed phrases and use your wallet starting with 0x


☀️ Validator Creation

NOTE: Replace <WALLET_NAME> with your wallet name and <MONIKER> with your desired moniker.

0gchaind tx staking create-validator --amount 1000000ua0gi --from <WALLET_NAME> --commission-max-change-rate "0.05" --commission-max-rate "0.10" --commission-rate "0.05" --min-self-delegation "1" --pubkey $(0gchaind tendermint show-validator) --moniker "<MONIKER>" --chain-id zgtendermint_16600-2 --fees 20000ua0gi

☀️ View Validator Details

0gchaind q staking validator $(0gchaind keys show wallet --bech val -a)

☀️ Check Sync Status

0gchaind status 2>&1 | jq .SyncInfo

☀️ View Wallet Balances

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

☀️ Withdraw Rewards

0gchaind tx distribution withdraw-all-rewards --from wallet --chain-id zgtendermint_16600-2 --fees 5000ua0gi

☀️ Withdraw Rewards and Commission

0gchaind tx distribution withdraw-rewards $(0gchaind keys show wallet --bech val -a) --commission --from wallet --chain-id zgtendermint_16600-2 --fees 5000ua0gi

☀️ Delegate Tokens to Self

0gchaind tx staking delegate $(0gchaind keys show wallet --bech val -a) 1000000ua0gi --from wallet --chain-id zgtendermint_16600-2 --fees 5000ua0gi

☀️ Editing Validator Details

0gchaind tx staking edit-validator --moniker "<MONIKER>" --identity "KEYBASE_ID" --website "<YOUR_WEBSITE>" --details "<YOUR_VALIDATOR_DETAILS>" --chain-id zgtendermint_16600-2 --from wallet --fees 5000ua0gi

☀️ Unjail Validator

0gchaind tx slashing unjail --from wallet --chain-id zgtendermint_16600-2 --fees 5000ua0gi

☀️ How to Fill the Form Guide

For detailed instructions on how to fill out the form, refer to the Guide on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published