Create a Solana wallet, fund it with USDC, and configure x402 for your agent.
DocketLayer queries are paid in USDC on Solana — $0.99 per query, settled on-chain via x402. Before your agent can make its first paid request, its wallet needs a USDC balance.
For agents that operate autonomously, generate a wallet programmatically. The private key is stored as an environment variable and the agent signs transactions automatically.
import { Keypair } from "@solana/web3.js";// Run once — save the output securelyconst wallet = Keypair.generate();console.log("Public key:", wallet.publicKey.toBase58());console.log("Secret key:", Buffer.from(wallet.secretKey).toString("base64"));
Each query costs $0.99 in USDC on Solana. Options for funding:Buy USDC on an exchange — Purchase on Coinbase or Kraken and withdraw to your Solana wallet address. When withdrawing, confirm you select the Solana network — not Ethereum or any other chain.Swap SOL to USDC — Use Jupiter to swap SOL or any Solana token to USDC directly in your wallet.Verify your balance at Solana Explorer by searching your wallet’s public address.
A depleted wallet causes all queries to fail. Check your balance programmatically and alert when it falls below a threshold:
from solana.rpc.api import Clientfrom spl.token.client import Tokendef get_usdc_balance(wallet_address): # USDC mint address on Solana mainnet USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" # Use Solana Explorer or your preferred RPC to check balance passbalance = get_usdc_balance(os.environ["SOLANA_PUBLIC_KEY"])if balance < 10: send_alert("Wallet balance low — refund before next cycle")