x402 wire format
The private-transfer scheme, for anyone writing their own client.
px402 uses x402 version 2 with its own scheme, private-transfer.
The challenge
The PAYMENT-REQUIRED header of a 402 is base64 JSON:
{
"x402Version": 2,
"resource": { "url": "https://x402.example.com/paid/demo", "description": "Sample paid response for the demo", "mimeType": "application/json" },
"accepts": [{
"scheme": "private-transfer",
"network": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
"amount": "10000",
"asset": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",
"payTo": "<receiver wallet address>",
"maxTimeoutSeconds": 300,
"extra": {
"nonce": "<32 random bytes, base64url>", "issuedAt": "<ISO>", "expiresAt": "<ISO>", "routeId": "<route id>",
"receiverShieldedAddress": "<base58, 99 bytes>", "ringsProgramId": "<program id>",
"bindingMode": "sender_proof", "claimDomain": "x402-private/claim/v1"
}
}]
} The payment
Make one Privacy Rings transfer of amount to receiverShieldedAddress, with the paying key as the only public signer.
Do not set a separate owner on the transfer.
The claim
Repeat the request with a PAYMENT-SIGNATURE header. Its payload is:
{ "nonce": "...", "signature": "<transaction signature>", "senderProof": "...", "bindingMode": "sender_proof" } The header also carries x402Version and accepted, which must equal the accepts entry you were given.
senderProof is an Ed25519 signature by the paying wallet over this UTF-8 text:
x402-private/claim/v1|<nonce>|<txSignature>|<routeId>|<amountBase> The receipt
PAYMENT-RESPONSE carries success, transaction, network and amount. It leaves out payer on purpose. That keeps
the address out of the response; it does not hide it, because the transaction is public.
The schemas are in @px402-tech/types.