Manual Instalation
Install dependencies
1sudo apt update && sudo apt upgrade -y2sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Setup GO
1cd $HOME2VER="1.21.8"3wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz"4sudo rm -rf /usr/local/go5sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"6rm "go$VER.linux-amd64.tar.gz"7[ ! -f ~/.bash_profile ] && touch ~/.bash_profile8echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile9source $HOME/.bash_profile10[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
Setup variables
1MONIKER=mynode2CHAIN_ID=zgtendermint_16600-23BASE_PORT=234OG_HOME=$HOME/.0gchain
Download latest binary
1# build binary2git clone -b v0.5.0.1 https://github.com/0glabs/0g-chain.git3./0g-chain/networks/testnet/install.sh
Init Chain
10gchaind config chain-id $CHAIN_ID
10gchaind init mynode --chain-id $CHAIN_ID2cd $OG_HOME/config3rm addrbook.json genesis.json45# download addrbook & genesis6wget https://blockhunters.dev/snapshots/testnet/0g/addrbook.json7wget https://blockhunters.dev/snapshots/testnet/0g/genesis.json
Config Chain
Set seed
1# TODO2SEEDS="[email protected]:58156"3sed -i -e "s#seeds = .*#seeds = "$SEEDS"#" $OG_HOME/config/config.toml
Set custom ports in app.toml
1sed -i.bak -e "s%:1317%:${BASE_PORT}317%g;2s%:8080%:${BASE_PORT}080%g;3s%:9090%:${BASE_PORT}090%g;4s%:9091%:${BASE_PORT}091%g;5s%:8545%:${BASE_PORT}545%g;6s%:8546%:${BASE_PORT}546%g;7s%:6065%:${BASE_PORT}065%g" $OG_HOME/config/app.toml
Set custom ports in config.toml file
1sed -i.bak -e "s%:26658%:${BASE_PORT}658%g;2s%:26657%:${BASE_PORT}657%g;3s%:6060%:${BASE_PORT}060%g;4s%:26656%:${BASE_PORT}656%g;5s%^external_address = ""%external_address = "$(wget -qO- eth0.me):${BASE_PORT}656"%;6s%:26660%:${BASE_PORT}660%g" $OG_HOME/config/config.toml
Config pruning
1sed -i -e "s/^pruning *=.*/pruning = "custom"/" $OG_HOME/config/app.toml2sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = "100"/" $OG_HOME/config/app.toml3sed -i -e "s/^pruning-interval *=.*/pruning-interval = "50"/" $OG_HOME/config/app.toml
Disable indexing
1sed -i -e "s/^indexer *=.*/indexer = "null"/" $OG_HOME/config/config.toml
Install & configure cosmovisor
1go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]23# Create Cosmovisor Folders4mkdir -p $OG_HOME/cosmovisor/genesis/bin5mkdir -p $OG_HOME/cosmovisor/upgrades67# Load Node Binary into Cosmovisor Folder8cp ~/go/bin/0gchaind $OG_HOME/cosmovisor/genesis/bin
Create service file
1sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF2[Unit]3Description=0G Node4After=network-online.target5[Service]6User=$USER7WorkingDirectory=$OG_HOME8ExecStart=$(which cosmovisor) start --home $OG_HOME9Restart=on-failure10RestartSec=511LimitNOFILE=6553512Environment="DAEMON_NAME=0gchaind"13Environment="DAEMON_HOME=$OG_HOME"14Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"15Environment="DAEMON_RESTART_AFTER_UPGRADE=true"16Environment="UNSAFE_SKIP_BACKUP=true"17[Install]18WantedBy=multi-user.target19EOF
Enable and start service
1sudo systemctl daemon-reload2sudo systemctl enable 0gchaind --now3sudo journalctl -u 0gchaind -f