#!/bin/bash
echo "🚀 MPCQ Validator Onboarding"
echo "Minimum: 16 CPU, 32GB RAM, 500GB NVMe, 100,000 MPCQ stake"
echo ""

read -p "Your validator moniker (name): " MONIKER
read -p "Your website (optional): " WEBSITE
read -p "Your identity/keybase (optional): " IDENTITY

# Find binary
BIN=$(which mpcqd 2>/dev/null || which evmd 2>/dev/null || find / -name "evmd" -type f 2>/dev/null | head -1)

if [ -z "$BIN" ]; then
    echo "❌ Binary not found. Please install mpcqd/evmd first."
    exit 1
fi

echo "✅ Using binary: $BIN"

# Create validator
$BIN tx staking create-validator \
  --amount=100000000000000000000000 \
  --pubkey=$($BIN tendermint show-validator) \
  --moniker="$MONIKER" \
  --website="$WEBSITE" \
  --identity="$IDENTITY" \
  --chain-id=262144 \
  --commission-rate="0.05" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --from=validator \
  --keyring-backend=test \
  --fees=200000ampcq \
  -y

echo ""
echo "✅ Validator creation submitted!"
echo "📊 Check status: $BIN q staking validator \$( $BIN keys show validator -a --keyring-backend=test )"
