Skip to content
satyamjhablockdevPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

🚀 0G Storage Node Complete Setup Guide 🚀

by Satyam Jha


🧩 Introduction

Storage Nodes are the foundation of 0G's decentralized storage while validator nodes secure the chain, storage nodes keep critical data persistent, available, and distributed. Running a storage node means you’re actively supporting the network’s long-term AI dataset and model hosting capabilities, contributing to resilience and decentralization.


🖥️ System & Hardware Requirements

System Requirements


⚡ Initial Setup Steps

Before You Begin:


🔧 Install Required Dependencies

Update & upgrade:

sudo apt-get update && sudo apt-get upgrade -y

Essential packages:

sudo apt install curl iptables build-essential git wget lz4 jq make protobuf-compiler cmake gcc nano automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev screen ufw -y

Install Rust

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Check Rust version:

rustc --version

Install Go

wget https://go.dev/dl/go1.24.3.linux-amd64.tar.gz && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf go1.24.3.linux-amd64.tar.gz && \
rm go1.24.3.linux-amd64.tar.gz && \
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && \
source ~/.bashrc

Check Go version:

go version

📂 Clone & Build Storage Node

Clone the repo:

git clone https://github.com/0glabs/0g-storage-node.git

Switch to the latest release & update submodules:

cd 0g-storage-node && git checkout v1.1.0 && git submodule update --init

Compile in release mode:

cargo build --release

⚙️ Configuration

Clear previous config (if any):

rm -rf $HOME/0g-storage-node/run/config.toml

Download the config file:

curl -o $HOME/0g-storage-node/run/config.toml https://raw.githubusercontent.com/Mayankgg01/0G-Storage-Node-Guide/main/config.toml

Add your wallet's private key: Important: Exclude the "0x" prefix!

Open the config for editing and enter your key under miner_key:

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

Config Example


Custom RPC (Optional)

  1. Find available RPC endpoints: Astrostake RPC List
  2. Update the RPC in your config:

RPC Example


🛡️ Systemd Service Setup

Create a service file:

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

Reload

sudo systemctl daemon-reload

Enable

sudo systemctl enable zgs

Start

sudo systemctl start zgs

🔎 Monitoring & Logs

Check service status:

sudo systemctl status zgs

Service Status

Follow logs live:

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

Check sync and block status:

while true; do response=$(curl -s -X POST http://localhost:5678 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}'); logSyncHeight=$(echo $response | jq '.result.logSyncHeight'); connectedPeers=$(echo $response | jq '.result.connectedPeers'); echo -e "logSyncHeight: \033[32m$logSyncHeight\033[0m, connectedPeers: \033[34m$connectedPeers\033[0m"; sleep 5; done

Sync Example


🛑 Stop & Remove Node

Stop & disable:

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

🔗 Useful Links


❓ FAQ: Running on a Local Device & Restarting

  • The process is identical for local PC and VPS—just follow all steps above.
  • To restart your node the next day, simply run:
sudo systemctl restart zgs

🧹 How to Clear Data & Start Fresh

If your VPS storage is full or you want a clean reset:

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

Then restart from the repository clone step and don’t forget the latest snapshot for fast sync!


Happy coding! You’re now powering the future of decentralized storage. — Guide by Satyam Jha


About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors