USDC wallet for AI agents on Base with x402 payment protocol support.
This skill interacts with real blockchain assets. Every precaution is taken.
RuleStatusPrivate key from env var only✅ WALLET_PRIVATE_KEY / .envPrivate key never logged✅ Zero logging of key materialPayments need explicit --confirm✅ Double security gateAddress separate from key✅ WALLET_ADDRESS for read-only mode
bash
export WALLET_ADDRESS=0x...
export WALLET_NETWORK=base-sepolia
node wallet.mjs balance
bash
npm install viem
export WALLET_PRIVATE_KEY=0x... # your wallet key (keep secret!)
export WALLET_ADDRESS=0x... # derived from key, or set manually
export WALLET_NETWORK=base-sepolia # or "base" for mainnet
node wallet.mjs pay <url> --confirm
CommandRequiresDescriptionbalanceWALLET_ADDRESSCheck USDC + ETH balancestatusWALLET_ADDRESSShow wallet config (safe)pay <url>+ PRIVATE_KEY + --confirmPay x402 resource
text
agent-wallet/
├── SKILL.md ← Usage docs
├── package.json ← Zero deps (viem optional for Phase 2)
├── .env.example ← Config template
├── wallet.mjs ← CLI entry point
└── lib/
├── core.mjs ← Core wallet (native fetch RPC, no deps)
├── crypto.mjs ← EIP-3009 signing (viem-powered)
└── x402-client.mjs ← x402 payment protocol client
NetworkChain IDRPCExplorerBase8453mainnet.base.orgbasescan.orgBase Sepolia84532sepolia.base.orgsepolia.basescan.org
javascript
import { getWallet, getBalances } from './lib/core.mjs';
// Read-only — safe
const wallet = await getWallet();
const { eth, usdc } = await getBalances(wallet);
// Payments (requires viem)
const { payX402 } = await import('./lib/x402-client.mjs');
const result = await payX402(url, privateKey, { confirm: true });