Skip to content

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 ​


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 Now

Transparent. Secure. Built by AstroStake, for the community.

Important Information ​

Smart Contract Addresses ​

ContractAddress
Staking Contract0xea224dBB52F57752044c0C86aD50930091F561B9

Network Details ​

ParameterValue
RPC URLhttps://evmrpc-testnet.0g.ai
Chain ID16601
Native TokenOG (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

Install Required Tools ​

Install foundry: ​

bash
curl -L https://foundry.paradigm.xyz | bash
foundryup

Verify installation: ​

bash
cast --help

Install additional tools: ​

bash
sudo apt update && sudo apt install -y jq curl

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 ​

bash
HOMEDIR=$HOME/.0gchaind/galileo/0g-home/0gchaind-home
CHAIN_SPEC=devnet

0gchaind deposit validator-keys --home $HOMEDIR --chaincfg.chain-spec=$CHAIN_SPEC

Note: Save the output 48-byte hex public key. You'll need it for the next steps.


2. Compute Validator Contract Address ​

bash
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.ai

Note: This returns your validator contract address. Save it for the next steps.


3. Generate Validator Signature ​

bash
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_SPEC

Note: Save both the pubkey and signature from 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 key

Commission rate: 5% (in basis points: 5 * 10000), withdrawal fee: 1 Gwei


5. Verify Registration ​

bash
cast call $STAKING_CONTRACT "getValidator(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.ai

If 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 ​

bash
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 ​

bash
cast call $VALIDATOR "getDelegation(address)(address,uint)" $YOUR_WALLET_ADDRESS --rpc-url https://evmrpc-testnet.0g.ai

āš ļø CUSTOMIZE: Replace $YOUR_WALLET_ADDRESS with your actual wallet address

Returns your validator address and number of shares held.


3. Undelegate from Validator ​

bash
# 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 address
  • 100 → Number of shares to undelegate
  • $YOUR_PRIVATE_KEY → Your wallet private key

4. Withdraw Commission (Validator Only) ​

bash
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:

solidity
address validator = staking.createValidator(pubkey);

DelegationBelowMinimum ​

Problem: Delegated amount is below minimum requirement

Solution: Check minimum delegation amount:

solidity
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:

solidity
uint96 fee = validator.withdrawalFeeInGwei();
validator.undelegate{value: fee * 1 gwei}(recipient, shares);

Useful Commands ​

Check validator status: ​

bash
cast call $STAKING_CONTRACT "getValidator(bytes)(address)" $PUBKEY --rpc-url https://evmrpc-testnet.0g.ai

Check total delegated tokens: ​

bash
cast call $VALIDATOR "tokens()(uint256)" --rpc-url https://evmrpc-testnet.0g.ai

Check validator commission rate: ​

bash
cast call $VALIDATOR "commissionRateInBasisPoints()(uint32)" --rpc-url https://evmrpc-testnet.0g.ai

šŸ“š Resources ​


Built by Node Runners. For the networks we believe in. šŸ›°ļø