The web3-wallet-worker is the on-chain gateway of the Hoox trading ecosystem. Running as an isolated private micro-worker, this service is responsible for securely managing EVM mnemonics and private keys (bound as encrypted Workers Secrets), querying multi-chain gas limits and token balances, executing native/ERC-20 transfers, and signing smart contract swap payloads (e.g. Uniswap/1inch routers) via JSON-RPC providers.
⚡ 1. Declared Wrangler Configurations & Bindings
The web3-wallet-worker does not expose a public URL, communicating internally via V8 Service Bindings. Its wrangler.jsonc specifies:
🔑 2. Environmental Variables & Encrypted Secrets
WALLET_PK_SECRET: Encrypted private key used for single-account execution.
WALLET_MNEMONIC_SECRET: Encrypted 12 or 24-word HD wallet seed phrase used to derive multiple accounts.
RPC_PROVIDER_URL: High-availability HTTP Ethereum / EVM RPC provider (e.g., Infura, Alchemy, or QuickNode).
INTERNAL_KEY_BINDING: Shared key used to validate calls from internal compute nodes.
Local Development Mocking (.dev.vars)
🔌 3. Internal REST API Specification
Note: For the canonical endpoint directory with full request/response examples across all workers, see /docs/devops/api/endpoints.
A. Execute On-Chain Transaction
- Endpoint:
/process
- Method:
POST
- Headers:
X-Internal-Auth-Key: <INTERNAL_KEY_BINDING>
- JSON Payload:
- Success Response (200 OK):
B. Query Token Balance
- Endpoint:
/process
- Method:
POST
- JSON Payload:
- Success Response (200 OK):
🛡️ 4. On-Chain Security Best Practices
Operating hot wallets on public blockchain networks introduces extreme security vectors:
- Harden Private Keys: Never write keys to wrangler config files or print them in telemetry logs. Always provision keys via encrypted Cloudflare Secrets.
- Gas Price Limit Traps: To prevent severe loss during network congestion or flash crashes, the worker enforces a gas limit trap—if current network gas price exceeds your KV configured limit (
web3:max_gas_price_gwei), transactions are dropped before signing to prevent massive fee consumption.
- Isolate Access: All calls must originate internally via Service Bindings. The wallet worker does not bind to public ports, meaning external scrapers cannot send raw transaction payloads or try to brute-force auth codes.
Testing on-chain logic locally? Use the Docker runtime stack (hoox dev start --runtime docker) to launch an isolated Hardhat/Anvil node container and test
private wallet swaps on a simulated local EVM fork safely!
🔗 Next Steps