Skip to main content
An agent is any client that pays x402-gated endpoints. On a 402, it signs a TransferFactory_Transfer, attaches it as proof, and retries automatically. The facilitator relays it and pays the traffic fee, so you never pay gas. See How Payments Work for the full flow.

Quickstart

CANTON_AGENT_NETWORK defaults to canton:testnet. Set it to canton:mainnet for mainnet, or a testnet wallet hitting the mainnet facilitator fails with a network mismatch.

CLI reference

All commands read the relay from CANTON_AGENT_RELAY_URL (or --relay-url). For POST bodies (e.g. LLM inference), use makePayingFetch from the SDK instead of pay.

SDK usage

Registry tokens (e.g. USDCx)

The wallet handles CIP-56 registry tokens alongside CC, with two safe-by-default opt-ins:
  • Receive: trust a token’s registrar with CANTON_AGENT_REGISTRY_TRUSTED_PARTIES (USDCx is built in). Untrusted registrars’ transfers are skipped by claim.
  • Spend: consent with CANTON_AGENT_PAYABLE_INSTRUMENTS="<registrar>::1220...|USDCx" (default: CC only), so a merchant cannot make you pay in a token you did not opt into.
pay needs no --admin/--id - the instrument comes from the merchant’s 402; you only opt in to spending it.

Reference

Environment variables Wallet file - ~/.canton-agent/wallet.json, mode 0600, holds the Ed25519 key and party id. Back it up; losing it loses the funds it holds. First-request latency - the first payment after a cold start warms the SV Scan caches (AmuletRules 5 min TTL, OpenMiningRound 30 s TTL); subsequent payments typically complete in 10 to 25 seconds on mainnet.