# BlazePhoenix-Dex Whitepaper v2.4.0 — part 6 of 9: Part V — Architecture, performance and deployment > One part of the whitepaper in llms.txt form; every part and every section is listed in > https://blazephoenix.xyz/whitepaper/llms.txt. The parts are the full text, unabridged: the bodies of parts > 1-9, joined in order, are https://blazephoenix.xyz/whitepaper.md byte for byte (sha256 a47389f947e4aa6656f693004e43fbe3e0101dccaf133e49c303767811f223cc). > Cite as https://doi.org/10.5281/zenodo.24517342; numbering (§, E, INV-) as in the paper. ----- verbatim text of whitepaper.md follows ----- ## Part V — Architecture, performance and deployment ## §16 Architecture and sizes *Plain:* five core contracts and three supporting pieces, one of which is pure mathematics imported by the others, and no piece of mathematics is defined twice. *Precise:* the Core is a stateless library with no storage write; Hub, Solver, Router and Quoter import it and none redefines a primitive, so one review of the mathematics covers every consumer; the Gate puts every external venue behind an immutable wrapper, and Math is a stateless library whose codehash the Solver pins. ### §16.1 The contracts: what each holds, what each may call The DEX source tree has sixteen deployable artefacts. Five are the core: Router, Solver, Hub, Quoter and Core. Three are supporting: the Gate and its per-venue wrapper, and the Math library. Eight are adapters that translate one external venue family into the Gate's single interface: AlgebraIntegral, BalancerV2, BalancerV3, CurveCryptoNG, CurveNG, InfinityBin, InfinityCL and LB (`src/adapters/` at `6387350`). Only the venues the repository's README lists as supported are claimed in this paper (Appendix E); an adapter that exists in the source but is not listed is not a claim. | Contract | Holds | May call | Writes persistent state | Size (runtime bytes) | |---|---|---|---|---| | **Core** (library) | nothing: pure and view functions (Ω, 𝒟, Φ, Ψ, the Monoslot codec, safe transfers, `mulDiv`) | pools and tokens, read-only, every guarded `staticcall` capped at `GAS_CAP = 100,000` | never: no `tstore`, no `sstore` in its source | 19,303 | | **Math** (library) | nothing: the stateless per-hop choice | the Hub, read-only | never | 9,768 | | **Hub** | the registry (one Monoslot per pool, ≤ 16 per pair), factory rows (≤ 16), bridges (≤ 3), hook allow-list with codehash pins, V4 entries, roles; ERC-7201 namespaced | pools and factories, read-only, through the Core; the V4 PoolManager via `extsload` | on `recordSwap` (Router only), on admission and configuration | 21,780 | | **Solver** | nothing, `view` only | the Hub (registry reads, discovery), pools through the Core, the Math library (its codehash is checked against the Solver's own record of it) | never | 21,349 | | **Router** | admin, treasuries, `permit2`, `weth`, `paused`, `controlRenounced`, rescue queue; **no token balance at rest** beyond the recorded `owed` (the part of a fee a recipient refused) | the input token, the pools of the route, the output token, the Hub (`isBridgeToken`, `isHookLive`, `recordSwap`), the Solver (`findBestRoutePlan` only, `view`, from the `swapBestExactIn` door), WETH and the PoolManager for V4, Permit2 for its door, the treasuries, the recipient, and external venues only through a Gate wrapper; never a caller-supplied target | its own configuration; the one external write per swap is `Hub.recordSwap` on the success path | 22,717 | | **Quoter** | nothing | the Solver (`view`), the Hub (`isBridgeToken`, read-only), pools for the Exact Pass dry-run (called and reverted) | never | 19,892 | | **Gate** and **GateWrapper** | the curated list of adapters (codehash pinned) and, per external venue, one immutable wrapper | the adapter, read-only for a quote and as the settlement path for a swap | on admission or replacement of an adapter, after `ADAPTER_DELAY` (48 hours); at most four wrappers per pair | 10,758 and 4,414 | | **Adapters** (eight) | nothing | one venue family each | never | 3,014 to 6,347 each; 37,340 together | ^tab-16.1 ![FIG-15 — Topology of the contracts](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-15.svg) *FIG-15 — Topology of the contracts: the Core (pure mathematics: Ω · 𝒟 · Φ · Ψ) imported by Hub (registry, Ψ state, bridges, hook pins), Solver (route optimiser, view, with the Math library it pins), Router (atomic execution, the only contract that moves funds) and Quoter (preview, view and dry-run); the Gate with its wrappers and eight adapters as the one door to external venues. Arrows are calls; the one solid arrow into storage per swap is Router → Hub.recordSwap; every other arrow from Solver and Quoter is view-only.* Trust runs one way. The Hub trusts the Router to call `recordSwap` (`onlyRouter`) and no one else; the Router trusts the Hub for three facts a route needs (is this token a bridge, is this hook live, and the registration write) and for nothing that prices a trade. The Solver trusts the Hub's registry only as a list of coordinates to measure. The Quoter trusts the Solver's plan as advisory and re-prices concentrated legs against the pools themselves. Nothing trusts calldata: a route reaches the Router as a stranger's claim. An external venue is reached only through a Gate wrapper, so what the Gate trusts is a codehash and a 48-hour delay, not a name (§14.4). ### §16.2 The life of one swap ![FIG-16 — The life of one swap](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-16.svg) *FIG-16 — The life of one swap: `previewAndEncode` (view) → calldata → a door → `_execute` → venues → settlement, with the check at each step named by its refusal code: minimum and deadline at the door; hop shape and continuity; arrival measured; per hop, rescale, fee if this is the fee hop, per-leg floor and coverage gate, hop aggregate; sweeps; gross output; the route floor Φ; the output-side fee if any; delivery measured at the recipient; `userMinOut`; the fee ledger; `recordSwap` per executed leg; `ExecutionProof`.* 1. **Preview** (off-chain, free): `previewAndEncode` runs `findBestRoutePlan` — registry and, if not fresh, discovery; Ξ; Ψ ranking; probes; the band; allocation; the clamp; the split gate; the attested floor — and returns the `Preview` and the calldata. The trader sets `userMinOut` from their own price expectation. 2. **The door**: `swapExactIn` (or a sibling) checks the deadline (`RouterE(4)`), refuses a zero minimum (`RouterE(10)`), pulls the input and measures the delta. 3. **`_execute`**: hop count, legs per hop and hop continuity (`RouterE(3)`); the fee scan; baselines born once. 4. **Per hop**: rescale against the measured arrival; charge the fee if this is the fee hop (or every hop in exhaustion); read each pool once for amount, impact and quote; execute each leg through the shape its kind selects (an external venue, kind 9, only through its Gate wrapper, §14.4; `RouterE(8)` for an unknown kind, `RouterE(9)` for a delta-altering hook); the per-leg floor with the coverage gate and the hop aggregate (`RouterE(5)`); the callback pays only the committed pool (`RouterE(6)`). 5. **Sweeps**: unspent input and bridge residuals above their baselines return to the payer. 6. **Settlement**: gross output as a delta (`RouterE(8)` if zero); `floorBps` from measured impact and concentration; the route floor against the final hop's in-frame quote and the three-way maximum (`RouterE(5)`); the output-side fee on a direct route into a bridge coin; transfer, delivery measured at the recipient, `userMinOut` on the delivered amount (`RouterE(5)`); the fee ledger (`RouterE(15)`, `RouterE(16)`). 7. **The one write**: `Hub.recordSwap` per executed leg, with measured amounts; then `ExecutionProof`, `Swap` and `Fee` events. Nothing is written when any check refuses; the transaction, every pool's swap included, never happened. ### §16.3 Sizes against EIP-170 Runtime bytes of the sixteen artefacts, from the `forge build --sizes src` output of the CI size guard at commit `6387350` (release profile, solc 0.8.36), identical byte for byte to the repository's `.sizes-snapshot` and README table: | Contract | Runtime bytes | Under the 24,000-byte gate | Under EIP-170 (24,576) | |---|---|---|---| | Router | 22,717 | 1,283 | 1,859 | | Hub | 21,780 | 2,220 | 2,796 | | Core | 19,303 | 4,697 | 5,273 | | Solver | 21,349 | 2,651 | 3,227 | | Quoter | 19,892 | 4,108 | 4,684 | | Gate | 10,758 | 13,242 | 13,818 | | Math | 9,768 | 14,232 | 14,808 | | GateWrapper | 4,414 | 19,586 | 20,162 | | Five core contracts together | 105,041 | | | | Eight adapters together (each between 3,014 and 6,347) | 37,340 | | | | All sixteen artefacts | 167,321 | | | ^tab-16.3 ![FIG-17 — Runtime sizes against the 24,000-byte gate and EIP-170](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-17.svg) *FIG-17 — Runtime sizes of the contracts against the project's 24,000-byte gate and the EIP-170 limit of 24,576 bytes, release profile; the largest initcode is the Solver's, 31,508 bytes, against the EIP-3860 limit of 49,152.* Against the 2.3 measurement the Hub is 1,868 bytes smaller and the Router 1,064 smaller, while the Solver is 1,663 larger, the Quoter 8,463 larger and the Core 12,861 larger (derived from the 2.3 table). The CI guard fails a build at 24,000 bytes of runtime, 576 below the EIP-170 limit, and it passed (`All BlazePhoenix contracts under the 24000-byte margin. OK.`). The gate is also asserted inside the suite (`DeployedSizeGate`) on the profile the suite runs under, which `profile_parity.py` keeps identical in compiler options to the release profile: a suite that tested a binary the chain could not accept would be testing the wrong object. Size is measured, never estimated. The Router and the Hub sit within about two to three thousand bytes of the wall (1,859 and 2,796 under EIP-170), so every byte added is paid for by a byte removed. To reproduce: `forge build --sizes src` with `FOUNDRY_PROFILE=release` on the commit named above, and compare against `.sizes-snapshot`. The STK contract is measured separately: runtime 24,157 bytes, 419 under EIP-170, solc 0.8.28, default profile at `c0366cf`; it is not one of the sixteen. ### §16.4 The attack surface, counted An attack surface is what an adversary can write, what a contract holds, whom it calls, and who holds power over it. Each is a countable quantity here. **What a caller can write.** A route is a typed structure, at most 2 hops × 5 legs = 10 legs, each leg ten fields (`pool`, `hooks`, `kind`, `fee`, `tickSpacing`, `zeroForOne`, `stable`, `amountIn`, `expectedOut`, `auxId`), and no field names a call target or carries a calldata blob. `docs/assurance/fields.json` classifies every caller-writable field that reaches state, an event or a guard: 25 rows at `969bcc6`, counted by class below (a row is a field at one site, so a field can appear in two rows). | Class | Rows | Meaning | Examples | |---|---|---|---| | **confirmed** | 17 | execution reads the field *and* a check compares it against an observation | `leg.kind` re-derived from the pool's shape (Hub `recordSwap`); `leg.fee` on concentrated pools, where the pool answers; `leg.amountIn`, rescaled by the measured arrival; `leg.expectedOut`, lifted by the coverage gate; `hop.tokenIn`/`tokenOut`, gated against the pool's own `token0`/`token1`; `leg.hooks` and `leg.auxId` on V4, which enter the executed pool id | | **steering** | 5 | the field directs a token movement, so a false value punishes the caller and needs no separate check | `leg.pool` on pair and concentrated venues (tokens are pushed to it, or the callback authenticates on it); `leg.kind` where execution runs the branch it names; `route.singleOutFloor` (monotone: it can only tighten the caller's own floor); the advisory route fields (`totalOut`, `estGas`, …), read by nobody | | **declared** | 3 | it reaches state, an event or a guard, and nothing observes it, each with its reason recorded | `leg.fee` on V2 pairs (no pair exposes `fee()`; bounded by a ceiling and used by quote and execution alike, so the two cannot diverge); `leg.hooks` on non-V4 legs (feeds only the hookless-before-hooked ordering; a lie costs the caller their own route); `leg.stable` (the Hub measures `stable()` at registration and both consumers read the same declaration) | ^tab-16.4a The registry's ranking, the protocol floor and the fee base are computed only from confirmed quantities (`docs/AUDIT_METHOD.md:74-79`). The Hub confirms `kind`; the Router confirms the amounts, the tokens and the concentrated fees; the derivation confirms the V4 fields by construction. The 2.3 text counted 23 fields (14 confirmed, 5 steering, 4 declared); the 969bcc6 file has 25 rows (17, 5, 3). The class of each row was read from `fields.json`; whether the 2.3 count of fields and this count of rows measure the same thing was not checked. **What the Router holds between transactions.** No token balance at rest: `INV-1`, asserted by `invariant_RouterHoldsNothing`, `invariant_routerHoldsNothing` and `invariant_HoldsNothingBeyondTheSeed` across the campaigns, each with its guard mutants (Appendix B). Fees stream to the treasuries inside the swap; residuals return to the payer inside the swap. The register refines two edges of "nothing": the Router records `owed`, the part of a fee a recipient refused (since 2026-10-21), and for share-based tokens that round down the final balance is below k + d/n shares after k transfers, zero for tokens that move the exact amount (`SHARED_QUANTITIES.md:54-55`, `test/RouterBalanceAfterSettlement.t.sol`). A mis-send is the only other thing that can sit in the Router: the 48-hour rescue exists to return it, and every swap's baselines exclude it from payout. Core, Solver and Quoter write no storage. **Whom a swap calls.** The counterparties of one swap form a closed set of classes: the input token; the output token; the pools the route names (at most 10, the product of the two route bounds); the Hub; the Solver, only through `findBestRoutePlan` from the `swapBestExactIn` door and only as a view; WETH and the PoolManager, only for V4 and native legs; Permit2, only through its door; the treasuries and the recipient; and, for an external venue, its Gate wrapper. The executor takes no caller-supplied call target (SOK-ARBITRARY-CALL), dispatching venue interaction from a closed set of shapes selected by a registry-held kind. Every guarded read is capped at 100,000 gas. **Who holds power.** The control functions of the Router and the Hub are enumerated in §14.6 and §14.7 with what each can and cannot reach; none can move principal, the fee, the split or the floors; all of them end at `renounceControl`, and what survives is the grow-only curator tier, existing operator seats, and each treasury's power to move its own slot (`moveTreasury`) and claim what that slot is owed (`claimFee`). The one added power is the Gate's: adding or replacing an adapter waits 48 hours, and a pair has at most four wrappers. There is no `selfdestruct` and no proxy in the Router source (a `grep` for `selfdestruct` and `delegatecall` at `6387350` is empty), and no initialiser after the Hub's one-time `initialize`. **What must exist for a trade to settle.** §3.1's budget: no routing service, no oracle, no solver network, no keeper, no proxy: five zeros where the incumbent design has "required", "common" or "varies". **The counted difference.** Against a design that fetches its route off-chain and executes a generic call list, or holds inventory: | Surface | This design | Off-chain-solved executor | Inventory-holding venue or router | |---|---|---|---| | caller-writable fields that reach a guard | 25 rows in the register, 17 confirmed against an observation, and 0 name a call target | a list of `(target, calldata)` pairs: unbounded, and each target is a call the contract makes on the caller's word | none | | token balance at rest in the executor | 0 (`INV-1`), apart from the recorded `owed` | typically 0 | the inventory itself | | contracts that write storage during a swap | 1 (`Hub.recordSwap`, one write per executed leg, success path only) | varies | the venue's accounting | | who computes the route | the chain (`findBestRoutePlan`, `view`) or the caller, re-measured in-frame either way | a server; the contract checks, it does not choose | none | | oracles, keepers, proxies, upgrade paths | 0 | commonly ≥ 1 of each | commonly a proxy | | privileged functions that can reach principal | 0 | a proxy admin can replace the logic | varies | | deployed bytes an auditor must read | 167,321 in sixteen artefacts, 105,041 of them in the five core contracts, every one under EIP-170 | the settlement contract, plus a server whose size in auditable lines is unknowable | none | ^tab-16.4b The comparison is counted, not argued: the difference is a bounded, typed, confirmed route against an unbounded list; zero against inventory; one write against many; and a route the chain derived, or the caller derived and the chain re-measured, against a route a server derived and the chain merely checked. ## §17 Measured performance *Plain:* everything in this section was measured on forks of real chains, with real venues and real reserves deposited by strangers, and every number carries its date and the commit it was measured at. *Precise:* a number appears here only if a harness in the repository, or a CI log, reproduces it; the harness, the chain and the date are printed beside it. A fork measurement is evidence about behaviour, not a deployment record; the deployment record is §19. This section has two layers and they are not mixed: the measurements of the 2.3 paper (August to September 2026), kept with their date; and the newer measurements of the DEX at `969bcc6`, taken from the CI run of 2026-11-16 (job numbers in the text) and from the gas campaign of 2026-11-13. Where the newer run did not repeat an old measurement, the old number stays and says so. ### §17.1 Cross-chain identity The same bytecode was exercised on forks of Ethereum, Arbitrum, Optimism and Base, adapting to each chain's venue mix (Aerodrome and Pancake alongside V4 on Base, Camelot on Arbitrum, Velodrome on Optimism), with no per-chain code change (2.3, 2026-08). The four chains were chosen because between them they exercise every venue family the registry admits, so a per-chain special case, had one existed, had four chances to surface. On every chain two identities were measured against ground truth: for CREATE2 derivation, each pool address computed by 𝒟 against the address the chain's own factory reports for the same pair and parameters, with `hasCode` confirming bytecode at every derived address; for the Exact Pass, the venue's own swap called over live state and its deltas carried out in the revert payload, surviving each family's callback conventions, Algebra's included. Both identities held on all four chains, and the differences column the table would need is empty. This paragraph carries the Version 2.3 measurement (2026-08). ### §17.2 Preview to delivery fidelity The thesis admits a direct measurement: quote a swap, execute it, compare. The `FidelityMatrix` fork harness quotes, executes and settles real pairs on Arbitrum, Base, Optimism and Robinhood Chain at pinned blocks and prints preview against delivery for every pair it touches; it carries a permanent alarm at 50 bps, so a fidelity regression announces itself. **2026-08-24 (2.3).** The band was 0 to 1 bps on every executed pair on all four chains, with the Solver matching an exhaustive two-way split grid in 10 % steps on Arbitrum, within 0.13 bps of the grid maximum on Base, and grid-exact on Robinhood Chain. **2026-11-16, `969bcc6`, fork job 133367255593 (`FOUNDRY_PROFILE=default`).** The `FidelityMatrix` prints 12 lines of "fidelidade bps", and all 12 are 0 bps (Arbitrum 2, Base 6, Optimism 2, Robinhood Chain 2). One further Base line printed no execution ("exec real 0"), so it is not counted among the 12. The gap between the gross quote and what is delivered, printed alongside, is 27 to 28 bps on every line. Log lines 1231 to 1414 of that job. | Chain | Executed lines at 0 bps | Solver against the grid maximum (`969bcc6`) | |---|---|---| | Arbitrum | 2 | 405150655106280137 against 405150948354222448: −0.0072 bps | | Base | 6 | 533611958127074266 against 533549116344743073: +1.178 bps, the Solver is above the grid | | Optimism | 2 | equal to the wei (0 bps) | | Robinhood Chain | 2 | equal to the wei (0 bps) | The grid comparison is `(s − g) / g × 10⁴` with `s` the Solver's output and `g` the grid maximum, read from the "[GRELHA] … solver/gridMax" lines. A Solver result above the grid maximum on Base means the grid, which is a 10 % grid, is not the optimum there; it is not a claim that the Solver is better than the optimum. The 2.3 paper also stated real fills of "222,000 to 326,000 gas all-in" on Base. This paper does not repeat that as confirmed: the 2026-11-16 matrix prints "gas: est / exec real" and the exec figure runs 383,452 to 2,164,869 on the six executed Base lines (and the same interval on the 12 lines of the four chains). That the "exec real" column and the 2.3's "all-in" are the same quantity was not checked, so the two ranges are shown, not reconciled. The matrix executes constant-product, concentrated, V4 (native included) and Solidly legs end to end. Two behavioural results ride alongside: bridge intermediaries are selected adaptively per pair as the Meta-Equation's maximiser, and a deliberately isolated pair returns no route rather than a fabricated one. ![FIG-17.2 — Preview against delivery, 12 lines](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-17.2.svg) *FIG-17.2: preview against delivery, 12 lines, one dot per line, all at 0 bps, with the 27 to 28 bps gross-to-delivered gap drawn separately.* ### §17.3 The factory census and the public sweep A venue registration is a claim, and the claim has its own instrument. The census harness (`FactoryCensus`) inherits the production deployment wiring and lives with that script in the private deployment tree, so its numbers are reported, not reproducible from this checkout. It reports, for every registered factory on every chain over a fixed token corpus, three columns: registered, holds a pool for the pair, won the pair (supplied a leg of the winning route), over one denominator, hop-pairs, with an explicit unresolved bucket that measured zero on all four chains in 2026-08. | Arbitrum, 88 hop-pairs (2026-08, private harness) | Holds a pool | Won the pair | |---|---|---| | Uniswap V4 (native + wrapped) | 67 | 48 | | Uniswap V3 | 86 | 33 | | Pancake V3 | 77 | 13 | | Camelot V3 | 66 | 10 | A pair credits every venue that supplied a leg of its winning route, so the column may exceed the pair count: attribution, not partition. There is no newer census in the repository. What is public and current is the sweep that shares its fixtures and its anti-vacuity gate, `test/fork/TokenSweep.t.sol`: in the fork job of 2026-11-16 (job 133367255593) it ran on Arbitrum (3 tests), Base (15) and Optimism (3), all green. A sweep is a pass or a fail on a fixed corpus; the paper does not turn it into a coverage percentage. The anti-vacuity gate means a pair reported as having depth must also quote non-zero. ### §17.4 Gas Every figure is traceable to a named harness or log, and cold and warm are reported separately. The table keeps the 2.3 rows with their date and adds the 2026-11-16 rows beside them. The two sets were taken with different set-ups and are not subtracted from one another. | Measurement | 2.3 (2026-08) | 2026-11-16 at `969bcc6` | |---|---|---| | discovery on its own (`discoverFor`) | 94,566 | 140,069 | | cold solve, first touch (`findBestRoutePlan`) | 169,093 | 506,007 (COLD, first touch); 506,094 (COLD, hot slots) | | warm solve | 132,691 | curated test: 433,610 | | warm saving | −36,402 gas (−21 %) | −72,340 gas (−14.30 %), 433,610 against 505,950 | | after the TTL | not measured | curated test: 564,239; after swaps (tier-2 lines) 564,253; after TTL 564,614 | | marginal cost per additional leg | about 28,700 | 73,955 (V2: `one_leg_tx` 200,835, `two_legs_tx` 274,790) | | marginal cost per additional hop | via-bridge second hop about 59,000 | 125,666 (`one_hop_v2_tx` 200,880, `two_hops_tx` 326,546) | Sources. The 2.3 cold and warm rows come from `REPORTS.md:301-311` (offline LifecycleMetrics, 4 factories, 2026-08-04); the 2.3 cited `test/fork/DiscoveryColdWarm.t.sol` for them, and that file prints legs, gross output and pool per phase, with no gas, at `969bcc6` (log 133367255593:1156-1171). The November rows come from the `LifecycleMetrics` of job 133367307807 (`isolate=true`, default profile, log lines 7758 to 7810; the curated saving is `433,610 − 505,950`), and the marginal rows from the committed snapshots `snapshots/test_Gas_Leg_V2_OneAndTwoLegs.json` and `test_Gas_Leg_TwoHops_V2ThenV3.json`, checked by the gas snapshot guard (job 133367308176, `FOUNDRY_PROFILE=release`, `FORGE_SNAPSHOT_CHECK=true`; the snapshots as read at `969bcc6`, where they last changed at `4d5ee34`, 2026-11-14; at `6387350` they read 73,252 per leg (200,835 becomes 200,328; 274,790 becomes 273,580) and 125,481 per hop (200,368; 325,849)). That the November marginal rows (whole transaction) and the 2.3 rows (execution) measure the same quantity was not checked; likewise that the November set-up matches the August one. The 2.3's `previewPlan` on live Base (1,524,221 / 1,414,633 / 1,359,925 gas) has no newer measurement: `test/fork/QuoterGasFork.t.sol` exists at `969bcc6` but does not run in the fork job, so those three numbers are carried as 2026-09 documents give them and are not re-measured. **The gas campaign G7/G8.** `docs/GAS_CAMPAIGN_G7_G8.md` records a campaign of 5,600 result lines from CI run 43376232767 (sealed at `e21e8f5`, 2026-11-13; seven chains, 800 lines each, Avalanche with no usable line), re-measured locally at `bb4cdbb` on 2026-11-14 (the other six chains, 800 lines each, Avalanche absent). The figures below are the campaign's, not of `969bcc6`: they are medians (p50) of three recorded columns for the "major" kind in mode D, with the number of lines `n`. | Chain | p50 `g_quote` | p50 `g_record` | p50 `g_exec` | n | |---|---|---|---|---| | Base | 11,759,662 | 686,452 | 1,153,096 | 20 | | Optimism | 3,622,412 | 292,858 | 607,702 | 28 | | Arbitrum | 5,127,965 | 356,052 | 719,544 | 30 | | BNB Chain | 3,075,085 | 320,455 | 690,914 | 22 | | Ethereum | 1,694,769 | 415,570 | 774,427 | 30 | | Robinhood Chain | 1,350,754 | 327,136 | 1,127,205 | 9 (p95 = the maximum) | | Avalanche | 0 lines ok (770 no-quote, 30 unforced) | | | not measured | Avalanche is "not measured", not "zero cost": it produced no usable line. Robinhood Chain rests on nine lines, so its median is a small sample. The column definitions are the campaign document's (lines 19 and 53 to 69); this paper does not restate them. ![FIG-17.4 — Cold, warm and after-TTL solve cost (gas)](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-17.4.svg) *FIG-17.4: cold, warm and after-TTL bars from the table above, one colour for the 2.3 set and one for the November set.* Three structural readings hold without any measurement, because they follow from the architecture. The warm saving scales with the registry's breadth, not the trade's size: what the cold path pays for is sweeping factories, and the cached read that replaces the sweep is one `SLOAD` regardless. Legs are the unit of marginal cost, which is why the split gate exists (§10.4). And hops are the expensive dimension: a bridge route must win by enough at the pools to pay for itself at the pump. Callers choose their point on this surface per trade (solve in-frame and pay for the search, or supply a route and pay only for execution), and the freshness gate of §9.4 reserves the sweep for pairs the protocol does not yet know. A live quote is view computation of about 1.36 to 1.52 million gas (2.3, 2026-09), paid by no one on chain. ### §17.5 The executor against the field A gas table without an external reference is self-praise, so in 2026-08 the execution layer was benchmarked on the same fork, at the same block, with real production calldata of KyberSwap's `MetaAggregationRouterV2`, on a Base fork pinned to the block each route was built at (2026-08-22), with Paraswap quoted alongside as a second comparator. Kyber's own encoded routes, requested from its public API and replayed against its deployed contract, were run with our routes beside them, and both sides' deliveries were measured as balance deltas. The harness validates itself first: the competitor's measured delivery matches its API's promise to the wei, so a revert on either side cannot masquerade as a result. Per leg, the executor measured 2.4× to 10.9× more gas-efficient than the reference; on the clearest pair, 322,172 gas for four legs against 879,553 for one. Across nine measured pairs the fully solving door and the calldata door delivered identical output. The error bars are part of the result: quotes were pinned to the block they were built for, and API-side gas estimates were discarded after real execution measured one of them 148 % above its estimate. The harness (`BenchExec.t.sol`) lives with the captured calldata in the private tree, so these numbers are reported, not reproducible from this checkout, and there is no newer measurement. The 2.3 added that the build was "compiled at `optimizer_runs = 999999`, so the difference is design, not compiler settings". That clause is withdrawn here: `foundry.toml` at `6387350` sets `optimizer_runs = 200` in both the default (line 19) and release (line 76) profiles. Whether the 2026-08 harness was compiled with another setting in the private tree is not known; until it is checked, this paper does not claim that compiler settings played no part. What can be said without it is the structural reading: their router interprets a generic call list that a server decided, ours executes a typed structure, and interpretation costs. ### §17.6 The byte–gas exchange rate ρ* Which door should a caller use, carry a route in calldata or let the chain solve? A transaction's cost is affine and separable, $21{,}000 + \mathrm{bytes} \cdot p_{\mathrm{byte}} + \mathrm{gas} \cdot p_{\mathrm{gas}}$, so the whole trade between calldata and execution reduces to one scalar: **ρ\***, the execution gas one byte of calldata buys. Against it stands each chain's live byte price, read from the chain's own fee predeploys (the OP-Stack gas-price oracle, Arbitrum's `ArbGasInfo`), with no key and no third-party feed. **2.3, 2026-08 (release profile).** ρ* ran 66.9 gas per byte on single-leg routes to 105.5 on four- and five-leg routes, whole transaction, measured with `test/EquationBench.t.sol`. **2026-11-16, `969bcc6` (default profile, `isolate=true`, job 133367307807, log lines 11462 to 11520).** `EquationBench` at this commit does not itself compute ρ*: it prints the gas and the calldata size of the two doors (`BENCH|gas`, `BENCH|cd_total`). The ratio Δgas/Δbytes between the solving door and the calldata door, computed here from those lines as `(bestExactIn − exactIn) / (cd_exactIn − 196)`, is: | Case | Δgas | Δbytes | Δgas/Δbytes | |---|---|---|---| | S1 | 83,278 | 832 | 100.09 | | H2 | 149,068 | 1,376 | 108.33 | | S3 | 293,240 | 1,472 | 199.21 | | H2L4 | 407,735 | 2,016 | 202.25 | | S5 | 447,289 | 2,112 | 211.78 | Whether this ratio is the same quantity as the 2.3's ρ* is inferred, not measured, and the two ranges (66.9 to 105.5; 100.09 to 211.78) are not the same measurement: the profile (release then, default now) and the isolation mode (`isolate=true` now) differ. They are shown together so a reader can see the order of magnitude, about one hundred to two hundred execution gas per calldata byte, and not a single number. The byte prices of 2026-08 are carried as they were read then; no newer reading is in the repository (they appear in the repository only in `docs/papers/llms-full.txt`, a copy of the 2.3): | Chain, prices read live 2026-08 | $p_{\mathrm{byte}}$ (gas/byte) | Data share of a swap | Cheap door | |---|---|---|---| | Base | 7.2 | 0.9 % | calldata route | | Arbitrum | 12.8 | 3.4 % | calldata route | | Optimism | 33.9 | 14.0 % | calldata route | | ZK rollup paying calldata-priced data availability | 243,256 | 99.9 % | in-frame solve, 14× cheaper end to end | Where $p_{\mathrm{byte}} < \rho^{*}$ the calldata door is the cheap one; where $p_{\mathrm{byte}} > \rho^{*}$ the in-frame solve is. On the OP-Stack and Arbitrum chains the data term was 0.9 to 14 % of a swap's cost in 2026-08, so execution is where the money goes. The Router's four doors are not a convenience feature; they are the affine cost model, made into an interface. Byte prices move with the chains' fee markets, so the table is a dated reading, not a standing quote. ## §18 The DEX, stripped to the bone Seventeen sections of mechanism reduce to one page. If you read nothing else, read this. **One job.** Take two tokens, an amount, your minimum, a recipient and a deadline. Return the most output the public liquidity of the chain can deliver, or refuse, with a code that says why. There is no third outcome: in the hostile-venue matrix, twenty of twenty venue-pathology-and-door fixtures settle inside the floors or refuse with a selector of ours (§15.5). **Five core contracts, one mathematics.** Three supporting pieces stand beside them: the Gate (with its per-venue wrappers), the Math library, and the adapters that translate an external venue into the Gate's one interface (§16.1). | Contract | What it is, in one line | |---|---| | **Core** | The stateless library: every venue's closed form, the derivation 𝒟, the floor Φ, the vitality score Ψ. Defined once, imported by the others. | | **Hub** | The registry that learns liquidity by trading it, and proves every pair before it stores it. It prices nothing. | | **Solver** | Builds the route and the split from *measured* marginal output and depth. `view` only. | | **Router** | The only contract that moves funds. Measures every balance delta, enforces the floor, holds nothing at rest. | | **Quoter** | The free preview: the same evaluator the Router settles with, so preview and delivery agree. | | **Gate** + adapters | Reach a venue whose arithmetic is not ours (Balancer V2 and V3, Curve NG) only through an immutable wrapper that is itself measured. | **Six venue kinds, four families, and one door for the rest.** The kinds the Core prices itself are Uniswap V2, V3 and V4 (native ETH included), Algebra dynamic-fee pools and Solidly stable and volatile pairs: six kinds with attributes, four working families, each priced by one closed form in the Core and reached by one dispatcher Ω (§4). A seventh kind, `EXTERNAL = 9`, is the Gate's: a venue that is not ours to price enters as a wrapper the Hub has registered, carries no attributes of its own, and is outside the executable set the Core itself dispatches (`BlazePhoenixCore.sol:273-277, 313-320` and `BlazePhoenixHub.sol:209-216` at `6387350`). The 2.3 said that Curve and Balancer were excised; that is no longer true, and it is not repeated here: Balancer V2 and V3 and Curve NG enter through the Gate, under the bounds of §14.4 (a delay on a new wrapper and a cap on the number of wrappers per pair), and the retired kind numbers stay retired (§4.1). Which venues are claimed is Appendix E, and only those the repository's README lists. **Four doors, one executor.** `swapExactIn`, `swapExactInWithPermit2` and `swapExactInNative` take a route in calldata; `swapBestExactIn` solves and executes atomically on chain. All four reach the same `_execute`, the same floors and the same fee (§11.1). **Three floors under every trade.** A per-leg floor, a hop aggregate, and the route floor Φ re-derived from measured impact in the executing frame, then *your* `userMinOut` on what actually arrives at the recipient. Delivery is the larger of the protocol's floor and yours (§11.5). **One fee, compiled in.** 0.28 %, charged once on the first bridge coin the Router holds, rounded up so it is never zero, and nothing that grows with the gap between quote and delivery (§13). **What it refuses to trust.** Advertised liquidity. Declared fees. Calldata depth. A pool's own account of which tokens it trades. A venue's own account of what it delivered. Every one is either measured from the pool or derived by arithmetic before it can reach shared state (§7, §9, §16.4). **What it costs.** Gas: deriving the route in-frame is dearer than settling an answer computed elsewhere, and §17.6 tells you per chain which door is cheapest. Immutability: a defect is disclosed and bountied, never patched (§21). ## §19 Deployment status This paper documents the repository, and the repository is canonical: where this text and the source disagree, the source wins. Two generations exist and they are never conflated. **V1 is what is live on chain.** It is a different, earlier codebase, archived in its own repository, not an earlier commit of this one. The site's deployment record lists V1 (version 1.0.0, "live") on five networks: Ethereum, Base, Optimism, Arbitrum and Robinhood Chain (`/api/deployments` and `/api/manifest`, read 2026-11-16). The 2.3 measured the deployed V1 router by RPC on 2026-09-04: the same 14,624-byte contract on Base, Ethereum, Optimism and Arbitrum (Robinhood Chain was not measured then, and this paper has not repeated the measurement). `test/fork/DeployedParity.t.sol` and `test/fork/DeployedCodehashPin.t.sol` pin what V1 is, on every network the SDK names: the codehash of each deployed contract is recorded in `test/fork/deployed-codehash.json`, so a change to what is deployed is noticed, and they assert the properties that hold regardless of generation: no `SELFDESTRUCT`, no `CALLCODE`, no `tx.origin` authority, a transient reentrancy lock, a fixed runtime size, live wiring, and control not yet renounced. **This repository is V2, and V2 is not deployed.** The tree described in this paper builds a 22,717-byte Router (23,781 in the 2.3) and carries external functions V1 does not have, among them the native-value door, the wrap/unwrap seam, the rescue path and the Permit2 door. The V2 contracts are deployed onto forks of live liquidity and exercised end to end on every fork run (§15.1, §17). Nothing in §15 or §17 protects the deployed V1 contracts; every claim in this paper is a claim about V2 as it stands at `6387350` (measurements keep the commit they were taken at) (the 2.3 stood at `8949a9d`). The site's record for V2 reads "pending" with no address on any network, and the Gate's adapter record in the repository has a header and no rows: no adapter is deployed. **V2 launches 15 December 2026, on six target networks.** The targets are Base, Optimism, Arbitrum, Robinhood Chain, Ethereum L1 and Avalanche. They are targets and not deployments: no address is given for any of them, here or in any list in this paper, and the launch date is a schedule, not a record. The repository's README at `6387350` names the same six targets (README.md:31); the README at `969bcc6` named Base, Optimism, Arbitrum, Robinhood Chain and further L2s and said V2 is not planned for Ethereum L1. On Avalanche the gas campaign produced no usable measurement (§17.4). The README gives no launch date: the date is the owner's current statement, and the reader who wants the live truth reads the deployment record, not either document. Two policies protect readers accordingly. This paper contains no contract addresses: addresses outlive the documents that quote them, and the live address surface is maintained where it can be updated and machine-checked, in the repository's records and the site's verification page and manifest. And a deployment record has a specified format (chain, address, deploying commit and runtime-bytecode hash, written at broadcast time, with a verification step that re-derives the hash from a clean build), so that when V2 deploys, every address claim is arithmetic, not trust. The staking engine follows the same rule: its two deployments are in §25.8, and it too has no address until it is deployed. ## §27 Interfaces: the SDK, the MCP servers, the API and the Hermes plugin *Plain:* six ways to reach the DEX, and none of them holds your keys or your funds: a library, two tool servers for AI agents, an HTTP API, an agent plugin and the APP. On the five read from source, the quote is always an `eth_call` on a node you choose; the APP is still a design document (§27.6). *Precise:* each interface is a client of the same on-chain Quoter and Router; none adds an authority, none signs, and each of the five read from source carries the Phoenix Check and a field-by-field comparison of the swap calldata with the request, computed where the reader can re-run it. This chapter says, per surface, which commit was read, who performs the RPC, what is checked and what is not guaranteed. Every statement about behaviour cites a source line as `path:line@commit`; the four interface repositories are each under the MIT licence (their `LICENSE` files), which is not the licence of the contracts. ### §27.1 The common model Three properties hold on every surface read from source (the APP, a design document, is outside them), and each is a property of the source, not of a deployment. **No keys, no funds.** No interface receives, stores or derives a private key. In the SDK source a search for `privateKey`, `mnemonic`, `signTransaction` and `sendRawTransaction` finds nothing; the only transaction send is `execute`, which requires a wallet client supplied by the caller and refuses to run without one (`src/client.ts:822-895@2d2fc39`). The local MCP server does not expose `execute` in any tool (`src/server.ts:10@3514804`), the hosted surfaces return unsigned calldata only, and the Hermes plugin states the same of itself (`bp.py:12@cf38638`). **The quote runs on the caller's node.** No surface ships a default RPC endpoint. With no RPC configured the SDK throws `rpc_required` and does not fall back to a built-in endpoint (`src/rpc.ts:165-171@2d2fc39`); the Hermes plugin does the same (`bp.py:225-226@cf38638`); the hosted surfaces never run the call at all (§27.4). **The check is recomputed, not relayed.** The Phoenix Check has one definition and three implementations that carry the same two thresholds, 2000 bps and 200 bps: the SDK (`src/checks.ts:9-10@2d2fc39`), the API worker (`worker/codec.ts:51-117@01c5468`) and the Hermes plugin (`bp.py:56@cf38638`). That the three agree on every input is not established here; only the thresholds and the verdict order were compared. ### §27.2 The SDK The package `@blazephoenix/sdk` is at version 1.6.0 on npm (latest, published 2026-11-20; the npm record names commit `bb41243`). The repository main, `2d2fc39`, carries 1.7.0, which is not on npm. It has two entry points, the package root and `@blazephoenix/sdk/xray`. **Client.** The class `BlazePhoenix` takes the RPC from the caller: a URL, a list of URLs in fallback order, an EIP-1193 provider, a viem transport, or a per-chain map of these (`src/client.ts:49-55@2d2fc39`). RPC URLs must use `https://` or `wss://`; plain `http://` and `ws://` are accepted only for a local node (`src/rpc.ts:55-68@2d2fc39`). The client offers fourteen methods: `quote`, `usdValue`, `quoteExact`, `quoteBatch`, `buildSwap`, `simulate`, `execute`, `tokenInfo`, `solvency`, `getFills`, `watchFills`, `deployments`, `resolveDeployment` and `verifyDeployment`. The set is the same in 1.6.0 and on main (`src/client.ts:138-975@bb41243`, `src/client.ts:138-987@2d2fc39`). It covers five chains: Ethereum, Base, Optimism, Arbitrum and Robinhood Chain (`src/constants.ts:19@2d2fc39`). **Phoenix Check.** `phoenixCheck` derives its result only from the Quoter's preview. The verdict is `blocked` when the preview cannot execute or the route is inconsistent; otherwise an expected impact of 2000 bps (20 %) or more is `danger`, 200 bps (2 %) or more is `caution`, and anything below is `ok` (`src/checks.ts:29-32@2d2fc39`). `routeIsConsistent` requires at least one hop, the first hop starting at tokenIn, the last ending at tokenOut, and each hop starting where the previous one ended (`src/checks.ts:19-25@2d2fc39`). One field deserves a plain reading: `ironFloor.enforcedOnChain` is a constant `true` in the returned object, a statement about the contract (§11.5), not a value the SDK reads from chain (`src/checks.ts:42-48@2d2fc39`). **Calldata verification.** `verifySwapExactIn` decodes the bytes with the Router ABI and requires the selector of `swapExactIn`; it then checks the amount in, the recipient, the deadline, a minimum out that is non-zero and at least the requested floor, and that the route connects tokenIn to tokenOut. Any mismatch throws `calldata_mismatch` with every mismatching field listed; the function performs no I/O (`src/calldata.ts:52-98@2d2fc39`). Its reach is narrower than its name suggests: `buildSwap` calls it on one path only, the 2.x path where the Quoter returns ready calldata for an ERC-20 input in route mode (`src/client.ts:718-743@2d2fc39`). On the other paths (1.x, native input, or best mode) the SDK encodes the Router calldata itself from the preview, so there are no foreign bytes to verify (`src/client.ts:744-758@2d2fc39`). **Simulate and execute.** `simulate` runs the swap as an `eth_call` from the paying address on the caller's RPC (`src/client.ts:804-820@2d2fc39`). `execute` sends through the caller's wallet, and rebuilds a plan older than 30000 ms when it is given the request, refusing to send a stale one otherwise (`src/client.ts:833-873@2d2fc39`). **USD value.** `usdValue` prices an amount only from the Quoter's own net-out answers, after the protocol fee and including price impact, read in one pinned block; the dollar anchor is the chain's USDC taken as 1 USD (USDG on Robinhood Chain) (`src/usd.ts:1-11@2d2fc39`). It references no external price API and no oracle, and when nothing can be measured it answers `not measured`, never 0 (`src/usd.ts:214-220@2d2fc39`). A stablecoin taken as 1 USD is an assumption, and the result is a quoted price, not an executed one. **Cross-chain price (1.7.0, main only).** `src/crossChain.ts` is new on main and absent from the npm package. `crossChainPrice` runs `usdValue` for one token on each listed chain, each on that chain's own RPC, and returns a per-chain price with its derivation: the route that gave it, leg by leg (`src/crossChain.ts:298-408@2d2fc39`). Tokens are named per chain by address or by a short built-in list, never matched across chains by on-chain symbol or name (`src/crossChain.ts:10-12@2d2fc39`). `aggregateQuotedPrices` is pure integer arithmetic over those answers (`src/crossChain.ts:112-149@2d2fc39`). Each price says whether its impact is `measured` or `modeled`, by venue kind (`src/crossChain.ts:345-383@2d2fc39`). The module bridges nothing and sends no transaction; its own basis string says the prices are quoted, not executed, and include the 0.28 % fee (`src/crossChain.ts:385-388@2d2fc39`). **X-Ray.** The second entry point measures a token before a trade: can it be bought, sold and transferred at the tax the caller accepts. The caller must state `maxTaxBps`; the SDK does not pick it. It measures by simulation on a pinned block, on a ladder of tiers from `eth_simulateV1` down to a plain `eth_call` (`src/xray/tiers.ts:1-4@2d2fc39`), with I/O only through a transport the caller injects (`src/xray/index.ts:1-16@2d2fc39`). Verdicts form a lattice, CONDEMN below WARN below MEASURED, with NOT_MEASURED as a status and not a pass (`src/xray/lattice.ts:1-33@2d2fc39`). It runs on three chains only (Base, Ethereum, Arbitrum), where it pins the Router and Quoter by address and code hash (`src/xray/ctx.ts:32-39@2d2fc39`), and its limits are declared in code per tier (`src/xray/tiers.ts:425-436@2d2fc39`). A MEASURED verdict describes one amount, one block and the measured actors; it says nothing about what a token's owner does next. **The one request that is not to the caller's node.** In its default registry mode, `auto`, the SDK fetches the deployment record from the site (`/api/deployments`) before its first read (`src/constants.ts:13-17@2d2fc39`, `src/registry.ts:83-90@2d2fc39`). The fetched record cannot move an address the package embeds, a deployment known only from the fetched record is verified on the caller's RPC before first use and refused on failure, and if the fetch fails the embedded snapshot is used (`src/registry.ts:5-14@2d2fc39`). Registry mode `embedded` makes no such request. No telemetry or analytics code was found. `verifyDeployment` checks that each registered address has code and, on 2.x, that `VERSION()` and the hub and solver wiring match the record; it compares no code hash (`src/client.ts:191-243@2d2fc39`). ### §27.3 The local MCP server The package `@blazephoenix/mcp` is at version 1.3.0 on npm (latest, published 2026-11-20; repository `3514804`), binary `blazephoenix-mcp`, depending on the SDK at exactly `1.6.0` (`package.json:26-31@3514804`). It is a thin layer: it runs on the user's machine and every chain read goes through the SDK client, so §27.2 applies to it as 1.6.0 stands, including the default registry fetch, which no environment variable of the server changes (`src/server.ts:128@3514804`). It registers eight tools (`src/server.ts:134-293@3514804`): `get_quote`, `build_swap`, `simulate_swap`, `check_solvency`, `get_token_info`, `get_deployments`, `verify_deployment` and `xray_token`. `build_swap` returns the SDK's plan, unsigned; `simulate_swap` requires the paying address and returns a reverted simulation as an error (`src/server.ts:181-207@3514804`). `check_solvency` reads no contract and answers `coming_soon`, an error result and never a verdict (`src/server.ts:209-218@3514804`); the reading of §25.10 for the staking engine is the SDK's `solvency` method. `xray_token` carries the SDK X-Ray's requests to the configured node and shows MEASURED only when the SDK verdict and every instrument are MEASURED, so the server's own predicate can lower a verdict and cannot raise one (`src/xray.ts:62-70@3514804`). Every input schema is strict, so an unknown key is refused and not dropped (`src/server.ts:34-36@3514804`). The RPC comes from the environment, never from a tool argument: the server hands it to the SDK's `rpcFromEnv` (`src/server.ts:128@3514804`), which reads `BLAZEPHOENIX_RPC_` per chain (by name or by chain id) or `BLAZEPHOENIX_RPC_URL` for a single node, and refuses both at once (`src/rpc.ts:217-236@bb41243`); the start-up log names the chains configured, never the URLs (`src/server.ts:75-87@3514804`). The protocol version it serves is chosen per call or pinned by `BLAZEPHOENIX_VERSION` (`latest`, a major such as `1` or `2`, or a full version such as `2.0.0`); any other value stops the server at start (`src/server.ts:124-131@3514804`). That is how V1 and V2 stay separate. ### §27.4 The hosted MCP and the API The API is a worker with one codec and two faces: REST routes and a hosted MCP endpoint. Its repository was read at `01c5468`. Its design is that the server prepares and decodes, and the caller's node answers. **Prepare, call, decode.** `prepare` returns the exact `eth_call` as a JSON-RPC object; the caller runs it on their own node and posts back the request with the node's result; `decode` turns that into the quote, the Phoenix Check and calldata (`worker/codec.ts:235@01c5468`). The plain quote routes behave the same way: asked for a quote without a result, they answer `rpc_required` together with the prepared call (`worker/quoteApi.ts:615-623@01c5468`, `worker/quoteApi.ts:713-729@01c5468`). The hosted MCP serves five tools over JSON-RPC 2.0 at `POST /mcp`, without a session (`worker/mcp.ts:1-2@01c5468`): `prepare_quote`, `decode_quote`, `decode_usd_value`, `get_deployments` and `get_abi` (`worker/mcp.ts:72-177@01c5468`). `prepare_quote` calls the same function as the REST prepare route (`worker/mcp.ts:199-211@01c5468`). **What the server does not do.** On these paths the worker makes no outbound request: a search for `fetch(` finds none in `worker/mcp.ts`, `worker/codec.ts` and `worker/usd.ts`. This is narrower than "the worker performs no RPC". The same worker serves site routes (`/api/stats`, `/api/tape`, `/api/verify`) that do read chains from the operator's side; those reads feed no quote served to a caller. A quote function that reads through the operator's nodes for the site's own bot exists in `worker/quoteApi.ts` and is not routed from any public path (`worker/quoteApi.ts:628-632@01c5468`). The statement of this section is about the quote, USD and MCP paths only. **Fail closed.** `decode` re-validates the posted request field by field and refuses an unknown chain or version. A result that does not decode as the Quoter's answer is `decode_failed`; a preview that is not consistent with the request is `result_mismatch`; an empty answer is `no_route` (`worker/codec.ts:281-339@01c5468`, `worker/codec.ts:461-465@01c5468`, `worker/codec.ts:632-634@01c5468`). When a recipient is given, the Quoter-returned calldata is checked field by field (function, amount, recipient, deadline, minimum, route) before any transaction is offered (`worker/codec.ts:542-553@01c5468`). And without a `userMinOut` set by the caller, `decode` offers no calldata at all (`min_required`): the code's own reason is that a pure decode cannot tell the node's answer from a forged but self-consistent one (`worker/codec.ts:527-535@01c5468`). **What binds the answer to the request, and what does not.** There is no request hash linking `prepare` to `decode`: `decode` receives the request object as sent and re-parses it (`worker/codec.ts:281-283@01c5468`). The quote's `eth_call` is prepared at block tag `latest`, and the decoded quote carries no block number (`worker/codec.ts:235@01c5468`). Only the USD value pins a block, by block hash, and rejects a second-stage result from a different block (`worker/usd.ts:66-109@01c5468`, `worker/usd.ts:284-302@01c5468`). So a quote decoded here is as fresh and as honest as the node that answered and the moment it answered; the floor the caller set is what the contract enforces (§11.5), and simulating the calldata from the paying address before sending remains the caller's step. **Solvency.** The solvency page and badge read no contract and say that proof of solvency is coming soon (`worker/solvency.ts:1-33@01c5468`). ### §27.5 The Hermes plugin The Hermes plugin is a plugin for the Hermes agent runtime: its manifest declares version 1.0.0 and requires Hermes 0.23.0 or later, and it gives an agent four tools: `blazephoenix_quote`, `blazephoenix_verify_calldata`, `blazephoenix_usd_value` and `blazephoenix_chains` (`plugin.yaml:2-14@cf38638`). It is a single Python module on the standard library, with the Router and Quoter addresses compiled in per chain (`bp.py:29@cf38638`) and its own implementations of the route check, the Phoenix Check and the calldata verification (`bp.py:270-284@cf38638`). The RPC URL is read from the agent's secret store under `BLAZEPHOENIX_RPC_`; without it the tool answers `rpc_required` and names the variable to set (`bp.py:222-226@cf38638`). The module has one network call site (`bp.py:214@cf38638`). The JSON-RPC methods it sends to the node are `eth_call`, `eth_chainId` and `eth_getBlockByNumber`, reads only (`bp.py:351@cf38638`, `bp.py:373@cf38638`, `bp.py:477@cf38638`, `bp.py:487@cf38638`, `bp.py:645@cf38638`). The quote tool is not on the node alone. It quotes protocol version 1, and it asks the hosted API (§27.4) to prepare the call and to decode the node's answer, so the request, and the node's result, are sent to the site (`bp.py:335-339@cf38638`, `bp.py:354@cf38638`). It does not take those answers on trust: the prepared call must match the Quoter and Router compiled in and the request, or the tool refuses with `prepare_mismatch` (`bp.py:345-350@cf38638`); the eth_call itself runs on the user's node (`bp.py:351@cf38638`); the hosted decode must agree with the plugin's own decoding of the node's result, or it refuses with `decode_mismatch` (`bp.py:355-359@cf38638`); the Phoenix Check is computed locally and reported beside the hosted verdict with a flag saying whether they agree (`bp.py:379-386@cf38638`); and any calldata the hosted decode returns is checked by the plugin's own `verify_swap` before it is shown, unsigned (`bp.py:393-399@cf38638`). That check compares the target with the chain's Router, requires a zero `value` and the `swapExactIn` selector, decodes the calldata and compares `amountIn`, the recipient, `userMinOut` (at least the requested minimum, and never zero) and the deadline (equal to the request's and within the next 3600 seconds); it requires the route to connect the input token to the output token and to equal the route the node returned, and, when an approval is returned, that it is exactly `amountIn` of the input token to the Router. Any difference refuses with `calldata_mismatch` and the list of mismatches (`bp.py:284-328@cf38638`). The USD value tool and the chain list make no request to the site. One property is specific to an agent setting. An RPC URL often carries its key in the path or the query, and a node's error text can echo that URL back, which would hand the key to the model and to its transcript. Since `cf38638`, `_scrub` removes from the node's text every piece of the URL that can carry a key (path segments raw and decoded, query values, user info, host), replaces each with `[redacted]`, and reduces any URL left to its scheme; where a credential is too short to remove safely, the node's text is dropped altogether (`bp.py:233-254@cf38638`). `rpc` passes every node error through it before the agent sees it (`bp.py:257-262@cf38638`). ### §27.6 The APP **The APP.** The site's APP is a separate route (`/app/`) from the content site. By its design (DESIGN-APP.md §2) it has no account, no email, no backend of its own, no wallet analytics and no custody; it adds no trust to the trade and sits in the same hostile-front-end threat model as any front end (§14.5). Its swap panel keeps the minimum received visible at all times (the floor the contract enforces, §11.5), shows the age of the quote in seconds, and prints a receipt with "Quoted" beside "Received", both measured (the stored quote and the balance delta of the receipt); if they differ, the difference is shown as it is. A refusal is shown with its own message when the error selector is known and as the selector in hexadecimal when it is not, and "nothing left your wallet" is shown only when the receipt proves it. The design document names neither a Phoenix Check nor the node the APP reads from, so this paper claims neither for the APP. Whether the APP is live at the time of reading is not established by this paper: DESIGN-APP.md is a design document, and the paper makes no claim about its deployment state. ### §27.7 Summary, and what was not checked | Surface | Version, commit | Who performs the RPC | What it verifies | What it does not guarantee | |---|---|---|---|---| | SDK | 1.6.0 on npm (`bb41243`); 1.7.0 on main (`2d2fc39`) | The caller's node; one registry fetch to the site in `auto` mode | Phoenix Check; calldata against the request on the 2.x route path; remote deployments before first use | That the node is honest; that a quoted price is an executed one; code hashes in `verifyDeployment` | | Local MCP | 1.3.0 on npm (`3514804`), SDK 1.6.0 | The user's node, from the environment | What SDK 1.6.0 verifies; X-Ray verdict can only be lowered | Solvency (`coming_soon`); anything the SDK does not | | Hosted MCP and API | `01c5468` | The caller's node; the server runs no call on the quote paths | Request re-validated; result decoded and checked for consistency; calldata field by field; no calldata without `userMinOut` | The block of the answer (`latest`, unpinned); a binding hash between prepare and decode; the node's honesty | | Hermes plugin | 1.0.0 (`cf38638`) | The user's node, from the agent's secret store; the quote's prepare and decode steps go to the hosted API | Hosted prepare and decode checked against the pinned addresses and the node's result; route check, Phoenix Check and calldata verification in its own code; node error text scrubbed | That the request stays private from the site on the quote tool; agreement with the SDK on every input (not compared here) | | APP | design document | Not stated in the design document | By design: floor shown at all times; quoted beside received | That it is live (§27.6) | *TAB-27.1: the interfaces, by who performs the RPC and what each verifies.* What this chapter did not establish. The test suites of the four repositories were not run for this paper, so no pass count is given. The hosted endpoints were not probed: the chapter describes the repository at `01c5468`, not what is served at the time of reading. The npm packages were matched to commits by the commit the npm record names, not by comparing the published files. The Hermes plugin was read by targeted search and through its quote path (`bp.py:333-402@cf38638`), not line by line. The three implementations of the Phoenix Check were compared by thresholds and verdict order only. And on every surface the final defence is the same and is not the interface: the minimum out the caller sets, enforced by the Router (§11.5). ![FIG-27 — The interfaces](https://blazephoenix.xyz/whitepaper/figs/v2.4/fig-27.svg) *FIG-27: the interfaces as boxes in front of one Quoter and one Router: the SDK, the local MCP server, the hosted MCP and API, the Hermes plugin and the APP. The quote arrow of each of the first four passes through the caller's node and the Phoenix Check sits inside each of them; a dashed arrow marks the Hermes plugin's prepare and decode requests to the hosted API. The APP, a design document (§27.6), is drawn dashed: it shows the floor, and the design names no Phoenix Check and no node. No box has an arrow to a key store.*