VEIL
network testnet + devnet rail x402

Private payment rails for the agent economy

Agents can pay for anything. On a public chain, everyone can watch them do it.

x402 gave agents a way to pay for an API call without a human and without an account. It left the amount, the counterparty and the pattern on a public ledger. Veil closes that gap with two real primitives — not a mixer, not a promise.

Amount
Encrypted on chain with Token-2022 Confidential Balances. Only the recipient's key decrypts its own balance.
Counterparty
The buyer rotates to a one-time address per call, so two payments from the same agent never sit next to each other on the graph.
Correctness
The merchant still reconciles settled total, spendable balance and every row — to the cent, in public.

The same payment, seen from two places

Left: the agent doing its job, paying each call into a one-time address. Right: what the merchant's own view holds back from everyone else. Same payment. One of them has numbers; the other has a redaction bar.

agent · feedmarket-bot · x402 client solana explorer · devnet
→ GET /v1/oracle/tide 402 Payment Required
← offer: $0.049 · mint 6pFk…3ur · x402 v2
→ pay to GvcoE…TrQ9 (one-time) · confidential
✓ settled 21:39:01 · slot 6
→ retry /v1/oracle/tide 200 OK
✓ resource delivered
✓ next call → Dq7CE…75E (unlinkable)
account GvcoE…TrQ9 — receiving, slot 6
extensions
  ConfidentialTransferAccount expected
    allow_confidential_credits required
    allow_non_confidential_credits required false
the server's answer when it cannot check these
  VEIL-CONF-003
the amount
  amount $0.049
  destination GvcoE…TrQ9 ← public, and Veil says so
  settlement mode local-ledger-only ← published, not implied
the third beat is not a third window same transfer · same slot one of them has numbers

The reveal above is the product's whole argument in one frame: nothing tries to make the transfer invisible. What is removed is the one field a competitor, an insurer or a data broker actually wants. What this does not hide →

What the mechanism actually is

01 · Confidential Balances
Token-2022's native extension. The transfer amount and both balances are stored as ElGamal ciphertext. Proofs are generated client-side and verified on chain, so a validator still knows the transfer is valid and non-inflationary — it just cannot read the number. No ZK circuit was written for this. The chain's own extension does it.
02 · Verify, then offer
Before quoting a price the server checks that the mint carries the extension and that the destination account accepts confidential credits. If it cannot check, it refuses with VEIL-CONF-003 rather than quoting. A settlement offer is a promise, and this is where the promise is made conditional on evidence. The source of that evidence is published at /.well-known/veil as privacySource, so a deployment that declared it instead of reading it cannot pass for one that read it.
03 · One-time addresses
Each paid call derives a fresh recipient account from the merchant's alias, used once. Confidential Balances hides the amount; this hides the edge. Together they defeat the two cheap deanonymisation attacks: reading the figure, and counting the recurrence.
04 · The refusal
When the preconditions cannot be satisfied or cannot be checked, the server returns a specific code — VEIL-CONF-001 through 005 — and no price. It never downgrades to a public transfer, because a merchant who believed an amount was hidden while it sat in the clear has been actively misled. The merchant ledger renders those codes as rows, so a refusal is visible rather than quietly absent. A privacy claim is worth nothing the moment the product lies to keep it looking true.

Encrypted until the holder decrypts — the mechanism, drawn

Public view writes a redaction bar over every amount. Lift view removes them, staggered — the same thing that happens the moment the merchant's key decrypts its own recipient ciphertext. It is not decoration: the toggle is how Veil states the boundary between the ledger's reader and everyone else, and how it proves the number was there the entire time.

Lifting the bars is a demonstration, not a back door. The auditor key is a single global key per mint — it cannot be the merchant's reconciliation path, and Veil does not pretend otherwise. Merchant reconciliation decrypts the merchant's own ciphertext.

recipient ciphertext · same rowdevnet
available_balance: [redacted]
lo  0x9fH2k7QvT8…
hi  0x14bC71dE03…
viewing_key merchant · v1
decrypts_to $240.10
Everything above the last line is what the chain stores. The last line is what only the holder can compute.

The second button reveals the amounts this merchant can already read. It reveals nothing an outside observer of the chain can see.

Redacted view: every amount is redacted.

Drop-in, because x402 is already the standard

Veil is a conformant x402 facilitator that speaks a confidential transfer instead of a plain one. A merchant that already accepts x402 adds a settlement address and nothing else. If the buyer's token account is not confidential, the facilitator refuses with a machine-readable reason instead of quietly settling in public.

merchant · settlement config3 lines
settlement = veil.facilitator(
  alias: "feedmarket.veil",
  confidential: true )
facilitator · refusal bodyHTTP 402
status  402
code    VEIL-CONF-003
reason  "confidential extension absent"
action  "configure account, then retry"

Refusing is a feature. A facilitator that accepts a non-confidential account still "works" and silently leaks the amount it promised to hide — which is worse than failing. Read the full 402 body →

Call it in two requests

The hosted rail is a normal x402 resource server. Ask without paying and you get a standard 402 Payment Required carrying a one-time account and a price. Settle a confidential transfer into that account, retry the same URL with X-PAYMENT, and the resource is yours. No account, no API key, no dashboard.

Every price the hosted rail charges, rendered from the same resource table the server serves. Amounts are in VeilUSD at six decimals; the figure that reaches the chain is encrypted at transfer time.
EndpointReturnsPer call
/v1/oracle/tide Sea-state and tidal window, per call 0.049 VeilUSD
/v1/quote/feedmarket Feed commodity quote, per 1k bushels 0.99 VeilUSD
/v1/attest/sensor Sensor provenance attestation, per call 0.012 VeilUSD
/v1/payee/test Reference payee — the seat the end-to-end check pays 0.001 VeilUSD
1 · ask, unpaidcurl
$ curl -i "https://veil-devnet.vercel.app/v1/oracle/tide?nonce=1" \
    -H "X-Payer: my-agent"

HTTP/1.1 402 Payment Required
  accepts[0].payTo              one-time account
  accepts[0].maxAmountRequired  49000
  accepts[0].extra.privacy      confidential-balances
2 · retry, paidthe same URL
$ curl -i "https://veil-devnet.vercel.app/v1/oracle/tide?nonce=1" \
    -H "X-Payer: my-agent" \
    -H "X-PAYMENT: <base64 x402 v2 payload>"

HTTP/1.1 200 OK
  settled.signature  <testnet tx>
  data               the resource
the same dance, in a client@x402/core + @x402/svm
const url = "https://veil-devnet.vercel.app/v1/oracle/tide?nonce=" + Date.now();
const payer = "my-agent";                 // any stable buyer id

const ask = await fetch(url, { headers: { "X-Payer": payer } });
const offer = await ask.json();          // a standard x402 402
const terms = offer.accepts[0];          // payTo, amount, mint, extra.privacy

// build one confidential transfer to terms.payTo (@x402/svm + @solana/zk-sdk),
// sign it, then hand the payload back as X-PAYMENT:
const paid = await fetch(url, {
  headers: { "X-Payer": payer, "X-PAYMENT": xPayment },
});

?nonce= identifies one payment. Keep it unique per payment — a retry of a settled nonce returns 409 payment-already-settled rather than taking the money again, and a nonce that is not a non-negative integer is refused with 400 invalid-nonce. X-Payer names the buyer so a retry gets its own seat back instead of burning a second one. Both headers are allowed cross-origin, so a browser can drive the rail directly.

Discovery is the same document the server publishes to agents: /.well-known/veil lists every resource, its price, and whether the confidentiality preconditions were read from chain or declared from the pool ledger. The full 402 body →

Live on Solana — testnet and devnet

The rail is deployed, not diagrammed. The mint, the one-time pool and two complete payment flows are confirmed on both clusters, and every row below links to the transaction that proves it — the operator's own end-to-end run, and an independent payer holding nothing but its own key.

Testnet · the pool is open
Mint H1WQvSNb…CA7p and 28 one-time seats — all 28 armed by the mint authority and able to receive confidential credits today, 4 already spent by past settlements. A fresh payer can settle into a new seat without touching anything of the deployer's. operator's confidential transfer →
Testnet · an independent payer
A fresh keypair that has never seen the deployer's seed signed only its own half of a 636-byte transaction; the facilitator co-signed the fee. /verify valid in 233 ms → /settle confirmed in 919 ms; the merchant alone decrypted 49000 available, 0 pending. the settlement →
Devnet · the same, from a cold start
Mint and pool created in one session from an untouched 5 SOL for 0.011 SOL, then both flows ran end to end; the pool is 8 one-time seats, 5 of them spent. /verify 260 ms → /settle 916 ms, and the merchant seat decrypted 49000 with the merchant key alone. operator transfer → · independent-payer settle →
Hosted — the rail in public
Merchant server and facilitator behind one HTTPS origin, free tier, no card: veil-devnet.vercel.app. A payment settled through the hosted facilitator — /verify → /settle against the public URL on devnet, merchant decrypted 49000. hosted settlement →
The deployer is not in a payment
Deployment paid the one-time rent; after that the deployer's key signs nothing. The payer signs its own transfer, the facilitator co-signs the fee, the merchant alone decrypts the amount. Reproduce either cluster with Verify it yourself — every step runs against the hosted rail, and the proofs are generated on the machine that pays.