API | RPC |
---|---|
https://0g.api.kgnodes.xyz |
https://0g.rpc.kgnodes.xyz/ |
Explorer: https://explorer.kgnodes.xyz/og
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
cd ~
VER="1.21.3" #Â Make sure that this version does not broke any other apps you run!
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
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="yourmoniker"" >> $HOME/.bash_profile
echo "export OG_CHAIN_ID="zgtendermint_16600-2"" >> $HOME/.bash_profile
echo "export OG_PORT="42"" >> $HOME/.bash_profile
source $HOME/.bash_profile
cd $HOME
rm -rf 0g-chain
git clone -b v0.2.3 https://github.com/0glabs/0g-chain.git
cd 0g-chain
make install
0gchaind config node tcp://localhost:${OG_PORT}657
0gchaind config keyring-backend file
0gchaind config chain-id zgtendermint_16600-2
0gchaind init "yourmoniker" --chain-id zgtendermint_16600-2
wget -O $HOME/.0gchain/config/genesis.json https://snapshot.kgnodes.xyz/snapshot/0gchain/genesis.json
wget -O $HOME/.0gchain/config/addrbook.json https://snapshot.kgnodes.xyz/snapshot/0gchain/addrbook.json
SEEDS="8f21742ea5487da6e0697ba7d7b36961d3599567@og-testnet-seed.itrocket.net:47656"
PEERS="[email protected]:34656,[email protected]:26646,[email protected]:26646,[email protected]:26646,[email protected]:26646,[email protected]:16656,[email protected]:26646,[email protected]:34656,[email protected]:34656,[email protected]:34656,[email protected]:34656,[email protected]:34656,[email protected]:46656,[email protected]:34656,[email protected]:34656,[email protected]:34656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml
sed -i.bak -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.bak -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
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/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0G node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.0gchain
ExecStart=$(which 0gchaind) start --home $HOME/.0gchain
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind
sudo systemctl start 0gchaind
Size | Heigt | Time |
---|---|---|
3.4G | 459594 | 2024-07-30 01:14 UTC |
sudo systemctl stop 0gchaind
cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json.backup
0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain --keep-addr-book
curl https://snapshot.kgnodes.xyz/snapshot/0gchain/snap_0gchain.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.0gchain
mv $HOME/.0gchain/priv_validator_state.json.backup $HOME/.0gchain/data/priv_validator_state.json
sudo systemctl restart 0gchaind
sudo journalctl -u 0gchaind -f --no-hostname -o cat
sudo journalctl -u 0gchaind -f --no-hostname -o cat
0gchaind keys add <wallet_name> --keyring-backend file --eth
0gchaind keys add <wallet_name> --recover --keyring-backend file --eth
echo "0x$(0gchaind debug addr $(0gchaind keys show <wallet_name> -a) | grep hex | awk '{print $3}')"
0gchaind keys unsafe-export-eth-key <wallet_name>
Request faucet with your evm adress on website below https://faucet.0g.ai/
Network name | 0g Newton Testnet-2 |
---|---|
Rpc Url | https://rpc-testnet.0g.ai/ |
Chain ID | 9000 |
Currency Symbol | A0GI |
0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker=yourmoniker \
--chain-id=zgtendermint_16600-2 \
--commission-rate=0.1 \
--commission-max-rate=0.2 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--from=<wallet_name> \
--identity="" \
--website="" \
--details="" \
--node=http://localhost:your-rpc-port \
-y
0gchaind tx staking delegate $(0gchaind keys show <wallet_name> --bech val -a) amount000000ua0gi --from <wallet_name> --node=http://localhost:your-rpc-port -y
0gchaind tx slashing unjail --from <wallet_name> --chain-id zgtendermint_16600-2 --gas=auto --gas-adjustment=1.6 -y
systemctl stop 0gchaind && \
systemctl disable 0gchaind && \
rm /etc/systemd/system/0gchaind.service && \
systemctl daemon-reload && \
cd $HOME && \
rm -rf .0gchain 0g-chain && \
rm -rf $(which 0gchaind)
sed -i '/OG_/d' ~/.bash_profile