Paxiom
Paxiom · Standard Specification Sheet
Canonical JSON Profile
Deterministic UTF-8 byte serialization and Ed25519 signing preimages.
Sheet PXM-RC-102· paxiom.receipt.v0· v0.2.0

Byte-for-byte reproducible Ed25519 signing inputs.

Signature and output-hash verification across Node.js, Edge Workers, and Python must produce identical UTF-8 byte sequences. paxiom.receipt.v0 (`v0.2.0`) defines both a deterministic JSON canonicalization profile (jcs-sha256) and raw byte hashing (raw-sha256) for binary, text, and streaming responses.

01 · Serialization Rules

Seven deterministic rules.

  1. Encode output as UTF-8.
  2. Object keys sorted lexicographically by UTF-16 code unit order recursively at every nesting level.
  3. Array order is preserved (arrays represent ordered sequences and are never re-sorted).
  4. No insignificant whitespace — zero spaces or newlines between JSON tokens.
  5. Monetary amounts and hashes are strings, never floats. All amounts (amountAtomic, amountDisplay) and digests are strings; non-string scalars in v0 payloads are restricted to booleans (checkedByVerifier, backward-compatible checkedByPaxiom) and optional integer HTTP delivery.statusCode (100–599).
  6. Hashes are SHA-256 formatted as lowercase hex with a 0x prefix (66 characters total).
  7. null serializes as null; keys with null values remain part of the signed structure (e.g., settlement.transactionHash).
Stack-Depth Hardening

Conforming verifiers reject non-JSON values (undefined, NaN, Infinity) and cap recursion depth at 256 so adversarial deeply-nested outputs return a structured error trust state rather than overflowing the call stack.

02 · Signing Input

Reference canonicalizer & Ed25519 envelope.

The Ed25519 signature covers the UTF-8 canonical JSON of exactly { receiptVersion, payload } (excluding the outer signature object itself):

function canonicalize(value) {
  if (value === null || typeof value !== 'object') return JSON.stringify(value);
  if (Array.isArray(value)) return '[' + value.map(canonicalize).join(',') + ']';
  const keys = Object.keys(value).sort();
  return '{' + keys.map(k => JSON.stringify(k) + ':' + canonicalize(value[k])).join(',') + '}';
}

const signingInput = Buffer.from(canonicalize({ receiptVersion, payload }), 'utf8');
const sigValue = crypto.sign(null, signingInput, privateKey).toString('base64');
03 · Binding Digests

Hash preimages across request, payment, and delivery.

Receipt fieldSHA-256 Preimage
delivery.outputHash (jcs-sha256)sha256( canonicalize(output) ) for structured JSON responses (default)
delivery.outputHash (raw-sha256)sha256( rawResponseBytes ) for binary, PDF, image, CSV, SSE, or non-JSON UTF-8 payloads
request.bodyHashsha256( canonicalize(requestBody) )
request.resourceHashsha256( utf8(resourceUrl) )
request.requestHashsha256( canonicalize({ bodyHash, method, resource }) )
payment.paymentRequirementsHashsha256( canonicalize(x402PaymentRequirements) )
payment.paymentPayloadHashsha256( canonicalize(x402PaymentPayload) )