Skip to main content
These flows are actively being refined. Crossmint’s customer success engineers (CSE) will work with you to review your architecture. Contact Crossmint to get started.

Overview

A stablecoin wallet gives your agent the ability to hold USDC and make onchain payments, including x402 payments, direct stablecoin transfers, and other crypto-native transactions. The wallet is non-custodial: the agent generates a keypair and holds the private key in its own runtime environment. Only the public key is registered with Crossmint as the wallet’s admin signer. Funding the wallet is done through the Crossmint onramp or by sending USDC directly to your address.

What This Enables

Once a wallet is created and funded, your agent can:
  • Hold stablecoins (USDC) across Solana, EVM chains, and Stellar
  • Make x402 payments to x402-enabled APIs and services
  • Send stablecoin transfers to other wallets
  • Pay for Crossmint Checkout orders using onchain payment methods

Prerequisites

  • A Crossmint developer account
  • A server-side API key with the scopes: wallets.create, wallets.read, wallets.fund, wallets:balance.read, wallets:transactions.create, wallets:transactions.sign, wallets:transactions.read

Integration Steps

1

Generate a keypair for the agent

Each agent needs its own keypair. The public key (address) will be registered as the wallet’s admin signer, while the private key stays in the agent’s runtime.
Generating and storing raw keypairs requires careful key management and is not recommended for production. Contact the Crossmint CSE team for a production-ready setup.
import { ethers } from "ethers";

const agentWallet = ethers.Wallet.createRandom();

console.log("Address:", agentWallet.address);
console.log("Private key:", agentWallet.privateKey);

// Store the private key in a secrets manager or encrypted environment variable.
// Never commit it to source code or expose it to client-side code.
2

Create the wallet with the agent's key as external signer

Use the public key from the previous step to create a Crossmint smart wallet. The agent’s key is registered as an external wallet signer, giving it control over the wallet without Crossmint ever having access to the private key.
import {
    CrossmintWallets,
    createCrossmint,
} from "@crossmint/wallets-sdk";

const crossmint = createCrossmint({
    apiKey: process.env.CROSSMINT_SERVER_API_KEY,
});
const crossmintWallets = CrossmintWallets.from(crossmint);

const wallet = await crossmintWallets.createWallet({
    chain: "base-sepolia",
    signer: {
        type: "external-wallet",
        address: agentWallet.address, // public key from Step 1
    },
});

console.log("Wallet address:", wallet.address);