Update system and install build tools
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget build-essential jq make lz4 gcc unzip -y
cd $HOME && \
ver="1.21.5" && \
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" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version
git clone -b v0.2.3 https://github.com/0glabs/0g-chain.git
cd 0g-chain
make install
0gchaind config chain-id zgtendermint_16600-2
0gchaind init YOUR-MONIKER --chain-id zgtendermint_16600-2
Prepare the genesis file And set some mandatory configuration options
sudo apt install -y unzip wget
rm ~/.0gchain/config/genesis.json
wget -P ~/.0gchain/config https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json
sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ua0gi\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchain/config/config.toml
# Update peers in the config
PEERS="[email protected]:12656,[email protected]:12656,[email protected]:12656,[email protected]:56656,[email protected]:13456,[email protected]:12656,[email protected]:12656,[email protected]:12656,[email protected]:58656,[email protected]:26856,[email protected]:12656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656" && \
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml
sed -i \
-e 's|^pruning *=.*|pruning = "custom"|' \
-e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
-e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
-e 's|^pruning-interval *=.*|pruning-interval = "10"|' \
$HOME/.0gchain/config/app.toml
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0gchaind
After=network-online.target
[Service]
User=$USER
ExecStart=$(which 0gchaind) start
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind
sudo systemctl restart 0gchaind && sudo journalctl -fu 0gchaind -o cat
0gchaind keys add wallet
0gchaind keys add wallet --recover
0gchaind q bank balances $(0gchaind keys show wallet -a)
0gchaind tx staking create-validator \
--amount=900000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker="YOUR-MONIKER" \
--chain-id=zgtendermint_16600-2 \
--commission-rate=0.05 \
--commission-max-rate=0.1 \
--commission-max-change-rate=0.1 \
--min-self-delegation=1 \
--from=wallet \
--identity="" \
--details="" \
--website="" \
--gas=500000 --gas-prices=99999ua0gi
-y
0gchaind q staking validator $(0gchaind keys show wallet --bech val -a)
0gchaind status 2>&1 | jq
0gchaind tx staking delegate $(0gchaind keys show WALLET_NAME --bech val -a) 1000000ua0gi --from wallet -y
0gchaind tx slashing unjail --from WALLET_NAME --gas=500000 --gas-prices=99999neuron -y
sudo systemctl stop 0gchaind
sudo systemctl restart 0gchaind
sudo journalctl -u 0gchaind -f -o cat
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml
sudo systemctl stop 0gchaind.service
sudo systemctl disable 0gchaind.service
sudo rm /etc/systemd/system/0gchaind.service
rm -rf $HOME/.0gchain $HOME/0g-chain