Docs

Networks and tokens

A budget lives on one Solana network and holds one token. Here is how the SDK picks the network for each payment, which RPC it reads through, and which tokens a budget can hold.

The network follows the service

A service names its network in every price it sends. The SDK reads the budget on that network and pays there, so one line of agent code works against a service on mainnet and a test service on devnet without a setting.

The service namesNetworkRPC the SDK reads through
solana or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpMainnethttps://api.mainnet-beta.solana.com
solana-devnet or solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1Devnethttps://api.devnet.solana.com
solana-testnet or solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zTestnethttps://api.testnet.solana.com

The long names are CAIP-2 identifiers, which the second version of x402 uses; the short ones are from the first. The SDK reads both and exports the mainnet one as MAINNET_NETWORK.

When a service offers several prices, the SDK takes the first network on which the budget exists and a price is named in the budget’s token.

Your own RPC

Pass rpcUrl and every read goes through it, on every network. Use it for a provider of your own, and for a local validator.

const agent = breaker({ budget, key, rpcUrl: process.env.SOLANA_RPC_URL })

The SDK keeps one connection for each network and reads at confirmed. A payment is one read: the budget, the token’s mint and the budget account in a single snapshot, so the figures it checks belong to the same slot.

status() reads the network of the last payment the instance made, and mainnet before any.

What the agent sends

The SDK signs and hands the payment to the service. It broadcasts nothing itself: the service’s facilitator sends the transaction and pays its fee. The agent’s machine needs to reach the service and an RPC, and nothing else.

Tokens

A budget holds one mint, chosen when it opens. x402 settles in USDC, so budgets default to it. A budget can hold any SPL Token or Token-2022 mint.

USDC on mainnetEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Decimals6
Token programsSPL Token and Token-2022. The budget records which one its mint belongs to.

A payment goes through when the service names a price in the budget’s mint. A service that offers several tokens is paid in the one the budget holds.

The mints the panel offers, with their symbols and decimals, are listed by the API at https://api.breaker.to/v1/config, beside the network it runs on and the program’s address.

Runtime

Node22
Module formatES modules
PaymentsSolana transactions of version 0, signed with Ed25519.