How we derive a USD value from the Quoter alone: no oracle, no price API
How is the USD value of a token amount derived with no oracle and no price API?
The BlazePhoenix SDK values a token amount in dollars by reading only the on-chain Quoter, at one block pinned by hash. Direct and indirect vias, the minimum of them, and a real run on Base.
BlazePhoenix Engineering · article updated 2026-11-20 · site dataset through 2026-11-30 · 7 min · written from the deployed bytecode
At a glance
Level
Intermediate
Reading time
7 min
Sections
13
Updated
2026-11-20
By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.
Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص
English — The BlazePhoenix SDK values a token amount in dollars by reading only the on-chain Quoter, at one block pinned by hash. Direct and indirect vias, the minimum of them, and a real run on Base.
Português — O SDK da BlazePhoenix avalia uma quantia de tokens em dólares lendo apenas o Quoter on-chain, num só bloco fixado por hash. Vias diretas e indiretas, o mínimo entre elas e uma execução real na Base.
Español — El SDK de BlazePhoenix valora una cantidad de tokens en dólares leyendo solo el Quoter on-chain, en un único bloque fijado por hash. Vías directas e indirectas, el mínimo de ellas y una ejecución real en Base.
Français — Le SDK de BlazePhoenix valorise un montant de tokens en dollars en ne lisant que le Quoter on-chain, à un seul bloc figé par hash. Voies directes et indirectes, le minimum entre elles, et une exécution réelle sur Base.
Deutsch — Das SDK von BlazePhoenix bewertet einen Token-Betrag in Dollar, indem es allein den Quoter on-chain liest, an einem per Hash festgelegten Block. Direkte und indirekte Wege, das Minimum daraus und ein echter Lauf auf Base.
Русский — SDK BlazePhoenix оценивает количество токена в долларах, считывая только on-chain Quoter, на одном блоке, зафиксированном по хешу. Прямые и непрямые пути, минимум из них и реальный запуск на Base.
Türkçe — BlazePhoenix SDK, bir token miktarının dolar değerini yalnızca zincir üzerindeki Quoter’ı okuyarak, hash ile sabitlenmiş tek bir blokta bulur. Doğrudan ve dolaylı via’lar, bunların minimumu ve Base üzerinde gerçek bir çalıştırma.
العربية — يقيّم BlazePhoenix SDK مقدارًا من رمز ما بالدولار بقراءة الـ Quoter على السلسلة فقط، عند كتلة واحدة مثبّتة بالـ hash. الـ vias المباشرة وغير المباشرة، وأدنى قيمة بينها، وتشغيل حقيقي على Base.
हिन्दी — BlazePhoenix SDK किसी टोकन की मात्रा का डॉलर मूल्य सिर्फ़ on-chain Quoter पढ़कर, hash से पिन किए गए एक ब्लॉक पर निकालता है। सीधे और परोक्ष via, उनका न्यूनतम, और Base पर एक असली रन।
中文 — BlazePhoenix SDK 只读取链上的 Quoter,在一个按哈希固定的区块上,把代币数额折算成美元价值。涵盖直接 via 和间接 via、取其中的最小值,以及在 Base 上的一次真实运行。
한국어 — BlazePhoenix SDK는 해시로 고정한 하나의 블록에서 온체인 Quoter만 읽어 토큰 수량을 달러로 평가합니다. 직접 via와 간접 via, 그중 최솟값, 그리고 Base에서 실제로 실행한 결과를 다룹니다.
Bahasa Indonesia — SDK BlazePhoenix menilai jumlah token dalam dolar hanya dengan membaca Quoter on-chain, pada satu blok yang dikunci dengan hash. Via langsung dan tidak langsung, nilai minimumnya, dan satu eksekusi nyata di Base.
বাংলা — BlazePhoenix SDK কোনো টোকেন পরিমাণের ডলার মান বের করে শুধু অনচেইন Quoter পড়ে, hash দিয়ে পিন করা একটি ব্লকে। সরাসরি ও পরোক্ষ via, সেগুলোর সর্বনিম্ন, এবং Base-এ একটি বাস্তব রান।
Filipino — Pinahahalagahan ng BlazePhoenix SDK sa dolyar ang isang amount ng token sa pamamagitan lang ng pagbasa sa on-chain Quoter, sa isang block na naka-pin sa hash. Ang direktang via at ang mga hindi direkta, ang pinakamababa sa mga ito, at isang tunay na takbo sa Base.
Short answer: the USD value of an amount is read from the Quoter alone. The SDK asks the Quoter what it would return for that exact amount of the token, in the dollar token (USDC, or USDG on Robinhood Chain), tries several routes to the dollar token, and keeps the lowest measured one. There is no oracle and no price API in the path: the reading is one or more eth_calls on your own node, at one block.
This page shows how we derive it, step by step: what is read, how the readings are combined, why the result holds up, and one measured example on Base mainnet.
Step 1: the amount is part of the question
Every number in the derivation is a netOut: what the Quoter answers for that exact input amount, after the 0.28% fee and including price impact. So 10 tokens and 10,000 tokens can be worth a different amount per token. A single quoted rate for the token would hide that. A reading at the amount you hold does not, which is why usdValue takes an amount and not only a token.
Step 2: read several vias to the dollar token
A via is one way of getting from the token T to the dollar token D. For an amount A, the SDK reads up to 8 vias, the direct one included, all in the same block.
Direct: the Quoter quotes T to D for A. The netOut is the value, in base units of the dollar token.
Via WETH: the Quoter quotes T to WETH for A and answers outW. It also quotes 1 WETH to D and answers outD. The value is outW × outD ÷ refX, rounded down, where refX is 1 WETH, that is 10^18 wei.
Via each token the direct route touches: for every token X that the direct route crosses, T to X for A gives outX. Then the amount of X that the route itself moves, called refX, is quoted to D, and the value is outX × outD ÷ refX, rounded down.
Why the second leg is scaled
All the quotes of the first call go out together in one Multicall3.aggregate3, so the second leg cannot wait for the output of the first. It is read at a fixed reference size, refX, and scaled linearly to the amount the first leg delivered. The consequence is stated openly: a scaled leg carries the price impact at refX, not at the amount the first leg delivered. The result shows refX as scaledFrom, so you can see the size at which that leg was read.
Step 3: take the minimum, show the spread
The value is the minimum over the vias that measured something. One via that reads high, through a thin route for example, cannot raise the value. It can only show up in the spread, which reports min, max, their difference and the difference in basis points. The spread has no threshold and gives no verdict: it shows how far the vias are apart and leaves the judgement to you.
Not measured is not zero
A via whose call reverts, whose route has 0 hops, or whose netOut is 0 measured nothing. It is reported as not measured, with the reason. If no via measured anything, usdValue is null and usd is the string not measured. It is never 0, because 0 would read as a measurement of worthless, and a failed reading says nothing about the token.
One block, pinned by hash
The client reads the block header (the latest block, or the blockNumber you pass) and runs every eth_call of one usdValue at that block hash with EIP-1898 and requireCanonical set to true. It never pins by number, because after a reorg a number names another block, and vias found on one block could be valued on another. The block number read inside the call must equal the header number; a pinned blockNumber must get its own header, or the result is an rpc_error.
If the node drops the block between the calls, which is what a reorg looks like from the client, discovery restarts on a new block, at most 2 snapshots. If the block is lost every time, or the node takes no blockHash parameter, usdValue returns not measured as a result and does not throw. It never falls back to a read by number.
One to four eth_calls, and ArbSys
One Multicall3.aggregate3 eth_call reads the block number, the decimals and every quote. A second one, at the same block hash, runs only when the direct route touches more tokens. A restart repeats both, so one usdValue sends 1 to 4 eth_calls. rpc.requests counts these calls, a failed one included, and not the header reads.
On Arbitrum and Robinhood Chain, block.number is the L1 block, not the block that RPC tags count. In the SDK commit that fixed it, the Arbitrum tag 525778791 answered 26452919 from getBlockNumber and 525778791 from arbBlockNumber. So on those two chains the block is read from the ArbSys precompile, inside the same aggregate3, and the block and the readings stay one eth_call.
The dollar is the dollar token
The dollar token is USDC, or USDG on Robinhood Chain, and it is taken as 1 USD. That is why the label reads USD (via USDC) and not a dollar quote: it is a value in dollar-token terms, measured on chain, with the assumption written in the label.
A measured example
This is a real, read-only run of usdValue from the published SDK 1.6.0 on Base mainnet, on 2026-11-20, for 1 AAPLc (8 decimals). No key, no transaction, no cost. The RPC URL is a placeholder.
The read was pinned to block 60030409 and the label was USD (via USDC). The value was 339.468654.
Direct: 1 AAPLc to USDC returned 344.476892.
Via WETH: 1 AAPLc to WETH returned 211127323484418216 wei. Then 1 WETH (refX = 10^18) to USDC returned 1607.885939. Scaled: 211127323484418216 × 1607885939 ÷ 10^18, rounded down, is 339468654 base units of USDC, which is 339.468654.
The minimum of the two is the via WETH reading, 339.468654. The spread was 5008238 base units, which is 145 bps.
The direct route touched no other token, so no second eth_call was needed: rpc.requests was 1.
Where it is used, and one difference
In the SDK, usdValue runs the reads on your own node, and usdFromVias is the same computation without any RPC. In the API and the MCP, the tool is decode_usd_value: the hosted endpoint performs no RPC, so prepare gives the exact eth_call to run on your node and decode turns the result into the value.
One difference is worth knowing. The hosted decoder checks that the first hop of each leg commits exactly the leg amount. If it does not, which is a partial fill, that leg would value less than the amount, and the via is reported as not measured. The SDK README lists a revert, 0 hops and a netOut of 0 as the cases that measure nothing. Do not assume the two agree on a partial fill.
What it does not do
It does not say what you would get on another venue, and it is not a quote to trade at: it is a measured value of an amount, at one block, on the Quoter. It does not judge the spread. And the dollar token is taken as 1 USD, so the value follows it if it moves. Read it as what the Quoter returns today for your amount, in dollars, with the working shown.
Do not trust this page — reproduce it
Every claim above is checkable against the chain. Start here:
Install @blazephoenix/sdk and call usdValue on your own RPC for a token and an amount. Check that vias lists the direct and the WETH readings, that usdValue equals the lowest measured via, that blockNumber is one block and that rpc.requests is between 1 and 4. For a two-leg via, check outW × outD ÷ refX against the reported value.
Cite this article
Licensed CC BY-NC-ND 4.0: quote and cite it with attribution and a link. Commercial use and derivative versions need written permission from BlazePhoenix; translations are made by BlazePhoenix. Copy a ready-made citation:
BlazePhoenix (2026). How we derive a USD value from the Quoter alone: no oracle, no price API. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/usd-value-from-the-quoter-alone/
@misc{blazephoenix_usd_value_from_the_quoter_alone,
title = {How we derive a USD value from the Quoter alone: no oracle, no price API},
author = {BlazePhoenix},
year = {2026},
url = {https://blazephoenix.xyz/learn/usd-value-from-the-quoter-alone/},
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).