telegramStorage KV Setup

Official documentation

Setting Up a Storage KV Node

Update packages and Install dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make gcc tar clang pkg-config libssl-dev ncdu cmake -y

Install :

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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
go version

Install rust:

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

Download the source code:

cd $HOME
rm -rf 0g-storage-kv
git clone -b v1.4.0-testnet https://github.com/0glabs/0g-storage-kv.git 

Build the source code:

cd 0g-storage-kv
git submodule update --init --recursive
cargo build --release

Copy the config_example.toml to config.toml and update the parameters:

cp $HOME/0g-storage-kv/run/config_example.toml $HOME/0g-storage-kv/run/config.toml
nano $HOME/0g-storage-kv/run/config.toml

Replace this:

#######################################################################
###                     Log Sync Config Options                     ###
#######################################################################

blockchain_rpc_endpoint = "https://evmrpc-testnet.0g.ai"
log_contract_address = "0xbD75117F80b4E22698D0Cd7612d92BDb8eaff628"
log_sync_start_block_number = 326165

Create Service file:

sudo tee /etc/systemd/system/0gkv.service > /dev/null <<EOF
[Unit]
Description=0G-KV Node
After=network.target

[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-kv/run
ExecStart=$HOME/0g-storage-kv/target/release/zgs_kv --config $HOME/0g-storage-kv/run/config.toml
Restart=always
RestartSec=10
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal
SyslogIdentifier=zgs_kv

[Install]
WantedBy=multi-user.target
EOF

Enable and start service:

sudo systemctl daemon-reload && \
sudo systemctl enable 0gkv && \
sudo systemctl start 0gkv && \
sudo systemctl status 0gkv

Check logs:

sudo journalctl -u 0gkv -f -o cat

Stop service and delete node

sudo systemctl stop 0gkv
sudo systemctl disable 0gkv
sudo rm /etc/systemd/system/0gkv.service
rm -rf $HOME/0g-storage-kv
Copyright © 2025 ITRocket. All Rights Reserved.