ZeroGravity: Storage KV node setup guide
Official ZeroGravity installation docs could be found here
This guide describes the installation method, slightly different from the official one. This creates a copy of the executable file and creates a separate directory for the configuration. The project repository and the running node are independent of each other. You can test builds of new versions without fear of breaking the working one.
Recommended way to run the storage kv node on the same server as the storage node.
network | chain_id | Stor KV node version | Stor KV node commit |
---|---|---|---|
testnet | zgtendermint_16600-2 | v1.2.0 | a3fa9966520e78eb787e2b2b1f0ccf06339d4c78 |
Hardware Requirements
- Memory: 4 GB RAM
- CPU: 2 cores
- Disk: Matches the size of kv streams it maintains
We use OS Ubuntu, version 22.04 and higher
Environment preparation
Package installation
sudo apt-get update
sudo apt-get install make gcc build-essential protobuf-compiler clang cmake jq -y
Rust installation
Installation script for current user, official page.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Add Rust enviroments to .bash_profile
echo . '$HOME'/.cargo/env >> $HOME/.bash_profile
source $HOME/.bash_profile
Build binary from sources
Create directory for used binary add it to PATH
mkdir $HOME/bin
echo export PATH='$PATH':$HOME/bin >> $HOME/.bash_profile
source $HOME/.bash_profile
Clone OG repo and build
cd ~
git clone https://github.com/0glabs/0g-storage-kv.git
cd 0g-storage-node
git fetch --all --tags
git checkout v1.2.0
git submodule update --init
cargo build --release
Copy binary to ~/bin:
cp $HOME/0g-storage-kv/target/release/zgs_kv $HOME/bin/
Node configuration
Create working directory for storage node, copy configuration file:
mkdir $HOME/.zgs_kv
cp $HOME/0g-storage-kv/run/* $HOME/.zgs_kv
cd $HOME/.zgs_kv
cp config_example.toml config.toml
Edit config file
You need to make some changes to $HOME/.zgs_kv/config.toml file:
nano $HOME/.zgs_kv/config.toml
Set configuration values for standard mode:
blockchain_rpc_endpoint = <your-consensus-node-evm-rpc>
log_contract_address = "0x0460aA47b41a66694c0a73f667a1b795A5ED3556"
log_sync_start_block_number = 595059
The default configuration assumes that storage node is running on the same server. If you run storage node on another server, specify the path to its rpc. Сhange the following parameter:
zgs_node_urls = "http://127.0.0.1:5678,http://127.0.0.1:5679"
If you want to change the KV RPC port change the parameter:
rpc_listen_address = "0.0.0.0:6789"
Firewall settings
Open kv rpc port if you need access from the outside:
sudo ufw allow 6789
Run node
You can run node (for test purpose) in terminal with command:
cd $HOME/.zgs_kv
zgs_kv --config $HOME/.zgs_kv/config.toml
Run node as service
Create service file:
tee $HOME/zgs_kvd.service > /dev/null <<EOF
[Unit]
Description=0G-StorageKV Node
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/.zgs_kv
ExecStart=$HOME/bin/zgs_kv --config $HOME/.zgs_kv/config.toml
Restart=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Init daemon with simlink:
sudo ln -s $HOME/zgs_kvd.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable zgs_kvd
Run node:
sudo systemctl start zgs_kvd
Checking
Show node logs:
journalctl -u zgs_kvd -o cat -f
Best regards and Good luck with your installation!❤️👍
Pro-Nodes75 team📡🗻