dipdup icon indicating copy to clipboard operation
dipdup copied to clipboard

Optimize TzKT big map requests

Open droserasprout opened this issue 1 year ago • 2 comments

Optimize tezos tzkt data source, use bigmap ptr filtration where possible. https://api.tzkt.io/#tag/BigMaps

Instead of

contract.in=KT1GBZmSxmnKJXGMdMLbugPfLyUPmuLSMwKS&path.in=store.expiry_map,store.records

Do

bigmap.in=1264,1262

droserasprout avatar Apr 11 '23 18:04 droserasprout

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

software engineering/ smart contract dev background and contributor in similar issues from last hackthons.(https://app.onlydust.com/u/Josh-121)

How I plan on tackling this issue

Review Current Implementation:

Analyze how the current API queries are structured using contract.in and path.in to retrieve data from the Tezos blockchain. Specifically, look at calls related to the contract KT1GBZmSxmnKJXGMdMLbugPfLyUPmuLSMwKS and its paths (store.expiry_map and store.records). Switch to BigMap Pointer Filtration:

Replace the contract.in and path.in method with bigmap.in=1264,1262, directly using the BigMap pointers for more efficient queries. This reduces unnecessary overhead by bypassing contract and path lookups, directly accessing the relevant BigMap data.

Update API Requests:

Refactor API calls to use the new filtration method, ensuring the query is streamlined and optimized for performance by fetching only the required data. Testing:

Test the API requests with BigMap pointers to ensure they return the correct data and are significantly faster than the previous implementation. Validate the data accuracy compared to the original method.

Work on feedback/recommendations

Josh-121 avatar Sep 26 '24 08:09 Josh-121

Hello @droserasprout , would push PR soon. Sorry for initial delays

Josh-121 avatar Oct 02 '24 07:10 Josh-121