0

I am trying to deploy a "verifyTx(tx_hash){}" function that takes a hash and tells me the state (succ vs. fail vs. pending), but I was hoping to get more advanced information on the hash if possible:

  1. Can I check what type of transaction was called? e.g. a mint, a burn, a transfer etc.? Is there any way to query the name of the function from the transaction receipt log?
  2. Is there any way to catch the scenario where the user speeds up a transaction on the network? Is there any reference that the new TX (hash) replaced this (hash)? I am seemingly failing to understand why these don't show as dropped/replaced and the overriding hash shows no indication that it was not the original (this seems like an oversight) - am I missing some way to track this? Note, I am well aware of Events but due to the live nature of our dapp I am hoping to log these to a ledger and query using crons to validate some web2 components along with the transaction and the more information I can gather about the transaction, the better.

Notes:

  • I'm using an Infura endpoint, and technically I'm working specifically with Polygon for this use case. (polygonscan as the blockchain explorer)
  • I am aware of transaction receipts and logs, but this still seems limited (where does Etherscan for example pull all of its rich metadata?)

2 Answers 2

2
  • You can use web3.js / ethers.js method getTransactionReceipt

await provider.getTransactionReceipt("0x_your_tx_hash");

It returns raw data of the transaction, all events, etc.

To check if a transaction has been replaced. To my knowledge, there are no standard solutions.

  • You can check for a specific event to happen.

or

  • you can call waitForTransaction that will wait for a specific duration that the transaction has been validated, if not, you can implement other logic like checking user's transactions, nonces, etc.
1

One way to get information regarding the replaced transaction is by listening and recording the pending transactions of that node. In the end, you will record the same tx-hash more than once, indicating the replaced transaction.

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.