1

the title is my question. I really want to know how these third party APIs like Alchemy, Moralis are working I'm building a product and need to create an API which can directly query the Ethereum blockchain and return the metadata of an NFT if I give it the contact address and token ID.

I searched everywhere online but couldn't find anything

3

2 Answers 2

1

Came across this hackathon project at Eth Global called the "Lindexer" powered by Envio, which pretty much answer the question.

tl;dr NFT metadata is stored off-chain, e.g. decentralized storage such as IPFS or third party hosting. Developer need an API for rich data beyond just what is emitted simply from events on chain.

tl;dr you want to find a reliable indexing solution that supports these arbitrary side processes and instant GraphQL API from the schema of your entities (essentially data model of your DApp).

Lindexer reference "indexes on-chain NFT data, while also indexing NFT meta-data (which is off-chain) in a blazingly fast and concurrent manner to a single database.

This functionality provides an extremely powerful and flexible API to app developers who require rich data beyond just what is emitted simply from events on chain."

0

If you have the NFT tokenId and the NFT implements the openzeppelin‘s ERC721 interface. you can access the ERC721 function:

tokenURI(uint256 tokenId)
Returns the Uniform Resource Identifier (URI) for tokenId token

There you’ll find your json metadata.

Your Answer

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

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