0G RPC Node
Testnet V3 (Galileo), ChainID: 16601
Resources
Website
https://0g.ai/
Hardware requirements
CPU
8 cores
RAM
64 GB
Storage
1 TB NVME
Network
100 mbps
OS
Linux (Ubuntu 20.04 x64)
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
echo 'export PATH=$PATH:$HOME/galileo/bin' >> $HOME/.bash_profile
source $HOME/.bash_profile
Get Galileo folder
cd $HOME
rm -rf galileo
wget https://github.com/0glabs/0gchain-NG/releases/download/v2.0.4/galileo-v2.0.4.tar.gz
tar -xvzf galileo-v2.0.4.tar.gz
cd $HOME/galileo-v2.0.4/bin
rm galileo-v2.0.4.tar.gz
chmod +x $HOME/galileo/bin/geth
chmod +x $HOME/galileo/bin/0gchaind
Move binaries to /usr/local/bin
sudo cp $HOME/galileo/bin/geth /usr/local/bin/geth
sudo cp $HOME/galileo/bin/0gchaind /usr/local/bin/0gchaind
Init 0G Node
mkdir -p $HOME/.0gchaind
cp -r $HOME/galileo $HOME/.0gchaind/
geth init --datadir $HOME/.0gchaind/galileo/0g-home/geth-home $HOME/.0gchaind/galileo/genesis.json
0gchaind init $MONIKER --home $HOME/.0gchaind/tmp
cp $HOME/.0gchaind/tmp/data/priv_validator_state.json $HOME/.0gchaind/galileo/0g-home/0gchaind-home/data/
cp $HOME/.0gchaind/tmp/config/node_key.json $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/
cp $HOME/.0gchaind/tmp/config/priv_validator_key.json $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/
Update config.toml
sed -i -e "s/^moniker *=.*/moniker = \"$MONIKER\"/" $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/config.toml
Set custom ports in geth-config.toml
sed -i "s/HTTPPort = .*/HTTPPort = ${OG_PORT}545/" $HOME/.0gchaind/galileo/geth-config.toml
sed -i "s/WSPort = .*/WSPort = ${OG_PORT}546/" $HOME/.0gchaind/galileo/geth-config.toml
sed -i "s/AuthPort = .*/AuthPort = ${OG_PORT}551/" $HOME/.0gchaind/galileo/geth-config.toml
sed -i "s/ListenAddr = .*/ListenAddr = \":${OG_PORT}303\"/" $HOME/.0gchaind/galileo/geth-config.toml
sed -i "s/^# *Port = .*/# Port = ${OG_PORT}901/" $HOME/.0gchaind/galileo/geth-config.toml
sed -i "s/^# *InfluxDBEndpoint = .*/# InfluxDBEndpoint = \"http:\/\/localhost:${OG_PORT}086\"/" $HOME/.0gchaind/galileo/geth-config.toml
Set custom ports for 0gchaind config.toml and app.toml
# config.toml
CONFIG="$HOME/.0gchaind/galileo/0g-home/0gchaind-home/config"
sed -i "s/laddr = \"tcp:\/\/0\.0\.0\.0:26656\"/laddr = \"tcp:\/\/0\.0\.0\.0:${OG_PORT}656\"/" $CONFIG/config.toml
sed -i "s/laddr = \"tcp:\/\/127\.0\.0\.1:26657\"/laddr = \"tcp:\/\/127\.0\.0\.1:${OG_PORT}657\"/" $CONFIG/config.toml
sed -i "s/^proxy_app = .*/proxy_app = \"tcp:\/\/127\.0\.0\.1:${OG_PORT}658\"/" $CONFIG/config.toml
sed -i "s/^pprof_laddr = .*/pprof_laddr = \"0.0.0.0:${OG_PORT}060\"/" $CONFIG/config.toml
sed -i "s/prometheus_listen_addr = \".*\"/prometheus_listen_addr = \"0.0.0.0:${OG_PORT}660\"/" $CONFIG/config.toml
# app.toml
sed -i "s/address = \".*:3500\"/address = \"127.0.0.1:${OG_PORT}500\"/" $CONFIG/app.toml
sed -i "s/^rpc-dial-url *=.*/rpc-dial-url = \"http:\/\/localhost:${OG_PORT}551\"/" $CONFIG/app.toml
Disable Indexer
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $CONFIG/config.toml
Set custom pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $HOME/.0gchaind/galileo/0g-home/0gchaind-home/config/app.toml
Create 0gchain systemd service
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0gchaind Node Service
After=network-online.target
[Service]
User=$USER
Environment=CHAIN_SPEC=devnet
WorkingDirectory=$HOME/.0gchaind/galileo
ExecStart=/usr/local/bin/0gchaind start \
--chaincfg.chain-spec devnet \
--home $HOME/.0gchaind/galileo/0g-home/0gchaind-home \
--chaincfg.kzg.trusted-setup-path=$HOME/.0gchaind/galileo/kzg-trusted-setup.json \
--chaincfg.engine.jwt-secret-path=$HOME/.0gchaind/galileo/jwt-secret.hex \
--chaincfg.kzg.implementation=crate-crypto/go-kzg-4844 \
--chaincfg.engine.rpc-dial-url=http://localhost:${OG_PORT}551 \
--chaincfg.restaking.enabled \
--chaincfg.restaking.symbiotic-rpc-dial-url https://ethereum-holesky-rpc.publicnode.com \
--chaincfg.restaking.symbiotic-get-logs-block-range 1 \
--home=$HOME/.0gchaind/galileo/0g-home/0gchaind-home \
--p2p.seeds 85a9b9a1b7fa0969704db2bc37f7c100855a75d9@8.218.88.60:26656 \
--p2p.external_address=$(curl -4 -s ifconfig.me):${OG_PORT}656
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Create Geth systemd service
sudo tee /etc/systemd/system/geth.service > /dev/null <<EOF
[Unit]
Description=0g Geth Node Service
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.0gchaind/galileo
ExecStart=/usr/local/bin/geth \
--config $HOME/.0gchaind/galileo/geth-config.toml \
--datadir $HOME/.0gchaind/galileo/0g-home/geth-home \
--http.port ${OG_PORT}545 \
--ws.port ${OG_PORT}546 \
--authrpc.port ${OG_PORT}551 \
--bootnodes enode://de7b86d8ac452b1413983049c20eafa2ea0851a3219c2cc12649b971c1677bd83fe24c5331e078471e52a94d95e8cde84cb9d866574fec957124e57ac6056699@8.218.88.60:30303 \
--port ${OG_PORT}303 \
--networkid 16601
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Reaload daemon and start nodes
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind
sudo systemctl enable geth
sudo systemctl start 0gchaind
sudo systemctl start geth
Check logs
journalctl -u 0gchaind -u geth -f
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
sudo rm -rf $HOME/galileo
Last updated