🔌 Installation RPC Node
1️⃣ Install Required Packages
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
cd $HOME
VER="1.23.4"
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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
2️⃣ Galileo Node Setup
➡️ Download and Install Node Files
cd $HOME
wget https://github.com/0glabs/0gchain-NG/releases/download/v1.1.1/galileo-v1.1.1.tar.gz
tar -xzvf galileo-v1.1.1.tar.gz -C $HOME
rm -rf $HOME/galileo-v1.1.1.tar.gz
mv $HOME/galileo $HOME/galileo-used
➡️ Set Permissions
sudo chmod 777 $HOME/galileo-used/bin/geth
sudo chmod 777 $HOME/galileo-used/bin/0gchaind
cp $HOME/galileo-used/bin/geth $HOME/go/bin/geth
cp $HOME/galileo-used/bin/0gchaind $HOME/go/bin/0gchaind
➡️ Set Environment Variables
Info
You can change
OG_PORT
to any available base port. All services will use this as a prefix. echo "export OG_MONIKER=your-moniker-name" >> $HOME/.bash_profile
echo "export OG_PORT=56" >> $HOME/.bash_profile
source $HOME/.bash_profile
➡️ Initialize Geth with Genesis File
mkdir -p $HOME/.0gchaind
cp -r $HOME/galileo-used/0g-home $HOME/.0gchaind
geth init --datadir $HOME/.0gchaind/0g-home/geth-home $HOME/galileo-used/genesis.json
➡️ Initialize 0gchaind
0gchaind init $OG_MONIKER --home $HOME/.0gchaind/tmp
mv $HOME/.0gchaind/tmp/data/priv_validator_state.json $HOME/.0gchaind/0g-home/0gchaind-home/data/
mv $HOME/.0gchaind/tmp/config/node_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
mv $HOME/.0gchaind/tmp/config/priv_validator_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
rm -rf $HOME/.0gchaind/tmp
➡️ Custom Port Configuration and Edit Moniker
sed -i "s|^moniker *=.*|moniker = \"${OG_MONIKER}\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
geth-config.toml
sed -i "s/HTTPPort = .*/HTTPPort = ${OG_PORT}545/" $HOME/galileo-used/geth-config.toml
sed -i "s/WSPort = .*/WSPort = ${OG_PORT}546/" $HOME/galileo-used/geth-config.toml
sed -i "s/AuthPort = .*/AuthPort = ${OG_PORT}551/" $HOME/galileo-used/geth-config.toml
sed -i "s|ListenAddr = .*|ListenAddr = \":${OG_PORT}303\"|" $HOME/galileo-used/geth-config.toml
sed -i "s|^# *Port = .*|# Port = ${OG_PORT}901|" $HOME/galileo-used/geth-config.toml
sed -i "s|^# *InfluxDBEndpoint = .*|# InfluxDBEndpoint = \"http://localhost:${OG_PORT}086\"|" $HOME/galileo-used/geth-config.toml
sed -i 's/^WSHost = "0\.0\.0\.0"/WSHost = "127.0.0.1"/' $HOME/galileo-used/geth-config.toml
sed -i 's/^AuthAddr = "0\.0\.0\.0"/AuthAddr = "127.0.0.1"/' $HOME/galileo-used/geth-config.toml
Do not use these codes if you are going to use rpc as public
sed -i 's/^HTTPHost = "0\.0\.0\.0"/HTTPHost = "127.0.0.1"/' $HOME/galileo-used/geth-config.toml
client.toml
sed -i "s|node = .*|node = \"tcp://localhost:${OG_PORT}657\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
config.toml
sed -i "s|laddr = \"tcp://0.0.0.0:26656\"|laddr = \"tcp://0.0.0.0:${OG_PORT}656\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i "s|laddr = \"tcp://127.0.0.1:26657\"|laddr = \"tcp://127.0.0.1:${OG_PORT}657\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i "s|^proxy_app = .*|proxy_app = \"tcp://127.0.0.1:${OG_PORT}658\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i "s|^pprof_laddr = .*|pprof_laddr = \"127.0.0.1:${OG_PORT}060\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i "s|prometheus_listen_addr = \".*\"|prometheus_listen_addr = \"127.0.0.1:${OG_PORT}660\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
app.toml
sed -i "s|address = \".*:3500\"|address = \"127.0.0.1:${OG_PORT}500\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i "s|^rpc-dial-url *=.*|rpc-dial-url = \"http://localhost:${OG_PORT}551\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
➡️ Pruning - Disable Indexer Configuration
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 = \"19\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
➡️ Symlink for client.toml
ln -sf $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml $HOME/.0gchaind/config/client.toml
➡️ Addrbook
Info
Updated every 6 hours.
curl https://files.mictonode.com/0g/addrbook/addrbook.json -o $HOME/.0gchaind/0g-home/0gchaind-home/config/addrbook.json
➡️ 0gchaind Service File
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0gchaind Node Service
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/galileo-used/bin/0gchaind start \\
--kzg.trusted-setup-path=$HOME/galileo-used/kzg-trusted-setup.json \\
--engine.jwt-secret-path=$HOME/galileo-used/jwt-secret.hex \\
--kzg.implementation=crate-crypto/go-kzg-4844 \\
--block-store-service.enabled \\
--node-api.enabled \\
--node-api.logging \\
--home=$HOME/.0gchaind/0g-home/0gchaind-home \\
--p2p.seeds=85a9b9a1b7fa0969704db2bc37f7c100855a75d9@8.218.88.60:26656 \\
--p2p.external_address $(curl -s http://ipv4.icanhazip.com):${OG_PORT}656 \\
--chain-spec devnet
WorkingDirectory=$HOME/galileo-used
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
➡️ 0ggeth Service File
sudo tee /etc/systemd/system/geth.service > /dev/null <<EOF
[Unit]
Description=0g Geth Node Service
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/geth \\
--config $HOME/galileo-used/geth-config.toml \\
--datadir $HOME/.0gchaind/0g-home/geth-home \\
--networkid 16601 \\
--bootnodes enode://de7b86d8ac452b1413983049c20eafa2ea0851a3219c2cc12649b971c1677bd83fe24c5331e078471e52a94d95e8cde84cb9d866574fec957124e57ac6056699@8.218.88.60:30303
Restart=always
WorkingDirectory=$HOME/galileo-used
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
➡️ Starter Snap
Check Snapshot Heightecho "0G Snapshot Height: $(curl -s https://files.mictonode.com/0g/snapshot/block-height.txt)"
cp $HOME/.0gchaind/0g-home/0gchaind-home/data/priv_validator_state.json $HOME/.0gchaind/0g-home/0gchaind-home/priv_validator_state.json.backup
rm -rf $HOME/.0gchaind/0g-home/0gchaind-home/data
rm -rf $HOME/.0gchaind/0g-home/geth-home/geth/chaindata
mkdir -p $HOME/.0gchaind/0g-home/geth-home/geth
SNAPSHOT_URL="https://files.mictonode.com/0g/snapshot/"
LATEST_COSMOS=$(curl -s $SNAPSHOT_URL | grep -oP '0g_\d{8}-\d{4}_\d+_cosmos\.tar\.lz4' | sort | tail -n 1)
LATEST_GETH=$(curl -s $SNAPSHOT_URL | grep -oP '0g_\d{8}-\d{4}_\d+_geth\.tar\.lz4' | sort | tail -n 1)
if [ -n "$LATEST_COSMOS" ] && [ -n "$LATEST_GETH" ]; then
COSMOS_URL="${SNAPSHOT_URL}${LATEST_COSMOS}"
GETH_URL="${SNAPSHOT_URL}${LATEST_GETH}"
echo "Downloading Cosmos snapshot: $LATEST_COSMOS"
curl "$COSMOS_URL" | lz4 -dc - | tar -xf - -C $HOME/.0gchaind/0g-home/0gchaind-home
echo "Downloading Geth snapshot: $LATEST_GETH"
curl "$GETH_URL" | lz4 -dc - | tar -xf - -C $HOME/.0gchaind/0g-home/geth-home/geth
mv $HOME/.0gchaind/0g-home/0gchaind-home/priv_validator_state.json.backup $HOME/.0gchaind/0g-home/0gchaind-home/data/priv_validator_state.json
else
echo "Snapshot not found."
fi
➡️ Start Services
sudo systemctl daemon-reload
sudo systemctl enable geth.service
sudo systemctl start geth.service
sudo systemctl enable 0gchaind.service
sudo systemctl start 0gchaind.service
➡️ Check Logs
sudo journalctl -u 0gchaind -u geth -f
sudo journalctl -u 0gchaind -f -o cat
sudo journalctl -u geth -f -o cat
5️⃣ Wallet Operations
➡️ Create Wallet
➡️ Import Wallet
➡️ Export Private Key
➡️ Faucet
6️⃣ Create Validator
Warning
Your node must be fully synced before you can create a validator.
➡️ Delegate
➡️ Block Sync Status Check
local_height=$(curl -s localhost:${OG_PORT}657/status | jq -r .result.sync_info.latest_block_height);
network_height=$(curl -s http://37.27.60.37:26657/status | jq -r .result.sync_info.latest_block_height);
blocks_left=$((network_height - local_height));
echo "Node height: $local_height";
echo "Network height: $network_height";
echo "Remaining blocks: $blocks_left"
- Node height – the current block height of your node
- Network height – the latest block height on the network
- Remaining blocks – number of blocks left for your node to fully sync
➡️ Clear Node
Warning
Make sure you have backed up your wallet key
& priv_validator_key.json
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 -f $(which geth)
sudo rm -rf $HOME/.0gchaind
sudo rm -rf $HOME/galileo-used