Try the live demo
See the full flow in action without setting anything up locally.
Stablecoin Wallet Quickstart
Explore the full reference implementation for user wallets, server signers, and USDXM transfers.
Prerequisites
- Node.js 20+ and pnpm
Setup
Clone the repo and install dependencies
You can ask your agent to walk you through the setup to run this quickstart.
Configure environment variables
Copy the example file. You’ll fill in the values in the next steps.
.env.local
Get Crossmint staging API keys
Sign in to the Crossmint Staging Console and create a project. Then in Project Settings → API keys, create:
- A client-side key → paste into
NEXT_PUBLIC_CROSSMINT_CLIENT_API_KEY. - A server-side key → paste into
CROSSMINT_SERVER_SIDE_API_KEY.
Generate a signer secret
The agent’s server signer uses a 32-byte secret that never leaves your backend. Generate one and paste it into
CROSSMINT_SIGNER_SECRET. Both raw 64-char hex and the prefixed xmsk1_<64-hex> format are accepted.Run the dev server
Understanding the user flow
Once running, the app walks the user through four steps on Base Sepolia:- Authenticate. Sign in with email OTP or Google via
CrossmintAuthProvider. Crossmint issues a user JWT that scopes every subsequent SDK call to the signed-in user. - Get a wallet.
CrossmintWalletProvideris configured withcreateOnLogin={{ chain: "base-sepolia", recovery: { type: "email" } }}, so a non-custodial smart wallet is created on first login with the user’s email as the recovery signer. The address appears as soon asuseWallet()resolves. - Authorize the agent. Clicking Authorize your agent calls
wallet.addSigner({ type: "server", secret }, { prepareOnly: true })from your backend, then the user approves the pending registration with a one-time email code. From here on, the server signer can sign for the wallet without any user prompt. - Fund and send.
wallet.stagingFund(5)mints 5 USDXM into the wallet (staging-only). A server action then activates the server signer withwallet.useSigner({ type: "server", secret })and callswallet.send(recipient, "usdxm", amount)— signed entirely on your backend. This is how an agent spends from a user’s wallet in production.
Next Steps
Using the Wallet
Send stablecoins, swap, bridge, and call any contract from your agent.
x402
HTTP-native micropayments — pay-per-call APIs and machine-to-machine settlement.
Remove Agent Access
Revoke an agent’s signer from a user’s wallet.

