# Complete Key Loading Instructions

**Status**: Ready to execute  
**Last Updated**: 2026-01-05

---

## Quick Start

### Option 1: Automated (Recommended)

**From your local machine:**

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

# Step 1: Generate keys
./scripts/generate-and-load-keys.sh 3 TestWallet123!

# Step 2: Copy keys to Proxmox host
scp /tmp/web3signer-keys/keystore-*.json root@ml110:/tmp/web3signer-keys/

# Step 3: Load keys into Web3Signer (from Proxmox host)
ssh root@ml110 'bash -s' < scripts/load-keys-complete.sh

# Step 4: Verify keys loaded
curl http://192.168.11.111:9000/api/v1/eth1/publicKeys

# Step 5: Configure allowlist
ADDRESSES=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')
./scripts/configure-wallet-allowlist.sh "$ADDRESSES"
```

### Option 2: Manual Step-by-Step

**1. Generate Keys:**
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/generate-and-load-keys.sh 3 TestWallet123!
```

**2. Copy to Proxmox Host:**
```bash
scp /tmp/web3signer-keys/keystore-*.json root@ml110:/tmp/web3signer-keys/
```

**3. SSH to Proxmox Host:**
```bash
ssh root@ml110
```

**4. Load Keys into Web3Signer Container:**
```bash
# Create directory
pct exec 107 -- mkdir -p /opt/web3signer/data/keys

# Copy keys
pct push 107 /tmp/web3signer-keys/keystore-test-1.json /opt/web3signer/data/keys/
pct push 107 /tmp/web3signer-keys/keystore-test-2.json /opt/web3signer/data/keys/
pct push 107 /tmp/web3signer-keys/keystore-test-3.json /opt/web3signer/data/keys/

# Set permissions
pct exec 107 -- chmod 644 /opt/web3signer/data/keys/*.json

# Restart Web3Signer
pct exec 107 -- systemctl restart web3signer

# Wait a few seconds
sleep 5

# Verify
pct exec 107 -- curl -s http://localhost:9000/api/v1/eth1/publicKeys
```

**5. Exit Proxmox Host:**
```bash
exit
```

**6. Configure Allowlist (from local machine):**
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
ADDRESSES=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')
./scripts/configure-wallet-allowlist.sh "$ADDRESSES"
```

---

## Verification

### Check Keys Are Loaded

```bash
curl http://192.168.11.111:9000/api/v1/eth1/publicKeys
```

**Expected output:**
```json
[
  "0x306290a09aefe8e7009c4fbd2662e1ee075255dc",
  "0x74b9ed9d5f37211128aec5b6de8ef5bb2762c68f",
  "0x7be3046f456a106d2ff8999ce90359dfc4c52f4c"
]
```

### Check Web3Signer Health

```bash
curl http://192.168.11.111:9000/upcheck
```

Should return: `OK`

### Check Translator Allowlist

```bash
ssh -i ~/.ssh/proxmox_translator root@192.168.11.240 "grep WALLET_ALLOWLIST /opt/rpc-translator-138/.env"
```

---

## Troubleshooting

### Keys Not Loading

1. **Check Web3Signer logs:**
   ```bash
   ssh root@ml110 "pct exec 107 -- journalctl -u web3signer.service -n 50"
   ```

2. **Verify files exist in container:**
   ```bash
   ssh root@ml110 "pct exec 107 -- ls -la /opt/web3signer/data/keys/"
   ```

3. **Check file format:**
   ```bash
   ssh root@ml110 "pct exec 107 -- cat /opt/web3signer/data/keys/keystore-test-1.json | jq ."
   ```

4. **Verify Web3Signer is running:**
   ```bash
   ssh root@ml110 "pct exec 107 -- systemctl status web3signer.service"
   ```

### Service Not Starting

```bash
ssh root@ml110 "pct exec 107 -- journalctl -u web3signer.service -n 100"
```

Common issues:
- Invalid keystore format
- Missing permissions
- Web3Signer not reading keys directory

---

## Scripts Created

1. **`scripts/generate-and-load-keys.sh`** - Generate keystore files
2. **`scripts/load-keys-complete.sh`** - Load keys into Web3Signer (run from Proxmox host)
3. **`scripts/verify-keys-loaded.sh`** - Verify keys are loaded

---

## Summary

✅ **Scripts created and ready**  
✅ **Instructions documented**  
⏳ **Ready for execution**

**Next**: Run the commands above to complete key loading.
