TransWikia.com

Web3 sending TX times out after 280 seconds because network lag

Ethereum Asked on November 22, 2021

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?

One Answer

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!

Answered by itsHarshad on November 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP