When I submit a transaction via web3 and metamask, it will await 280 seconds before timing out and returning the transaction receipt.

How can I catch this error and handle with it so that my app can continue waiting for the transaction to be mined?

Is there a way to loop it with the tx hash that you can generate prior to it timing out?

EDIT: What is the best way to handle this, by using filter? By simply catching and running a filter for the 50+ blocks it can run max, doesn't seem like the best way. Also, will the Txhash remain the same if I generate it before I execute the transaction and the transaction is delayed for a day due to gas costs?

1 Answer 1


I've been searching solution to 50 Blocks problem for long enough and I've found one.

What you can do is:

1. Wait for transaction hash once you've sent the transaction. Use this LINK for reference.

2. Once you've received one, call web3.eth.getTransactionReceipt to get the transaction status using transaction hash. Now refer this LINK-2

NOTE : It (getTransactionReceipt) will return NULL until the transaction is mined!

Hope it helps!

  • How do you await JUST the transaction hash?
    – Zach
    Nov 21, 2018 at 7:07
  • Like this: await web3.eth.sendTransaction({ from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe', to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', value: '1000000000000000' }) .on('transactionHash', function(hash){ console.log("Hash : " + hash); })
    – itsHarshad
    Nov 21, 2018 at 8:13

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.