# Run Fix Commands - Step by Step

**Date**: 2026-01-05  
**Issue**: Shell execution environment unavailable - run these commands manually

---

## 🚀 Execute These Commands

Copy and paste these commands into your terminal:

### Step 1: Fix Web3Signer Keys

```bash
# Fix permissions
ssh root@192.168.11.11 "pct exec 107 -- bash -c 'for f in /opt/web3signer/data/keys/*.json; do [ -f \"\$f\" ] && chmod 644 \"\$f\" && echo \"  ✅ \$(basename \$f)\"; done'"

# Restart Web3Signer
ssh root@192.168.11.11 "pct exec 107 -- systemctl restart web3signer && sleep 5"

# Verify keys loaded
sleep 3
curl http://192.168.11.111:9000/api/v1/eth1/publicKeys | jq '.'
```

**Expected**: JSON array with 3 addresses

### Step 2: Configure Wallet Allowlist

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

# Get addresses
ADDRESSES=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')

# Configure on all translators
./scripts/configure-wallet-allowlist.sh "$ADDRESSES"
```

**Expected**: Allowlist updated on all 3 translators

### Step 3: Restart Translator Services

```bash
# Restart all translator services
for IP in 192.168.11.240 192.168.11.241 192.168.11.242; do
    echo "Restarting $IP..."
    ssh -i ~/.ssh/proxmox_translator root@$IP "systemctl restart rpc-translator-138.service && sleep 3"
done
```

### Step 4: Verify All Services

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/monitor-services.sh
```

---

## 📋 All-in-One Command Block

Copy and paste this entire block:

```bash
#!/bin/bash
set -e

echo "═══════════════════════════════════════════════════════════════"
echo "🔧 FIXING ALL ISSUES"
echo "═══════════════════════════════════════════════════════════════"

# Step 1: Fix Web3Signer keys
echo ""
echo "Step 1: Fixing Web3Signer keys..."
ssh root@192.168.11.11 "pct exec 107 -- bash -c 'for f in /opt/web3signer/data/keys/*.json; do [ -f \"\$f\" ] && chmod 644 \"\$f\"; done'"
ssh root@192.168.11.11 "pct exec 107 -- systemctl restart web3signer && sleep 5"

# Step 2: Verify keys
echo ""
echo "Step 2: Verifying keys..."
sleep 3
KEYS=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys)
if [ "$KEYS" != "[]" ] && [ -n "$KEYS" ]; then
    KEY_COUNT=$(echo "$KEYS" | jq '. | length')
    echo "✅ $KEY_COUNT key(s) loaded!"
    ADDRESSES=$(echo "$KEYS" | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')
    echo "Addresses: $ADDRESSES"
else
    echo "⚠️  No keys loaded"
    exit 1
fi

# Step 3: Configure allowlist
echo ""
echo "Step 3: Configuring wallet allowlist..."
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/configure-wallet-allowlist.sh "$ADDRESSES"

# Step 4: Restart translators
echo ""
echo "Step 4: Restarting translator services..."
for IP in 192.168.11.240 192.168.11.241 192.168.11.242; do
    echo "  Restarting $IP..."
    ssh -i ~/.ssh/proxmox_translator root@$IP "systemctl restart rpc-translator-138.service && sleep 3"
done

# Step 5: Verify
echo ""
echo "Step 5: Verifying all services..."
./scripts/monitor-services.sh

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

---

## 🎯 Quick Reference

**Or run the script directly:**
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
bash scripts/fix-all-issues.sh
```

**If script doesn't work, use the step-by-step commands above.**

---

## ✅ Expected Results

After running all steps:

1. **Web3Signer**: 3 keys loaded
2. **Allowlist**: Configured on all 3 translators
3. **Services**: All active and healthy
4. **Health Checks**: All responding
5. **RPC Tests**: All passing

---

**Status**: Ready to execute - copy and paste the commands above!
