agent-crypto-wallet
v1.0.0
Published
Cryptocurrency wallet system for AI agents. Secure storage and management of Bitcoin (BTC), USDT (ERC20/TRC20), and USDC (Base). Payments between agents via x402 protocol, trading on major exchanges (Binance, Coinbase), and non-custodial MPC wallet operat
Downloads
101
Maintainers
Readme
Agent Crypto Wallet
Cryptocurrency wallet system for AI agents. Enables secure storage and management of Bitcoin (BTC), USDT (ERC20/TRC20), and USDC (Base), with support for agent-to-agent payments via x402 protocol and trading on major exchanges.
Features
- Multi-Chain Support: Bitcoin, Ethereum, Base, and TRON networks
- Secure Storage: AES-256-GCM encryption for all credentials
- MPC Wallets: Non-custodial key management via Coinbase CDP
- Agent Payments: x402 protocol for seamless agent-to-agent transactions
- Exchange Trading: Trade on Binance and Coinbase
- HD Wallets: BIP39/BIP44 hierarchical deterministic wallets
- OpenClaw Integration: Ready-to-use skill for OpenClaw agents
Installation
npm install -g agent-crypto-walletQuick Start
Initialize Wallet
import AgentWallet from 'agent-crypto-wallet';
// Create or load wallet
const wallet = new AgentWallet({
agentId: 'my-agent',
mpc: { provider: 'cdp' }
});
// Initialize with existing wallet or generate new
await wallet.initialize({
password: 'secure-password',
generateSeed: true // Set to false to load existing
});Check Balances
// Get all addresses
const addresses = wallet.getAllAddresses();
console.log(addresses);
// { bitcoin: 'bc1q...', ethereum: '0x...', base: '0x...', tron: 'T...' }
// Get balance for specific asset
const btcBalance = await wallet.getBalance('BTC');
console.log(`BTC: ${btcBalance}`);Send Payments
// Send payment via x402 protocol
await wallet.sendPayment({
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '100',
asset: 'USDC-Base',
protocol: 'x402'
});
// Send native payment
await wallet.sendPayment({
to: 'bc1q...',
amount: '0.001',
asset: 'BTC',
protocol: 'native'
});Trade on Exchanges
// Buy BTC on Binance
await wallet.createOrder({
exchange: 'binance',
symbol: 'BTC/USDT',
side: 'buy',
amount: 0.001,
type: 'market'
});
// Sell on Coinbase
await wallet.createOrder({
exchange: 'coinbase',
symbol: 'BTC-USD',
side: 'sell',
amount: 0.001,
type: 'limit',
price: 45000
});Configuration
Environment Variables
# MPC Wallet (Coinbase CDP)
COINBASE_CDP_API_KEY=your_api_key
COINBASE_CDP_API_SECRET=your_secret
# Exchange APIs
BINANCE_API_KEY=your_key
BINANCE_API_SECRET=your_secret
COINBASE_API_KEY=your_key
COINBASE_API_SECRET=your_secret
# Node URLs (optional)
ETHEREUM_NODE=https://eth-mainnet.alchemyapi.io/v2/YOUR_KEY
BASE_NODE=https://mainnet.base.org
TRON_NODE=https://api.trongrid.ioSupported Assets
| Asset | Network | Address | |-------|---------|---------| | BTC | Bitcoin | Native | | USDT | Ethereum (ERC20) | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | | USDT | TRON (TRC20) | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | | USDC | Base | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
OpenClaw Skill Usage
After installation, the wallet skill is automatically registered with OpenClaw. Use these commands:
"Initialize my crypto wallet"
"Show my wallet addresses"
"Check my BTC balance"
"Send 100 USDC to 0x742d..."
"Buy 0.001 BTC on Binance"Security
- Encryption: All credentials encrypted with AES-256-GCM
- MPC Support: Multi-party computation for enhanced security
- Key Storage: Private keys never stored in plain text
- Sandboxed: All wallet operations run in isolated context
API Reference
AgentWallet
Constructor
new AgentWallet(options)Options:
agentId(string): Unique identifier for the agentmpc.provider(string): MPC provider ('cdp' or 'agentpayy')mpc.enabled(boolean): Enable MPC wallet (default: true)
Methods
initialize(options)
Initialize the wallet.
Options:
password(string, required): Encryption passwordseedPhrase(string, optional): Existing seed phrasegenerateSeed(boolean, optional): Generate new seed (default: false)forceNew(boolean, optional): Create new wallet even if exists
getAddress(chain)
Get address for specific chain.
Parameters:
chain(string): 'bitcoin', 'ethereum', 'base', 'tron'
getBalance(asset)
Get balance for specific asset.
Parameters:
asset(string): 'BTC', 'USDT-ERC20', 'USDT-TRC20', 'USDC-Base'
sendPayment(params)
Send payment to another address.
Parameters:
to(string, required): Recipient addressamount(string|number, required): Amount to sendasset(string, required): Asset to sendprotocol(string): 'x402' or 'native' (default: 'x402')
createOrder(params)
Create trading order on exchange.
Parameters:
exchange(string, required): 'binance' or 'coinbase'symbol(string, required): Trading pair (e.g., 'BTC/USDT')side(string, required): 'buy' or 'sell'amount(number, required): Order amounttype(string): 'market' or 'limit' (default: 'market')price(number): Required for limit orders
Development
# Clone repository
git clone https://github.com/clawfin/agent-crypto-wallet.git
cd agent-crypto-wallet
# Install dependencies
npm install
# Run tests
npm test
# Link for local development
npm linkLicense
MIT
Contributing
Contributions welcome! Please read our contributing guidelines.
Support
- GitHub Issues: https://github.com/clawfin/agent-crypto-wallet/issues
- Documentation: https://github.com/clawfin/agent-crypto-wallet/wiki
