Running a Node is a Commitment, but If You Can't Afford It, There's No Need!
Rewards Are Not Guaranteed π― #DYOR
π’ Let's Explore
Let's seeπ
π Which VPS should I use? π How do I install it?
π Which VPS should I use? π I recommend purchasing the Contabo VPS-3 or VPS-4 as these are perfect for running this node.
π VPS (Virtual Private Server) π You can buy it from: πΆ Contabo (Use the link below if you have a Credit or Debit Card) π· Link: Contabo If not, use VPSDIME: πΆ VPSDIME (Pay with Crypto) π· Link: VPSDIME
β‘ Purchase the suitable VPS and then access your VPS using a MOBILE SSH App (if you're on iPhone/Android) or use Putty (PC).
π How do I install it?
π Storage Node Deployment Guide π πΆ Install Rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
πΆ Set variables:
INPUT YOUR OWN JSON-RPC ENDPOINT (http://yourvpsip:8545/) OR USE THIS ENDPOINT: https://rpc-testnet.0g.ai/ read -p "Enter json-rpc: " BLOCKCHAIN_RPC_ENDPOINT && echo "Current json-rpc: $BLOCKCHAIN_RPC_ENDPOINT" && ENR_ADDRESS=$(wget -qO- eth0.me) echo "export ENR_ADDRESS=${ENR_ADDRESS}" >> ~/.bash_profile echo 'export ZGS_LOG_DIR="$HOME/0g-storage-node/run/log"' >> ~/.bash_profile echo 'export ZGS_LOG_SYNC_BLOCK="802"' >> ~/.bash_profile echo 'export LOG_CONTRACT_ADDRESS="0x8873cc79c5b3b5666535C825205C9a128B1D75F1"' >> ~/.bash_profile echo 'export MINE_CONTRACT="0x85F6722319538A805ED5733c5F4882d96F1C7384"' >> ~/.bash_profile echo "export BLOCKCHAIN_RPC_ENDPOINT=\"$BLOCKCHAIN_RPC_ENDPOINT\"" >> ~/.bash_profile source ~/.bash_profile echo -e "\n\033[31mCHECK YOUR STORAGE NODE VARIABLES\033[0m\n\nLOG_CONTRACT_ADDRESS: $LOG_CONTRACT_ADDRESS\nMINE_CONTRACT: $MINE_CONTRACT\nZGS_LOG_SYNC_BLOCK: $ZGS_LOG_SYNC_BLOCK\nBLOCKCHAIN_RPC_ENDPOINT: $BLOCKCHAIN_RPC_ENDPOINT\n\n"
π Verify the JSON-RPC sync to ensure itβs at the latest block:
curl -s -X POST $BLOCKCHAIN_RPC_ENDPOINT -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq -r '.result' | xargs printf "%d\n"
πΆ Download binary:
cd $HOME git clone https://github.com/0glabs/0g-storage-node.git cd $HOME/0g-storage-node git fetch git checkout tags/v0.3.3 --force git submodule update --init sudo apt install cargo cargo build --release
πΆ Export wallet private key:
0gchaind keys unsafe-export-eth-key $WALLET
πΆ Save your private key in a variable:
read -sp "Enter your private key: " PRIVATE_KEY && echo
πΆ Update node configuration:
sed -i ' s|^miner_key = ""|miner_key = "'"$PRIVATE_KEY"'"| s|^\s*#\?\s*network_dir\s*=.*|network_dir = "network"| s|^\s*#\?\s*network_enr_address\s*=.*|network_enr_address = "'"$ENR_ADDRESS"'"| s|^\s*#\?\s*network_enr_tcp_port\s*=.*|network_enr_tcp_port = 1234| s|^\s*#\?\s*network_enr_udp_port\s*=.*|network_enr_udp_port = 1234| s|^\s*#\s*watch_loop_wait_time_ms\s*=.*|watch_loop_wait_time_ms = 1000| s|^\s*#\?\s*network_libp2p_port\s*=.*|network_libp2p_port = 1234| s|^\s*#\?\s*network_discovery_port\s*=.*|network_discovery_port = 1234| s|^\s*#\s*rpc_listen_address\s*=.*|rpc_listen_address = "0.0.0.0:5678"| s|^\s*#\s*rpc_listen_address_admin\s*=.*|rpc_listen_address_admin = "0.0.0.0:5679"| s|^\s*#\?\s*rpc_enabled\s*=.*|rpc_enabled = true| s|^\s*#\?\s*db_dir\s*=.*|db_dir = "db"| s|^\s*#\?\s*log_config_file\s*=.*|log_config_file = "log_config"| s|^\s*#\?\s*log_directory\s*=.*|log_directory = "log"| s|^\s*#\?\s*network_boot_nodes\s*=.*|network_boot_nodes = \["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/18.167.69.68/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]| s|^\s*#\?\s*log_contract_address\s*=.*|log_contract_address = "'"$LOG_CONTRACT_ADDRESS"'"| s|^\s*#\?\s*mine_contract_address\s*=.*|mine_contract_address = "'"$MINE_CONTRACT"'"| s|^\s*#\?\s*log_sync_start_block_number\s*=.*|log_sync_start_block_number = '"$ZGS_LOG_SYNC_BLOCK"'| s|^\s*#\?\s*blockchain_rpc_endpoint\s*=.*|blockchain_rpc_endpoint = "'"$BLOCKCHAIN_RPC_ENDPOINT"'"| ' $HOME/0g-storage-node/run/config.toml
πΆ Create service:
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF [Unit] Description=ZGS Node After=network.target [Service] User=$USER WorkingDirectory=$HOME/0g-storage-node/run ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config.toml Restart=on-failure RestartSec=10 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF
πΆ Start the Node:
sudo systemctl daemon-reload && \ sudo systemctl enable zgs && \ sudo systemctl start zgs && \ sudo systemctl status zgs
πΆ Check full logs:
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
πΆ tx_seq-only logs:
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep tx_seq:
π Wait until it syncs to the latest tx_seq number on the OG Storage Scan π· Link: Storage Scan
Useful commands:
πΆ Delete the Storage-node:
sudo systemctl stop zgs sudo systemctl disable zgs sudo rm /etc/systemd/system/zgs.service rm -rf $HOME/0g-storage-node