Best practices for making many calls for chain data?

Hey guys,

I am a front end dev with some experience creating dapps, and I would like to know your best practice for fetching large amounts of data from a chain.
Say there is a dapp allowing users to make posts of some kind and these posts are kept in a list.
To get the full information about the post we need to call a getter each post using its index / key / whatever.

Either way, what is the best method to make many calls to a contract without completely flooding my API keys? Is there a sensible way of batching them? Are you just expected to make 1000s of calls every time a user loads a page (doesn’t seem great scalability wise)? Does this problem just need to be solved on the smart contract level so you can get all the required information in one API call?
Is there another solution?
I feel this is really limiting me in building dApps but I see many websites out there achieving the desired results.

I hope I explained that well enough, any advice would be really appreciated.

Many thanks X.

What do you think?

10 Points
Upvote Downvote

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings


  1. There is an abstraction layer between a front-end and the blockchain. You interact with a node in real-time getting all new data from each new block and then save it in a DB. You can then read data directly from your DB.

    Projects like The Graph are working to better decentralize efforts like this and make grabbing data from chains more efficient. But at the end of the day, most sites that need “large amounts of data” will hold that in their database and read from it.

  2. Ask yourself why youre storing these posts on chain. Depending on the answer to that the best approach will differ. If you don’t have a good answer to that then the best approach is to not store your posts on chain. If the answer is to prove to the user viewing the post that a certain user made the post in the form they are seeing it, then consider storing a single merkle root on chain and serving each post with a merkle proof that it is in the merkle tree. Alternatively have users sign their posts using metamask and then serve the signed document as a normal web page and verify the signature client side. Again, you don’t need a blockchain this way.

  3. Pretty sure you’re looking for “Multicall” which is a contract / library that helps you bundle multiple calls into one:

    Other than that you might also want to look into The Graph and its subgraph if you’re only dealing with read-only data.

    Feel free to drop by the CryptoDevHub Discord if you have any further questions:

MyEtherWallet & MyCrypto — the litigation story between Kosala “kvhnuke” Hemachandra and Taylor “tayvano” Monahan | by Badri Natarajan

DD..PETS what do you think? High Short Stock