sync
01architecture

The handshake that turns
402 into a payment rail.

Three layers: an on-chain program for settlement and registry, an SDK for both sides, and an off-chain 402 handshake over HTTP/gRPC. Solana is the settlement layer — sub-second finality and tiny fees make per-call accounting viable.

layer 1Anchor

on-chain program

settlement + registry — PDAs for services, channels, stake, fleets, receipts.

layer 2consumer & provider

SDK

thin wrappers: a gate middleware for providers, an HTTP client for consumers.

layer 3402 over HTTP / gRPC

off-chain handshake

the payment challenge / proof exchange that rides on top of normal requests.

x402-style handshake

Request. 402. Pay. Retry.

The interface borrows HTTP 402 Payment Required. A provider answers an unpaid call with a payment challenge — price, token, recipient, channel, nonce, expiry. The consumer signs a voucher (or sends a tx), retries with proof, and receives the result plus a PurchaseReceipt.

# the exchange, end to end
1 consumer → request → provider
2 provider → 402 + challenge → consumer
3 consumer signs voucher (B) or tx (A)
4 consumer → retry + proof → provider
5 provider → result + receipt
6 background → channel reconciliation on-chain
ConsumerVendClient
⇄ HTTP / gRPC
ProvidervendGate
01request
02402 Payment Required
03sign voucher
04retry + payment proof
05result + receipt
06settle on Solana
two settlement modes

Direct for rare calls. Channels for the firehose.

mode Adirect settlement

One tx per call

Every call settles in its own transaction. Ideal for rare or high-value requests. Economical on Solana thanks to low fees, but throughput-bound at hundreds of calls per second.

  • + simplest possible flow
  • + no channel lifecycle
  • one on-chain tx every call
payment channel · ch_18b2off-chain · 0 gas
deposit$0.7361 / $5.00
voucher nonce
#1840
accrued
$0.7361
on-chain tx
1
per channel

Each call signs a fresh voucher — the provider accepts it instantly without touching the chain. Reconciliation happens once, at threshold or on close: thousands of calls, one transaction.

on-chain program · anchor

Accounts (PDAs)

ServiceRegistryprovider record: endpoint, price/call, fleet price, accepted token, stake, metadata
PaymentChannelconsumer ↔ provider: deposit, spent, last nonce
Vaultescrow for channel funds (SPL / Token-2022)
ProviderStake$VEND stake — reputation & misbehaviour defence
Fleetan owner's agents: keys + shared-memory key reference
PurchaseReceiptservice, request hash, result hash, license scope, TTL
FeeConfigprotocol fee parameters + treasury address
threat model

Security properties

spend limits

per-agent daily caps bound the damage of a bug or hostile provider.

monotonic nonces

vouchers cannot be replayed — each carries a strictly increasing nonce.

close timeouts

a consumer can force-close and reclaim the remainder via a challenge window.

stake slashing

paid-but-unanswered calls are disputable; provider stake is at risk.

encrypted memory

fleet content is encrypted to the fleet key — providers & outsiders can't read it.

on-chain membership

fleet membership is verified on-chain — no free-riding by foreign agents.

receipt TTL

stale fleet receipts expire; fresh data must be re-purchased.

token isolation

users settle in stablecoins, insulated from $VEND volatility.