0

I have an Ethereum node which I connect using web3j library. In the code I iterate over transactions of a particular block and try to fetch information about ERC721 transfers. In particular, I want to trace the token address.

For example, here is a transaction transferring a token on Etherscan.

Etherscan is able to reference the token address.

enter image description here

By checking topics in the logs of the transactions receipt, I was able to find the token id (which is a number 9984), but not the token address.

Question: How to get a token address from an ERC721 transaction? How does Etherscan do it?

1
  • In the transaction receipt the contract address should appear with the logs entries.
    – Ismael
    Feb 12, 2022 at 17:28

1 Answer 1

0

You can use this API endpoint for Ropsten Network. It will provide you all the details with tokenID and other details of your address.

https://api-ropsten.etherscan.io/api?module=account&action=tokennfttx&address=<your_Contract_Address>&startblock=0&endblock=latest&sort=asc&apikey=<your_API_key>

I am using Ropsten API because my contract is deployed on Ropsten Testnet. You can adjust block with your starting block.

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.