Retry Transactions
Replace stuck transactions by preparing and sending calls again.
Key use cases:
- Replace transactions stuck due to low gas prices
- Speed up pending transactions by increasing gas fees
- Override transactions that have been pending for too long
- Cancel stuck transactions by replacing with a no-op
The Retry flow
- Send the initial transaction
- Monitor the transaction status
- If the transaction is stuck/pending too long, re-prepare the same call
- Send the transaction with higher gas to replace the stuck transaction
- The original transaction gets dropped from mempool
Prerequisites
- An Alchemy API Key
- A Gas Manager policy
- A signer to own the account and sign messages
If the original transaction is already being mined, the replacement transaction may be dropped. In this case, you won’t be able to retrieve data using the replacement’s call ID, and the original transaction will be included!
React
JavaScript
API
Required SDK version: ^v4.61.0
Use the useSendCalls hook to send and retry transactions. When retrying, don’t specify a nonceOverride - the client automatically uses the same nonce to replace the stuck transaction.
You’ll need both ALCHEMY_API_KEY and ALCHEMY_POLICY_ID environment variables set to follow along!