Connect ›
Cover: On-chain quoting: why the price you see is the price the contract computed

On-chain quoting: why the price you see is the price the contract computed

How BlazePhoenix computes DEX-aggregator quotes fully on-chain via previewPlan and revert-extraction, why that removes the trusted-API problem, and what exact-mode requoting means for execution guarantees.

Known formally as The Exact Pass in the BlazePhoenix whitepaper.

BlazePhoenix Engineering · updated 2026-10-05 · data through 2026-10-11 · 6 min · written from the deployed bytecode

By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.

Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص

English — BlazePhoenix computes DEX-aggregator quotes on-chain via previewPlan and revert-extraction: the price you see is produced by the same contract that executes, with no pricing server to trust.

Português — A BlazePhoenix calcula cotações de agregador DEX on-chain via previewPlan e extração por revert: o preço que vês é produzido pelo mesmo contrato que executa, sem servidor de preços para confiar.

Español — BlazePhoenix calcula cotizaciones del agregador DEX en cadena mediante previewPlan y extracción por revert: el precio que ves lo produce el mismo contrato que ejecuta, sin servidor de precios en quien confiar.

Français — BlazePhoenix calcule les cotations d'agrégateur DEX on-chain via previewPlan et l'extraction par revert : le prix affiché est produit par le contrat qui exécute, sans serveur de prix à croire sur parole.

Deutsch — BlazePhoenix berechnet DEX-Aggregator-Kurse on-chain über previewPlan und Revert-Extraktion: Der angezeigte Preis stammt vom selben Contract, der ausführt — ohne Preisserver, dem man vertrauen muss.

Русский — BlazePhoenix вычисляет котировки DEX-агрегатора он-чейн через previewPlan и извлечение из revert: цена, которую вы видите, создана тем же контрактом, который исполняет сделку, без доверия к ценовому серверу.

Türkçe — BlazePhoenix, DEX toplayıcı fiyatlarını previewPlan ve revert çıkarımı ile zincir üstünde hesaplar: gördüğünüz fiyatı, işlemi yürüten sözleşmenin kendisi üretir; güvenilecek bir fiyat sunucusu yoktur.

العربية — تحسب BlazePhoenix أسعار مجمّع التداول على السلسلة عبر previewPlan واستخراج revert: السعر الذي تراه ينتجه العقد نفسه الذي ينفذ الصفقة، دون خادم أسعار يجب الوثوق به.

हिन्दी — BlazePhoenix, previewPlan और revert-निष्कर्षण के जरिए DEX एग्रीगेटर कोट्स ऑन-चेन गणना करता है: जो कीमत आप देखते हैं वही कॉन्ट्रैक्ट बनाता है जो ट्रेड निष्पादित करता है — किसी प्राइस सर्वर पर भरोसे की जरूरत नहीं।

日本語 — BlazePhoenixはpreviewPlanとrevert抽出によりDEXアグリゲーターの見積もりをオンチェーンで計算します。表示される価格は実行するコントラクト自身が生成し、信頼すべき価格サーバーは存在しません。

中文 — BlazePhoenix 通过 previewPlan 与 revert 提取在链上计算 DEX 聚合器报价:你看到的价格由执行交易的同一合约生成,无需信任任何报价服务器。

한국어 — BlazePhoenix는 previewPlan과 revert 추출로 DEX 애그리게이터 견적을 온체인에서 계산합니다. 표시되는 가격은 실행하는 컨트랙트가 직접 생성하며, 신뢰해야 할 가격 서버가 없습니다.

Bahasa Indonesia — BlazePhoenix menghitung kuotasi agregator DEX secara on-chain melalui previewPlan dan ekstraksi revert: harga yang Anda lihat dihasilkan oleh kontrak yang sama yang mengeksekusi, tanpa server harga yang harus dipercaya.

বাংলা — BlazePhoenix previewPlan এবং revert-নিষ্কাশনের মাধ্যমে DEX অ্যাগ্রিগেটর কোট অন-চেইনে গণনা করে: আপনি যে দাম দেখেন তা সেই একই কন্ট্রাক্ট তৈরি করে যা ট্রেড সম্পাদন করে — কোনো প্রাইস সার্ভারে বিশ্বাসের প্রয়োজন নেই।

Filipino — Kinakalkula ng BlazePhoenix ang mga quote ng DEX aggregator on-chain gamit ang previewPlan at revert-extraction: ang presyong nakikita mo ay ginawa mismo ng kontratang nag-eexecute, walang price server na kailangang pagkatiwalaan.

Every mainstream DEX aggregator quotes off-chain: a server simulates routes, returns a number, and you trust that the server was honest and its state was fresh. The transaction then executes against different state than the quote saw. BlazePhoenix inverts this: the quote itself is computed by the Quoter contract on-chain, with the same math and the same state access as execution.

The core call is previewPlan: it walks candidate pools, simulates the full route leg by leg, and returns the plan the Router would execute — gross output, protocol fee, net output, price impact, gas estimate, and the iron floor (the minimum output the Router will enforce). Because it runs as an eth_call, it costs nothing and anyone can run it against any block.

Revert-extraction: exact quotes without state pollution

Exact mode (previewPlanExact) goes further: it actually performs the swaps inside a call and then reverts, extracting the real deltas from the revert payload. The revert is not an error — it is the answer. This technique gives execution-grade numbers (including transfer-fee tokens and hook side-effects) while leaving zero state change on chain.

The pattern matters for fee-on-transfer and rebasing tokens, where static math lies: only moving the tokens reveals the real received amount. The contract measures instead of assuming.

What this removes from the trust equation

No pricing server to compromise, rate-limit, or geo-block. No stale-cache windows between quote and execution semantics. No API key. The public REST API does not even read the chain for you: /api/quote/prepare hands you the exact call to the Quoter and /api/quote/decode reads your node's answer, so every number was computed by the contract on your own node — and you can skip the API entirely and call the Quoter yourself. A quote you cannot recompute is a story; a quote you can recompute is a measurement.

Do not trust this page — reproduce it

Every claim above is checkable against the chain. Start here:

Read the verified source of the Router on Basescan (/verify lists the address): PROTOCOL_FEE_BPS = 28 is a compile-time constant of BlazePhoenixCore (src/BlazePhoenixCore.sol:323), inlined into the Router and the Quoter bytecode, so no transaction can change it. It has no getter; the source is the proof.
Cite this article

Licensed CC BY 4.0 — quote, translate and reuse freely, including commercially, with attribution and a link. Copy a ready-made citation:

BlazePhoenix (2026). On-chain quoting: why the price you see is the price the contract computed. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/on-chain-quoting
@misc{blazephoenix_on_chain_quoting,
  title  = {On-chain quoting: why the price you see is the price the contract computed},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/on-chain-quoting},
  note   = {Accessed: reproduce the claim with the command above}
}

Writing an answer, a wiki entry or a paper? The claim above is reproducible against the chain before you quote it — which is the only sound basis for citing a technical source at all.

Contracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF).

Related engineering

Next in Routing & pricing · 1 / 19
Any ticker, one honest answer: resolving symbols by deepest real liquidity ›How the BlazePhoenix API turns an arbitrary token symbol into an address: choose the candidate with the deepest verified liquidity, echo the resolution back, and let addresses stay the precision path.5 min