Sub topic 4
Raw, Decoded and Curated Tables
Assume you know basic SQL and understand transactions, logs, addresses, and smart contracts. This chapter explains how Dune organizes blockchain data so you can choose the right table for a question.
Three table layers
A blockchain stores events as low-level records. Dune transforms those records into tables that are easier to query. The three useful layers are raw, decoded, and curated.
| Layer | What it contains | Typical use |
|---|---|---|
| Raw | Transactions, logs, traces, and block data close to the chain format | Investigating contract calls or unsupported protocols |
| Decoded | Contract events and function calls mapped to named columns | Measuring token transfers or protocol-specific events |
| Curated | Normalized tables built for common activities | Comparing DEX trades across protocols and chains |
The exact table names can change as Dune updates its schema. Check the table description and column list before writing a query.
Raw blockchain tables
Raw tables preserve the structure produced by a blockchain node.
A transaction records a requested action, such as calling a contract. A log is an event emitted by a contract. A trace records internal calls created while a transaction executes. One transaction can therefore have many logs and traces.
For example, a transaction may call a DEX router. The router can call a pool, transfer tokens, and emit several swap and transfer events. Looking only at the transaction row would hide most of this activity.
Raw data is useful when:
- You are studying a new or unusual contract.
- No decoded table exists.
- You need to inspect exact topics, calldata, or internal calls.
- You want to validate how a higher-level table was produced.
Raw data requires more protocol knowledge. Event topics and hexadecimal values must often be interpreted manually.
Decoded event tables
Decoded tables interpret known smart-contract events. For an ERC-20 Transfer event, Dune exposes the sender, recipient, token contract, amount, transaction hash, and event time as separate columns.
The token amount is still stored in the token's smallest unit. USDC uses six decimal places, while many tokens use eighteen.
SELECT
date_trunc('day', evt_block_time) AS day,
SUM(CAST(value AS double) / 1e6) AS usdc_transferred
FROM erc20_ethereum.evt_Transfer
WHERE contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
AND evt_block_date >= current_date - INTERVAL '7' DAY
GROUP BY 1
ORDER BY 1;This query measures the total face value of USDC transfer events. It does not prove that the transfers were payments, trades, or unique economic actions.
Curated activity tables
Curated tables combine and normalize data from many contracts. The dex.trades table represents swaps in a common shape, including the chain, protocol, date, token amounts, and often a USD value.
SELECT
block_date,
project,
SUM(amount_usd) AS volume_usd
FROM dex.trades
WHERE blockchain = 'ethereum'
AND block_date >= current_date - INTERVAL '30' DAY
GROUP BY 1, 2
ORDER BY 1, 3 DESC;This is usually better than reconstructing every swap from raw logs when your question concerns DEX volume. The trade table may contain multiple rows for one user action, such as multi-hop routing. Read its documentation before summing rows.
How the layers relate
Avoiding layer mistakes
Do not join a curated trade row to every matching token transfer and then sum both sides. The join can multiply rows and inflate the result. Start with one table, define the grain of each row, and aggregate before joining when necessary.
Also distinguish event count from economic volume. A transfer table counts emitted events. A curated trade table attempts to represent swaps. These measures answer different questions.
Exercise
Which layer should you start with to compare Ethereum DEX volume across several protocols, and why?
Show answer
Start with the curated dex.trades table because it normalizes trades across protocols and provides fields such as project, blockchain, and amount_usd. Use decoded or raw tables to investigate coverage or discrepancies.