Installation Guide

Install required packages

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

Install Go

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

Build And Install Binary

cd $HOME && mkdir -p go/bin/
git clone -b v0.1.0 <https://github.com/0glabs/0g-chain.git>
./0g-chain/networks/testnet/install.sh
source .profile

Moniker

0gchaind config chain-id zgtendermint_16600-1
0gchaind init YOUR-MONIKER-NAME --chain-id zgtendermint_16600-1

Set up configuration

rm ~/.0gchain/config/genesis.json
curl -Ls <https://github.com/0glabs/0g-chain/releases/download/v0.1.0/genesis.json> > $HOME/.0gchain/config/genesis.json
curl -Ls <https://github.com/JeTr1x/addrbook/blob/main/addrbook.json> > $HOME/.0gchain/config/addrbook.json

rm ~/.0gchain/config/genesis.json
wget -P ~/.0gchain/config <https://github.com/0glabs/0g-chain/releases/download/v0.1.0/genesis.json>

Set up PEERS

PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:12656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:16656,[email protected]:32656,[email protected]:12656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:12656,[email protected]:12656,[email protected]:26656,[email protected]:26656"
sed -i 's|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.0gchain/config/config.toml

Set Up Gas Prices

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0agnet"|g' $HOME/.0gchain/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchain/config/config.toml

Set Up pruning

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 = "19"|' \\
  $HOME/.0gchain/config/app.toml

Create Service A File

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