Security Architecture
Agentic Wallet implements a defense-in-depth security model with multiple trust boundaries and protection layers. The system is designed to ensure that AI agents can execute blockchain transactions autonomously while maintaining strict security controls.Key Isolation
Private keys never leave the wallet-engine boundary
Policy Enforcement
All spend-capable intents pass policy evaluation
Gateway Protection
API key authentication, scopes, and rate limiting
Capability Governance
Agent permission controls and signed manifests
Trust Boundaries
The platform enforces strict trust boundaries at multiple layers:Agent Boundary
Agents operate in a zero-trust model for key material:- Agents never receive or hold private keys
- Agents emit high-level intents only (e.g., “transfer 0.1 SOL to address X”)
- Intent validation happens server-side before any signing occurs
- Agents cannot bypass the signing boundary
Signing Boundary
The wallet-engine service is the exclusive signing authority:- Private key material is isolated within the wallet-engine process
- Only wallet-engine can access key providers (encrypted-file, KMS, HSM, MPC)
- All transaction signing requests must go through the wallet-engine API
- No direct key access from other services or agents
services/wallet-engine/src/app.ts:67:
Policy Boundary
All spend-capable intents pass through policy evaluation before signing:Approval Gate (if needed)
Transaction pauses at
approval_gate status until operator approves/rejectsRead-only intents like
query_balance and query_positions skip the signing stage and confirm immediately.Protocol Boundary
The protocol-adapters service provides a safe abstraction layer:- Agents submit protocol-agnostic intents (e.g.,
swap,stake,create_escrow) - Protocol adapters translate intents into protocol-specific transactions
- Adapters handle complex DeFi interactions (Jupiter, Marinade, Solend, Orca, etc.)
- Unsafe operations are blocked at build time
Gateway Protections
The API gateway (apps/api-gateway) provides the first line of defense:
Authentication
API key-based authentication with configurable enforcement:- Each API key can be scoped to specific tenants
- Keys can have granular permission scopes (wallets, transactions, policies, agents, etc.)
- Missing or invalid keys result in
401 Unauthorized - Tenant mismatches result in
403 Forbidden
apps/api-gateway/src/index.ts:284:
Scope-Based Authorization
The gateway enforces granular scopes for different API surface areas:| Scope | Coverage |
|---|---|
wallets | Wallet creation, balance, token queries |
transactions | Transaction lifecycle operations |
policies | Policy creation, evaluation, versioning |
agents | Agent runtime, capabilities, manifests |
protocols | Protocol adapters, DeFi operations, escrow |
risk | Risk controls, chaos engineering |
strategy | Backtesting, paper trading |
treasury | Budget allocation, rebalancing |
audit | Audit events, metrics |
mcp | MCP tools endpoint |
all | Wildcard access to all scopes |
403 Forbidden with the missing scope name.
Rate Limiting
Per-API-key rate limiting prevents abuse:- Sliding window rate limiter tracks requests per API key
- Exceeding the limit returns
429 Too Many Requests - Rate limits reset every 60 seconds
- Separate counters maintained per API key
apps/api-gateway/src/index.ts:317:
Normalized Error Envelope
The gateway normalizes all responses into a machine-readable format:- Consistent error reporting across all services
- Deterministic stage tracking for debugging
- Trace IDs for request correlation
- Machine-parseable error codes for automation
Capability Governance
Agents are constrained by capability controls at multiple levels:Intent Allowlists
Each agent has an explicitallowedIntents array:
- Agents can only execute intents in their allowlist
- Attempts to execute disallowed intents are rejected at runtime
- Intent permissions can be updated via
PUT /api/v1/agents/:agentId/capabilities
Execution Modes
Agents operate in one of two modes:Autonomous Mode
Agent can execute allowed intents without human approval (subject to policy constraints)
Supervised Mode
All agent executions require human approval before signing
Signed Capability Manifests
For high-security environments, agents can be required to present signed capability manifests:- The agent-runtime verifies manifest signatures before execution
- Manifests have time-to-live (TTL) expiration
- Intent and protocol permissions are enforced at runtime
- Invalid or expired manifests result in execution rejection
Security Best Practices
Use Strong Encryption Secrets
Set a cryptographically random
WALLET_KEY_ENCRYPTION_SECRET for productionChoose Production Signer Backend
Use
kms, hsm, or mpc signer backends for production (not encrypted-file or memory)Threat Model
In Scope
- Compromised agent logic: Policy enforcement and capability controls limit blast radius
- API key theft: Rate limiting and scope constraints reduce impact
- Malicious intents: Policy engine evaluates all spend-capable intents
- Replay attacks: Idempotency keys prevent duplicate submissions
Out of Scope
- Host compromise: If the wallet-engine process is compromised, keys are at risk
- RPC manipulation: Agentic Wallet trusts the configured Solana RPC endpoints
- Smart contract vulnerabilities: Protocol adapter safety depends on upstream contracts
Recommended Production Hardening
- Host Isolation: Run wallet-engine in an isolated environment (separate container, VM, or network segment)
- Secret Management: Use external secret managers (AWS Secrets Manager, HashiCorp Vault) for sensitive environment variables
- Network Segmentation: Place wallet-engine behind a firewall, accessible only to transaction-engine
- Key Rotation: Implement periodic key rotation for KMS/HSM backends
- Audit Logging: Enable comprehensive audit logging and forward to a SIEM
- Webhook Alerts: Configure
AGENT_PAUSE_WEBHOOK_SECRETfor real-time breach notifications
Related Pages
Key Management
Private key storage, rotation, and signer backends
Policy Enforcement
Policy evaluation flow and rule types
Signer Backends
Encrypted-file, memory, KMS, HSM, and MPC options