x402 batch settlement on Stellar
Pay per request. Settle in batches.
AgentBatch gives AI agents one escrowed USDC deposit and a signed voucher for every call. Sellers answer instantly and claim many buyers at once, in a single Stellar transaction.
01The problem
Agent fleets pay dozens of services, thousands of times a day.
Inference, search, data, compute, other agents: every call is a small usage-based payment. Settling each one on-chain, or funding a separate channel for every agent–provider pair, does not scale.
Fragmented funding
Each provider channel needs its own funding allocation. Balances end up scattered across independent payment relationships.
Operational overhead
Channel creation, signer management, funding, settlement, monitoring and reconciliation, repeated for every provider.
Repeated settlement
Independent providers redeem their channels one by one. Combining claims into one transaction needs dedicated infrastructure.
Delegated spending risk
Agents need bounded payment authority, without unrestricted access to the organization's treasury.
Three providers, one agent fleet. AgentBatch keeps one channel record per provider, each with its own reserved collateral, inside one funded treasury.
02How it works
One deposit. Many channels. One claim.
Channels are records inside a shared treasury, each with its own reserved collateral. Agents pay with signed vouchers off-chain; providers settle together on-chain.
- Worked example from the design doc, in USDC. The Testnet PoC ran these exact numbers with synthetic AUSD. Hover to pause, click a step to jump.
- available
- 100.00
- reserved
- 0.00
- paid
- 0.00
03What's different
Off-chain vouchers exist.
The shared treasury is new.
AgentBatch does not reinvent cumulative payment channels. It combines shared liquidity, independently collateralized virtual channels, delegated vouchers and bounded multi-provider settlement in one Soroban layer.
Shared multi-provider funding
One organization-funded treasury backs many virtual payment channels across independent providers.
Virtual channels, no extra deployments
Channels are records inside one Soroban contract, not separately deployed and funded channel contracts.
Independent collateral
Each channel reserves its maximum liability. The same funds can never guarantee two providers.
Multi-provider settlement
Claims from independent providers settle in one atomic batch. Recipients come from storage, never from the caller.
1–4 channels per batch in the PoCBounded delegated spending
Agents sign with delegated keys capped by their channel allocation. They never control the treasury.
Reusable settlement layer
Facilitators, AI platforms and wallets integrate one collateral and settlement primitive instead of bespoke escrow.
SDK and x402 adapter planned04Proof
Running on Stellar Testnet today.
One 100 AUSD deposit backed three channels of 40 / 35 / 15. Agents completed 11 paid requests without a single transaction, then one batch settled all three providers.
transactions submitted during 11 paid requests
batch paid three providers 12 / 8 / 5 AUSD
archived Testnet transactions, 19 successful and 3 intentionally failed
bytes of optimized contract WASM
Measures redemption fees only. Deployment, channel rent and other lifecycle costs are separate. See benchmarks
- Demo treasury contractCCNFYVZNOP…DT4YKMGJ
- Three-provider batch · 12 / 8 / 5 AUSDcf74ff5818…b82dd2c2
- Incremental redemption · cumulative 17 pays +58b707294e9…8a18f7e6
- Replayed batch · rejected on-chainee90afe38c…fc75fa8f
Proof of concept, not production. The current code is a limited Stellar Testnet PoC using synthetic AUSD, not USDC. It has internal review and regression tests but no independent external security audit. Do not use it with assets of value. Security assumptions
05For developers
Sign, verify, serve. No network needed.
The voucher library encodes, signs and verifies cumulative Ed25519 vouchers. Providers check every increment locally before serving, and duplicates are rejected.
- deposit(amount) · owner funds the treasury
- open_channel(provider, signer_key, allocation)
- redeem_batch(vouchers) · anyone settles 1–4 channels
- withdraw_available(amount) · unallocated funds only
@agentbatch/voucher is a private workspace package today. The production TypeScript SDK is planned work.
import {
AgentSigner, ChannelSpender, MemoryVoucherStore, ProviderVerifier,
} from "@agentbatch/voucher";
const agent = AgentSigner.random();
// Illustrative channel metadata. A real provider must pin code and asset and
// obtain this record from its trusted deployment before accepting requests.
const channel = {
channelId: 1n, owner, provider, signer: agent.publicKey,
allocation: 100_000_000n, redeemed: 0n,
};
const spender = new ChannelSpender(agent, context, channel.allocation);
const verifier = new ProviderVerifier(
{ ...scope, provider },
new MemoryVoucherStore(scope),
);
for (const price of [10_000_000n, 20_000_000n, 5_000_000n]) {
const voucher = spender.pay(price);
assert.equal(verifier.accept(channel, voucher, price).ok, true);
}$
06Accounting invariants
Every claim is backed by its own collateral.
Shared custody never means shared promises. One accounting invariant holds across every state change, with checked arithmetic throughout.
Invariant I1
Per-channel ceilings
0 ≤ redeemed ≤ allocation. A compromised agent key cannot pay beyond its channel.
No double allocation
Opening a channel moves funds from available into that channel's reservation only.
Reserved funds stay put
Owner withdrawals are bounded by unallocated funds. Collateral backing claims cannot leave.
No repeated payout
Payout is the voucher amount minus what was already redeemed. Replays fail on-chain.
Domain-separated vouchers
Each signature binds network, contract, channel, owner, provider, signer and cumulative amount.
Atomic batches
If any voucher in a batch is invalid, the whole transaction reverts. Recipients come from storage.
07Use cases
Built for machine-to-machine commerce.
Wherever agents buy small units of work from many independent services, thousands of times a day.
High-frequency inference
Every model call carries an incremental voucher. The provider verifies instantly and settles periodically.
One agent, many APIs
Inference, search, structured data and compute, each on its own channel with independent limits.
Enterprise agent fleets
Research, analytics and automation agents get bounded authority. Finance sees exposure in one treasury.
Agent-to-agent payments
A coordinator pays specialist agents for retrieval, reasoning and tools, then their claims settle together.
AI tool marketplaces
Many independently operated tools and APIs share collateral and settlement infrastructure.
Designed to plug into · adapters are planned work
08Roadmap
From proof of concept to Mainnet.
Each stage needs explicit acceptance criteria, security review and reproducible validation before release.
- Proof of conceptshipped · Testnet
The core settlement architecture, on Testnet
- One treasury, independently reserved channels
- Real Ed25519 cumulative vouchers
- Provider-side verification and durable stores
- Atomic settlement of 1–4 channels
- Incremental redemption and replay protection
- Owner withdrawal of unallocated funds
- Stage 1next
Production treasury and channel infrastructure
- Multi-tenant treasury management
- Channel lifecycle with protected closure
- Safe collateral allocation and reallocation
- Secure signer rotation and revocation
- Stage 2planned
Scalable settlement and integration
- Multi-provider settlement coordination
- Keeper mechanisms with bounded incentives
- Complete TypeScript SDK
- MPP and x402 integration adapters
- Stage 3planned
Mainnet readiness and adoption
- Treasury Console and settlement monitoring
- Independent security review
- Real AI-service integration pilots
- Mainnet deployment
Open source · Apache-2.0
One treasury. Many providers. Settled in batches.
Off-chain micropayments with coordinated on-chain settlement, built to make Stellar the network of choice for high-volume agent commerce.