Resources
Hardware requirements
Installation 💾
Install dependencies
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Install GO 1.22.2
sudo rm -rf /usr/local/go && \
curl -L https://go.dev/dl/go1.24.2.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local && \
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile && \
source $HOME/.bash_profile && \
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
go version
Set vars (change your <wallet-name> and <moniker>)
echo "export OG_WALLET="<WALLET_NAME>"" >> $HOME/.bash_profile
echo "export OG_MONIKER="<MONIKER>"" >> $HOME/.bash_profile
echo "export OG_PORT="26"" >> $HOME/.bash_profile
source $HOME/.bash_profile
Get Galileo folder
wget https://github.com/0glabs/0gchain-NG/releases/download/v1.1.1/galileo-v1.1.1.tar.gz
Extract folder
tar -xzvf galileo-v1.1.1.tar.gz -C $HOME
Copy galileo home folder
sudo chmod 777 $HOME/galileo/bin/geth
sudo chmod 777 $HOME/galileo/bin/0gchaind
cp $HOME/galileo/bin/geth $HOME/go/bin/geth
cp $HOME/galileo/bin/0gchaind $HOME/go/bin/0gchaind
Init 0G Node
mkdir -p $HOME/.0gchaind
cp -r $HOME/galileo/0g-home $HOME/.0gchaind
Init Geth
geth init --datadir $HOME/.0gchaind/0g-home/geth-home $HOME/galileo/genesis.json
Init 0gchaind
0gchaind init "Moniker" --home $HOME/.0gchaind/tmp
Copy tmp node files to 0gchaind and delete tmp folder
cp $HOME/.0gchaind/tmp/data/priv_validator_state.json $HOME/.0gchaind/0g-home/0gchaind-home/data/
cp $HOME/.0gchaind/tmp/config/node_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
cp $HOME/.0gchaind/tmp/config/priv_validator_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
rm -rf $HOME/.0gchaind/tmp
Custom config settings (optional)
Edit ports in config
sed -i -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/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${OG_PORT}657\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
sed -i -e "s|^keyring-backend *=.*|keyring-backend = \"os\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
Edit pruning, gas, indexer
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
Create 0gchaind service file
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0GChainD Service
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/galileo
ExecStart=$HOME/galileo/bin/0gchaind start \
--rpc.laddr tcp://0.0.0.0:26657 \
--chain-spec devnet \
--kzg.trusted-setup-path=$HOME/galileo/kzg-trusted-setup.json \
--engine.jwt-secret-path=$HOME/galileo/jwt-secret.hex \
--kzg.implementation=crate-crypto/go-kzg-4844 \
--block-store-service.enabled \
--node-api.enabled \
--node-api.logging \
--node-api.address 0.0.0.0:3500 \
--pruning=nothing \
--home $HOME/.0gchaind/0g-home/0gchaind-home \
--p2p.seeds 85a9b9a1b7fa0969704db2bc37f7c100855a75d9@8.218.88.60:26656 \
--p2p.external_address $(wget -qO- eth0.me):${OG_PORT}656
Restart=always
RestartSec=5
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
Create geth service file
sudo tee /etc/systemd/system/geth.service > /dev/null <<EOF
[Unit]
Description=Go Ethereum Client
After=network-online.target
Wants=network-online.target
[Service]
User=root
ExecStart=$HOME/go/bin/geth \\
--config $HOME/galileo/geth-config.toml \\
--datadir $HOME/.0gchaind/0g-home/geth-home \\
--networkid 16601 \\
--port 30303 \\
--http.port 8645 \\
--authrpc.port 8551
Restart=always
WorkingDirectory=$HOME/galileo
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Reaload daemon and start nodes
sudo systemctl daemon-reload && \
sudo systemctl enable 0gchaind.service && \
sudo systemctl enable geth.service
sudo systemctl start 0gchaind
sudo systemctl start geth
Useful commands ⚙️
Node status
0gchaind status 2>&1 | jq
Check logs
sudo journalctl -fu 0gchaind -o cat
sudo journalctl -fu geth -o cat
Bloack sync status
while true; do
PORT=$(grep -A 3 '^\[rpc\]' $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml | grep -oP 'laddr = "tcp://[0-9.:]+:\K\d+')
local=$(curl -s localhost:$PORT/status | jq -r '.result.sync_info.latest_block_height//0')
network=$(curl -s http://8.218.94.246:26657/status | jq -r '.result.sync_info.latest_block_height//0')
left=$((network - local))
echo -e "Local: \033[1;34m$local\033[0m | Network: \033[1;36m$network\033[0m | Left: \033[1;31m$left\033[0m"
sleep 5
done
Delete node 🗑️
cd $HOME
sudo systemctl stop 0gchaind geth
sudo systemctl disable 0gchaind geth
sudo rm /etc/systemd/system/0gchaind.service
sudo rm /etc/systemd/system/geth.service
sudo systemctl daemon-reload
sudo rm -f $(which 0gchaind)
sudo rm -rf $HOME/.0gchaind