base-wallet
? Crypto wallet for AI agents. Create wallets, sign messages, send transactions — no browser needed.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- base-wallet
- description
- ? Crypto wallet for AI agents. Create wallets, sign messages, send transactions — no browser needed.
02 资源文件 6
- 参考文档_meta.json273 B
- 参考文档package.json414 B
- 参考文档references/basemail-api.md2.4 KB
- 脚本scripts/basemail-register.js6.0 KB
- 脚本scripts/check-balance.js1.9 KB
- 脚本scripts/create-wallet.js6.6 KB
03 SKILL.md 正文
? Base Wallet — Crypto Identity for AI Agents
Create. Sign. Transact. No human needed.
TL;DR: Programmatic wallet creation on Base/Ethereum. SIWE auth, balance checks, transactions.
Create and manage Base chain (Ethereum-compatible) wallets programmatically.
⚠️ Security First
| ✅ DO | ❌ DON'T |
|---|---|
| Use environment variables for private keys | Store private keys in plain text files |
| Set wallet files to chmod 600 | Commit wallet files to git |
Use --env mode (recommended) |
Use console.log(privateKey) |
| Back up mnemonics offline | Share private keys or mnemonics |
Quick Start
Create a New Wallet (Recommended)
# Output as environment variable format (safest)
node scripts/create-wallet.js --env
# Output example:
# export WALLET_ADDRESS="0x..."
# export PRIVATE_KEY="0x..."
Then copy to your shell or .env file.
Create with File Storage (Opt-in)
# Only if you need file-based storage
node scripts/create-wallet.js --managed my-agent
⚠️ This stores private key in ~/.openclaw/wallets/my-agent.json
Usage Examples
Load Wallet from Environment
const { ethers } = require('ethers');
// ✅ SECURE: Load from environment variable
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
console.log('Address:', wallet.address);
// ❌ NEVER: console.log('Private Key:', wallet.privateKey);
Load from Mnemonic
const wallet = ethers.Wallet.fromPhrase(process.env.MNEMONIC);
Check Balance
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const balance = await provider.getBalance(wallet.address);
console.log('Balance:', ethers.formatEther(balance), 'ETH');
Sign Message (SIWE)
const message = `example.com wants you to sign in with your Ethereum account:
${wallet.address}
Sign in message
URI: https://example.com
Version: 1
Chain ID: 8453
Nonce: ${nonce}
Issued At: ${new Date().toISOString()}`;
const signature = await wallet.signMessage(message);
Send Transaction
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const connectedWallet = wallet.connect(provider);
const tx = await connectedWallet.sendTransaction({
to: recipientAddress,
value: ethers.parseEther('0.001')
});
const receipt = await tx.wait();
console.log('TX Hash:', tx.hash);
Scripts
| Script | Description |
|---|---|
create-wallet.js --env |
Create wallet, output as env vars (recommended) |
create-wallet.js --managed [name] |
Create wallet, save to file (opt-in) |
create-wallet.js --json |
Create wallet, output as JSON |
basemail-register.js [name] |
Register for BaseMail email |
check-balance.js [address] |
Check wallet balance |
BaseMail Integration
Register for a @basemail.ai email using your wallet signature.
# If using environment variable:
PRIVATE_KEY="0x..." node scripts/basemail-register.js
# If using managed wallet:
node scripts/basemail-register.js my-agent
Network Configuration
| Network | Chain ID | RPC URL |
|---|---|---|
| Base Mainnet | 8453 | https://mainnet.base.org |
| Base Sepolia | 84532 | https://sepolia.base.org |
? Audit Logging
Operations are logged to ~/.base-wallet/audit.log.
Secure Storage Pattern
// ✅ Recommended: Use environment variables
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error('PRIVATE_KEY environment variable not set');
}
const wallet = new ethers.Wallet(privateKey);
// ❌ Avoid: Storing private keys in code or files
If you must store to file (not recommended):
const fs = require('fs');
const path = require('path');
// Store with restricted permissions
const filepath = path.join(process.env.HOME, '.openclaw', 'wallets', 'wallet.json');
fs.writeFileSync(filepath, JSON.stringify({
address: wallet.address,
// Only store if absolutely necessary
privateKey: wallet.privateKey
}), { mode: 0o600 }); // Owner read/write only
.gitignore
Add to your project's .gitignore:
# Wallet files - NEVER commit!
.openclaw/
*.wallet.json
*.mnemonic
private-key*
Dependencies
npm install ethers
Changelog
v1.1.0 (2026-02-08)
- ? Security: Changed create-wallet.js to opt-in file storage
- ✨ Added --env mode (recommended)
- ? Added audit logging
- ⚠️ Removed console.log(privateKey) from examples
- ? Enhanced security documentation
v1.0.0
- ? Initial release
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.