1

I'm connected to an Ethereum node (running Geth) I manage and I'm able to connect to it using RPC. I can access web3 in the terminal after issuing geth console. I can access and run the RPC function calls as listed in the documentation here. I have to switch between different libraries like webpy and web3.js so an implementation in either should be fine.

Given a transaction hash, I can fetch the transaction details, say using web3.eth.getTransaction(transaction_hash). But all the details I get only includes: hash, input, nonce, from, to, transaction_index, value, v, r, s.

What I'm curious about is how does this website access rest of the rich details as to how many tokens were transferred. More specifically, how can we read (given the sender and contract address involved in a transactions) the value of tokens transferred i.e. the value parameter of the function call?

A snapshot of such details from the above website. (How does one figure out the Token Transfer, shown in the picture below)

enter image description here

Is it from the input field? If so, how does one interpret the hex to actuall values and the function called?

2 Answers 2

1

They most probably are listening on the events generated by every smart contract and indexes them in their local database.

The standard ERC20 compatible smart contracts generate a Transfer() event with each transaction. If you want to monitor all the events generated by a smart contract, you can subscribe your client to allEvents

0
0

To access the name of the function that was called, the name of the parameters of the function, the types of the parameters (uint256, address, etc.) and the value of those parameters, you need to decode the "Input Data" field.

An easy way to decode the input data is to use an already built decoder such as ethereum-input-data-decoder.

Events are not a reliable way to access this data because many contracts functions do not fire events, and you can never be sure that the event gives you the true value of the parameters.

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.