Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nhestrompia/shielded-x402/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The protocol defines typed data structures for shielded payments, X402 payment flows, and agent interactions. All structures use strict TypeScript types with hex-encoded values.Shielded Note
Represents a private note in the shielded payment system.The note’s value in the smallest unit of the asset
Random blinding factor for the commitment (32 bytes, hex-encoded)
Hash of the owner’s public key (32 bytes, hex-encoded)
The note commitment hash (32 bytes, hex-encoded)
Position in the Merkle tree (0-based index)
Example
Spend Public Inputs
Public inputs for zero-knowledge spend proofs.Unique nullifier preventing double-spends (32 bytes, domain:
shielded-x402:v1:nullifier)Merkle root proving note existence (32 bytes, hex-encoded)
Commitment to merchant output (32 bytes, domain:
shielded-x402:v1:output)Commitment to change output (32 bytes, domain:
shielded-x402:v1:output)Hash binding payment to merchant challenge (32 bytes, domain:
shielded-x402:v1:challenge)Payment amount in smallest unit
Shielded Payment Response
Complete payment proof package sent to merchants.ZK-SNARK proof bytes (hex-encoded)
Array of public inputs (each 32 bytes, hex-encoded)
The nullifier from public inputs (32 bytes)
Merkle root from public inputs (32 bytes)
Merchant output commitment (32 bytes)
Change output commitment (32 bytes)
Challenge hash from public inputs (32 bytes)
Encrypted payment receipt for the merchant (hex-encoded)
Optional transaction hint for off-chain coordination
Example
Payment Requirement
X402 payment requirement structure for merchant challenges.Protocol version (always 2)
Payment scheme, typically
"exact"Target blockchain network identifier
Asset contract address or identifier
Merchant’s payment recipient address (20 bytes)
Payment rail, typically
"shielded-usdc"Payment amount as decimal string
Unique challenge nonce (32 bytes, hex-encoded)
Challenge expiration timestamp (ISO 8601 or Unix timestamp)
Merchant’s public key for encryption (hex-encoded)
Contract address for proof verification (20 bytes)
Maximum timeout for payment completion
Human-readable payment description
MIME type of the expected response
JSON schema for response validation
Additional metadata, includes shielded rail parameters
X402 Payment Signature Payload
Complete X402 payment package with signature.Protocol version (always 2)
The payment requirement being fulfilled
The shielded payment proof and data
Challenge nonce from the requirement (32 bytes)
Cryptographic signature over the payload (hex-encoded)
Relayer Settlement Delta
State update from relayer after settlement.Merchant’s new note commitment (32 bytes)
Sender’s change note commitment (32 bytes)
Merchant note position in Merkle tree
Change note position in Merkle tree
Updated Merkle root after insertion (32 bytes)
Hex Type
All hex-encoded values use theHex type:
Validation
- isHex: Validates
0x-prefixed hex strings of any length - isHex32: Validates exactly 32-byte (64 hex characters) values
Canonical Format
- Always lowercase
- Always prefixed with
0x - 32-byte values padded to 64 hex characters
- Addresses padded to 64 characters (40 → 64) for word alignment