How can i find the value of erc20 token in a transaction using the hash generated? I can't seem to find answers anywhere.

I found that it is possible to use w.eth.getTransactionReceipt('0xxxxxHashValue') and then int('0x0000000000000000000000000000000000000000000000000000000000000050',0) from the log value of the result to get the amount of token sent.

However, i am still confused as to how to achieve this using PHP.

1 Answer 1


Partial answer, in an ethereum transaction there is a data field used for interacting with the smartcontract address. So if you're looking for an amount of erc-20 token using the hash of a transaction, it could mean you probably want to know the amount of an erc-20 token transfered by a specific transaction using its hash:

  • I would investigate the data or input field using either the web3ethgettransaction
  • Investigate at the log receipt with the getTransactionReceipt

If your goal is to know the actual balance of an ethereum account, you should read the smartcontract using an ethereum address, either the sender or the beneficiary depending on your use case.

  • To add onto this, you can't get any meaningful data about a transaction from the transaction hash. The transaction hash is the keccak256 hash of the transaction payload, meaning it's a random 256-bit number displayed as a 64-bit hexadecmial string.
    – Danny B
    Jun 9, 2023 at 20:22

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.