@xochi/spec
v0.14.0
Published
Xochi protocol spec, wire contract and byte-equality conformance vectors.
Maintainers
Readme
@xochi/spec
The Xochi/Riddler wire contract: SPEC.md (normative signing, fee and HTTP spec), its companion
RFCs, and the byte-equality vector sets every signer implementation (TypeScript, Elixir
raxol_payments, Python/Go/Rust ports) must reproduce exactly.
Contents
SPEC.md: the normative document. EIP-712 signing (ERC-3009, Permit2, XochiIntent) and fee construction are pinned by the vectors below; the HTTP surface bywire/openapi.json.SOLVER-RFC.md: maker-side sealed-bid RFQ (SPEC §7). Versions independently (- **RFC version:**header); makers gate onSOLVER_RFC_VERSIONfrom@xochi/solver-sdk.ESCROW-RFC.md: non-custodial escrow (orderIdpreimage,OpenAuth, proof-of-fill).[RESERVED]and inert.PASSKEY-RECIPIENT.md: APPROVED passkey recipients (xochi-sdk#155; product-owner sign-off 2026-11-09). Covers the WebAuthn PRF key derivation, the WebAuthn parameters and refusals, thePKW1wrapped import, the passkeyBackupPersistenceAckmode, the threat model and the PRF support matrix. Approval does not authorize deployment: passkey claims remain default-off until every CSP and host rollout prerequisite in §6 is satisfied. Its vectors are thepasskeysection ofconformance/shielded-recipient.json.conformance/conformance.json+schema.json: 45 signing vectors (9 erc3009, 19 permit2, 17 xochi) with inputs andexpected_{signer,digest,signature,signed_object}.conformance/solver-bid-v2.json+.schema.json: SolverBid v2 sealing (SOLVER-RFC §5.1).conformance/{order-id,open-auth,dest-blinding,fill-salt,fill-auth,fill-attestation,slash-attestation,fill-acceptance}.json(+.schema.json): escrow vectors (ESCROW-RFC, SOLVER-RFC §5.3). Public test keys only.conformance/xsp.json+.schema.json: Xochi Settlement Protocol digests (ESCROW-RFC §13).conformance/capability-routes.json+.schema.json: the producer's ordered typed-route examples. Riddler keeps a byte-identical fixture and asserts its capability derivation against the decoded routes.conformance/shielded.json+.schema.json: shielded settlement contract v1 typed encodings (xochidocs/planning/shielded-execution.md§7): NetworkIdentity, the saltedDomain (binding)/Domain (terms), RecipientBinding digests with source-wallet signatures (public test keys), and the Aztecbytes32/ amount refusals. Inert: shielded settlement is not live.conformance/shielded-terms.json+.schema.json: PROPOSED typed encodings of the D7 amendment (Riddler#1296):ShieldedTermsV1(§7 SignedTerms +rail+feePayer), the non-signableShieldedPreviewV1, andCorridorManifestV1(whosehashStructismanifestDigest), with signatures from public test keys and single-member refusals. Every choice §7 does not spell is listed in itsproposedarray. Inert.conformance/shielded-recipient.json+.schema.json: the recipient-side encodings:descriptorDigest, stockSchnorrAccountaddress derivation for pinned Aztec 5.2.0 and@aztec-labs6.0.0, the recipient message wide reduction, recipient Schnorr signatures, and approvedBackupPersistenceAck,SenderRegistrationAck,PaymentReceiptAck, andTokenRegistrationAckcontracts. ItsoxideTokensection records the OxideToken immutables hash, OXDAI vector, and corridors that require the acknowledgement (xochi#753). The enrollment acknowledgements reuse the named binding's exact nonce and expiry; a payment receipt uses its own receipt challenge. Its APPROVEDpasskeysection (PASSKEY-RECIPIENT.md; product-owner sign-off 2026-11-09) pins the passkey derivation, the passkey backup commitment and a passkey-mode acknowledgement with the verifier's verdicts. TEST ONLY keys.conformance/shielded-readiness.json+.schema.json: the pxe-bridge readiness attestations (Membership,RecipientDeployment,RootUpdate) under theXochi Shielded Readinessdomain, with replay and record-parse refusals. Public test key.fee/vectors.json,fee/schedule.json,fee/schema.json: 16 fee vectors (SPEC §4), the rate schedule, and thefee_breakdownschema.erc8262/provider-discovery.schema.json,erc8262/provider-evidence.schema.json: the ERC-8262 provider protocol (SPEC §10), the documents a provider serves at/.well-known/erc8262-provider.jsonand/v1/erc8262/evidence/{evidenceId}.erc8262/vectors.json+vectors.schema.json: native and gateway fixtures, schema rejections, evaluation and quorum cases. Fixture addresses only.wire/openapi.json+wire/openapi.sha256: the served/xochi/openapi.json(reformatted) and its digest, plus the differwire/compare.mjs; seewire/README.md.
Every file is exported by path, e.g. @xochi/spec/conformance/conformance.json.
Who is authoritative
conformance.json,xsp.json,shielded*.json,fee/*,erc8262/*: this repo (fees mirror Riddler'sFeePolicyin lockstep).solver-bid-v2.jsonand the escrow sets: parity with Riddler; digests must match on both sides.wire/openapi.json: the server. Nothing here edits it.
A changed vector is a wire change. Never regenerate one to make a check pass.
npm run generate -w @xochi/spec regenerates every set; CI runs
npm run check:vectors -w @xochi/spec, which regenerates and fails on any diff. Per set:
conformance.jsonis the byte-equality contract withraxol_payments(ExUnit reads it verbatim). Any change to@xochi/signer'ssigning.ts/xochi-signing.tsor topackages/reference/src/config.tsregenerates it (npm run generate:conformance -w @xochi/spec) in the same PR; a stale fixture silently breaksraxol_payments. Tron is never in the generator's chain lists: the client signs on the EVM source only.solver-bid-v2.jsonpins SolverBid v2 (SOLVER-RFC §5.1: struct,RiddlerSolver/2domain with nochainIdand noverifyingContract, typehash, domain separator, canonical decimaloutput, absolutevalidUntilMs). Drift silently rejects every honest bid; anrfcVersionskew moves no digest, so its guard is the pre-bid check (SOLVER-RFC §12).npm run generate:solver-bid-v2 -w @xochi/speclands in lockstep with the server.capability-routes.jsonmirrors Riddler's producer fixture byte-for-byte. Riddler's live pair, chain, token and settlement gates are authoritative; the vector pins their deterministic capability serialization and the SDK parser consumes the same bytes. Neither side keeps an independent route allowlist.shielded.jsonis generated here and vendored inbound by Riddler and the Xochi Worker, which never compute their own expectations (§7 "Vector authority"). Its generator derives every value from §7's literals with ethers primitives and imports nothing from@xochi/signer, whoseshielded.tsis tested against the committed file;npm run generate:shielded -w @xochi/specregenerates it, and only an edit to §7 may change it: its approved encodings fix the vectors, refusals and values, and what it leaves open fixesopen. Network, corridor and Aztec values are fixtures. It holds no vector for what §7 leaves open (ShieldedTermsV1, manifestDigest); itsopenarray names each one.shielded-terms.jsonis generated here (npm run generate:shielded-terms -w @xochi/spec) by the same rules asshielded.json, and staysstatus: "PROPOSED"until the product owner approves itsproposeditems into §7. It is the only vector set for the terms, preview and manifest digests; Riddler vendors it behind a default-off preview flag and never computes its own expectation.shielded-recipient.jsonandshielded-readiness.jsonfollow the same rules and are vendored by Riddler, the Worker and pxe-bridge (pxe-bridge#50 recomputes the descriptor digest it attests over).npm run generate:shielded -w @xochi/specregenerates all three shielded files in order (readiness reads the recipient file). The recipient file's Aztec-specific values (class ids, selector, separators, derivation intermediates, addresses) are held to the real SDKs, exact-pinned, and its Schnorr verdicts to each SDK line's bb.jsSchnorr.verifySignature(theSchnorrAccountcircuit itself is not executed), byaztec-crosscheck/(its own package and lockfile, CI jobaztec-crosscheck;npm run crosscheck:aztec -w @xochi/spec), so an equality there is never between two copies of this repo's own code. Itsacknowledgementssection is approved protocol bytes: changing a member, type, purpose or ordering requires a new primary type/version.backupFormatIdis exactlykeccak256(UTF8("xochi.shielded.backup-format.v1"))(sealed file) or, in passkey mode,keccak256(UTF8("xochi.shielded.backup-format.passkey.v1")); a verifier that names no format accepts only the first. The verifiers (verifyRecipientAck,verifyReadinessRecord) and what their callers must supply are@xochi/signer's: its README, "Shielded recipient and readiness". A caller accepting an acknowledgement MUST atomically commit replay-key consumption with the application acceptance/result, or persist an exact-request durable idempotent result with the consumption and return it on retry; committing the consumed key alone is forbidden.fee/*mirrorsRiddler.Integrations.Xochi.FeePolicyin lockstep: the schedule isfee/schedule.json, the rules SPEC §4. A schedule change lands on both sides and regenerates the vectors (npm run generate:fee -w @xochi/spec, from@xochi/client's builtFEE_SCHEDULE).
Consuming the spec
Pin an exact version; never read a sibling checkout:
npm install --save-dev --save-exact @xochi/[email protected]import conformance from "@xochi/spec/conformance/conformance.json" with { type: "json" };Non-JS CI:
npm pack @xochi/[email protected] && tar -xzf xochi-spec-0.14.0.tgz # -> package/conformance/..., package/fee/...Verifying an implementation
Signing: for each vector, sign its quote/domain/message (erc3009/permit2) or eip712 (xochi)
fields, assert byte-equality with expected_digest, expected_signature and
expected_signed_object, and check that (expected_digest, expected_signature) recovers
expected_signer. Validate unknown shapes against the matching .schema.json. SolverBid and
escrow sets also ship encode_type/typehash/domain_separator; compare those first so a mismatch
points at the wrong layer.
Fees: reproduce every expected in fee/vectors.json from its input (SPEC §4.4/§4.5). The
reference is computeFeeBreakdown / FEE_SCHEDULE in @xochi/client; total_fee is the
sum of independently floored layers.
Wire: check openapi.json against openapi.sha256; compare a served document with compare.mjs.
ERC-8262 providers: what a provider or consumer reproduces from erc8262/vectors.json is SPEC
§10.8. The reference runner is
packages/spec/test/erc8262-provider.test.ts.
Reference runners live in the repo:
packages/reference/test.
Changes: CHANGELOG.md.
License
MIT
