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

BlazePhoenix Engineering · updated 2026-07-17 · 6 min · written from the deployed bytecode

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

EnglishBlazePhoenix 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êsA 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ñolBlazePhoenix 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çaisBlazePhoenix 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.

DeutschBlazePhoenix 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çeBlazePhoenix, 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 IndonesiaBlazePhoenix 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 অ্যাগ্রিগেটর কোট অন-চেইনে গণনা করে: আপনি যে দাম দেখেন তা সেই একই কন্ট্রাক্ট তৈরি করে যা ট্রেড সম্পাদন করে — কোনো প্রাইস সার্ভারে বিশ্বাসের প্রয়োজন নেই।

FilipinoKinakalkula 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 at /api/quote is a thin mirror of the chain — the numbers it relays were computed by the contract, and you can bypass it entirely and call the Quoter yourself.

Do not trust this page — reproduce it

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

cast call 0x4cEF0615614B212895F45Aa1D4833B16666E18d3 "PROTOCOL_FEE_BPS()(uint256)" --rpc-url https://mainnet.base.org

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

Related engineering