Quickstart
Get an AI agent sending USDC in under 5 minutes.
Prerequisites
- A Bithaven account — sign up here
- USDC on Base in an external wallet (for deposits)
- Node.js 18+ and TypeScript
1. Create an Agent Wallet
After signing up, go to your dashboard and create an agent wallet. Give it a label like "My First Agent".
2. Fund the Wallet
Deposit USDC to your master wallet address (shown on the dashboard). Once confirmed, use the "Fund" button to allocate USDC from your master wallet to the agent wallet.
3. Generate an API Key
On the agent wallet detail page, click "Generate API Key". Copy the key — it starts with bh_live_ and is only shown once.
4. Install the SDK
npm install @bithaven/mcp-sdk5. Send Your First Payment
import { BithavenClient } from '@bithaven/mcp-sdk';
const client = new BithavenClient({
apiKey: 'bh_live_your_key_here',
});
// Check balance
const balance = await client.checkBalance();
console.log(`Balance: ${balance.balance} ${balance.currency}`);
// Send USDC
const tx = await client.sendPayment({
toAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD68',
amount: '5.00',
memo: 'API credits',
});
console.log(`Sent! TX hash: ${tx.txHash}`);6. Set a Policy (Optional)
From the dashboard, add a spending policy to the agent wallet:
- Daily spend cap — e.g., $50/day
- Total spend cap — e.g., $500 lifetime
- Address whitelist — only allow transfers to approved addresses
Transactions that violate policy are automatically blocked. The agent receives a PolicyDeniedError with details about which rule was violated.