This tutorial walks through setting up an AI agent (e.g., OpenClaw or any framework) with its own USDC-backed smart token vault on BitBadges. The agent gets a wallet, a vault with configurable rules, and the ability to withdraw funds programmatically.
Architecture Overview
Your AI Agent (OpenClaw, etc.)
β
βββ Wallet (Cosmos or EVM key pair)
β
βββ BitBadges Smart Token Vault
βββ 1:1 USDC backing
βββ Spending rules (limits, whitelists, etc.)
βββ Withdraw via MsgTransferTokens
The agent holds vault tokens. To spend, it withdraws (unbacking) tokens back to USDC by sending a MsgTransferTokens to the vault's backing address. The vault rules (daily limits, recipient whitelists, 2FA thresholds, etc.) are enforced at the protocol level.
Step 1: Create the Vault (Website)
Go to the BitBadges website Create tab and select Smart Token.
Configure a 1:1 USDC-backed smart token
Add your custom rules (spending limits, recipient whitelists, time gates, etc.)
Optionally check AI Agent Vault to enable the AI Prompt tab on the token view page
Submit the transaction to create the collection
After creation, note your Collection ID - you'll need it for the agent.
Step 2: Set Up the Agent Wallet
Your AI agent needs a wallet to sign transactions. You can use either a Cosmos (mnemonic) or EVM (private key) approach.
Option A: Cosmos Wallet (Recommended for Server-Side)
Generate a mnemonic and derive a BitBadges address:
Option B: Cosmos Wallet from Private Key
Option C: EVM Wallet
If your agent framework already manages an EVM key:
Fund the Wallet
The agent address needs a small amount of $BADGE for gas fees. Transfer some from your main wallet, or use the testnet faucet if testing:
Deposit USDC into the Vault
Transfer USDC to the vault's backing address, then mint vault tokens to the agent's address. This is the deposit (backing) operation - see the AI Prompt tab on your token's page for the exact transaction format with your vault's specific approval IDs and versions.
Step 3: Understand Vault Rules
Your vault's transferability rules determine what the agent can and can't do. These are enforced at the protocol level - the agent cannot bypass them regardless of what code it runs.
Reading Rules Programmatically
Common Rule Types
Rule
What It Does
Protocol Enforcement
Daily spending limit
Caps total amount per day
approvalAmounts with resetTimeIntervals
Recipient whitelist
Only approved addresses
toListId pointing to an address list
Transaction rate limit
Max N transfers per period
maxNumTransfers with resetTimeIntervals
2FA for large amounts
Human approval above threshold
ETH signature challenges or external checks
Emergency freeze
Halt all activity
Locked canUpdateCollectionApprovals permission
Using the AI Prompt Tab
If you checked "AI Agent Vault" when creating your token, the token view page on BitBadges has an AI Prompt tab. This generates a ready-to-use prompt containing:
Collection ID and token name
Backing address
Denomination (USDC)
Exact approval IDs and versions for deposit/withdraw
Step-by-step deposit and withdraw instructions
Copy this prompt and provide it to your AI agent as part of its system instructions or context.
Step 4: Withdraw from the Vault (Spending)
Withdrawing converts vault tokens back to USDC. The agent sends its vault tokens to the backing address, and the protocol releases equivalent USDC to the agent's account.
Building the Withdraw Transaction
Signing and Broadcasting
Depositing Back (Backing)
To deposit USDC back into the vault, the direction is reversed - transfer from the backing address to your address:
Step 5: Integrate with Your Agent Framework
Wire the wallet and vault operations into your AI agent's tool set. The specifics depend on your framework (OpenClaw, LangChain, custom, etc.).
Example: Expose as Agent Tools
Providing Context to the Agent
Give your agent the prompt from the AI Prompt tab (Step 3) as part of its system context. This tells the agent what vault it has access to, what the rules are, and how to construct transactions.
Key Concepts Summary
Concept
Details
Vault tokens
Smart tokens backed 1:1 by USDC. Agent holds these.
Backing address
Protocol-controlled escrow. Holds the actual USDC.
Withdraw (unback)
Send vault tokens TO backing address -> receive USDC
Deposit (back)
Transfer FROM backing address to your address -> receive vault tokens
Rules
Encoded in collectionApprovals. Protocol-enforced, not bypassable.
Gas
Agent needs $BADGE for tx fees (separate from USDC vault balance)