stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

Add block-based filtering to prevent pagination issues in endpoints

Open pradel opened this issue 3 months ago • 0 comments

Is your feature request related to a problem? Please describe.

The current pagination with limit and offset is causing issues when dealing with live blockchain data. Since new blocks are constantly being added, the pages keep shifting around between requests, which means we can end up missing transactions or getting duplicates when paginating through results.

Describe the solution you'd like

I'd like to see block-based filtering added (similar to how Ethereum handles this) with fromBlock and toBlock parameters. This way we can query data from a specific block range that won't change while we're paginating through it.

Could we start by adding these parameters to the contract events endpoint: https://api.mainnet.hiro.so/extended/v1/contract/{contract_id}/events? If it works well there, we could roll it out to other endpoints that have similar pagination issues.

I am opening this issue to start the discussion on this

pradel avatar Sep 09 '25 15:09 pradel