Skip to main content

Storage Node


In the 0G network, storage nodes play a vital role in maintaining the system's decentralized storage layer. They are responsible for storing and serving data, ensuring data availability and reliability across the network. By running a storage node, you actively contribute to the network and earn rewards for your participation. This guide details the process of running a storage node, including hardware specifications and interaction with on-chain contracts.

Hardware Requirements

ComponentStorage NodeStorage KV
Memory32 GB RAM32 GB RAM
CPU8 cores8 cores
Disk500GB / 1TB NVMe SSDSize matches the KV streams it maintains
Bandwidth100 Mbps (Download / Upload)-
note
  • For Storage Node: The NVMe SSD ensures fast read/write operations, critical for efficient blob storage and retrieval.
  • For Storage KV: The disk size requirement is flexible and should be adjusted based on the volume of KV streams you intend to maintain.

Next Steps

For detailed instructions on setting up and operating your Storage Node or Storage KV, please refer to our comprehensive setup guides below:

Prerequisites

Before setting up your storage node:

  • Understand that 0G Storage interacts with on-chain contracts for blob root confirmation and PoRA mining.
  • Check here for deployed contract addresses.

Install Dependencies

Start by installing all the essential tools and libraries required to build the 0G storage node software.

sudo apt-get update
sudo apt-get install clang cmake build-essential pkg-config libssl-dev

Install rustup: (rustup) is the Rust toolchain installer, necessary as the 0G node software is written in Rust.

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

Download the Source Code:

git clone -b <latest_tag> https://github.com/0glabs/0g-storage-node.git

Build the Source Code

cd 0g-storage-node

# Build in release mode
cargo build --release

This compiles the Rust code into an executable binary. The --release flag optimizes the build for performance.

Configuration

Navigate to the run directory and open config.toml for editing. Follow the steps below.

  1. Edit the configuration file:
cd run
nano config.toml
  1. Update configuration with your preferred settings:

Below is just an example configuration for illustration purposes. For official default values, copy over the config-testnet-turbo.toml file or config-testnet-standard.toml file to your config.toml file.

# Peer nodes: A list of peer nodes to help your node join the network. Check inside 0g-storage/run directory for suggested configurations.
network_boot_nodes = []

# Contract addresses
log_contract_address = "CONTRACT_ADDRESS" #flow contract address, see testnet information
mine_contract_address = "CONTRACT_ADDRESS" #Address of the smart contract on the host blockchain that manages mining.

# L1 host blockchain RPC endpoint URL. See testnet information page for RPC endpoints
blockchain_rpc_endpoint = "RPC_ENDPOINT"

# Start sync block number: The block number from which your node should start synchronizing the log data.
log_sync_start_block_number = BLOCK_NUMBER

# Your private key (64 chars, no '0x' prefix, include leading zeros): Your private key (without the `0x` prefix) if you want to participate in PoRA mining and earn rewards.
miner_key = "YOUR_PRIVATE_KEY"

# Max chunk entries in db (affects storage size): The maximum number of chunk entries (each 256 bytes) to store in the database. This effectively limits the database size.
db_max_num_chunks = MAX_CHUNKS

# ENR address: Your node's public IP address, essential for other nodes to discover and connect to you. Currently automatically set by the node.
# network_enr_address = ""

Running the Storage Node

  1. Check configuration options:
../target/release/zgs_node -h
  1. Run the storage service:
cd run
../target/release/zgs_node --config config.toml --miner-key <your_private_key>

Additional Notes

  • Security: Keep your private key (miner_key) safe and secure. Anyone with access to it can control your node and potentially claim your mining rewards.

  • Network Connectivity: Ensure your node has a stable internet connection and that the necessary ports are open for communication with other nodes.

  • Monitoring: Monitor your node's logs and resource usage to ensure it's running smoothly.

  • Updates: Stay informed about updates to the 0G storage node software and follow the project's documentation for any changes in the setup process.

Remember: Running a storage node is a valuable contribution to the 0G network. You'll be helping to maintain its decentralization and robustness while earning rewards for your efforts.