| name | agent-wallet-security |
| description | Security best practices for AI agents handling cryptocurrency wallets — key management, transaction signing, approval hygiene, phishing detection, and operational security. Critical for any OpenClaw agent interacting with DeFi or managing wallet operations. |
| metadata | {"openclaw":{"emoji":"🔐"}} |
Agent Wallet Security Guide
When AI agents interact with crypto wallets and DeFi protocols, security becomes critical. This guide covers best practices for keeping user funds safe.
Threat Model
What Can Go Wrong
| Threat | Impact | Likelihood |
|---|
| Phishing (fake protocol) | Total fund loss | High |
| Unlimited approval exploit | Token drain | Medium |
| Transaction manipulation | Swap to wrong token/address | Medium |
| Private key exposure | Total fund loss | Low (with proper setup) |
| Social engineering | Unauthorized transactions | Medium |
| Smart contract exploit | Partial/total fund loss | Low-Medium |
Key Management
Wallet Architecture
Recommended setup for agent-assisted DeFi:
Cold Wallet (Hardware/Multisig)
└── Long-term storage (>80% of portfolio)
└── Never connected to DeFi directly
Hot Wallet (Browser/Mobile)
└── Active DeFi operations (<20% of portfolio)
└── Agent assists with transactions
└── Regular approval audits
Burner Wallet (Temporary)
└── Testing new protocols
└── Airdrop claims from unknown sources
└── Minimal funds
Agent Access Levels
| Level | What Agent Can Do | When to Use |
|---|
| Read-only | View balances, track positions | Portfolio monitoring |
| Quote | Get prices, simulate transactions | Trade planning |
| Propose | Build unsigned transactions | User signs manually |
| Execute | Submit signed transactions | Automated strategies |
Recommendation: Keep agents at "Propose" level for most users. User should always review and sign.
Transaction Safety
Before Every Transaction
- Verify recipient address — check first and last 4 characters
- Verify contract address — match against known protocol deployments
- Check transaction value — confirm amount matches intent
- Review function call — understand what the transaction does
- Check gas estimate — unusually high gas may indicate a revert
Red Flags
| Signal | Risk |
|---|
| Unknown contract address | Possible scam contract |
| Unusually high gas estimate | Transaction may fail |
| Approve for unlimited amount | Token drain if compromised |
| Redirect to unexpected domain | Phishing site |
| Urgent "act now" pressure | Social engineering |
| Token with transfer tax >5% | Likely honeypot/scam |
Address Verification
Always verify addresses against canonical sources:
| Protocol | Verification Source |
|---|
| Uniswap | Official docs + Etherscan verified |
| Aave | aave.com/developers |
| Sperax | docs.sperax.io |
| Any protocol | Verified contract on block explorer |
Never trust: Addresses from social media, DMs, or unverified sources.
Approval Management
Best Practices
- Use exact-amount approvals when possible
- Revoke unused approvals monthly
- Keep a separate DeFi wallet — don't approve from your main holdings
- Check approvals at Revoke.cash before large deposits
High-Risk Approval Patterns
- Approving a contract you've never interacted with
- Approving right after clicking a link (could be phishing)
- Approving permits (EIP-2612) — these happen off-chain and are harder to track
Phishing Detection
Common Phishing Vectors
| Vector | How It Works | Prevention |
|---|
| Fake DEX frontend | Clones real UI, sends funds to attacker | Bookmark real URLs |
| Fake airdrop claim | "Claim your tokens" → drains wallet | Verify on official channels |
| DNS hijacking | Real domain → attacker's server | Check SSL cert |
| Approval phishing | Sign a permit → attacker gets approval | Read what you sign |
| Address poisoning | Sends $0 from similar address | Verify full address |
Verification Checklist
Operational Security
For Agent Operators
- Never store private keys in agent config — use hardware wallets or secure key management
- Set transaction limits — cap the amount an agent can transact
- Use separate wallets — different wallets for storage vs DeFi
- Enable alerts — get notified of all transactions
- Regular audits — review agent activity and approval states
For Automated Strategies
- Whitelist contracts — agents should only interact with pre-approved contracts
- Set guards — maximum trade size, maximum slippage, minimum output
- Time delays — non-urgent transactions can wait for human review
- Kill switch — ability to immediately stop agent operation
- Logging — record all transactions for audit trail
Multi-Sig for High-Value Operations
For significant funds:
- Use a multisig wallet (Safe/Gnosis)
- Require 2+ signatures for large transactions
- Agent proposes → owners confirm
Emergency Response
If Wallet Is Compromised
- Immediately transfer remaining funds to a secure wallet
- Revoke all approvals from the compromised address
- Check transaction history for unauthorized activity
- Do NOT reuse the compromised wallet for anything
- Report the incident to relevant protocols
If You Signed a Malicious Transaction
- Check what was approved — use Etherscan/Revoke.cash
- Revoke the approval immediately if it's an approve() call
- Move tokens to a new wallet if the approval is for unlimited amount
- Time is critical — act within minutes
Agent Tips
When assisting with wallet operations:
- Always verify addresses — never trust addresses from conversation context alone
- Warn before approvals — explain what the user is granting access to
- Recommend hardware wallets for amounts >$5K
- Never ask for seed phrases or private keys — legitimate tools never need them
- Suggest Arbitrum for routine DeFi — low gas means less cost per security measure
Links