My transactions take so long and eventually fail

Created by Sourajyoti Gupta, Modified on Fri, 28 Jul 2023 at 07:25 PM by Sourajyoti Gupta

The transaction usually fails when the gas price which is being sent along the transaction payload is low. This transaction then goes to the "pending" status which generally means that the network has received your transaction but it's not being indexed yet by the indexer then finally after waiting for some time it gets failed.

So to avoid this it is recommended to switch you a dedicated private RPC URL such as Infura or Alchemy and we would also like to suggest you fetch the maxFeePerGas from for the Mumbai testnet and for Polygon mainnet, after fetching make sure to convert the fetched price from GWEI to WEI. If you are setting a static gasLimit, then we suggest you estimate the gasLimit. If your transaction still shows pending then you can overwrite it resetting your metamask or fetch the nonce and resend the transaction with higher gasprice. Moreover you can try putting in a retry logic to resend transaction with a higher gas price after a certain period of time (eg: Infura ITX supports retry).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article