0

How can I get only to and from addresses from a transaction Hash using Web3. I am unable to get details of to and from using web3.eth.getTransaction() method. Please help!!

3
  • It is not possible to obtain to and from from the transaction hash alone (it is a hash), you need at least the raw transaction. – Ismael Mar 18 at 5:16
  • Can I get raw transaction hash from mempool? – Yash Attal Mar 19 at 6:07
  • What web3 provider are you using? getTransaction should return an object with to and from. If it is failing with getTransaction it might fail with other apis. – Ismael Mar 19 at 13:47
0

You can use the hash to get the transaction receipt. The transaction receipt will include the to and from addresses among other things. There are similar methods for inspecting the pending transaction before it is mined.

https://web3js.readthedocs.io/en/v1.3.4/web3-eth.html#gettransactionreceipt

Hope it helps.

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.