Open
Description
With the Nakamoto release effectively increasing the number of blocks by 100x, we need more query capabilities for fetching transaction details from block ranges.
Scenario: I need to fetch all transactions (and their events) from blocks 1000-2000.
Currently, in order to achieve this there is an inefficient waterfall of steps that must be taken.
- Fetch all transactions for each block within the range. Requires 1000 calls to
/extended/v2/blocks/:height_or_hash/transactions
in order to aggregate all transactions in that range. - Now we have all the transactions but we encounter a new issue - the above endpoint does not return any transaction events as part of the transaction resource - this ultimately leads to step 3
- Paginate through
/extended/v1/tx/multiple
with batches of 100 transaction ids at a time (100-110 is the magic number of how many TX ids you can fit in the URL before getting a 400 response). - Additional pagination is needed on
/extended/v1/tx/multiple
for any transactions that have > 50 events.
The inefficiencies with this approach will be greatly compounded with Nakamoto as the number of blocks increases drastically in which it will be the case that there are many more blocks likely containing fewer transactions.
Proposed enhancements to GET /extended/v1/tx
- Add query parameters
from_block_height
andto_block_height
to allow filtering through block ranges - Add query parameters
event_limit
andevent_offset
to allow for fetching events eagerly - Add query parameters for ordering results set (e.g., by block_height)
Proposed enhancements to GET /extended/v2/blocks/:height_or_hash/transactions
- Add query parameters
event_limit
andevent_offset
to allow for fetching events eagerly. Default behavior can remain unchanged if event_limit defaults to 0 (i.e., return no events).
Proposed enhancements to GET /extended/v2/blocks
- Add query parameters
from_block_height
andto_block_height
to allow filtering through block ranges - Add query parameters for ordering results set (e.g., by block_height)
- Add query parameter
canonical
to allow filtering by canonical/not-canonical