I want to obtain some information about a given CNFT project. For instance, the number of asset minted, and all the assets metadata (e.g., attributes). How can I proceed with this? I mainly use R as a statistical/programing tool. Is there an api somewhere to do this? I have been web scraping this information, but it is really cumbersome and I am looking for an alternative.
2 Answers
I think the best option for this is: Blockfrost API
Specifically, Cardano > Assets endpoints
I.e. To retrieve the list of Tokens for a policy, you can use the following code:
curl --location --request GET 'https://cardano-mainnet.blockfrost.io/api/v0/assets/policy/c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1' \
--header 'project_id: <project_id>'
Where <project_id>
is your blockfrost API key.
-
Thank you very much! I am having a hard time understanding how to use the api. Could you give me just an example on how to pull data from one project via an URL api call (e.g., BCRC:
c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1
)? That would really help me out.– matJan 6 at 8:59 -
-
thank you so much! But would it be possible to just have a single link? I use R to make api calls and they usually are in a json format or something similar. I Tried
https://cardano-mainnet.blockfrost.io/api/v0/assets/policy/c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1?project_id=<my_blockfrost_api_key>
but it did not work...– matJan 6 at 15:49 -
@mat No, as you need to attach it as a header. You can take a look on this: stackoverflow.com/a/65649641/1133816 to use CURL in R with headers.– georgeosJan 6 at 15:56
There are multiple ways.
As per the previous answer you can fetch data from Blockfrost.
But it looks you want to fetch loads of data in bulk, and that could lead to having to pay blockfrost as the basic account only gives you a limited number of api calls.
Alternative is to run cardano-db-sync by yourself https://github.com/input-output-hk/cardano-db-sync
Or leverage some open source like dandelion.link