Storage Node

0G System is composed of multiple components, each with its own functionalities. Detailed steps are provided as a guideline to deploy the storage node.

Prerequisite

0G Storage interact with on-chain contracts for blob root confirmation and PoRA mining.

For official deployed contract addresses, visit this page.

Storage Node

Hardware Requirement

- Memory: 16 GB RAM
- CPU: 4 cores
- Disk: 500GB / 1T NVME SSD
- Bandwidth: 500 MBps for Download / Upload

Deployment Steps

  1. Install dependencies

  • For Linux

sudo apt-get update
sudo apt-get install clang cmake build-essential
  • For Mac

brew install llvm cmake
  1. Install rustup

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

  • For Linux

# Download the Go installer
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz

# Extract the archive
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz

# Add /usr/local/go/bin to the PATH environment variable by adding the following line to your ~/.profile.
export PATH=$PATH:/usr/local/go/bin
  • For Mac

Download the Go installer from https://go.dev/dl/go1.22.0.darwin-amd64.pkg. Open the package file you downloaded and follow the prompts to install Go.

  1. Then download the source code

git clone -b v0.3.2 https://github.com/0glabs/0g-storage-node.git
  1. Build the source code

cd 0g-storage-node
git submodule update --init

# Build in release mode
cargo build --release
  1. Update the run/config.toml

# enr address, must fill your instance's public ip to support peer discovery
network_enr_address

# p2p port
network_libp2p_port

# rpc endpoint
rpc_listen_address

# peer nodes, we provided two nodes, you can also modify to your own ips
network_boot_nodes = ["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS"]

# flow contract address
log_contract_address

# mine contract address
mine_contract_address

# layer one blockchain rpc endpoint
blockchain_rpc_endpoint

# block number to start the sync
log_sync_start_block_number

# location for db, network logs
db_dir
network_dir

# your private key with 64 length
# do not include leading 0x
# do not omit leading 0
# must fill if you want to participate in the pora and get mining reward
miner_key
  1. Run the storage service

cd run

# consider using tmux in order to run in background
../target/release/zgs_node --config config.toml

You are all set !

Last updated