NodesHub Services
  • About Us
  • Mainnet
    • Atomone
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Celestia
      • Celestia-app
        • Installation
        • Upgrade
        • State Sync
        • Snapshot
          • Archive
          • Pruned
        • Public RPC
      • Bridge Node
        • Installation
        • Upgrade
        • Snapshot
    • Chihuahua
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Elys
      • Installation
      • Upgrade
      • State Sync
      • Snapshot-Pruned
      • Snapshot-Archive
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Firmachain
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Functionx
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Juno
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Kopi
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Kyve
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Mantra
      • Installation
      • Upgrade
      • State Sync
      • Snapshot-Pruned
      • Snapshot-Archive
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Nibiru
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Router
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Zetachain
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
  • Testnet
    • Og-chain
      • Full Node
        • Installation
      • Upgrade
        • State Sync
        • Snapshot
        • Public RPC
        • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
      • DA Node
        • Installation
        • Troubleshooting
        • Upgrades
      • Storage Node
        • Installation
        • Troubleshooting
        • Upgrades
      • Storage-KV
        • Installation
        • Troubleshooting
        • Upgrades
      • Storage-Cli
    • Atomone
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Celestia
      • Celestia-app
        • Installation
        • Upgrade
        • State Sync
        • Snapshot
          • Archive
          • Pruned
        • Public RPC
      • Bridge Node
        • Installation
        • Upgrade
        • Snapshot
    • Elys
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Empe
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Functionx
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Juno
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Lumera
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Mantra
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Pell
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Prysm
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Selfchain
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Symphony
      • Installation
      • Upgrade
      • Oracle
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Tellor
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Titan
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Warden
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • XRPL
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Zenrock
      • Installation
      • Upgrade
      • Sidecar Setup
        • config.yaml
        • eigen_operator_config.yaml
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Zetachain
      • Installation
      • Upgrade
      • State Sync
      • Snapshot
      • Public RPC
      • Useful commands
        • Validator Operations
        • Node Management
        • Wallet Management
        • Governance
    • Port Prefixes
Powered by GitBook
On this page
  • Installation
  • 0G Storage Node Guide
  • Required Hardware Specifications
  • upgrade the storage node
  1. Testnet
  2. Og-chain
  3. Storage Node

Installation

Installation

0G Storage Node Guide

Required Hardware Specifications

Required
Specification

CPU

4 Cores

Memory

16 GB

Storage

500 GB NVMe SSD

Bandwidth

100mbps

OS

Linux


1. Install dependencies for building from source

sudo apt-get update
sudo apt-get install clang cmake build-essential
sudo apt install git
sudo apt install libssl-dev
sudo apt install pkg-config
sudo apt-get install protobuf-compiler
sudo apt-get install clang
sudo apt-get install llvm llvm-dev

2. 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

3. install rustup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

4. set vars

PLEASE INPUT YOUR OWN JSON-RPC ENDPOINT (VALIDATOR_NODE_IP:8545) or you can use any available public RPC Endpoint

read -p "Enter json-rpc: " BLOCKCHAIN_RPC_ENDPOINT && echo "Current json-rpc: $BLOCKCHAIN_RPC_ENDPOINT"
ENR_ADDRESS=$(wget -qO- eth0.me)
echo "export ENR_ADDRESS=${ENR_ADDRESS}" >> ~/.bash_profile
echo 'export ZGS_LOG_DIR="$HOME/0g-storage-node/run/log"' >> ~/.bash_profile
echo "export BLOCKCHAIN_RPC_ENDPOINT=\"$BLOCKCHAIN_RPC_ENDPOINT\"" >> ~/.bash_profile

source ~/.bash_profile

echo -e "\n\033[31mCHECK YOUR STORAGE NODE VARIABLES\033[0m\n\nBLOCKCHAIN_RPC_ENDPOINT: $BLOCKCHAIN_RPC_ENDPOINT\n\n"

ALSO CHECK THE JSON-RPC SYNC, MAKE SURE IT'S IN THE LATEST BLOCK

curl -s -X POST $BLOCKCHAIN_RPC_ENDPOINT -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq -r '.result' | xargs printf "%d\n"

5. download binary

sudo apt install cargo
cd $HOME
git clone https://github.com/0glabs/0g-storage-node.git
cd $HOME/0g-storage-node
git fetch --all --tags
git checkout v0.4.4
git submodule update --init
cargo build --release

6. wallet private key check

obtain yout wallet's private key by using this command in your validator node :

0gchaind keys unsafe-export-eth-key $WALLET

store your private key in variable:

read -sp "Enter your private key: " PRIVATE_KEY && echo

7. update node configuration

sed -i '
s|^\s*#\s*miner_key\s*=.*|miner_key = "'"$PRIVATE_KEY"'"|
s|^\s*#\?\s*blockchain_rpc_endpoint\s*=.*|blockchain_rpc_endpoint = "'"$BLOCKCHAIN_RPC_ENDPOINT"'"|
' $HOME/0g-storage-node/run/config-testnet.toml

8. 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

9. start the node

sudo systemctl daemon-reload && \
sudo systemctl enable zgs && \
sudo systemctl start zgs && \
sudo systemctl status zgs

10. show logs by date

  • check the logs file

ls -lt $ZGS_LOG_DIR
  • full logs command

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

tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep tx_seq:
  • minimized-logs command

tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep -v "discv5\|network\|connect\|16U\|nounce"
  • check your storage node through rpc

curl -X POST http://localhost:5678 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}'  | jq

delete storage node

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

upgrade the storage node

1. delete the node

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

-----------------------------------------------------------------

## Storage Node CLI
### Build Binary
```bash
cd $HOME
git clone https://github.com/0glabs/0g-storage-client.git
cd 0g-storage-client
go build
sudo mv "$HOME/0g-storage-client/0g-storage-client" /usr/local/bin

Generate a test file

0g-storage-client gen --file test.txt

Upload file

Please change YOURVALIDATORIP:8545 with your actual validator IP address and port and YOURSTORAGEIP:5678 with your actual storage node IP address and port.

0g-storage-client upload \
--url http://YOURVALIDATORIP:8545 \
--contract "0xB7e39604f47c0e4a6Ad092a281c1A8429c2440d3" \
--key $PRIVATE_KEY \
--node http://YOURSTORAGEIP:5678 \
--file test.txt

Last updated 9 months ago

MAKE SURE YOUR LOGS HAS THE INCREASING TX_SEQ VALUE

WAIT UNTIL IT SYNCED TO THE LATEST TX_SEQ NUMBER ON THE

THEN START OVER FROM

STEP 4
OG STORAGE SCAN