1

It is possible to check which address owns a particular NFT by using the ERC721 standard function:

function ownerOf(uint256 tokenId) public view virtual override returns (address) in ERC721.sol

But I would like to know all NFTs owned by a particular address.

My Question:

Is there a way to retrieve all ERC721 tokens owned by a partcular Ethereum address using Web3.JS?

3
  • You check all Transfer events and filter it by receiving address. – Mikko Ohtamaa May 3 at 20:52
  • Is there a better way than that? What if the address received something and then sent it somewhere else later? – Oscar Chambers May 3 at 20:57
  • You check also outgoing transfer events. – Mikko Ohtamaa May 4 at 9:48
1

No, web3 doesn't know about all ERC721 token contracts, which would be required to call ownerOf() for each NFT.

What could be done: take a list of popular ERC721 contracts (like this one from Bloxy) and check the owner of each and every token, which is quite cumbersome.

Alternative, more convenient approaches would be to use third party APIs like Alchemy's Transfer API or Ethersan's Account API (see 'Get a list of "ERC721 - Token Transfer Events" by Address').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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