0

I am using web3py to do transactions for token and ether. Now I need to keep a track of transaction fee applied for each transcation. How can I get the transaction fee from transaction hash?

0

You can get this from the transaction receipt. You can use

web3.eth.getTransactionReceipt(transaction_hash)

It returns a dictionary with the field gasused, combining this with the gasPrice that you used for the transaction you can get the fee cost in Ether.

for details of the receipt see the Documentation

Hope this helps

  • So it means, transaction_fee_in_wei = gasUsed * gasPrice ? – Paras Mar 22 at 9:49
  • Yes, that is correct – Jaime Mar 22 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.