1

Here is the TUSD smart ERC20 contract, if I have a transaction hash, how can search the transaction history with this transaction hash?

right now the only way I can think is to get the whole history, but that doesn't seem to be effecient as shown

contractAddress = "0x00.."
web3.eth.filter({
address: contractAddress
from: 1,
to: 'latest'
}).get(function (err, result) {
// callback code here
}) 
  • there is not history for this transaction hash because transaction hash is unique and it only happens once in a lifetime – Nulik Sep 21 '18 at 0:01
  • so if the user submits a transaction, and he gives me the transaction hash, how could I search the transaction with this transaction hash in order to verify the transaction is complete? – user824624 Sep 21 '18 at 4:23
  • you can use the Status or transactionIndex field, returned by eth.getTransaction(hash), however the proper call would be getTransactionReceipt(hash) – Nulik Sep 21 '18 at 10:43
0

If you are accepting a user provided tx hash and want to know the status of the transaction, you should use the eth_getTransactionReceipt method.

If no transaction receipt is found, the transaction has not been mined yet. If a transaction receipt is found, it will contain the status (1 for success, 0 for failure), and any logs emitted by the transaction, which should be an ERC20 transfer event in this case.

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.