| | --- |
| | license: cc-by-nc-4.0 |
| | tags: |
| | - ethereum |
| | - evm |
| | - blockchain |
| | - cryptocurrency |
| | - crypto |
| | - onchain-data |
| | - tabular |
| | - timeseries |
| | - datasets |
| | - pandas |
| | - polars |
| | - duckdb |
| | pretty_name: BlockDB Swap Fees - Sample |
| | size_categories: |
| | - 10M<n<100M |
| | --- |
| | |
| | ## Sample Notice |
| |
|
| | This dataset contains **a small sample** of the full BlockDB Swap Fees dataset. |
| | It is provided **for evaluation, research, and interoperability testing only**. |
| |
|
| | If you need full historical coverage, real-time streaming, or end-of-day (EOD) exports |
| | please contact us directly: |
| |
|
| | 📧 **support@blockdb.io** |
| | 🌐 https://www.blockdb.io |
| |
|
| |
|
| | ## Dataset Overview |
| | Per-swap fee accounting with detailed breakdown. Each row represents fee amounts collected on a specific swap event, including total fee, user/LP share, protocol share, and extra fees (burn/staking), all denominated in the fee token (typically token_in). |
| | |
| | |
| | ## Chains and Coverage |
| | ETH, BSC, Base, Arbitrum, Unichain, Avalanche, Polygon, Celo, Linea, Optimism (others on request). |
| | Full history from chain genesis; reorg-aware real-time ingestion and updates. |
| | |
| | |
| | ## Schema |
| | List of columns exactly as delivered: |
| | |
| | • id BIGINT – Unique swap fee record identifier (primary key) |
| | • pool_uid BYTEA – Unique pool identifier (FK to liquidity_pools) |
| | • exchange_id INTEGER – Exchange/DEX identifier |
| | • type_id INTEGER – Pool type identifier (FK to liquidity_pool_types) |
| | • block_number BIGINT – Block when the swap was observed |
| | • block_time TIMESTAMPTZ – UTC timestamp when the block was mined |
| | • tx_index INTEGER – Transaction index within the block |
| | • log_index INTEGER – Log index within the block |
| | • token_in BYTEA – 20-byte address of input token |
| | • token_out BYTEA – 20-byte address of output token |
| | • fee_token BYTEA – 20-byte address of the token fees are denominated in |
| | • amount_in NUMERIC(78,0) – Executed input amount (decimals-adjusted) |
| | • amount_out NUMERIC(78,0) – Executed output amount (decimals-adjusted) |
| | • fee_amount_total NUMERIC(78,0) – Total fee amount in fee_token units |
| | • fee_amount_user NUMERIC(78,0) – LP/user share in fee_token units |
| | • fee_amount_protocol NUMERIC(78,0) – Protocol share in fee_token units |
| | • fee_amount_extra NUMERIC(78,0) – Other share in fee_token units (burn/staking/etc.) |
| | • _tracing_id BYTEA – Tracing ID of this swap fees record |
| | • _genesis_tracing_ids BYTEA[] – Tracing IDs of the genesis records leading to this record |
| | • _parent_tracing_ids BYTEA[] – Tracing IDs of the parent records leading to this record |
| | • _created_at TIMESTAMPTZ – Record creation timestamp |
| | • _updated_at TIMESTAMPTZ – Record last update timestamp |
| | |
| |
|
| | ### Notes |
| | • fee_token is either token_in or token_out; fee_amount_total ≤ amount of fee_token. |
| | • fee_amount_user + fee_amount_protocol + fee_amount_extra ≤ fee_amount_total. |
| | • Unique constraint: (pool_uid, token_in, token_out, block_number, tx_index, log_index) guarantees one fee record per swap log per direction. |
| | • Indexes on (pool_uid, block_number DESC, tx_index DESC, log_index DESC), (pool_uid, block_time DESC, tx_index DESC, log_index DESC), (block_number, tx_index, log_index), block_time, and (token_in, token_out, block_time DESC) support fast lookups. |
| | |
| |
|
| | ## Lineage |
| | Each swap fee record includes deterministic _tracing_id, _genesis_tracing_ids, and _parent_tracing_ids, providing: |
| |
|
| | • Provenance tracking from raw logs to decoded fee events |
| | • Reproducible analytics and signal extraction |
| | • Cross-system consistency checks (RPC vs. indexers vs. internal warehouses) |
| | |
| |
|
| | ## Common Use Cases |
| | • LP revenue analysis and yield estimation |
| | • Protocol fee revenue tracking |
| | • Cost of execution analysis for traders |
| | • Fee tier comparison across DEXes and pools |
| | |
| |
|
| | ## Quality |
| | • Verifiable lineage: deterministic cryptographic hashes per row |
| | • Reorg-aware ingestion: continuity and consistency across forks |
| | • Complete historical coverage: from chain genesis to present |
| | |