Description
The Swap Fees stream delivers real-time per-swap fee accounting for AMM pools. Each message includes executed swap sizes, computed fee amounts, and fee splits across recipients.
Subscription Parameters
Filter updates to specific BlockDB pool identifiers.
Filter by input token addresses.
Message Fields
Address of the input token.
Address of the output token.
Total fee amount in fee_token units.
Block height where the swap occurred.
Row-level lineage hash for correlation.
Subscription Example
# Use wscat to connect and subscribe
wscat -c wss://stream.blockdb.io/v1/evm/ \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-x '{"action": "subscribe", "dataset_id": "0303", "chain_id": 1, "params": {"token_in_addresses": ["c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]}}'
Response Example
{
"chain_id": 1,
"dataset_id": "0303",
"is_reorg": false,
"data": {
"pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
"token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"fee_token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount_in": "5.000000000000000000",
"amount_out": "15850.000000000000000000",
"fee_amount_total": "0.015000000000000000",
"block_number": 19000042,
"_tracing_id": "0303c0ffee0000000000000000000000000000000000000000000000000001",
"_created_at": "2025-12-20T12:35:01Z"
}
}