SKIP TO CONTENT
Blockchain

Nonce

A sequential counter tracking the number of transactions sent from an address.

What is a Nonce?

A nonce (number used once) is a sequential counter assigned to each transaction sent from an Ethereum address. Starting at zero for new accounts, the nonce increments by one with each outgoing transaction. This mechanism prevents replay attacks. Where someone could rebroadcast your signed transaction. And ensures transactions execute in the intended order.

How Nonces Work

When you submit a transaction, it includes your current nonce value. The network only accepts a transaction if its nonce exactly matches the expected next value for your address. If your last confirmed transaction had nonce 5, the next transaction must have nonce 6. No gaps allowed, and no duplicate nonces permitted.

This sequential requirement creates ordering guarantees. If you submit three transactions rapidly, they must confirm in nonce order regardless of gas prices. A higher-nonce transaction cannot confirm until all lower-nonce transactions from that address have processed. This property is both a feature (predictable ordering) and a constraint (can create bottlenecks).

Nonce Management Challenges

Stuck transactions create nonce-related issues. If a low-gas-price transaction with nonce 5 remains pending indefinitely, all subsequent transactions (nonce 6, 7, etc.) queue behind it, unable to confirm. To resolve this, users can submit a replacement transaction with the same nonce but higher gas price. Either the original transaction with boosted fees or a zero-value self-transfer to effectively cancel the pending transaction.

Rapid transaction submission requires careful nonce management. Submitting multiple transactions before any confirm requires manually specifying incrementing nonces rather than relying on automatic assignment from the network. Some wallets and development tools handle this automatically through nonce tracking, while others require manual intervention.

Advanced Nonce Concepts

For account abstraction systems (ERC-4337), nonce management becomes more sophisticated, allowing parallel transaction streams through multi-dimensional nonce spaces. This evolution addresses traditional nonce limitations while maintaining replay protection. Some protocols use meta-transactions with separate nonce tracking to enable gasless transactions while preserving security guarantees.

Examples

  • To cancel a stuck transaction with nonce 5, submit a new transaction with nonce 5 and higher gas price

Theory meets practice. See current rates across DeFi.

Track live yields, compare protocols, and build your DeFi portfolio with Fensory.

GET EARLY ACCESSArrow right