agent-wallet-security
Skill8 starsChanged 9 months agoMITView on GitHub
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.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- sperax-skillsSkill
- ai-agent-defi-guideSkill
- airdrop-hunting-guideSkill
- arbitrum-defi-guideSkill
- chainlink-oracle-guideSkill
- cross-chain-bridge-guideSkill
- crypto-governance-guideSkill
- crypto-market-sentimentSkill
- crypto-news-aggregationSkill
- crypto-portfolio-managementSkill
- crypto-price-data-guideSkill
- crypto-tax-basicsSkill
- dca-strategy-guideSkill
- defi-dashboard-buildingSkill
- defi-lending-guideSkill
- defillama-analytics-guideSkill
- defi-risk-assessmentSkill
- defi-yield-strategiesSkill
- erc8004-agent-identitySkill
- gas-optimization-guideSkill
- impermanent-loss-explainedSkill
- mev-protection-guideSkill
- nft-analytics-guideSkill
- onchain-analytics-guideSkill
- plutus-plsassets-guideSkill
- plutus-protocol-overviewSkill
- plutus-vaults-guideSkill
- restaking-explainedSkill
- smart-contract-reading-guideSkill
- sperax-ecosystem-overviewSkill
- sperax-farms-guideSkill
- sperax-spa-stakingSkill
- sperax-usds-guideSkill
- stablecoin-mechanicsSkill
- subgraph-development-guideSkill
- token-approval-safetySkill
- token-discovery-guideSkill
- token-swap-best-practicesSkill
- web3-glossarySkill
- whale-watching-guideSkill
- yield-vault-guideSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
When AI agents interact with crypto wallets and DeFi protocols, security becomes critical.
- Distinctive: line 55
Recommendation: Keep agents at "Propose" level for most users.
- Distinctive: line 80
Always verify addresses against canonical sources:
- Distinctive: line 95
Use exact-amount approvals: when possible
- Distinctive: line 98
Check approvals at Revoke.cash: before large deposits
- Distinctive: line 147
Use a multisig wallet (Safe/Gnosis)
- Distinctive: line 164
Revoke the approval immediately: if it's an approve() call
- Distinctive: line 170
When assisting with wallet operations:
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 fundsAgent 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
- URL matches the official protocol domain exactly
- SSL certificate is valid and from expected issuer
- Contract address matches official deployment (check docs)
- Transaction details match your intent
- No unexpected approvals in the transaction
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
- Revoke.cash: https://revoke.cash
- Safe Multisig: https://safe.global
- Sperax (secure DeFi on Arbitrum): https://app.sperax.io
- ERC-8004 (on-chain agent identity): https://eips.ethereum.org/EIPS/eip-8004
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

