Manual Installation
Let's explore the manual installation process as we set up a node with Cosmovisor!
Install Dependencies
Update system package and install build tools
sudo apt -q update
sudo apt -qy install curl git jq lz4 build-essential fail2ban ufw
sudo apt -qy upgrade
Secure Setup
π’
This step is optional, and you can choose to skip ahead to configure moniker.
Setup ssh for oglabs user replace YOUR_PUBLIC_SSH_KEY with your own!
sudo adduser oglabs --disabled-password -q
sudo usermod -aG sudo oglabs
sudo -u oglabs bash -c 'mkdir -p ~/.ssh && echo "YOUR_PUBLIC_SSH_KEY" >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
Configure Moniker
Replace <your-moniker-name> with your own validator name
MONIKER="<your-moniker-name>"
Install Go
install go version 1.21.7
sudo rm -rf /usr/local/go
curl -Ls https://go.dev/dl/go1.21.7.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
eval $(echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee /etc/profile.d/golang.sh)
eval $(echo 'export PATH=$PATH:$HOME/go/bin' | tee -a $HOME/.profile)
Build Binaries
Cloning project repository & Compile binaries
cd $HOME
rm -rf 0g-chain
git clone -b v0.2.3 https://github.com/0glabs/0g-chain.git
cd 0g-chain
git checkout v1.0.0-testnet
make build
Latest commit : b52c268d6a66949195bc89e2e2f6b755c4d0dd3b
Prepare binaries for cosmovisor
mkdir -p $HOME/.0gchain/cosmovisor/genesis/bin
mv out/linux/0gchaind $HOME/.0gchain/cosmovisor/genesis/bin/
rm -rf out/linux/
Create symlinks
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
Cosmovisor Setup
Install cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0
Create Service
Create a systemd service
sudo tee /etc/systemd/system/oglabs.service > /dev/null << EOF
[Unit]
Description=oglabs node service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --home $HOME/.0gchain
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.0gchain"
Environment="DAEMON_NAME=0gchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
EOF
Enable Service
Enable oglabs systemd service
sudo systemctl daemon-reload
sudo systemctl enable oglabs
Initialize Node
Setting node configuration
0gchaind config chain-id zgtendermint_16600-2
0gchaind config keyring-backend test
0gchaind config node tcp://localhost:24457
Initialize node
0gchaind init $MONIKER --chain-id zgtendermint_16600-2
Download Genesis & Addrbook
Download genesis & addrbook file
curl -Ls https://snap.nodex.one/oglabs-testnet/genesis.json > $HOME/.0gchain/config/genesis.json
curl -Ls https://snap.nodex.one/oglabs-testnet/addrbook.json > $HOME/.0gchain/config/addrbook.json
sha256sum genesis.json
: 0d471d89866e4bdb94647d198a24d0e1c64333a8f799707e35b959f2aed82026
Configure Seeds
Setting up a seed peers
sed -i -e "s|^seeds *=.*|seeds = \"d1d43cc7c7aef715957289fd96a114ecaa7ba756@testnet-seeds.nodex.one:24410\"|" $HOME/.0gchain/config/config.toml
Configure Gas Prices
Setting up a gas prices
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0ua0gi\"|" $HOME/.0gchain/config/app.toml
Pruning Setting
Configure pruning setting
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
Custom Port
Please note that updating the port is optional!
Configure a custom port
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:24458\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:24457\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:24460\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:24456\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":24466\"%" $HOME/.0gchain/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:24417\"%; s%^address = \":8080\"%address = \":24480\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:24490\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:24491\"%; s%:8545%:24445%; s%:8546%:24446%; s%:6065%:24465%" $HOME/.0gchain/config/app.toml
Download Snapshots
Download latest chain snapshot
curl -L https://snap.nodex.one/oglabs-testnet/oglabs-latest.tar.lz4 | tar -Ilz4 -xf - -C $HOME/.0gchain
[[ -f $HOME/.0gchain/data/upgrade-info.json ]] && cp $HOME/.0gchain/data/upgrade-info.json $HOME/.0gchain/cosmovisor/genesis/upgrade-info.json
Start Service
Letss f*cking goooo!
sudo systemctl start oglabs