1

My question is not quite simple... Is it possible to get the owner's wallet address by knowing the NFT address?

Let's imagine that we already know the address of a certain NFT that some person bought and we want to call some method in the nonNFT contract in order for it to return to us the wallet address of this owner of this NFT. I know that it is possible to call the "ownerOf" method in the NFT contract itself, but is it possible to call a similar method outside the NFT contract?

Do you have any idea how this can be done?

Thank you in advance,

Andrew

2
  • What do you mean by "NFT address"? NFT's are usually differentiated by their ID's. In ERC721 NFT implementation, the "NFT Address" is equivalent to OwnerAddress.
    – Sky
    Dec 8, 2022 at 18:22
  • think they mean NFT's contract address, or series number in that contract in the case of a NFT collection. This is not the same as the owner's public key which they want to query, given the former.
    – user610620
    Dec 8, 2022 at 20:39

2 Answers 2

1

I think you'll find that your question is extremely simple. You can make an external call to the nft contract from inside any other contract by wrapping the address in an ERC721 interface.

address owner = ERC721(--insert nft address--).ownerOf(_tokenId);

The problem is that you need to know the tokenId of the NFT itself to be able to find the address.

3
  • What is ERC721()? A Solidity function?
    – user610620
    Dec 9, 2022 at 6:34
  • It is how you tell the solidity code what functions can be called on the address inside the parenthesis. At the top of the file, you would also have an import statement that imports an ERC721 contract. You could also do the same thing with IERC721 - an interface without function implementations. Dec 9, 2022 at 6:45
  • @YanDigilov, thank you for your answer very much. I'll try it. Dec 9, 2022 at 12:10
0

The NFT contract is the place which has this information. So you should query it to get the data, via the ownerOf function.

The data may be stored also elsewhere, in various (external) services. But they are simply replicating the blockchain's data. Their data may be outdated or they may have bugs in their code. To be absolutely certain of an owner, you have to query the contract yourself.

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.