{"record":{"id":"343e52613dc0669f","repo":"affaan-m/ECC","slug":"trading-wallet-private-key-not-set","errorCode":null,"errorMessage":"TRADING_WALLET_PRIVATE_KEY not set","messagePattern":"TRADING_WALLET_PRIVATE_KEY not set","errorType":"exception","errorClass":"EnvironmentError","httpStatus":null,"severity":"error","filePath":"skills/llm-trading-agent-security/SKILL.md","lineNumber":120,"sourceCode":"\n        if self.hour_start_value <= 0:\n            self.halt(\"Invalid hour_start_value\")\n            return\n\n        hourly_pnl = (portfolio_value - self.hour_start_value) / self.hour_start_value\n        if hourly_pnl < -self.MAX_HOURLY_LOSS_PCT:\n            self.halt(f\"Hourly PnL {hourly_pnl:.1%} below threshold\")\n```\n\n### Wallet isolation\n\n```python\nimport os\nfrom eth_account import Account\n\nprivate_key = os.environ.get(\"TRADING_WALLET_PRIVATE_KEY\")\nif not private_key:\n    raise EnvironmentError(\"TRADING_WALLET_PRIVATE_KEY not set\")\n\naccount = Account.from_key(private_key)\n```\n\nUse a dedicated hot wallet with only the required session funds. Never point the agent at a primary treasury wallet.\n\n### MEV and deadline protection\n\n```python\nimport time\n\nPRIVATE_RPC = \"https://rpc.flashbots.net\"\nMAX_SLIPPAGE_BPS = {\"stable\": 10, \"volatile\": 50}\ndeadline = int(time.time()) + 60\n```\n\n## Pre-Deploy Checklist\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/llm-trading-agent-security/SKILL.md#L102-L138","documentation":"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.","triggerScenarios":"Thrown at skills/llm-trading-agent-security/SKILL.md:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Load the key from a secret manager or .env excluded from git","Use a dedicated hot wallet funded only with trading capital","Validate required secrets at process start and fail fast"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d8409a4b0813771235555e32e3d8046a73988bfa","analyzedAt":"2026-08-26T12:15:34.022Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}