Skip to content

Mayankgg01/0G-Storage-Node-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 

Repository files navigation

IntroductionπŸ“”

-----Storage Nodes: Unlike Validator Nodes that focus on securing the blockchain itself, Storage Nodes focus on managing and serving data. They are the backbone of the network's data storage capabilities, ensuring persistence and availability for long-term data storage (e.g., training datasets, large AI models). By running a storage node, you'll contribute to the decentralized storage of 0G data, making it accessible and resilient.

πŸ‘¨πŸ»β€πŸ’» 0G Storage Node Guide πŸ‘¨πŸ»β€πŸ’»

Device/System Requirements πŸ’»

image

Pre-Requirements πŸ› 

Install All Require Dependecies

sudo apt-get update && sudo apt-get upgrade -y
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 rustup
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Check 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 version

go version

Clone the Repository

git clone https://github.com/0glabs/0g-storage-node.git
cd 0g-storage-node && git checkout v1.1.0 && git submodule update --init
  • Build in release mode
cargo build --release

Set Configrations

rm -rf $HOME/0g-storage-node/run/config.toml
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 in config.toml, ❗❗Dont Add 0X before the key:

-open and go to miner_key and add your pvt key:

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

image

If u want to change RPC then follow this:

  1. get rpc from here - https://www.astrostake.xyz/0g-status

  2. Chooose any rpc and edit in the config.toml file

image

Create a Systemd 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 service
sudo systemctl start zgs

Managing Logs

sudo systemctl status zgs

Screenshot 2025-05-27 190436

  • check Full Logs
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
  • Check block & Sync process - Match to the latest block on explorer
 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

Screenshot 2025-05-28 155703

Stop & Delete the service

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

Explorer & Useful Webs

DONE!!

πŸ“‹FAQ-1 ( Process for Local Device & how to restart on next day!)

  • So, For local PC All the process is same as VPS: You have to start from Pre-Requirements πŸ› 

  • πŸ‘‰Next Day process:

  • Just Open your wsl/terminal and run
sudo systemctl restart zgs

The service/node will be start after that:

πŸ“ˆ Download Snapshot For Faster Sync πŸš€

  • βš•οΈ This Snapshot will help u to sync Faster & it will start from Block -- 4787000

πŸ› οΈ Installation Instructions

  • Stop The Node & Delete flow db
sudo systemctl stop zgs
rm -rf $HOME/0g-storage-node/run/db/flow_db
  • Download and extract the Flow db:
wget https://github.com/Mayankgg01/0G-Storage-Node-Guide/releases/download/v1.0/flow_db.tar.xz \
  -O $HOME/0g-storage-node/run/db/flow_db.tar.xz && \
  tar -xJvf $HOME/0g-storage-node/run/db/flow_db.tar.xz -C $HOME/0g-storage-node/run/db/
  • Restart Your Service/Node
sudo systemctl restart zgs

βœ”οΈDone: Your Node Will start Syncing From Block 4787000 πŸš€

πŸ›  how to delete data & start the node Again πŸ› 

  • If Your Vps storage got full, then u can follow these commands and instruction to Clear it & Do Again:
sudo systemctl stop zgs
sudo systemctl disable zgs
sudo rm /etc/systemd/system/zgs.service
rm -rf $HOME/0g-storage-node

Doneβœ…βœ”οΈ

/////////////////////////////////////////////////////////////////////////////////////////////////

πŸ“ˆ Upgrade to new release {v1.1.0}

  • Stop the service
sudo systemctl stop zgs
  • Change Repo , Fetch the latest tags and switch to the new release
cd ~/0g-storage-node
git reset --hard
git clean -fd
git fetch --all
git checkout v1.1.0
git submodule update --init --recursive
  • Build the new release
sudo apt-get install protobuf-compiler
cargo build --release
sudo systemctl start zgs
  • ❗❗ After that Dont Forget to download Snapshot for faster Sync:

-----------Follow this procees: πŸ“ˆ Download Snapshot For Faster Sync πŸš€

πŸ₯³Done: U have upgrade to latest Release

πŸ‘‰ Join TG for more Updates: https://telegram.me/cryptogg

If U have any issue then open a issue on this repo or Dm me on TG~

Thank You! Happy Coding!πŸ“ˆ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published