Storage Node Setup Guide (Mainnet)
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)
💡 Need a reliable VPS to run this node?
We recommend Netcup — high performance and affordable.
Use this voucher to get a discount:
36nc1753448678036nc1754247115136nc17542471150
Just a heads up: This is an affiliate link (no extra cost to you). Any support we get through it goes straight back into building free public infra — RPCs, APIs, snapshots, and more to support the community.
Manual Install
- Install necessary packages
sudo apt-get update
sudo apt-get install clang cmake build-essential openssl pkg-config libssl-dev jq git bc- Install go
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- Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. "$HOME/.cargo/env"- Download and Install 0G Storage Node
git clone https://github.com/0gfoundation/0g-storage-node.gitcd $HOME/0g-storage-node
git submodule update --init
cargo build --release- Set config
rm -rf $HOME/0g-storage-node/run/config.toml
curl -o $HOME/0g-storage-node/run/config.toml https://vault.astrostake.xyz/mainnet/0g-labs/storage-node/config.tomlINFO
check miner_key and input your private key
nano $HOME/0g-storage-node/run/config.tomlYour config.toml should look like this (focus on miner_key):
# 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)- Create service
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- Star service
sudo systemctl daemon-reload && sudo systemctl enable zgs && sudo systemctl start zgs🛡️ Security
To apply a quick security baseline, you can configure your firewall like this:
sudo ufw allow 1234/tcp comment 'ZGS P2P Port'
sudo ufw allow 1234/udp comment 'ZGS P2P Port'
sudo ufw allow 5678/tcp comment 'ZGS Public RPC'🔐 For a more secure and maintainable setup, check out our Essentials Guide, including SSH key setup, Fail2Ban protection, and a full VPS hardening checklist.
Troubleshooting
INFO
If you face any errors during node installation, please refer to the Troubleshooting Guide.
Useful Commands
Check Full Logs
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)Check Blocks and Peers
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.
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/0G-Labs-script/refs/heads/main/storage-node/change_storage_rpc.sh)Stop and delete node
Stop
sudo systemctl stop zgsDelete
sudo systemctl disable zgs
sudo rm /etc/systemd/system/zgs.service
rm -rf $HOME/0g-storage-node