Xochi Technical Appendix
Appendix to the Xochi Whitepaper. API specs, fee tables, solver requirements, and glossary.
Table of Contents
- A. Intent API Endpoints
- B. EIP-712 Intent Signatures
- C. Complete Fee Matrix
- D. Solver Specifications
- E. Xochi's ZK Compliance Oracle Proof Types
- F. Trust Score Providers
- G. Glossary
- H. Widget SDK (Upcoming)
- I. Formal Derivations
- J. Execution Specifications
A. Intent API Endpoints
Auth roles (defined in the glossary): Member (passkey JWT), Guest (x402 micropayment), or both. JWT and x402 are alternatives, not additive: send Authorization for Member, send X-PAYMENT for Guest. Routes marked "Member or Guest" accept both. Routes marked "Member" require JWT; the Mandate path (Member-signed envelope authorizing an Agent, presented as X-Xochi-Delegation) is live. Public routes need no auth.
For machine-readable specs see /openapi.yaml (opens in new tab) (V1 surface, 10 endpoints) and /.well-known/agents.json (opens in new tab) (full x402 catalog with prices).
Market Orders
POST /api/intent/quote # Get solver quotes [Member or Guest, x402: $0.0001]
POST /api/intent/execute # Execute signed intent [Member or Guest, x402: $0.01]
GET /api/intent/:id # Get intent details [Member or Guest, x402: $0.0001]
GET /api/intent/:id/status # Get execution status [Member or Guest, x402: $0.0001]
GET /api/intent/history # User trade history [Member or Guest, x402: $0.0001]
Limit Orders
POST /api/intent/limit-quote # Quote for limit order [Member or Guest, x402: $0.0001]
POST /api/intent/limit-submit # Submit limit order [Member or Guest, x402: $0.01]
GET /api/intent/limit-orders # List active limits [Member or Guest, x402: $0.0001]
DELETE /api/intent/limit/:id # Cancel limit order [Member]
Trust & Privacy
POST /api/attestation # Submit attestation [Member]
GET /api/attestation # Get attestations [Member]
POST /api/tier-proof/verify # Verify tier proof [Member]
GET /api/tier-proof # Get tier proofs [Member]
Settlements
POST /api/settlement/claim # Claim shielded settlement [Member or Guest, x402: $0.005]
GET /api/settlement # Query settlements for a wallet [Member or Guest, x402: $0.0001]
Solver Revenue
POST /api/solver/deposit # Batch settlement from Riddler [Member]
GET /api/solver/stats # Revenue tracking [public]
GET /api/solver/history # Recent solver fills [public]
Stealth Addresses (ERC-5564/6538)
L1 privacy via one-time receiving addresses. Open to every wallet, no trust-score gate (privacy is free by default).
GET /api/stealth/meta-address # Lookup stealth meta-address [Member or Guest, x402: $0.0001]
POST /api/stealth/register # Register stealth meta-address [Member]
GET /api/stealth/announcements # Query announcements by view tag [Member]
POST /api/stealth/announcements # Index new announcement [Member]
POST /api/stealth/claim # Gasless stealth claim [Member]
Prices
GET /api/prices # Token prices, USD, 60s edge cache [public]
Capabilities
GET /api/capabilities # Solver capability matrix (chains/tokens/bounds) [public]
Real-time
WS /ws # Intent status updates [Member]
Riddler Solver API (/xochi/*)
Xochi's own API surface on the Riddler solver. Own schema, own fee tiers, own settlement targets.
POST /xochi/quote # Quote with tier-based fees + stealth info
POST /xochi/execute # Execute signed intent (EIP-712)
POST /xochi/claim # Gasless stealth claim (ERC-4337)
GET /xochi/status/:intent_id # Intent status with stealth/counterfactual fields
GET /xochi/chains # Supported chains
GET /xochi/routes # Supported routes
GET /xochi/health # Health check
Stealth claim flow: When settlement type is "stealth", tokens land at a counterfactual ERC-4337 SimpleAccount. The recipient calls /xochi/claim with their stealth keys and a destination address (Safe, EOA). The server derives the stealth signing key, builds a Pimlico-sponsored UserOperation, and submits it to the bundler. Account deployment + token transfer happen atomically in one gasless step.
Quote response includes claimInfo for stealth settlements:
{
"claimInfo": {
"factoryAddress": "0x91E60e0613f8E48b12EFC11BcAfB4dDA7763EC23",
"salt": 0
}
}
Announcement metadata (109 bytes, ERC-5564 extension):
view_tag(1) || token(20) || selector(4) || amount(32) || factory(20) || salt(32)
B. EIP-712 Intent Signatures
Xochi Frontend Intent (existing)
const intentTypes = {
Intent: [
{ name: "sellToken", type: "address" },
{ name: "buyToken", type: "address" },
{ name: "sellAmount", type: "uint256" },
{ name: "minBuyAmount", type: "uint256" },
{ name: "deadline", type: "uint256" },
{ name: "privacyTier", type: "uint8" },
{ name: "nonce", type: "uint256" },
],
};
Riddler XochiIntent (solver-side)
Signed by the user's wallet when executing via the /xochi/execute endpoint. The
wallet signs the solver-served typed data verbatim; the struct is solver-versioned
and VM-agnostic (a leg can be a base58 Tron address, so token/recipient fields are
strings). Current version is v3. Domain: name "Xochi", a deploy-scoped version
(e.g. "3-prod"), chainId = origin chain, and salt = keccak256(version); no
verifyingContract.
const xochiIntentTypes = {
XochiIntent: [
{ name: "intentId", type: "string" },
{ name: "quoteId", type: "string" },
{ name: "wallet", type: "address" }, // signer is always an EVM key
{ name: "recipient", type: "string" }, // VM-agnostic payout address
{ name: "fromChainId", type: "uint256" },
{ name: "toChainId", type: "uint256" },
{ name: "fromToken", type: "string" }, // string, not address (base58 TRC-20)
{ name: "toToken", type: "string" },
{ name: "fromAmount", type: "uint256" },
{ name: "toAmount", type: "uint256" },
{ name: "settlementPreference", type: "string" },
{ name: "deadline", type: "uint256" },
],
};
C. Complete Fee Matrix
Trading Fees by Tier
Fees are shown stablecoin / volatile (ETH/WETH). Each total decomposes into a never-discounted solver cost layer plus a tier-discounted venue + routing layer. The MEV rebate is retired; the solver shares 15% of price improvement instead (see Settlement Types).
| Tier | Trust Score | Stable | Volatile |
|---|---|---|---|
| Standard | 0-24 | 0.24% | 0.40% |
| Trusted | 25-49 | 0.21% | 0.35% |
| Verified | 50-74 | 0.17% | 0.29% |
| Premium | 75-99 | 0.14% | 0.25% |
| Institutional | 100+ | 0.12% | 0.22% |
Privacy Level Fees
The deeper privacy levels (Private, Sovereign) are gated by trust score; L1 stealth is open to all. The effective fee equals your trust tier's base fee. Higher trust unlocks deeper privacy at a lower rate.
| Privacy Level | Min Trust Score | Fee at Min Trust (stable / volatile) |
|---|---|---|
| Open | None | -0.02% (flat) |
| Public | None | 0% (flat) |
| Standard | 0 | 0.24% / 0.40% |
| Stealth | None | 0.24% / 0.40% |
| Private | 50 | 0.17% / 0.29% |
| Sovereign | 75 | 0.14% / 0.25% |
Open and Public are flat-rate tiers: Open pays users -0.02% plus analytics (loss leader), Public is free. For Standard through Sovereign, the fee is determined by trust tier (see Trading Fees table above). Users with trust scores above the minimum for their chosen privacy level pay their trust tier rate.
Settlement Types
| Type | Layer | Availability | Trust Score | Description |
|---|---|---|---|---|
| public | L1 | Now | 0+ | Standard wallet address |
| stealth | L1 | Now | 0+ | One-time stealth address (ERC-5564 + gasless ERC-4337 claim) |
| shielded | L2 | In deployment | 50+ | Aztec shielded note via pxe-bridge (opens in new tab) (embedded PXE, see Glossary) |
FX Fees
| Trade Size | Base Fee | Notes |
|---|---|---|
| <$100K | 0.08% | Trust tier rate |
| $100K-$1M | 0.05% | Trust tier rate |
| $1M-$10M | 0.03% | Trust tier rate |
| >$10M (OTC) | 0.02% | Negotiated |
Other Fees
| Source | Fee | Notes |
|---|---|---|
| Intent surplus | 15% | Of price improvement |
| OTC ($100K+) | 0.02-0.04% | Size-based |
| x402 (Guest mode) | 0.01 | Per-call micropayment when Agents transact without a Member account. Read endpoints 0.005-$0.01. See agents.json (opens in new tab) x402.endpoints for the full catalog. |
Partner Revenue Share
| Monthly Volume | Revenue Share |
|---|---|
| <$1M | 10% |
| $1-10M | 15% |
| $10-50M | 18% |
| >$50M | 20% |
D. Solver Specifications
Standard Solver Requirements
| Requirement | Threshold | Purpose |
|---|---|---|
| Stake | TBD | Slashing collateral |
| Fill rate | >95% | Reliability |
| Latency | <500ms | UX consistency |
| Uptime | >99.5% | Availability |
FX Solver Requirements
| Requirement | Threshold | Notes |
|---|---|---|
| Stake | TBD | 5x base |
| Quote validity | 30s | vs 60s for crypto |
| Slippage tolerance | 0.02% max | Tighter than crypto |
| Settlement time | <5 min | |
| Min volume | $500K/mo | For probation removal |
Slashing Events
| Event | Penalty |
|---|---|
| Failed fill after commitment | 0.1% of trade size |
| Price manipulation detected | 100% of stake |
| Latency violation (3x) | Warning, then 1% stake |
Solver Onboarding
- Stake collateral (amount TBD)
- Submit compliance attestation (jurisdiction, license type)
- Pass technical integration test
- 7-day probation period (limited volume)
- Full activation
Riddler: Current Performance
| Metric | Value |
|---|---|
| P95 Latency | <6 seconds |
| Delivery Time | ~2.1 seconds |
| Live Chains | Ethereum, Optimism, Base, Arbitrum, Polygon, Robinhood Chain |
| Integrations | LiFi, Across, CCTP, Everclear netting |
| Upcoming Chains | Tron, Solana, Aztec (pxe-bridge deployed) |
Riddler (protocol solver) is the primary active solver. External solver onboarding is open and permissionless. Contact team for integration support.
E. Xochi's ZK Compliance Oracle Proof Types
| Circuit | Code | Assertion | Hidden Data |
|---|---|---|---|
| Compliance | 0x01 | "Score below jurisdiction X" | Exact score, signals |
| Risk Score | 0x02 | "Score > X" / "Score in [X,Y]" | Exact score |
| Pattern Detection | 0x03 | "Pattern P not detected" | Transaction history |
| Attestation | 0x04 | "Valid attestation exists" | Attestation details |
| Membership | 0x05 | "Address in set S" | Which element |
| Non-Membership | 0x06 | "Address NOT in set S" | Set contents |
| Compliance Signed | 0x07 | Compliance + provider secp256k1 sig | Signals, score, sig |
| Risk Score Signed | 0x08 | Risk Score + provider secp256k1 sig | Exact score, sig |
| Compliance Multi-Signed | 0x09 | M of N providers attest (up to 5) | Per-provider data |
Signed variants (0x07, 0x08) bind a secp256k1 ECDSA signature in-circuit over the screening payload, plus chain_id and oracle_address (audit F-6) to prevent cross-chain or cross-deployment replay. The multi-signed variant (0x09) aggregates M independent signers under AND-semantics with a runtime threshold_m; jurisdictions configure a minimum (JurisdictionConfig.minMultiProviderThreshold: EU=1, US=2, UK=1, SG=2, UAE=2). Per-jurisdiction requireSignedSignals decides whether unsigned proofs are acceptable: US (BSA), Singapore, and UAE (VARA) require signed; EU (AMLD6) and UK (MLR) accept either. The signer_pubkey_hash public input is validated against an on-chain registry, so a compromised provider can be rotated without redeploying circuits.
Formal derivations for the unsigned circuits in Appendix I. Signed-variant circuits share the public-input shape of their base circuit (0x07 with 0x01, 0x08 with 0x02) plus the in-circuit signature check; 0x09 extends 0x07 with M parallel signer slots.
Jurisdiction Thresholds
| Jurisdiction | Low | Medium | High | Filing Trigger |
|---|---|---|---|---|
| EU (AMLD6) | 0-30 | 31-70 | >70 | High |
| US (BSA) | 0-25 | 26-65 | >65 | High |
| UK (MLR) | 0-30 | 31-70 | >70 | High |
| Singapore | 0-35 | 36-75 | >75 | High |
| UAE (VARA) | 0-30 | 31-70 | >70 | High |
F. Trust Score Providers
Humanity (Max 25 points)
| Provider | Points | Verification Method | Data Stored |
|---|---|---|---|
| Humanode | 15 | Biometric PoH | Hash only |
| Idena | 18 | AI-resistant tests | Hash only |
| Human Passport | 18 | Aggregated sybil scoring | Score + stamps |
| Worldcoin | 8 | Orb-verified iris | Nullifier hash |
| BrightID | 10 | Social graph | Connection hash |
Identity (Max 35 points)
| Provider | Points | Verification Method | Data Stored |
|---|---|---|---|
| ZKPassport | 30 | Government ID via ZK | Hash only |
| Privado ID | 32 | ZK identity credentials | Claim hash |
| Coinbase Verified | 25 | Exchange-level KYC | Status only |
| Civic | 22 | Identity verification | Hash only |
Reputation (Max 20 points)
| Provider | Points | Verification Method | Data Stored |
|---|---|---|---|
| ENS | 10 | Domain ownership | Boolean |
| Lens Protocol | 6 | Social graph history | Boolean |
Compliance (Max 40 points)
| Provider | Points | Verification Method | Data Stored |
|---|---|---|---|
| Chainalysis | 20 | Sanctions screening | Risk flag |
| Xochi History | 15 | Clean trading record | Flag status |
Diminishing Returns
- 1st provider in category: 100% of points
- 2nd provider: 25% of points
- 3rd+ providers: 10% of points
Score Reachability
| Tier | Score Required | Typical Path | Target User |
|---|---|---|---|
| Standard | 0-24 | Default | Anyone |
| Trusted | 25-49 | 1 humanity + 1 identity | Retail |
| Verified | 50-74 | 2 categories maxed | Power users |
| Premium | 75-99 | 3 categories + history | DAOs, funds |
| Institutional | 100+ | Full compliance stack | Licensed entities |
Maximum achievable: ~120 points. Most retail users reach Trusted or Verified. Institutional tier requires licensed compliance providers (Chainalysis) and is designed for entities, not individuals.
G. Glossary
Aztec: Zero-knowledge L2 for private smart contract execution on Ethereum. Unlike EVM chains where all execution is public and replayed by every node, Aztec splits transactions into a private phase (executed locally) and a public phase (executed on-network). Private state is encrypted and only visible to its owner. Alpha Network live (v4.x, March 2026). Explicitly experimental: known proving system vulnerability (v5 fix targeting July 2026), state not migrated between releases, ~$6.5M max safe value. 3,500+ sequencers, 50+ provers. Uses AIP-20/AIP-721 token standards (not ERC-20/721). Xochi connects via pxe-bridge (opens in new tab).
PXE (Private eXecution Environment): Aztec's local runtime for the private half of transactions. The PXE holds encrypted notes (Aztec's UTXO-like balance model), executes private contract functions locally, generates zero-knowledge proofs of correct execution, and submits those proofs to the Aztec network. The network never sees the plaintext inputs. pxe-bridge embeds a PXE and wraps it in JSON-RPC so that EVM solvers can create shielded notes without understanding Aztec's privacy model.
CCTP: Circle's Cross-Chain Transfer Protocol for native USDC transfers.
EIP-712: Ethereum standard for typed structured data hashing and signing.
Intent: User-signed message expressing desired trade outcome without specifying execution path.
MEV: Maximal Extractable Value. Profit from reordering, inserting, or censoring transactions.
Riddler: Xochi's protocol solver. Live on Ethereum, Optimism, Base, Arbitrum, Polygon, Robinhood Chain (USDG). <6s P95, ~2.1s delivery. Integrated with LiFi and Across.
Solver: Entity that fills intents by sourcing liquidity and executing trades.
Stealth Address: One-time receiving smart account derived via ECDH from a meta-address. ERC-5564 defines announcements; ERC-6538 defines the registry. Provides L1 settlement privacy.
Xochi's ZK Compliance Oracle: Zero-knowledge compliance proofs that verify regulatory conditions (AML, sanctions, thresholds) without revealing transaction data. Formalized as ERC-8262 (opens in new tab). Formerly referred to as ZKSAR (the name used in the legal documentation).
Additional Terms
Account Abstraction (AA, ERC-4337): Ethereum standard that lets smart contracts act as wallets. Enables gasless transactions (someone else pays the gas), batched operations, and custom authentication logic. Xochi uses it for stealth settlement so recipients can claim tokens without holding ETH.
Agent: Automated principal that holds its own keypair and transacts through Xochi as a Guest (anonymous, x402 pay-per-call) or under a Member's Mandate. See Member, Mandate, Guest below.
AML: Anti-Money Laundering. Regulations requiring financial institutions to detect and report suspicious activity.
Basis Points (bps): 1 bps = 0.01%. Used for expressing small fee percentages. 24 bps = 0.24% (the Standard-tier stablecoin fee).
CEX: Centralized exchange (Binance, Coinbase). Custodial platform where the operator holds user funds.
Counterfactual: A smart contract whose address is deterministic (computable in advance) but not yet deployed on-chain. It exists "in theory" until someone sends a transaction that deploys it. Xochi uses counterfactual SimpleAccounts for stealth settlement.
DCA: Dollar-Cost Averaging. Recurring purchases of an asset at fixed intervals to smooth out price volatility.
DEX: Decentralized exchange. Non-custodial trading venue where swaps execute via smart contracts. Examples: Uniswap, Curve.
ECDH: Elliptic Curve Diffie-Hellman. A key exchange protocol used in stealth address derivation. Allows two parties to generate a shared secret from their public keys without prior communication.
Everclear: Netting protocol for cross-chain transfers. When two opposing flows exist (A sends to B, C sends from B to A), they cancel out, reducing on-chain transactions.
Flash Loan: Uncollateralized loan borrowed and repaid within a single blockchain transaction. If repayment fails, the entire transaction reverts. Used to amplify solver capacity without custody risk.
Frontrunning: Trading ahead of a known pending transaction to profit from the expected price movement.
Gas: The unit of computational cost on Ethereum. Users pay gas fees (in ETH) to compensate validators for processing transactions. "Gasless" means a third party (paymaster) covers the fee.
Guest: An Agent transacting through Xochi without a Member account. Pays per call via x402 micropayments. Capped at Standard tier privacy.
Iceberg Order: A large order split into smaller visible pieces. Only one slice is shown at a time; when it fills, the next slice appears. Hides the full order size.
KYC: Know Your Customer. Identity verification required by financial regulations.
L1: Layer 1. The base blockchain (Ethereum mainnet). Transactions settle here with full finality.
L2: Layer 2. Chains that execute transactions off L1 and post compressed proofs back to it. Cheaper and faster than L1. Examples: Optimism, Arbitrum, Aztec.
Mandate: An EIP-712 envelope signed by a Member that authorizes a specific Agent wallet to act on the Member's behalf within scoped limits (max amount, expiry, call count). Presented per-request as X-Xochi-Delegation; the server verifies it without persisting any (Agent, Member) link. Revoked by the delegator via POST /api/auth/mandate/revoke. Live.
Member: A human authenticated via XID (passkey). Earns Trust Score through attestations, can issue Mandates to Agents.
Mempool: The queue of pending transactions waiting to be included in a block. Public on most chains, which is why MEV bots can see and frontrun your trades.
Meta-address: A public key pair (spending + viewing) from which stealth addresses are derived. Published once; used to generate unlimited one-time receiving addresses (ERC-6538).
MiCA: Markets in Crypto-Assets. EU regulation for crypto-asset service providers, effective 2024.
Noir: A domain-specific language for writing zero-knowledge circuits, developed by Aztec. Compiles to arithmetic circuits proven by Barretenberg (the proving backend). UltraHonk is the proof system. BN254 is the elliptic curve.
Nullifier: A value derived from a note that, when revealed, marks the note as spent. Prevents double-spending without revealing which note was consumed.
OTC: Over-the-counter. Direct trades between two parties, typically for large sizes ($100K+), negotiated outside public order books.
Pimlico: An ERC-4337 paymaster and bundler service. Sponsors gas for Xochi's gasless stealth claims.
Privacy Pool (category): Any anonymity-set primitive that lets a user prove membership or non-membership in a set without revealing which element. Examples: Railgun, Panther, 0xbow's Privacy Pools. Operates at the deposit layer; does not hide trade execution.
Privacy Pools (0xbow): Specific product implementing deposit set membership proofs ("my deposit isn't in the sanctioned set"). Live on mainnet since March 2025. Composes with Xochi: clean withdrawal from Privacy Pools, then private execution via Xochi.
Private Execution Venue: Xochi's category. A trading venue that hides the swap itself, not just the wallet or deposit history. Distinct from privacy pools (deposit layer) and privacy L1s (separate chains).
SAR: Suspicious Activity Report. A filing that financial institutions submit to regulators when they detect potentially illicit activity.
Sandwich Attack: An MEV attack where a bot inserts a buy order before your trade and a sell order after it, profiting from the price impact your trade creates.
Schnorr Account: An Aztec account type using Schnorr signatures for authentication. pxe-bridge derives a deterministic Schnorr account from the configured secret key.
Shielded Note: Xochi's term for what Aztec docs call a "private note" or just a "note". An encrypted UTXO that only the owner's PXE can decrypt and spend.
Slippage: The difference between the expected price of a trade and the price at execution. Caused by market movement or insufficient liquidity.
TWAP: Time-Weighted Average Price. An execution strategy that splits a large order into equal-sized slices over a time window to reduce market impact.
USDG: Global Dollar. A regulated USD stablecoin issued by Paxos. Native stablecoin of Robinhood Chain, which has no USDC; Riddler settles USDC<->USDG cross-asset corridors to and from it.
UTXO: Unspent Transaction Output. A balance model (used by Bitcoin, Aztec) where funds are represented as discrete "notes" rather than account balances. Spending a note consumes it entirely and creates new notes for the recipient and change.
VARA: Virtual Assets Regulatory Authority. Dubai's crypto regulator, operating under Law No. (4) of 2022.
VASP: Virtual Asset Service Provider. Any entity that conducts virtual asset transactions on behalf of others. Defined by FATF and adopted by VARA, MiCA, and other frameworks.
View Key: A cryptographic key that allows a third party to see (but not spend) private transaction data. Some privacy protocols use view keys for auditability. Xochi's ZK Compliance Oracle avoids this by proving compliance without creating viewable data.
x402: HTTP 402 Payment Required protocol for pay-per-call API access (https://x402.org (opens in new tab)). Xochi accepts x402 USDC payments on writes (0.01) and reads ($0.0001) so Guests can transact without a Member account. JWT and x402 are alternatives, not additive.
Zero-Knowledge Proof (ZKP): A cryptographic proof that a statement is true without revealing the underlying data. Example: proving your age is over 18 without revealing your birthdate.
H. Widget SDK (Upcoming)
Installation
npm install @xochi/widget-react
Basic Usage
import { XochiWidget } from "@xochi/widget-react";
<XochiWidget
appCode="my-dapp"
theme="dark"
partnerFee={{ bps: 25, recipient: "0x..." }}
onTradeComplete={(tx) => console.log(tx)}
/>;
Configuration
interface XochiWidgetParams {
appCode: string;
chainId?: number;
enabledChains?: number[]; // [1, 42161, 10, 8453]
defaultPrivacy?: PrivacyTier; // "standard" | "shielded" | "private" | "sovereign"
partnerFee?: { bps: number; recipient: string };
theme?: "light" | "dark" | CustomTheme;
mode?: "swap" | "fx" | "fx-api";
pairs?: string[]; // For FX mode: ["USDC/EURC"]
batchEnabled?: boolean; // For fx-api mode
webhookUrl?: string; // For fx-api mode
exportFormat?: "csv" | "json"; // For reconciliation
}
Events
const listeners = {
onQuoteReceived: (quote: Quote) => void,
onTradeComplete: (result: TradeResult) => void,
onTradeFailed: (error: Error) => void,
onPrivacyTierChange: (tier: PrivacyTier) => void,
};
Partner Tiers
| Tier | Max Fee | Requirements | Perks |
|---|---|---|---|
| Standard | 25 bps | None | Self-service |
| Premium | 50 bps | $100K/mo | Hide branding |
| Enterprise | Custom | Contact | White-label |
I. Formal Derivations
Mathematical specifications for the Xochi ZK Compliance Oracle. Each section defines a predicate proven in zero knowledge: the verifier learns only the public inputs, never the private witness.
Reference implementation: ERC-8262 (opens in new tab). Proof system: UltraHonk (Barretenberg). Circuit language: Noir. Merkle depth: 20 (capacity: leaves).
Hash functions. All commitments use Pedersen hash over the BN254 curve via fixed-arity wrappers (). Domain separation between contexts is achieved by prepending an explicit domain-tag field constant to the hash input. The reference implementation defines eight tags (internal Merkle nodes, set-bound leaves, value leaves, subject-bound leaves, credential hashes, signed-variant payload, multi-signed slot payload, and signer pubkey commitment); three further commitments (provider set, config, transaction set) are fixed-arity hashes over a single context and rely on the input layout itself for distinctness. Pedersen does not separate domains by arity alone: trailing-zero generators collapse to identity, so for without an explicit tag. Migration to Poseidon2 is planned when stable high-level APIs are available in Noir.
I.1 Risk Score
Given screening providers, each returning a signal with published weight :
is in basis points: 0 = 0.00%, 10000 = 100.00%. Integer division truncates (max error bps).
Overflow bound. Worst case: , , .
All intermediate values fit in u32. No modular reduction occurs.
Commitment. The prover commits to the provider set via and to the weight configuration via . The verifier checks these against published on-chain values. The prover also supplies and the circuit verifies matches the sum, preventing denominator spoofing.
I.2 Compliance (Circuit 0x01)
Proves a risk score is below a jurisdiction's high-risk filing threshold.
Public inputs: jurisdiction , provider_set_hash, config_hash, timestamp , result .
Private inputs: signals , weights , weight sum , provider IDs , provider count .
Predicate:
where is the risk score (I.1) and is the jurisdiction threshold:
| Jurisdiction | (bps) | Equivalent | |
|---|---|---|---|
| 0 | EU (AMLD6) | 7100 | 71% |
| 1 | US (BSA) | 6600 | 66% |
| 2 | UK (MLR) | 7100 | 71% |
| 3 | Singapore | 7600 | 76% |
| 4 | UAE (VARA) | 7100 | 71% |
Constraints:
- (after 2021, before year ~36812)
I.3 Risk Score (Circuit 0x02)
Standalone risk score proof supporting threshold and range predicates. Like Compliance (I.2), this circuit commits to the provider set, preventing a prover from fabricating signals from unverified providers.
Public inputs: proof_type , direction , lower bound , upper bound , result , config_hash, provider_set_hash.
Private inputs: signals , weights , weight sum , provider IDs , provider count .
Predicate:
Constraints:
I.4 Pattern Detection (Circuit 0x03)
Proves a transaction set exhibits no structuring, velocity, or round-amount anomalies.
Public inputs: analysis_type , result (true = clean), reporting threshold , time window , tx_set_hash.
Private inputs: amounts , timestamps , count .
Commitment:
Constraints:
- (timestamp sanity on active transactions)
- (inactive slots zeroed)
Overflow bound. The floor calculation must not overflow u64. The circuit enforces .
Structuring (). Let (floor at 90% of threshold). Count suspicious transactions:
Clean if fewer than half of transactions cluster just below the reporting threshold.
Velocity (). Let . Count transactions in the window:
Round amounts (). Count amounts divisible by 1000:
Clean if fewer than 80% of transactions are round numbers.
I.5 Attestation (Circuit 0x04)
Proves the submitter holds a valid, unexpired credential issued by an authorized provider. Each provider maintains a per-provider Merkle tree of credentials they have issued; the on-chain registry binds each tree root to the issuing provider_id, and the Solidity validator checks that the proof's claimed provider_id matches the registered provider for the supplied root.
Public inputs: provider ID , credential type , result , credential root (the provider's per-provider credentials tree), current timestamp , submitter . Credential types: 1 = KYC Basic, 4 = Institutional. Types 2 and 3 are reserved for future use (e.g., KYC Enhanced, Accredited Investor).
Private inputs: attribute , expiry , Merkle index , Merkle path .
Credential hash (single-round Pedersen with explicit domain tag, binding the credential to a specific submitter at issuance time):
Leaf: (value-style leaf hash with explicit tag).
Predicate:
with the implicit constraint enforced by hard assert: the proof cannot be produced if the leaf is not in the tree. Forging a credential requires either breaking Pedersen preimage resistance on the leaf hash or publishing a new root, which only the provider's authorized publisher EOA can do.
I.6 Membership (Circuit 0x05)
Proves an element belongs to a set (allowlist, approved counterparties).
Public inputs: Merkle root , set ID , timestamp , result .
Private inputs: element , Merkle index , Merkle path .
Leaf binding: (prevents cross-set membership claims).
Predicate:
where MerkleRoot walks from leaf to root using little-endian index bits to determine left/right child placement at each level.
I.7 Non-Membership (Circuit 0x06)
Proves an element is NOT in a sorted set (sanctions list exclusion). Uses an indexed Merkle tree.
Public inputs: Merkle root , set ID , timestamp , result .
Private inputs: element , adjacent leaves , their Merkle indices and paths.
Adjacency proof:
where leaf hashes are bound to set_id: , .
Truncation defense. The BN254 scalar field is ~254 bits. Ordering comparisons use u64 casts, which truncate. Without range checks, an attacker could craft a 254-bit field element that differs from a real leaf but produces the same u64 after truncation, falsely proving non-membership of a value that IS in the tree. The circuit enforces:
This makes truncation a no-op: the u64 cast preserves the full value.
I.8 Trust Score Aggregation
Trust scores are computed off-chain from verified attestations across four categories.
Category caps:
| Category | Cap |
|---|---|
| Humanity | 25 |
| Identity | 35 |
| Reputation | 20 |
| Compliance | 40 |
Diminishing returns. Within each category, the -th attestation contributes a fraction of its base points :
Category score:
where attestations within each category are sorted by descending (greedy: highest-value first).
Total trust score:
Maximum achievable: ~120. Tier thresholds:
| Tier | Score range | Stable | Volatile |
|---|---|---|---|
| Standard | 0.24% | 0.40% | |
| Trusted | 0.21% | 0.35% | |
| Verified | 0.17% | 0.29% | |
| Premium | 0.14% | 0.25% | |
| Institutional | 0.12% | 0.22% |
I.9 Fee Function
Trust tier and asset class determine the fee. Privacy level determines data retention and is gated by trust score. There is no additive privacy premium. Each total decomposes into a never-discounted solver cost layer plus a tier-discounted venue + routing layer (the MEV rebate is retired; the solver shares 15% of price improvement).
Base fee (piecewise on trust score and asset class ):
Privacy level access requires minimum trust score :
| Privacy level | |
|---|---|
| Open | |
| Public | |
| Standard | |
| Stealth | |
| Private | |
| Sovereign |
Effective fee (trust , privacy level , asset class ):
Open and Public are flat-rate loss leaders. For Standard through Sovereign, the fee is trust- and asset-based. Higher trust earns both deeper privacy access and a lower total. An Institutional user (100+) pays 0.12% (stable) / 0.22% (volatile) at any privacy level. A Standard user (0-24) pays 0.24% (stable) / 0.40% (volatile) at Standard, the only level they can access.
Additional revenue: 15% of intent surplus (price improvement over quoted amount), plus solver spread captured by Riddler.
I.10 Spoofability Score and Weight Updates
Each screening provider carries a spoofability score:
where:
- : flagged-to-total address ratio (empirical sybil rate)
- : forgery cost normalized to USD
- : incident severity index
- , , , with
Effective weight:
caps the maximum downward adjustment at 40%.
Recovery. After two consecutive improved review periods (each cycle must improve on the immediately prior one), a provider regains up to 20% of lost weight per cycle:
Convergence. After a single incident with no further degradation, recovery to within 1% of base weight takes cycles. For maximum penalty (): cycles (8.5 years at bi-annual cadence). For typical penalties (): cycles (2.5 years).
Review cadence: bi-annual (January/July). Adjustments published 14 days before effect.
I.11 Security Properties
Soundness. A computationally bounded prover cannot produce a valid proof for (meets threshold) when . Inherited from UltraHonk (~128-bit security). Applies to all six circuits.
Zero-knowledge. The verifier learns only the public inputs. Individual signals, weights, provider identifiers, transaction amounts, timestamps, credential contents, and set elements remain hidden. Pedersen commitments are computationally hiding under the discrete log assumption on BN254.
Replay prevention. On-chain, proofs are keyed on . The same proof bytes submitted for different proof types are treated as distinct.
Proof-of-innocence. Attestations are stored on-chain with the original proof hash, provider set hash, and timestamp. If an address is later flagged, the historical attestation proves it was clean at .
I.12 Known Limitations
- Proof front-running (partial fix). Compliance (0x01) and risk_score (0x02) proofs now include
submitteras a public input. The Oracle enforcessubmitter == msg.sender, so these proofs cannot be front-run. Attestation (0x04), membership (0x05), and non-membership (0x06) proofs still lack submitter binding. An attacker who observes one of these in the mempool can submit it first, burning the replay slot. - Timestamp staleness. The circuit enforces but no recency bound. A proof generated weeks ago remains valid. The SDK applies an optional recency check (
maxProofAge, default 3600s), but this is client-side only. - Pattern time_window. The prover chooses . The circuit enforces , but a malicious prover can set to trivially pass velocity checks. On-chain enforcement of a minimum is not yet implemented. The SDK enforces a minimum of 86,400 seconds (24 hours) at the application layer, and the solver relay rejects clearance tokens where the associated proof used below this minimum. However, these are off-chain checks that can be bypassed by a forked SDK. Moving minimum enforcement into the circuit itself is a priority update. This matters for settlement splitting (XIP-1): the anti-structuring requirement at finalization depends on a valid pattern proof, but until on-chain enforcement ships, the solver relay is the last line of defense.
J. Execution Specifications
Technical details for intent execution, inventory management, and settlement. Complements Section 6 of the whitepaper.
Inventory Check
Before self-filling an intent, Riddler computes available inventory on the destination chain:
A safety buffer is applied based on trade size:
| Trade Size | Buffer |
|---|---|
| <$10K | 10% |
| $10K-100K | 5% |
| >$100K | 2% |
Minimum remaining after fill: $1,000 USD. Supported self-fill tokens: USDC, USDT, USDG, WETH.
Bridge Routing Priority
When self-fill is insufficient, Riddler routes through external liquidity in priority order based on urgency:
| Priority | Adapter | Typical Latency | Fee (bps) | When Used |
|---|---|---|---|---|
| 1 | DeFi Llama | Varies | ~0 | Cheapest quotes |
| 2 | Native bridges | 5-15 min | ~0 | L1-to-L2 (Optimism, Arbitrum, Base) |
| 3 | CCTP | 10-20 min | ~0 | USDC only (Circle attestation) |
| 4 | Hop | 10-30 min | Low | Fast, lower fees than Across |
| 5 | Everclear | 15-30 min | ~2.3 | Netting layer (80%+ savings if netted) |
| 6 | LiFi | Varies | Varies | Flexible cross-chain, oracle proofs |
| 7 | Across | Varies | Varies | Multi-hop fallback |
| 8 | CEX | 5-30 min | Varies | Binance/Coinbase when bridges down |
Everclear is excluded from high-urgency and emergency scenarios due to the 15-30 minute netting window. CEX routing uses Binance (primary) and Coinbase (preferred for Base).
Flash Loan Integration (Planned)
For same-chain fills where Riddler lacks inventory:
Block N:
1. Borrow X tokens from Aave/Compound flash loan pool
2. Transfer X tokens to user's stealth account (fill the intent)
3. Receive user's sell tokens (from PERMIT2/ERC-3009 authorization)
4. Repay flash loan + fee
5. Net profit = spread - flash loan fee - gas
Cross-chain: flash loans cover the fill on the destination chain. The sell-side tokens on the origin chain are received via the user's authorization (PERMIT2 or ERC-3009). Bridge capital is still required for the duration of the cross-chain transfer.
Settlement Splitting
Two kinds, at different layers. They compose.
Compliance proof splitting (XIP-1 (opens in new tab), Draft): breaks a trade into N sub-settlements, each with its own compliance proof, linked by a tradeId in a SettlementRegistry contract. Splitting is deterministic (uniform amounts, remainder on the last sub-trade). Randomized and logarithmic distributions were considered and rejected: the compliance circuit doesn't take amounts as input, so noisy amounts buy nothing. Finalization requires a pattern detection proof (circuit 0x03) to prevent structuring. Minimum split threshold: 10 ETH.
Stealth address splitting (planned): puts each sub-settlement into a separate stealth account.
1. Derive N stealth keys from recipient's meta-address (varying ephemeral secrets)
2. Compute N counterfactual SimpleAccount addresses (salt = 0, 1, ..., N-1)
3. Split sub-trade amount equally across N accounts
4. Submit N announcements (ERC-5564, 109 bytes each)
5. Recipient scans and claims from each account independently
Gas cost scales linearly with N. Recommended threshold: $100K+ trades.
Venue routing (XIP-2 (opens in new tab), Draft): each sub-trade from XIP-1 can be routed independently to public (L1), stealth (ERC-5564), or shielded (Aztec L2) based on the user's trust score and a gas budget. Users who need trade-size privacy use shielded venues. That's the only settlement path where amounts aren't visible on-chain (the solver still sees them during execution).
Fill Rejection
When an intent exceeds available liquidity (inventory + external sources), the API returns:
{
"error": "INSUFFICIENT_LIQUIDITY",
"availableAmount": "50000000000",
"requestedAmount": "100000000000",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chain": 1
}
The frontend can display the available amount and offer to fill at the reduced size (partial fill support planned).
Last updated: April 2026