Sub topic 13
Pending, Stuck, and Failed Transactions
Assume you understand wallets, addresses, networks, native coins, tokens, gas, and nonces. This chapter focuses on diagnosing a transaction after you submit it and choosing a safe next action.
What the statuses mean
A transaction hash identifies a signed transaction. After submission, a node usually holds it in a mempool, which is a temporary pool of transactions waiting for inclusion.
- Pending means the transaction is known but not yet included in a block.
- Stuck means it has remained pending longer than expected, often because its fee is too low.
- Dropped means nodes no longer have the transaction. It might still appear as pending in an explorer that has stale data.
- Failed means the transaction was included in a block, but execution reverted. The sender usually still pays gas for the attempted execution.
- Replaced means another transaction with the same sender and nonce was accepted instead.
| Status | Evidence | Usual response |
|---|---|---|
| Pending | No receipt yet | Wait or inspect the fee and nonce |
| Failed | Receipt status is 0 | Find the execution error before retrying |
| Replaced | Another transaction uses the same nonce | Track the replacement hash |
| Dropped | No node can find the hash | Rebroadcast or create a replacement if safe |
Diagnose before changing anything
- Confirm that your wallet and explorer use the same network. A transaction on one chain cannot confirm on another chain.
- Look up the transaction using its hash. Check the sender, recipient, nonce, amount, and fee fields.
- Request the transaction receipt. A missing receipt means the transaction has not been included, while a receipt with status 0 means execution failed.
- Compare the transaction nonce with the account’s latest and pending nonce. A later nonce cannot normally execute until earlier transactions are processed.
- For a token transfer, inspect the contract address and transfer event. A successful receipt does not prove that you used the intended token contract.
You can check these states with ethers:
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const hash = process.env.TX_HASH;
async function main() {
const tx = await provider.getTransaction(hash);
if (!tx) {
console.log("Transaction not found on this network");
return;
}
console.log("From:", tx.from);
console.log("Nonce:", tx.nonce);
console.log("Block:", tx.blockNumber ?? "pending");
const receipt = await provider.getTransactionReceipt(hash);
if (!receipt) {
console.log("Still pending, dropped, or unavailable");
} else {
console.log("Status:", receipt.status === 1 ? "success" : "failed");
console.log("Gas used:", receipt.gasUsed.toString());
}
console.log("Latest nonce:",
await provider.getTransactionCount(tx.from, "latest"));
console.log("Pending nonce:",
await provider.getTransactionCount(tx.from, "pending"));
}
main().catch(console.error);Resolving a stuck transaction
If the fee is too low, a wallet may offer Speed up. This creates a replacement with the same nonce and a higher fee. The replacement must satisfy the network’s fee-bump rules. After it confirms, the original hash will not confirm.
Cancel creates another transaction, usually sending zero native coins from the account back to itself. It also uses the same nonce and a higher fee. Cancellation is not guaranteed because miners or validators may include the original transaction first.
If a transaction was dropped, rebroadcast the original signed transaction when possible. Do not automatically submit a new transaction with a different nonce, because that can create an unintended second payment.
A failed transaction needs a different approach. Check the revert reason, destination contract, balance, gas limit, token amount, and network. Increasing the fee does not repair a contract condition that rejects the call.
Exercise
A transaction has a receipt with status 0. Should you resend it with a higher fee?
Show answer
No. It was included but reverted. Find the execution error and correct the transaction data or account conditions before retrying.