affaan-m/ECC · error · EnvironmentError

TRADING_WALLET_PRIVATE_KEY not set

Error message

TRADING_WALLET_PRIVATE_KEY not set

What it means

Illustrative guard from the llm-trading-agent-security skill: os.environ.get('TRADING_WALLET_PRIVATE_KEY') returned nothing at import/startup, so the trading account cannot be derived. This is a missing-configuration error — the dedicated wallet key was never provided to the environment.

Solutions

  1. Load the key from a secret manager or .env excluded from git
  2. Use a dedicated hot wallet funded only with trading capital
  3. Validate required secrets at process start and fail fast
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at skills/llm-trading-agent-security/SKILL.md:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@d8409a4b08 (2026-08-26). Data as JSON: /api/errors/343e52613dc0669f. Report an issue: GitHub.

Appendix: source

Thrown at skills/llm-trading-agent-security/SKILL.md:120

        if self.hour_start_value <= 0:
            self.halt("Invalid hour_start_value")
            return

        hourly_pnl = (portfolio_value - self.hour_start_value) / self.hour_start_value
        if hourly_pnl < -self.MAX_HOURLY_LOSS_PCT:
            self.halt(f"Hourly PnL {hourly_pnl:.1%} below threshold")
```

### Wallet isolation

```python
import os
from eth_account import Account

private_key = os.environ.get("TRADING_WALLET_PRIVATE_KEY")
if not private_key:
    raise EnvironmentError("TRADING_WALLET_PRIVATE_KEY not set")

account = Account.from_key(private_key)
```

Use a dedicated hot wallet with only the required session funds. Never point the agent at a primary treasury wallet.

### MEV and deadline protection

```python
import time

PRIVATE_RPC = "https://rpc.flashbots.net"
MAX_SLIPPAGE_BPS = {"stable": 10, "volatile": 50}
deadline = int(time.time()) + 60
```

## Pre-Deploy Checklist

View on GitHub (pinned to d8409a4b08)