curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
安装 Go
对于 Linux
# Download the Go installer
wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz
# Extract the archive
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.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
cd 0g-storage-node
# Build in release mode
cargo build --release
如有必要,请检查并更新 。run/config.toml
# enr address, must fill your instance's public ip to support peer discovery
network_enr_address
# peer nodes, check the 0g-storage/run/config-tfor the official configurations
network_boot_nodes = []
# 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
# 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
# The max number of chunk entries to store in db.
# Each entry is 256B, so the db size is roughly limited to
# `256 * db_max_num_chunks` Bytes.
# If this limit is reached, the node will update its `shard_position`
# and store only half data.
db_max_num_chunks
运行 storage service
使用zgs_node -h
我们提供了一个用于测试网的使用。run/config-testnet.toml
cd run
# consider using tmux in order to run in background
../target/release/zgs_node --config config-testnet.toml --miner-key <your_private_key> --blockchain-rpc-endpoint <blockchain_rpc> --db-max-num-chunks <max_chunk_num>