# Load Web3Signer Keys - Instructions

**Status**: Keys need to be loaded into Web3Signer container (VMID 107)

---

## Quick Solution

Since SSH access to the Web3Signer container isn't configured, we'll use the Proxmox host (`pct`) to copy the keys.

### Option 1: Use pct from Proxmox Host (Recommended)

**Step 1: Generate keys (already done or run this):**
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/generate-test-keys.sh 3 TestWallet123!
```

This will create keystore files in a temporary directory. **Copy the file paths** shown at the end.

**Step 2: On Proxmox host (ml110 or r630-01), run:**
```bash
# Create keys directory in Web3Signer container
pct exec 107 -- mkdir -p /opt/web3signer/data/keys

# Copy keystore files (adjust paths as needed)
pct push 107 /path/to/keystore-test-1.json /opt/web3signer/data/keys/keystore-test-1.json
pct push 107 /path/to/keystore-test-2.json /opt/web3signer/data/keys/keystore-test-2.json
pct push 107 /path/to/keystore-test-3.json /opt/web3signer/data/keys/keystore-test-3.json

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

# Restart Web3Signer
pct exec 107 -- systemctl restart web3signer

# Wait a few seconds and verify
sleep 5
pct exec 107 -- curl -s http://localhost:9000/api/v1/eth1/publicKeys
```

### Option 2: Set up SSH to Web3Signer Container

**Step 1: Enable SSH in Web3Signer container:**
```bash
# From Proxmox host
pct exec 107 -- apt-get update
pct exec 107 -- apt-get install -y openssh-server
pct exec 107 -- systemctl enable ssh
pct exec 107 -- systemctl start ssh
pct exec 107 -- passwd root  # Set a password
```

**Step 2: Copy SSH key or use password:**
```bash
# From your local machine
ssh-copy-id root@192.168.11.111
# Or use password authentication
```

**Step 3: Use the automated script:**
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/setup-complete.sh 3 TestWallet123!
```

### Option 3: Manual Copy via Proxmox Console

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

2. **Copy keys to a shared location** (or scp to Proxmox host)

3. **Access Web3Signer container console:**
   - Via Proxmox web UI: VMID 107 → Console
   - Or: `pct enter 107`

4. **In the container console:**
   ```bash
   mkdir -p /opt/web3signer/data/keys
   # Copy keys here (or mount a volume)
   chmod 644 /opt/web3signer/data/keys/*.json
   systemctl restart web3signer
   curl http://localhost:9000/api/v1/eth1/publicKeys
   ```

---

## Verification

After loading keys, verify:

```bash
# Check keys are loaded
curl http://192.168.11.111:9000/api/v1/eth1/publicKeys

# Should return something like:
# [
#   "0x306290a09aefe8e7009c4fbd2662e1ee075255dc",
#   "0x74b9ed9d5f37211128aec5b6de8ef5bb2762c68f",
#   "0x7be3046f456a106d2ff8999ce90359dfc4c52f4c"
# ]

# Configure wallet allowlist
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/configure-wallet-allowlist.sh "0x306290a09aefe8e7009c4fbd2662e1ee075255dc,0x74b9ed9d5f37211128aec5b6de8ef5bb2762c68f,0x7be3046f456a106d2ff8999ce90359dfc4c52f4c"
```

---

## Troubleshooting

### Keys Not Loading

1. **Check Web3Signer logs:**
   ```bash
   pct exec 107 -- journalctl -u web3signer.service -n 50
   ```

2. **Verify file format:**
   ```bash
   pct exec 107 -- cat /opt/web3signer/data/keys/keystore-test-1.json | jq .
   ```

3. **Check permissions:**
   ```bash
   pct exec 107 -- ls -la /opt/web3signer/data/keys/
   ```

### Web3Signer Not Restarting

```bash
pct exec 107 -- systemctl status web3signer.service
pct exec 107 -- journalctl -u web3signer.service -n 100
```

---

## Next Steps After Loading Keys

1. ✅ **Get public keys** (addresses)
2. ✅ **Configure wallet allowlist** on all translator VMIDs
3. ✅ **Test transaction signing** via translator

Run:
```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/get-web3signer-public-keys.sh
./scripts/configure-wallet-allowlist.sh "<addresses>"
```

---

**Note**: The keys generated use password `TestWallet123!`. For production, use secure, randomly generated passwords and proper key management.
