Sub topic 13
Cross-checking Dune against DefiLlama
Assume you know basic SQL, Ethereum transactions, ERC-20 tokens, Dune’s curated tables, and DefiLlama’s TVL and volume dashboards. The goal is not to force both tools to return the same number. The goal is to explain any difference well enough to decide which number answers your question.
Start with the same measurement
Before comparing results, write down the metric definition:
- Scope: Ethereum only, or every supported chain?
- Activity: DEX swaps, aggregator trades, or all protocol volume?
- Time range: calendar days, UTC days, or a rolling period?
- Unit: USD value, token units, or transaction count?
- Inclusion rules: which protocols, pools, and transaction types count?
- Price source: execution price, a market-price oracle, or a daily reference price?
A comparison is meaningful only when these choices match as closely as possible.
For example, this DuneSQL query measures daily Ethereum DEX volume from Dune’s curated trade table:
SELECT
block_date,
SUM(amount_usd) AS volume_usd
FROM dex.trades
WHERE blockchain = 'ethereum'
AND block_date >= current_date - INTERVAL '30' DAY
GROUP BY 1
ORDER BY 1The query uses block_date, which is a partition column. It also selects only the date and aggregate value needed for the comparison.
In DefiLlama, select the DEX volume dashboard, choose Ethereum, and use the same 30 calendar days. Export the daily data if the dashboard provides that option. Do not compare Dune’s 30-day sum with a DefiLlama headline number that uses a different period.
Understand why the numbers differ
The two platforms use different data pipelines and attribution rules.
| Difference | Possible effect on the comparison |
|---|---|
| Protocol coverage | One source may include a new or small DEX that the other has not classified |
| Aggregator attribution | The same swap may be attributed to an aggregator, its routed DEX, or both |
| Price calculation | USD volume can differ when sources use different token prices |
| Time boundaries | UTC dates, block dates, and dashboard refresh times may not align |
| Corrections and delays | One dataset may update sooner or revise historical rows later |
Dune’s dex.trades table is built for transaction-level analysis. DefiLlama presents an interpreted protocol metric. Neither description automatically makes one more correct. It tells you that they answer slightly different questions.
Compare in a controlled sequence
Use this workflow:
- Compare the same chain and date range.
- Compare totals before comparing individual days.
- Check whether both sources include the same protocols.
- Compare large protocols separately. A single missing protocol can explain most of the gap.
- Investigate unusual spikes by inspecting transactions in Dune.
- Record the query, dashboard filters, retrieval time, and metric definitions.
A useful diagnostic is the relative difference:
relative difference = (Dune total - DefiLlama total) / DefiLlama total
A small percentage difference may come from price timing or refresh delays. A large difference usually points to scope, attribution, missing data, or double counting.
Present the result honestly
A trustworthy report states both the result and its limits. For example:
“Dune reports 1.24 billion dollars of Ethereum DEX volume for the selected UTC dates. DefiLlama reports 1.19 billion dollars for the same period. The 4.2% difference is likely related to protocol attribution and price-source differences. The values are directionally consistent, but they should not be merged into one blended metric.”
This wording preserves the measurement method instead of hiding uncertainty behind excessive precision.
Exercise
Dune reports higher DEX volume than DefiLlama for the same dates. What should you check first?
Show answer
Confirm the chain, dates, units, protocol coverage, aggregator treatment, price method, and data refresh times before deciding why the totals differ.