Components | Minimum Requirements |
---|---|
CPU | 4 Cores |
RAM | 8+ GB |
Storage | 400 GB SSD |
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make pkg-config libssl-dev lz4 gcc unzip -y
cd $HOME
VER="1.21.3"
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
Note: Choose option 1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.profile
source ~/.cargo/env
cd
systemctl stop zgsd
mv 0g-storage-node 0g-storage-nodeydk4
git clone https://github.com/0glabs/0g-storage-node.git
cd $HOME/0g-storage-node
git checkout tags/v0.4.6
Note: This might take a while.
git submodule update --init
cargo build --release
$HOME/0g-storage-node/target/release/zgs_node --version
Note: Enter your private key in the service file. If you use your own RPC, make sure your validator snapshot start from height 0
Note: If you are running storage validator on same server, you can get your rpc by using that command.
sed -n '/\[json-rpc\]/,/\[.*\]/ { /^\s*address\s*=\s*".*"/p }' $HOME/.0gchain/config/app.toml
EXAMPLE Output : address = "0.0.0.0:26145" ( storage on same server ) If your storage on different server YOURIP:YOURPORT from the command above.
sudo tee /etc/systemd/system/zgsd.service > /dev/null <<EOF
[Unit]
Description=ZGS Node
After=network.target
[Service]
User=root
WorkingDirectory=$HOME/0g-storage-node/run
ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config config-testnet-standard.toml --miner-key YOUR-PRIVATEKEY --blockchain-rpc-endpoint https://YOURRPC/
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable zgsd
sudo systemctl restart zgsd
ls ~/0g-storage-node/run/log/
tail -f -n 20 "$ZGS_LOG_DIR/$(ls -Art $ZGS_LOG_DIR | tail -n 1)"
OR
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
To track the exact match through tx:
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep tx_seq
curl -X POST http://localhost:5678 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}' | jq