Module 3: How Blockchains and Transactions Work

The Mempool, Nonces, and Stuck Transactions

Chapter 4 of 13 · about 6 minutes

4.1 The traffic jam

Mint sent a transaction with a low fee on a busy day. It stayed pending. Mint then tried to send another transaction, with a normal fee, and that one got stuck too. Then a third.

"Everything I send is frozen," Mint said. "Is my wallet broken?"

"Your wallet is fine," said Hash. "Your first transaction is blocking the road. Everything behind it is waiting for it to move. Let's talk about nonces."

4.2 The mempool, revisited

Chapter 1 described the mempool as a waiting room for pending transactions, with each node keeping its own version. Here's what matters for you as a user.

Higher fees generally go first. When blocks are full, block producers prioritise transactions that pay the most.

Mempools have limits. Nodes can't store unlimited pending transactions. When mempools are crowded, transactions with the lowest fees may be dropped from some nodes.

Your transaction is public while it waits. Anyone watching the public mempool can see it before it's confirmed, including its type and details. Chapter 11 explains why that matters for trading.

Some transactions never enter the public mempool. They're sent directly to block builders through private channels, often to avoid the risks in Chapter 11.

4.3 What a nonce is

On Ethereum and other account-based networks, every transaction from an address has a nonce: a number that counts how many transactions that address has sent. Your first transaction has nonce 0, the next nonce 1, and so on.

The rule is strict: transactions from an address must be processed in nonce order, with no gaps. Transaction 5 can't be included until transaction 4 has been included.

Think of a numbered ticket queue at a government office. If ticket 41 hasn't been served, ticket 42 can't be called, no matter how urgent it is.

The nonce exists for a good reason: it prevents replay attacks, where someone copies a valid signed transaction and submits it again. Since each nonce can only be used once, a copy would be rejected.

4.4 Mint's traffic jam

Here's what happened to Mint.

NonceTransactionFeeStatus
46Earlier transactionNormalConfirmed
47Send to NodeVery lowPending, too cheap for current conditions
48SwapNormalPending, waiting for nonce 47
49Send to exchangeNormalPending, waiting for nonce 48

Transactions 48 and 49 were paying enough to be included. But they couldn't be, because 47 hadn't been. The cheap transaction was blocking the queue.

Chapter 4 · Nonces and stuck transactions

Transactions must execute in nonce order. Nonce 47 is pending with too low a fee, so nonce 48 and 49 are blocked behind it. Replacing nonce 47 with a higher-fee transaction, either a speed-up or a cancel, unblocks the queue.

Each account processes transactions in strict nonce order. If a low-fee transaction gets stuck, the ones behind it wait too. You clear the jam by replacing the stuck nonce with a higher-fee speed-up or cancel.

4.5 Speed up and cancel

Because each nonce can only be used once, you can replace a pending transaction by sending a new one with the same nonce and a higher fee. Block producers will prefer the higher-paying version, and once one is included, the other becomes invalid.

Most wallets offer two buttons for this:

Speed up sends the same transaction again, with the same nonce and a higher fee.

Cancel sends a transaction with the same nonce, sending 0 ETH to yourself, with a higher fee. If it's included first, the original transaction is effectively cancelled, because its nonce has been used.

OptionWhat it doesCost
Speed upReplaces the stuck transaction with the same action at a higher feeHigher fee for the original action
CancelReplaces it with an empty transaction to yourself, at a higher feeA fee for doing nothing, but frees the queue
WaitLeaves it until fees fall enough for it to be includedFree, but may take a long time

Replacements usually need to pay meaningfully more than the original, often at least 10% higher, to be accepted by nodes.

Mint chose "speed up" on transaction 47. Within a minute, it confirmed, and 48 and 49 followed straight after.

"So cancel doesn't really cancel," said Node. "It races."

"Exactly," said Hash. "If the original gets included first, the cancel fails. Cancelling is a race, not a guarantee. That's why you can't reliably cancel a transaction during very fast-moving moments."

4.6 Other reasons transactions get stuck

Low fees aren't the only cause.

Nonce gaps. If a transaction with nonce 47 was dropped from mempools entirely, but your wallet thinks it's still pending, later transactions may be stuck waiting for a nonce that no node knows about. Many wallets have a "reset account" or "clear activity" option that resyncs the nonce from the network. It doesn't affect your funds or keys.

Using the same address in two wallets. If you've imported the same seed phrase into two wallet apps and sent transactions from both, they may disagree about the next nonce.

Max fee below the base fee. If the base fee rises above the max fee you set, your transaction waits until the base fee falls again.

RPC issues. Occasionally, the node your wallet uses fails to broadcast a transaction properly. Switching networks back and forth or trying again later can help.

4.7 Pending isn't the same as failed or confirmed

Beginners often confuse these states.

StatusWhat it meansYour funds
PendingWaiting in mempools, not yet in a blockNot moved yet
DroppedRemoved from mempools without being includedNot moved; the nonce is still available
Confirmed and successfulIncluded in a block and executed as intendedMoved
Confirmed but failedIncluded in a block, but execution revertedNot moved, except the gas fee, which is paid

"So while it's pending, nothing has happened yet," said Mint.

"Right," said Hash. "Which is also why you shouldn't send the same transaction again in a panic. If you send the same action with a new nonce, both might eventually go through, and you'll have paid twice."

4.8 Bitcoin's version

Bitcoin doesn't use nonces in the same way, because of the UTXO model. Instead, each UTXO can only be spent once, which plays a similar role in preventing double spending. Stuck Bitcoin transactions are handled with replace-by-fee or child pays for parent, as Chapter 3 described.

4.9 Try it yourself

On a testnet, send a transaction with the lowest fee your wallet allows. While it's pending, send a second transaction normally. Observe both waiting. Then use "speed up" on the first one and watch them both confirm.

On a block explorer, open your testnet address and find the nonce of your latest transaction. Count your transactions and check that the numbers match.

Key takeaways from this chapter

  1. Pending transactions wait in mempools, where higher fees are generally included first and low-fee transactions can be dropped.
  2. Every transaction from an Ethereum address has a nonce, and transactions must be processed in nonce order.
  3. One stuck transaction blocks all later transactions from the same address.
  4. Speed up and cancel both work by replacing a pending transaction with a higher-fee transaction using the same nonce.
  5. Cancelling is a race, not a guarantee.
  6. Nonce gaps, multiple wallets, max fees below the base fee, and RPC issues can also cause stuck transactions.
  7. Never resend the same action in a panic. You may end up executing it twice.