0G Galileo Validator & Staking Guide
This guide includes everything you need to register as a validator and participate in staking on the 0G Galileo testnet. Brought to you by AstroStake 🚀
Contents
- Important Information
- Prerequisites & Installation
- ⚡ One Script to Rule Them All
- Create Validator
- Delegate & Undelegate
- Tips & Troubleshooting
- Resources
Stake via Web with AstroStake
Prefer UI over CLI?
Explore all active validators, view delegation history, and stake directly from your browser — all in one place.
Stake NowTransparent. Secure. Built by AstroStake, for the community.
Important Information
Smart Contract Addresses
| Contract | Address |
|---|---|
| Staking Contract | 0xea224dBB52F57752044c0C86aD50930091F561B9 |
Network Details
| Parameter | Value |
|---|---|
| RPC URL | https://evmrpc-testnet.0g.ai |
| Chain ID | 16601 |
| Native Token | OG (testnet ETH) |
Minimum Requirements
- Validator Staking: 32 OG minimum
- Delegation: Check contract for current minimum
- Withdrawal Fee: 1 Gwei (set by validator)
- Commission Rate: Customizable (example: 5% = 50000)
Prerequisites & Installation
System Requirements
- Fully synced Galileo node
- 32+ OG (testnet ETH) available for staking
- Directory structure (AstroStake format):
- Node path:
$HOME/.0gchaind/galileo - Home:
$HOME/.0gchaind/galileo/0g-home/0gchaind-home
- Node path:
Install Required Tools
Install foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryupVerify installation:
cast --helpInstall additional tools:
sudo apt update && sudo apt install -y jq curl⚡ One Script to Rule Them All
Feeling lazy? Good. You should be.
This one-liner handles all the heavy lifting:
- Generate validator keys
- Compute validator address
- Register on-chain
- Delegate, undelegate, and verify info
bash <(wget -qO- https://raw.githubusercontent.com/astrostake/scripts/refs/heads/main/0g-labs/staking-interfaces.sh)⚠️ Before you run this script:
Make sure you’ve exported your private key:bashexport ETH_PRIVATE_KEY=0xYOUR_PRIVATE_KEYThis is required to sign transactions during validator creation and staking.
Don't forget to clear it afterwards:bashunset ETH_PRIVATE_KEYThis helps prevent your private key from lingering in your shell session.
Create Validator
This section will help you register as a validator on the 0G Galileo testnet using the 0gchaind tooling and staking smart contracts. It assumes your node is already synced and running.
1. Generate Validator Keys
HOMEDIR=$HOME/.0gchaind/galileo/0g-home/0gchaind-home
CHAIN_SPEC=devnet
0gchaind deposit validator-keys --home $HOMEDIR --chaincfg.chain-spec=$CHAIN_SPECNote: Save the output 48-byte hex public key. You'll need it for the next steps.
2. Compute Validator Contract Address
STAKING_CONTRACT=0xea224dBB52F57752044c0C86aD50930091F561B9
PUBKEY=0xYOUR_PUBLIC_KEY # Replace with your actual public key from step 1
cast call $STAKING_CONTRACT "computeValidatorAddress(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.aiNote: This returns your validator contract address. Save it for the next steps.
3. Generate Validator Signature
VALIDATOR_CONTRACT=0xYOUR_VALIDATOR_ADDRESS # Replace with address from step 2
AMOUNT_GWEI=32000000000 # 32 ETH
0gchaind deposit create-validator $VALIDATOR_CONTRACT $AMOUNT_GWEI $HOMEDIR/config/genesis.json --home $HOMEDIR --chaincfg.chain-spec=$CHAIN_SPECNote: Save both the
pubkeyandsignaturefrom the output. You'll need them for registration.
4. Register Validator On-chain
Create Validator
Configuration:
Generated Code:
Loading...⚠️ CUSTOMIZE THESE VALUES:
"Moniker"→ Your validator name"Identity"→ Your keybase ID"Website"→ Your website URL"Contact"→ Your contact email"Details"→ Your validator description$PUBKEY→ Your public key from step 1$SIGNATURE→ Your signature from step 3$YOUR_PRIVATE_KEY→ Your wallet private keyCommission rate: 5% (in basis points: 5 * 10000), withdrawal fee: 1 Gwei
5. Verify Registration
cast call $STAKING_CONTRACT "getValidator(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.aiIf your validator address appears, you're successfully registered! 🎉
Delegate & Undelegate
Guide to delegate OG tokens to a validator and undelegate later using the 0G Galileo staking contract.
1. Delegate to a Validator
STAKING_CONTRACT=0xea224dBB52F57752044c0C86aD50930091F561B9
PUBKEY=0xYOUR_VALIDATOR_PUBKEY # Replace with target validator's public key
AMOUNT=1ether # Replace with amount you want to delegate
# Get validator contract address
VALIDATOR=$(cast call $STAKING_CONTRACT "getValidator(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.ai)
# Delegate
cast send $VALIDATOR "delegate(address)" $YOUR_WALLET_ADDRESS \
--value $AMOUNT \
--rpc-url https://evmrpc-testnet.0g.ai \
--private-key $YOUR_PRIVATE_KEY⚠️ CUSTOMIZE THESE VALUES:
$PUBKEY→ Public key of the validator you want to delegate to$AMOUNT→ Amount to delegate (e.g., 1ether, 5ether)$YOUR_WALLET_ADDRESS→ Your wallet address$YOUR_PRIVATE_KEY→ Your wallet private key
2. Check Delegation Status
cast call $VALIDATOR "getDelegation(address)(address,uint)" $YOUR_WALLET_ADDRESS --rpc-url https://evmrpc-testnet.0g.ai⚠️ CUSTOMIZE: Replace
$YOUR_WALLET_ADDRESSwith your actual wallet address
Returns your validator address and number of shares held.
3. Undelegate from Validator
# Get withdrawal fee
FEE_GWEI=$(cast call $VALIDATOR "withdrawalFeeInGwei()(uint96)" --rpc-url https://evmrpc-testnet.0g.ai)
FEE=$(cast to-wei $FEE_GWEI gwei)
# Undelegate (e.g. 100 shares)
cast send $VALIDATOR "undelegate(address,uint256)" $YOUR_WALLET_ADDRESS 100 \
--value $FEE \
--rpc-url https://evmrpc-testnet.0g.ai \
--private-key $YOUR_PRIVATE_KEY⚠️ CUSTOMIZE THESE VALUES:
$YOUR_WALLET_ADDRESS→ Your wallet address100→ Number of shares to undelegate$YOUR_PRIVATE_KEY→ Your wallet private key
4. Withdraw Commission (Validator Only)
cast send $VALIDATOR "withdrawCommission(address)" $YOUR_ADDRESS \
--rpc-url https://evmrpc-testnet.0g.ai \
--private-key $YOUR_PRIVATE_KEY⚠️ CUSTOMIZE THESE VALUES:
$YOUR_ADDRESS→ Your wallet address to receive commission$YOUR_PRIVATE_KEY→ Your wallet private key
ℹ️ Important Notes
- Undelegation Delay: There's a waiting period before withdrawal is available
- Token Calculation:
tokens()returns total delegated tokens (including rewards) - Share Supply:
delegatorShares()returns total share supply - Fees: Always check withdrawal fees before undelegating
Tips & Troubleshooting
⚠️ Common Issues
Validator not found
Problem: Your validator hasn't been created or registered on-chain
Solution: Ensure you've completed all steps in the "Create Validator" section:
address validator = staking.createValidator(pubkey);DelegationBelowMinimum
Problem: Delegated amount is below minimum requirement
Solution: Check minimum delegation amount:
uint96 minDelegation = staking.effectiveDelegationInGwei();
require(msg.value >= minDelegation * 1 gwei, "Insufficient delegation");NotEnoughWithdrawalFee
Problem: Insufficient withdrawal fee provided
Solution: Always include the correct withdrawal fee:
uint96 fee = validator.withdrawalFeeInGwei();
validator.undelegate{value: fee * 1 gwei}(recipient, shares);Useful Commands
Check validator status:
cast call $STAKING_CONTRACT "getValidator(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.aiCheck total delegated tokens:
cast call $VALIDATOR "tokens()(uint256)" --rpc-url https://evmrpc-testnet.0g.aiCheck validator commission rate:
cast call $VALIDATOR "commissionRateInBasisPoints()(uint32)" --rpc-url https://evmrpc-testnet.0g.ai📚 Resources
- Official 0G Docs
- Staking Contracts on GitHub
- 0G Discord
- Foundry Documentation
- AstroStake Validator Status
- AstroStake Endpoints Status
Built by Node Runners. For the networks we believe in. 🛰️