I want to get all the onchain data available on the Ethereum blockchain about an NFT from its contract address and tokenID. Like its metadata, the current owners, its last price, etc. How can I do this from scratch without using any API.

I need this as I'm trying to build a product of which this is a component, and cannot use any third party API for this.

3 Answers 3


If you need live onchain data, you have 3 options.

  1. Using an API or providers like Alchemy etc.
  2. If the users connects his wallet you can use the users provider in his wallet (metamask for ex.)
  3. You can run your own Ethereum node and get the data from there. Which should be online and connected to the eth network 7/24 for your app to work.

In order to read any onchain data from Ethereum directly, you will need to use a Web3 provider. You have the following options for doing so:

  1. If you're building a UI app, you could use the user's Web3 provider (i.e., Metamask or WalletConnect). But these providers use APIs internally. Metamask, for example, uses Infura in order to connect to the Ethereum blockchain.

  2. Use a web3 provider service like Infura or Alchemy directly.

  3. Spin your own web3 node.

Personally, I would recommend you use a service like Infura or Alchemy since this is what makes most sense in most cases.

It is also possibly to query the Ethereum blockchain indirectly as follows:

  1. Query information regarding a particular smart contract by developing and deploying a subgraph for it on The Graph protocol. You would be able to query information on your smart contract by making GraphQL or HTTP requests to that subgraph.
  2. Query information about the Ethereum blockchain using Google's BigQuery. This is usually used to perform data science on the Ethereum blockchain as a whole, so it might not be what you're looking for.

Using an API really is the most efficient way of doing this, for example DeCommas’ Mission Control API has a very straightforward NFT endpoint: https://docs.decommas.io/nfts If you really want to circumvent using an API, you can get any NFT metadata using https://datalayer.decommas.net/datalayer/api/v1/nft_metadata/{chain_name}/{contract_address}/{token_id} method. It supports both ERC-721 and ERC-1555 over 8 EVM networks, provides collection name, url for media attached to NFT and other valuable stuff. Just pass chain name, contract address and token id as url params and get the JSON response. To obtain an API key visit https://dashboard.decommas.io/

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.