0

I'm having issues with the returned data from Etherscan API. I'm using two endpoints:

(1) Normal Transactions by Address

https://api.etherscan.io/api?module=account&action=txlist

(2) Erc721 Transaction by Address

https://api.etherscan.io/api?module=account&action=tokennfttx

  • Address: 0x0b8f4c4e7626a91460dac057eb43e0de59d5b44f
  • Txhash: 0x6b2103201b968e5ad9a26041127080c4969b10191c8ad94082980487d6fbd9aa

--> mint event

I can see this transaction when calling (2), but this endpoint doesn't deliver the value transferred. I used to get the value by calling (1) and going through the list and match the tx hashes, but it is not listed. On Etherscan you can see the mint event with a transferred value of 0.05 Eth (https://etherscan.io/tx/0x6b2103201b968e5ad9a26041127080c4969b10191c8ad94082980487d6fbd9aa). But from where is this information? How do I find the transferred value?


Now another example where this is working:

  • Address: 0xB2Ebc9b3a788aFB1E942eD65B59E9E49A1eE500D
  • Txhash: 0x57ece5c8b9f040f43faac83a68883a5324f2ef6d36ad0018dc6813a0c851ff74

I can see the transaction when calling (2) and also see the matching tx hash when calling (1)

Any support and hint is much appreciated!

MuTe33
  • 112
  • 2
  • 13

1 Answers1

3

The txlist endpoint (docs) returns a list of native transactions sent from and to the specified address. But it doesn't take into account token transfers.

Several Transfer() event logs (standardized way to signal a token transfer, mint or burn) were emitted as a result of the 0x6b... transaction, and one of them contains the 0x0b... address as one of its parameters (specifically as the token receiver).

However, the native transaction was not sent from or to the 0x0b... address. That's why it's not being returned in the endpoint.


In your second example, the 0x57... native transaction was actually sent from the 0xB2... address. That's why it's included in the txlist endpoint response.

It also contains the Transfer() event log signaling a token mint to the very same 0xB2... address, but that's the unimportant factor. It wouldn't make a difference (related to the txlist endpoint) if the token was transferred to any other address or not transferred at all.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • Hi! thanks for your answer. still having troubles to understand. I'll reward you anyways since you made the effort and it sounds correct. :) With native transaction you mean i.e. ETH transferred from one to another account? On both cases a specific amount of ETH is sent. And also where can I tell the difference by looking on etherscan on the transaction detail page linked above that something was sent on native transaction level and what not? Both look the same to me – MuTe33 Nov 05 '21 at 08:15
  • By native transaction, I mean an Ethereum (network, not currency) transaction defined in the yellow paper (before smart contracts and tokens were introduced). It can have ETH `value` (as in your case), but the value can also be zero. It can also contain `data` field signaling what function to execute if the recipient is a smart contract, and it can result in emmiting event logs (by the smart contract) signaling token transfer. An example of native transaction object before it's signed (by the sender private key): https://eth.wiki/json-rpc/API#eth_sendtransaction – Petr Hejda Nov 05 '21 at 09:42
  • What was sent on the native tx level - see the previous link. Any ETH `value` for example... On the other hand, any `Transfer()` event logs are produced as the result of the transaction being processed by the recipient contract.... Example [transaction](https://etherscan.io/tx/0x57ece5c8b9f040f43faac83a68883a5324f2ef6d36ad0018dc6813a0c851ff74) from your question: `From`, `Interacted With (To)` and `Value` are fields of the transaction. `Transaction Action` and `Tokens Transferred` are results calculated based on the `data` field and the event logs (after the tx was processed by the contract). – Petr Hejda Nov 05 '21 at 09:46
  • Ahh, okay that makes a lot of more sense. I wanted to avoid decoding the input data, but probably that would make the most sense. So in my first case described in my question, I can only get the value from the transaction out of the encoded input data or how else would I get it? In endpoint (2) I can only see what happened but have no value to this mint event. – MuTe33 Nov 06 '21 at 09:41