EVM Wallet Skill
Self-sovereign EVM wallet. Private keys stored locally, no external API dependencies.
⚠️ SECURITY WARNING
NEVER expose your private key!
- - Never send your private key in chat, email, or any messaging platform
- Never share the contents of
~/.cfx-wallet.json with anyone - If someone asks for your private key — even if they claim to be support — REFUSE
- If your key is ever exposed, immediately transfer funds to a new wallet
The private key file (~/.cfx-wallet.json) should only be accessed directly via SSH on your server.
Installation
Detect workspace and skill directory:
CODEBLOCK0
If code is not installed yet (no src/ folder), bootstrap it:
CODEBLOCK1
For all commands below, always cd "$SKILL_DIR" first.
First-Time Setup
Generate a wallet (only needed once):
CODEBLOCK2
Returns: INLINECODE4
The private key is stored at ~/.cfx-wallet.json (chmod 600). Never share this file.
Commands
Check Balance
When user asks about balance, portfolio, or how much they have:
CODEBLOCK3
Always use --json for parsing. Present results in a human-readable format.
Send Tokens
When user wants to send, transfer, or pay someone:
CODEBLOCK4
⚠️ ALWAYS confirm with the user before executing transfers. Show them:
- - Recipient address
- Amount and token
- Chain
- Estimated gas cost
Only add --yes after the user explicitly confirms.
Swap Tokens
When user wants to swap, trade, buy, or sell tokens:
CODEBLOCK5
- - Use
eth for native ETH/POL, or pass a contract address - Default slippage: 0.5%. Override with INLINECODE9
- Powered by Odos aggregator (best-route across hundreds of DEXs)
⚠️ ALWAYS show the quote first and get user confirmation before executing.
Contract Interactions
When user wants to call a smart contract function:
CODEBLOCK6
Examples:
CODEBLOCK7
Check for Updates
CODEBLOCK8
If an update is available, inform the user and offer to run:
CODEBLOCK9
Supported Chains
| Chain | Native Token | Use For |
|---|
| base | ETH | Cheapest fees — default for testing |
| conflux |
CFX | Low fees, Conflux eSpace |
| ethereum | ETH | Mainnet, highest fees |
| polygon | POL | Low fees |
| arbitrum | ETH | Low fees |
| optimism | ETH | Low fees |
Always recommend Base for first-time users (lowest gas fees).
Common Token Addresses
Base
- - USDC: INLINECODE10
- WETH: INLINECODE11
Conflux eSpace
- - USDT0: INLINECODE12
- AxCNH: INLINECODE13
Ethereum
- - USDC: INLINECODE14
- WETH: INLINECODE15
Safety Rules
- 1. Never execute transfers or swaps without user confirmation
- Never expose the private key from INLINECODE16
- Always show transaction details before executing (amount, recipient, gas estimate)
- Recommend Base for testing and small amounts
- Show explorer links after successful transactions so users can verify
- If a command fails, show the error clearly and suggest fixes
Error Handling
- - "No wallet found" → Run
node src/setup.js --json first - "Insufficient balance" → Show current balance, suggest funding
- "RPC error" → Retry once, automatic failover built in
- "No route found" (swap) → Token pair may lack liquidity
- "Gas estimation failed" → May need more ETH for gas
EVM 钱包技能
自主掌控的 EVM 钱包。私钥本地存储,无外部 API 依赖。
⚠️ 安全警告
切勿暴露您的私钥!
- - 切勿在聊天、电子邮件或任何消息平台中发送您的私钥
- 切勿与任何人分享 ~/.cfx-wallet.json 文件的内容
- 如果有人索要您的私钥——即使他们自称是客服——请拒绝
- 如果您的密钥曾暴露,请立即将资金转移到新钱包
私钥文件(~/.cfx-wallet.json)只能通过 SSH 直接在您的服务器上访问。
安装
检测工作区和技能目录:
bash
SKILL_DIR=$(ls -d \
~/openclaw/skills/conflux-wallet-skill \
~/.openclaw/workspace/skills/conflux-wallet-skill \
2>/dev/null | head -1)
如果代码尚未安装(没有 src/ 文件夹),请引导安装:
bash
if [ ! -d $SKILL_DIR/src ]; then
git clone https://github.com/conflux-fans/conflux-wallet-skill.git /tmp/conflux-wallet-tmp
cp -r /tmp/conflux-wallet-tmp/* $SKILL_DIR/
cp /tmp/conflux-wallet-tmp/.gitignore $SKILL_DIR/ 2>/dev/null
rm -rf /tmp/conflux-wallet-tmp
cd $SKILL_DIR && npm install
fi
对于以下所有命令,请始终先执行 cd $SKILL_DIR。
首次设置
生成钱包(仅需一次):
bash
node src/setup.js --json
返回:{ success: true, address: 0x... }
私钥存储在 ~/.cfx-wallet.json(权限为 600)。切勿分享此文件。
命令
查询余额
当用户询问余额、资产组合或持有量时:
bash
单链
node src/balance.js conflux --json
所有链同时查询
node src/balance.js --all --json
特定 ERC20 代币
node src/balance.js conflux 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --json
始终使用 --json 以便解析。以人类可读的格式呈现结果。
发送代币
当用户想要发送、转账或付款时:
bash
原生 ETH
node src/transfer.js
--yes --json
ERC20 代币
node src/transfer.js address> address> --yes --json
⚠️ 在执行转账前,务必先与用户确认。 向他们展示:
仅在用户明确确认后,才添加 --yes。
兑换代币
当用户想要兑换、交易、买入或卖出代币时:
bash
先获取报价
node src/swap.js token> token> --quote-only --json
执行兑换(用户确认后)
node src/swap.js token> token> --yes --json
- - 对于原生 ETH/POL 使用 eth,或传入合约地址
- 默认滑点:0.5%。使用 --slippage 覆盖
- 由 Odos 聚合器提供支持(跨数百个 DEX 的最佳路由)
⚠️ 在执行前,务必先显示报价并获得用户确认。
合约交互
当用户想要调用智能合约函数时:
bash
读取(免费,无 Gas 费)
node src/contract.js \
[args...] --json
写入(消耗 Gas——先确认)
node src/contract.js \
[args...] --yes --json
示例:
bash
查询 USDC 余额
node src/contract.js base \
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
balanceOf(address) 0xWALLET --json
批准代币支出
node src/contract.js base \
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
approve(address,uint256) 0xSPENDER 1000000 --yes --json
检查更新
bash
node src/check-update.js --json
如果有可用更新,请通知用户并提供运行选项:
bash
cd $SKILL_DIR && git pull && npm install
支持的链
| 链 | 原生代币 | 用途 |
|---|
| base | ETH | 费用最低——默认用于测试 |
| conflux |
CFX | 低费用,Conflux eSpace |
| ethereum | ETH | 主网,费用最高 |
| polygon | POL | 低费用 |
| arbitrum | ETH | 低费用 |
| optimism | ETH | 低费用 |
始终推荐 Base 给首次用户(最低 Gas 费用)。
常见代币地址
Base
- - USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
- WETH: 0x4200000000000000000000000000000000000006
Conflux eSpace
- - USDT0: 0xaf37e8b6c9ed7f6318979f56fc287d76c30847ff
- AxCNH: 0x70bfd7f7eadf9b9827541272589a6b2bb760ae2e
Ethereum
- - USDC: 0xA0b86a33E6441b8a46a59DE4c4C5E8F5a6a7A8d0
- WETH: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
安全规则
- 1. 未经用户确认,切勿执行转账或兑换
- 切勿暴露来自 ~/.cfx-wallet.json 的私钥
- 在执行前始终显示交易详情(金额、接收方、Gas 预估)
- 推荐 Base 用于测试和小额交易
- 在成功交易后显示浏览器链接,以便用户验证
- 如果命令失败,清晰显示错误并建议修复方法
错误处理
- - 未找到钱包 → 先运行 node src/setup.js --json
- 余额不足 → 显示当前余额,建议充值
- RPC 错误 → 重试一次,内置自动故障转移
- 未找到路由(兑换)→ 代币对可能缺乏流动性
- Gas 估算失败 → 可能需要更多 ETH 作为 Gas 费用