# Run All Fixes - Complete Command List

**Issue**: Web3Signer error when sending transaction

## Execute All Commands

Copy and paste this entire block:

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138

echo "═══════════════════════════════════════════════════════════════"
echo "🔧 RUNNING ALL FIXES"
echo "═══════════════════════════════════════════════════════════════"
echo ""

# Step 1: Check Web3Signer keys
echo "Step 1: Checking Web3Signer keys..."
KEYS=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys)
KEY_COUNT=$(echo "$KEYS" | jq '. | length' 2>/dev/null || echo "0")
echo "  Found $KEY_COUNT key(s) in Web3Signer"
if [ "$KEY_COUNT" -gt 0 ]; then
    echo "  Keys:"
    echo "$KEYS" | jq -r '.[]' | while read addr; do
        echo "    - $addr"
    done
fi

# Step 2: Check if address has key
echo ""
echo "Step 2: Checking if address has key..."
ADDRESS="0x71e81eaec98e507f68bbcf5e2005f179db851603"
if echo "$KEYS" | jq -r '.[]' | grep -qi "$(echo $ADDRESS | tr '[:upper:]' '[:lower:]')"; then
    echo "  ✅ Address has key in Web3Signer"
    HAS_KEY=true
else
    echo "  ❌ Address does NOT have key in Web3Signer"
    HAS_KEY=false
fi

# Step 3: Fix allowlist
echo ""
echo "Step 3: Fixing allowlist..."
if [ "$HAS_KEY" = "false" ]; then
    echo "  Removing address from allowlist (user wallet - signs locally)"
    WEB3SIGNER_ADDRESSES=$(echo "$KEYS" | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')
    if [ -n "$WEB3SIGNER_ADDRESSES" ] && [ "$WEB3SIGNER_ADDRESSES" != "" ]; then
        echo "  Updating allowlist to only include Web3Signer keys: $WEB3SIGNER_ADDRESSES"
        ./scripts/configure-wallet-allowlist.sh "$WEB3SIGNER_ADDRESSES"
    else
        echo "  No Web3Signer keys - clearing allowlist"
        ./scripts/configure-wallet-allowlist.sh ""
    fi
else
    echo "  Address has key - keeping in allowlist"
    echo "  Issue may be with transaction format - check logs"
fi

# Step 4: Verify
echo ""
echo "Step 4: Verifying configuration..."
echo "  Web3Signer keys: $KEY_COUNT"
echo "  Allowlist on translators:"
for IP in 192.168.11.240 192.168.11.241 192.168.11.242; do
    ALLOWLIST=$(ssh -i ~/.ssh/proxmox_translator root@$IP "grep '^WALLET_ALLOWLIST=' /opt/rpc-translator-138/.env | cut -d'=' -f2-" 2>&1 || echo "")
    echo "    $IP: $ALLOWLIST"
done

echo ""
echo "═══════════════════════════════════════════════════════════════"
echo "✅ ALL FIXES COMPLETE"
echo "═══════════════════════════════════════════════════════════════"
```

## Or Use the Script

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/fix-web3signer-allowlist-mismatch.sh
```

---

**This will automatically:**
1. Check what keys are in Web3Signer
2. Check if the address has a key
3. Update allowlist to only include addresses with keys
4. Verify the configuration
