1

I'm super new to cardano blockchain development. Today, I just have a chance to explore on blockfrost api. I've been trying to find an answer of the question that

  • Is there any public APIs out there that can make me get all addresses holding cnfts from a single project under the same policy id ? For example, the below image is a captured screenshot from www.opencnft.io, it shows all wallet holders distribution.
  • Right now I only see these two available APIs from blockfrost
  1. https://cardano-mainnet.blockfrost.io/api/v0/assets/policy/{policy_id}

  2. https://cardano-mainnet.blockfrost.io/api/v0/assets/{asset}/addresses

The problem right now is that the second api, {asset} is like a concatenation of the policy_id and hex-encoded asset_name mixed together, which asset_name in cnft asset will be a unique asset id and their asset ids all vary from each other under the same policy. Meaning that I need to call this API n times by having each request vary on asset_name (given n are total nfts of a project)

Appreciate any helps :)

enter image description here

1 Answer 1

0

Seeing as many projects have up to 10k assets it's clear that you cannot use Blockfrost for this.

Unless opencnft.io has an exposed API endpoint that you can use to query this info from their database, I'm afraid you're going to have to use a tool like Ogmios to extract the relevant information from the blockchain yourself. You'll have to set up a cardano node and use the chainSyncClient utility in Ogmios to sync blocks and store the UTxOs/addresses containing the assets in a custom database (for example json/SQL).

4
  • Depending on the exact use case Blockfrost should be a perfectly fine option to fetch the holders of 10k assets. Even the free plan includes 50k requests per day. It might not be the best option for building a site that frequently needs to update this data on many projects though.
    – sean
    Jul 2, 2022 at 15:04
  • Right. It depends on the the use case indeed. I assumed the latter.
    – et97
    Jul 3, 2022 at 1:33
  • Thanks so much guys, you guys help me a lot 🙏🏻
    – Michael904
    Jul 3, 2022 at 3:52
  • To add one more approach I recently found which could potentially be much simpler. On Cardanoscan if you go to the token's policy details page, there's a button "View" right after "Policy Asset Holders". It will show you the token holder's addresses per page. You can easily scrape this data, for example in Python using requests module or async requests to reduce time as you'll need to scrape multiple pages (200+ pages). Change the query param pageNo with each new request cardanoscan.io/tokenPolicy/… Spacebudz example
    – et97
    Jul 4, 2022 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.