Skip to content

Storage Node Setup Guide (V3 Galileo)

This guide will help you set up a Storage Node for OG Labs. For official documentation, check here.

Requirements

  • Memory: 32 GB RAM
  • CPU: 8 Cores
  • Disk: 500GB / 1TB NVME SSD
  • Bandwidth: 100 Mbps (Download / Upload)

Migration from V2

Already installed a previous version? Click here for the migration guide from v2 to v3.

Version: v1.0.0

One-Click Command

bash
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/galileo/migration_storage_node_v3.sh)

Manual Install

  1. Stop Service
bash
systemctl stop zgs
  1. Remove db folder
bash
rm -rf $HOME/0g-storage-node/run/db
  1. Backup Config
bash
cp $HOME/0g-storage-node/run/config.toml $HOME/zgs-config.toml.backup
  1. Update to v1.0.0
bash
cd $HOME/0g-storage-node
git stash
git fetch --all --tags
git checkout v1.0.0
git submodule update --init
cargo build --release
  1. Download V3 Config
bash
rm -rf $HOME/0g-storage-node/run/config.toml
curl -o $HOME/0g-storage-node/run/config.toml https://vault.astrostake.xyz/testnet/0g-labs/config-v3.toml

INFO

check miner_key and input your private key

bash
nano $HOME/0g-storage-node/run/config.toml
  1. Delete and Create New Service
bash
sudo rm -f /etc/systemd/system/zgs.service
bash
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF
[Unit]
Description=ZGS Node
After=network.target

[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-node/run
ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
  1. Restart Service
bash
sudo systemctl daemon-reload && sudo systemctl enable zgs && sudo systemctl start zgs

Update to New Contract

Click here to see how to update to the new contract.

Stop zgs service

bash
systemctl stop zgs

Delete old db

bash
rm -rf $HOME/0g-storage-node/run/db

Download new config

bash
rm -rf $HOME/0g-storage-node/run/config.toml
curl -o $HOME/0g-storage-node/run/config.toml https://vault.astrostake.xyz/testnet/0g-labs/config-v3.toml

Check miner_key and input your private key

bash
nano $HOME/0g-storage-node/run/config.toml

Restart zgs service

bash
systemctl restart zgs

One-Click Command Update

This command only updates your node version. If you're moving from v2 to v3, make sure to follow the migration guide instead.

version: v1.0.0

bash
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/galileo/storage_node_update_v3.sh)

One Click Command Install

bash
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/galileo/0g_storage_node_v3_chain.sh)

Manual Install

  1. Install necessary packages
bash
sudo apt-get update
sudo apt-get install clang cmake build-essential openssl pkg-config libssl-dev jq git bc
  1. Install go
bash
cd $HOME && \
ver="1.22.0" && \
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" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile && \
source ~/.bash_profile && \
go version
  1. Install rustup
bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
bash
. "$HOME/.cargo/env"
  1. Download and Install 0G Storage Node
bash
git clone -b v1.0.0 https://github.com/0glabs/0g-storage-node.git
bash
cd $HOME/0g-storage-node
git stash
git fetch --all --tags
git checkout v1.0.0
git submodule update --init
cargo build --release
  1. Set config
bash
rm -rf $HOME/0g-storage-node/run/config.toml
curl -o $HOME/0g-storage-node/run/config.toml https://vault.astrostake.xyz/testnet/0g-labs/config-v3.toml

INFO

check miner_key and input your private key

bash
nano $HOME/0g-storage-node/run/config.toml

Your config.toml should look like this (focus on miner_key):

toml
# Miner key is used to sign blockchain transaction for incentive.
# The value should be a hex string of length 64 without 0x prefix.
#
# Note, the corresponding address should have enough tokens to pay
# transaction gas fee.
miner_key = "YOUR-PRIVATE-KEY"

# Period for querying mine context on chain (in seconds)
  1. Create service
bash
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF
[Unit]
Description=ZGS Node
After=network.target

[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-node/run
ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
  1. Star service
bash
sudo systemctl daemon-reload && sudo systemctl enable zgs && sudo systemctl start zgs

Troubleshooting

INFO

If you face any errors during node installation, please refer to the Troubleshooting Guide.

Useful Commands

Check Full Logs

bash
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)

Check Blocks and Peers

bash
source <(curl -s https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/check_block.sh)

Change RPC

Need a reliable option? You can find community RPC Endpoints at AstroStake RPC Dashboard.

Auto

bash
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/change_storage_rpc.sh)

Manual

bash
nano $HOME/0g-storage-node/run/config.toml

In your config.toml, locate and update the blockchain_rpc_endpoint.

Example configuration:

toml
#######################################################################
###                     Log Sync Config Options                     ###
#######################################################################

# RPC endpoint to sync event logs on EVM compatible blockchain.
blockchain_rpc_endpoint = "https://evmrpc-testnet.0g.ai"

# Flow contract address to sync event logs.
log_contract_address = "0xbD75117F80b4E22698D0Cd7612d92BDb8eaff628"

Once you've made the change, save the file and restart the service:

bash
systemctl restart zgs

Stop and delete node

Stop

bash
sudo systemctl stop zgs

Delete

bash
sudo systemctl disable zgs
sudo rm /etc/systemd/system/zgs.service
rm -rf $HOME/0g-storage-node