curl -X POST "https://api.blockdb.io/v1/evm/swaps/fees" \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chain_id": 1,
"from_block": 19000000,
"to_block": 19000100,
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250
}'
{
"meta": {
"chain_id": 1,
"request_window": {
"from_block": 19000000,
"to_block": 19000100
},
"resolved_window": {
"from_block": 19000000,
"to_block": 19000100
},
"filters": {
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250,
"cursor": null
}
},
"data": [
{
"pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
"exchange_id": 1,
"type_id": 201,
"block_number": 19000042,
"block_time": "2025-12-20T12:34:56Z",
"tx_index": 15,
"log_index": 88,
"token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"fee_token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount_in_raw": "5000000000000000000",
"amount_in": "5",
"amount_out_raw": "15850000000",
"amount_out": "15850",
"fee_amount_total_raw": "15000000000000000",
"fee_amount_total": "0.015",
"fee_amount_user_raw": "12000000000000000",
"fee_amount_user": "0.012",
"fee_amount_protocol_raw": "3000000000000000",
"fee_amount_protocol": "0.003",
"fee_amount_extra_raw": "0",
"fee_amount_extra": "0",
"_tracing_id": "0303c0ffee000000000000000000000000000000000000000000000000000001",
"_parent_tracing_ids": [
"0103c0ffee000000000000000000000000000000000000000000000000000001",
"0204c0ffee000000000000000000000000000000000000000000000000000001"
],
"_created_at": "2025-12-20T12:35:01Z",
"_updated_at": "2025-12-20T12:35:01Z"
}
],
"cursor": null,
"page_count": 1
}
Swaps
Swap Fees
Read per-swap fee accounting (executed sizes + computed fee amounts) for pool economics and yield modeling.
POST
/
v1
/
evm
/
swaps
/
fees
curl -X POST "https://api.blockdb.io/v1/evm/swaps/fees" \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chain_id": 1,
"from_block": 19000000,
"to_block": 19000100,
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250
}'
{
"meta": {
"chain_id": 1,
"request_window": {
"from_block": 19000000,
"to_block": 19000100
},
"resolved_window": {
"from_block": 19000000,
"to_block": 19000100
},
"filters": {
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250,
"cursor": null
}
},
"data": [
{
"pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
"exchange_id": 1,
"type_id": 201,
"block_number": 19000042,
"block_time": "2025-12-20T12:34:56Z",
"tx_index": 15,
"log_index": 88,
"token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"fee_token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount_in_raw": "5000000000000000000",
"amount_in": "5",
"amount_out_raw": "15850000000",
"amount_out": "15850",
"fee_amount_total_raw": "15000000000000000",
"fee_amount_total": "0.015",
"fee_amount_user_raw": "12000000000000000",
"fee_amount_user": "0.012",
"fee_amount_protocol_raw": "3000000000000000",
"fee_amount_protocol": "0.003",
"fee_amount_extra_raw": "0",
"fee_amount_extra": "0",
"_tracing_id": "0303c0ffee000000000000000000000000000000000000000000000000000001",
"_parent_tracing_ids": [
"0103c0ffee000000000000000000000000000000000000000000000000000001",
"0204c0ffee000000000000000000000000000000000000000000000000000001"
],
"_created_at": "2025-12-20T12:35:01Z",
"_updated_at": "2025-12-20T12:35:01Z"
}
],
"cursor": null,
"page_count": 1
}
Overview
- Dataset ID:
0303 - Liquidity Pool Swap Fees - Description: Per-swap fee accounting: executed swap sizes plus computed fee amounts using the pool’s fee terms (
blockdb_evm.b0212_liquidity_pools_fee_terms_v1). - CSV Sample: Download
- JSON Sample: Download
Parameters
Range Filters (mutually exclusive)
Starting block number (inclusive) for the query. Use with
to_block.Ending block number (inclusive) for the query. Use with
from_block.Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with
to_timestamp.Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with
from_timestamp.Validation rule:
You must provide either a block range, a time range, or at least one direct selector.
Providing more than one option results in HTTP 400.
Providing none results in HTTP 400.
You must provide either a block range, a time range, or at least one direct selector.
Providing more than one option results in HTTP 400.
Providing none results in HTTP 400.
Pool Selectors
Filter swaps by exchange IDs. See the DigitalExchange enumeration for supported values.
Filter by BlockDB pool identifiers (
uid from /evm/entities/pools).Filter by pool contract addresses (hex string, 20 bytes, no
0x prefix).Filter by protocol-specific pool identifiers (e.g., Uniswap V4
pool_id).Token Selectors (directional)
Restrict to swaps where the input token is in this set (hex string, 20 bytes, no
0x prefix).Restrict to swaps where the output token is in this set (hex string, 20 bytes, no
0x prefix).Restrict to swaps where the fee is denominated in one of these tokens (hex string, 20 bytes, no
0x prefix).Pagination Controls
Recommended default
250; maximum 1000 to stay under ~10 MB responses.Pagination cursor from a prior call.
Decimals-Adjusted Amounts
Off by default. When set to
true, the response includes decimals-adjusted siblings of every *_raw field (amount_in, amount_out, fee_amount_total, fee_amount_user, fee_amount_protocol, fee_amount_extra). Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or false, those fields are returned as null and only the always-present *_raw fields are populated.Response Fields
Meta
Echo of request metadata applied to the response.
EVM chain ID echoed from the request.
Pure echo of the window you sent (
from_block/to_block/from_timestamp/to_timestamp); unset bounds are null.The concrete window the query actually executed against, after resolving the request. For a block range on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP),
from_timestamp/to_timestamp hold the resolved timestamp window (and from_block/to_block echo your request). For a time range on a block-keyed endpoint, from_block/to_block hold the resolved block range (and the timestamps echo your request). null for selector-only requests (no window). No extra database work is done — these are the values the query already computed.Resolved/echoed start block of the executed window.
Resolved/echoed end block of the executed window.
Resolved/echoed start timestamp (ISO-8601) of the executed window.
Resolved/echoed end timestamp (ISO-8601) of the executed window.
Filters echoed from the request (selectors, pagination state, etc.).
Data
Array of per-swap fee records matching the request. There is no separate numeric
id field.BlockDB pool identifier (
uid from /evm/entities/pools).Exchange/DEX identifier.
Pool type identifier.
20-byte address of the input token (direction of trade).
20-byte address of the output token for this swap direction.
Token address the fee is denominated in (typically
token_in).Executed input amount as a raw integer in
token_in’s smallest denomination. String-encoded to preserve uint256 precision.Decimals-adjusted form of
amount_in_raw (amount_in_raw / 10^decimals resolved against token_in). null when decimals are unknown or include_adjusted_amounts=false.Executed output amount as a raw integer in
token_out’s smallest denomination.Decimals-adjusted form of
amount_out_raw (resolved against token_out). null when decimals are unknown or include_adjusted_amounts=false.Total fee amount as a raw integer in
fee_token’s smallest denomination.Decimals-adjusted form of
fee_amount_total_raw (resolved against fee_token). null when decimals are unknown or include_adjusted_amounts=false.User/LP share of the fee as a raw integer in
fee_token units. null when the protocol does not split.Decimals-adjusted form of
fee_amount_user_raw. null when the raw value is null, when decimals are unknown, or when include_adjusted_amounts=false.Protocol share of the fee as a raw integer in
fee_token units. null when the protocol does not split.Decimals-adjusted form of
fee_amount_protocol_raw. Same null semantics as the user field.Extra-destination share of the fee as a raw integer in
fee_token units. null when not applicable.Decimals-adjusted form of
fee_amount_extra_raw. Same null semantics as the user field.Block height where the swap event was observed.
UTC timestamp of the block containing the swap.
Zero-based transaction index within the block.
Zero-based log index within the transaction.
Row-level lineage hash (hex string, no
0x prefix).Lineage references of immediate parents.
Record creation timestamp (ISO-8601).
Last update timestamp (ISO-8601).
Envelope Fields
Cursor token for pagination.
Number of records returned in
data.curl -X POST "https://api.blockdb.io/v1/evm/swaps/fees" \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chain_id": 1,
"from_block": 19000000,
"to_block": 19000100,
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250
}'
{
"meta": {
"chain_id": 1,
"request_window": {
"from_block": 19000000,
"to_block": 19000100
},
"resolved_window": {
"from_block": 19000000,
"to_block": 19000100
},
"filters": {
"pool_uids": [
"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"
],
"token_in_addresses": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"token_out_addresses": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"limit": 250,
"cursor": null
}
},
"data": [
{
"pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
"exchange_id": 1,
"type_id": 201,
"block_number": 19000042,
"block_time": "2025-12-20T12:34:56Z",
"tx_index": 15,
"log_index": 88,
"token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"fee_token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount_in_raw": "5000000000000000000",
"amount_in": "5",
"amount_out_raw": "15850000000",
"amount_out": "15850",
"fee_amount_total_raw": "15000000000000000",
"fee_amount_total": "0.015",
"fee_amount_user_raw": "12000000000000000",
"fee_amount_user": "0.012",
"fee_amount_protocol_raw": "3000000000000000",
"fee_amount_protocol": "0.003",
"fee_amount_extra_raw": "0",
"fee_amount_extra": "0",
"_tracing_id": "0303c0ffee000000000000000000000000000000000000000000000000000001",
"_parent_tracing_ids": [
"0103c0ffee000000000000000000000000000000000000000000000000000001",
"0204c0ffee000000000000000000000000000000000000000000000000000001"
],
"_created_at": "2025-12-20T12:35:01Z",
"_updated_at": "2025-12-20T12:35:01Z"
}
],
"cursor": null,
"page_count": 1
}
Last modified on May 29, 2026
Was this page helpful?
⌘I