hirosystems / hirosystems/stacks-blockchain-api

Add block-based filtering to prevent pagination issues in endpoints

Open
#2,349 0 comments 0 reactions 1 assignee Claimed by @rmottley-hiro View on GitHub
Dominant language
TypeScript
Stars
193
Forks
127
Avg merge
16h 35m
Merged PRs (30d)
46

Description

**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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.