Skip to main content

What Is a Nonce in Crypto? Account Nonce vs Hash Nonce Explained

A nonce in crypto is a one-time-use number that prevents the same action from being processed twice and gives a blockchain a way to put events in order. The...

Written by Eco
What Is a Nonce in Crypto? Account Nonce vs Hash Nonce Explained

A nonce in crypto is a one-time-use number that prevents the same action from being processed twice and gives a blockchain a way to put events in order. The term means "number used once," and it shows up in two distinct places: the account nonce that Ethereum attaches to every transaction, and the hash nonce that Bitcoin miners adjust billions of times per second searching for a valid block. Same word, different jobs. Conflating them is the single most common source of confusion when reading blockchain documentation, and it is why a wallet can show "nonce too low" while a mining pool dashboard tracks something also called a nonce. This article separates the two cleanly, walks through the mechanics of each, and shows why the concept matters for replay protection, mempool ordering, account abstraction, and recovering a stuck transaction.

What is a nonce in crypto?

A nonce is a number a system uses exactly once for a specific purpose. In Ethereum, the account nonce is a per-transaction counter that rejects duplicates and keeps actions in submission order. In Bitcoin, the hash nonce is the field a miner brute-forces to make the block header hash satisfy the difficulty target. Same word, two distinct jobs.

The reason the same word covers both is historical: cryptographic protocols going back to the 1970s used "nonce" for any short-lived value that prevents replay — challenge-response handshakes, session tokens, IV bytes in symmetric ciphers. When Satoshi's 2008 whitepaper needed a name for the field a miner mutates inside the block header, "nonce" was the obvious choice. When Vitalik Buterin's 2014 Ethereum whitepaper needed a counter to sequence transactions from an externally owned account, "nonce" was again pulled from the same well.

The two uses look similar at a 100-foot view — both are integers, both prevent replay — but the mechanics diverge sharply. The Ethereum account nonce is monotonic, deterministic, and visible per address. The Bitcoin hash nonce is random-looking, single-shot, and discarded after each attempt. A reader who learns one mental model and then tries to apply it to the other will get tangled. The split is worth memorizing: account nonce sequences transactions, hash nonce drives proof-of-work.

Other systems have related concepts that are sometimes also called nonces. Cosmos chains use a per-account "sequence" field that behaves like an Ethereum account nonce. Solana uses durable nonces — a separate primitive that lets a transaction be signed offline and submitted later without expiring. Solana's durable nonce mechanism is closer to Ethereum's account nonce in role, but with different semantics around expiration. The shared theme: a nonce is whatever short-lived integer a system needs to defeat replay or fix ordering.

What are the two kinds of nonces?

The two kinds are the account nonce, which sequences transactions out of an externally owned account, and the hash nonce, which lives inside a proof-of-work block header. Account nonces are state attached to an address; hash nonces are search variables inside a hash function. Both are integers, but they operate on different layers and solve different problems.

The cleanest way to keep them straight is to ask which layer the integer lives on. The account nonce is part of Ethereum's account state, stored in the world state trie, and it changes when a transaction lands. The hash nonce is a 32-bit integer inside the Bitcoin block header, and it changes trillions of times per block as miners search for a hash below the difficulty target. State-layer integer versus search-space integer.

The table below summarizes the differences a developer or curious user will run into most often.

Dimension

Account nonce (Ethereum)

Hash nonce (Bitcoin)

Durable nonce (Solana)

Purpose

Order transactions, prevent replay

Brute-force a valid block hash

Defer transaction expiry

Range

Unsigned 64-bit, monotonic

Unsigned 32-bit, random search

32-byte hash advance

Where stored

Account state trie

Block header field

Onchain nonce account

Who increments

Sender wallet

Mining hardware

Network on advance

Visible to user

Yes (wallet, explorer)

Block explorer field

RPC query

Failure mode

Stuck or skipped tx

Wasted hashes

Stale blockhash

This taxonomy carries through the rest of the article. The next two sections drill into each kind in turn.

How does the account nonce work in Ethereum?

The Ethereum account nonce is a per-address counter that starts at zero and increments by one each time the account sends a transaction. The network requires every new transaction's nonce to equal the current account nonce, then rejects duplicates and rejects out-of-order submissions. This single counter is what makes Ethereum's transaction ordering deterministic.

The mechanic is described in the Ethereum Yellow Paper as part of the account state tuple `(nonce, balance, storageRoot, codeHash)`. When a transaction is included in a block, the EVM checks that the transaction's nonce matches the sender's current account nonce. If it does, the transaction executes and the account nonce increments by one. If the submitted nonce is lower than expected, the transaction is rejected with "nonce too low." If it is higher, the transaction enters the mempool but cannot execute until all lower nonces have been processed.

This rule produces several emergent behaviors that wallets must handle. Transactions submitted with sequential nonces — say 17, 18, 19 — execute in that order. If nonce 17 is dropped from the mempool, nonce 18 and 19 stall. The user has to either resubmit nonce 17 or use replace-by-fee to overwrite a stuck transaction with a higher gas price. EIP-1559 made replace-by-fee easier by exposing explicit max-fee and priority-fee fields, but the underlying constraint — nonce sequencing — has not changed.

Smart contracts have their own nonce too, but it serves a different purpose. A contract's nonce is incremented when it deploys a child contract via CREATE. The deterministic deployment address is computed as keccak256(rlp([sender, nonce]))[12:], which means a contract at the same address with the same nonce will always deploy a child to the same address. This is why CREATE2 was added — it removed the nonce dependency so factory contracts could deploy to predictable addresses without needing to track per-deployment counter state.

The account nonce's daily impact on users shows up in three places: replay protection, transaction queueing, and stuck-tx recovery. A signed transaction is bound to a specific nonce, so an attacker cannot rebroadcast the signed bytes after the legitimate transaction has been processed — the network will reject the second copy as nonce-too-low. Wallets can submit several transactions in a row and trust that they will land in nonce order. And when a transaction stalls, users have a defined recovery path through replace-by-fee (covered in the section below).

Account nonces also intersect with EIP-7702, which lets externally owned accounts temporarily delegate execution to smart contract code. EOAs delegated through EIP-7702 still use account nonces for transaction sequencing, but the contract code can introduce its own nonce concept for batched user operations. This is where account abstraction enters the picture, covered later.

How does the hash nonce work in Bitcoin mining?

The hash nonce is a 32-bit integer field in the Bitcoin block header that miners increment to find a hash below the network's difficulty target. Each candidate block hashes to a different value; miners loop through nonces searching for one that produces a hash with a sufficient number of leading zero bits. When they find one, they broadcast the block.

The full block header is 80 bytes and contains the previous block hash, the Merkle root of transactions, a timestamp, the difficulty target, the version field, and the nonce. Bitcoin's block-hashing algorithm double-hashes that header with SHA-256, and the resulting 256-bit number must be below the target encoded in the header itself. The miner mutates the nonce field and re-hashes until the output passes the check.

The challenge is that 32 bits — about 4.3 billion possible values — is no longer enough to find a valid hash for any given header at modern difficulty. Bitcoin's hash rate is in the hundreds of exahashes per second range; a single ASIC can sweep the entire 32-bit nonce space in a fraction of a second. So miners also vary other parts of the header. They change the timestamp, they roll the coinbase transaction to alter the Merkle root, and they use the extranonce field inside the coinbase transaction as additional search space. The 32-bit header nonce is one slice of a much larger search.

Per Blockchain.com hash-rate data, network hashing power has grown from a handful of CPU users in 2009 to industrial-scale ASIC operations today. The economics work because every successful block earns the miner a coinbase reward plus transaction fees. The per-nonce computational cost is what enforces the security of proof-of-work: an attacker rewriting history would need to redo the hash search for every block from the fork point onward, against the entire honest network's combined hash rate. Hal Finney's reusable proof-of-work writeup from 2004 covers the core insight that grinding hashes converts electricity into ledger security.

Other proof-of-work coins inherited the same nonce structure. Litecoin's block header carries a hash nonce too. Ethereum's pre-Merge proof-of-work consensus used a header nonce as part of Ethash. Once Ethereum switched to proof-of-stake at The Merge in September 2022, the header nonce field still exists for consistency but is no longer mined. Proof-of-stake validators are selected by stake-weighted lottery, not hash search, and the hash nonce is effectively decorative.

Why do nonces matter for replay attacks and double-spend?

Nonces are the simplest defense against an attacker rebroadcasting a signed transaction. Without one, a 1 ETH payment could be replayed and processed multiple times — the signature still verifies. The nonce binds each signature to a specific slot in the sender's transaction stream, so any replay produces a "nonce too low" rejection at the network layer.

The same logic protects against cross-chain replay. After Ethereum's DAO fork in 2016, the Ethereum and Ethereum Classic chains shared identical signed transactions. A user's transaction on one chain could be replayed on the other unless the chains diverged. The fix was EIP-155, which folded a chain identifier into the signed transaction so a signed payload was bound to a specific chain. The chain ID acts like a contextual nonce — same idea applied to a different ambiguity.

Double-spend prevention is a related but distinct problem. Bitcoin's hash nonce does not directly prevent double-spend; the longest-chain rule does that. But the nonce-driven proof-of-work makes it costly to produce competing chains, which is what makes the longest-chain rule actually enforce double-spend protection. Bitcoin's confirmation guidance recommends six confirmations as the threshold beyond which reorganizing the chain becomes prohibitively expensive.

In Ethereum, both replay protection and double-spend protection rely on the account nonce. The mempool deduplicates by sender + nonce. If two transactions arrive with the same sender and nonce but different content (or different gas price), the network keeps one and discards the other. This is the foundation of replace-by-fee, covered in a later section.

Token approvals are a special case worth flagging. ERC-2612 Permit uses an ERC-20-internal nonce (separate from the account nonce) so off-chain signed approvals cannot be replayed. Permit2 generalizes that with a domain-separated nonce scheme. Permit3 extends the idea to stablecoin gas payments — the user signs a permit nonce, and an executor uses that nonce to spend the user's stablecoins to pay for gas. Different nonces for different purposes, all derived from the same anti-replay logic.

How do nonces work in account abstraction?

In ERC-4337 account abstraction, the account is a smart contract, so the nonce is whatever value the contract chooses rather than a fixed state field. ERC-4337 introduced a 2D nonce: a 192-bit key plus a 64-bit sequence. This lets a single smart account run multiple parallel transaction streams, each with its own sequence counter, all sharing the same address.

The motivation is concurrency. A traditional EOA can only have one in-flight transaction per nonce slot, so a user trying to bridge funds, sign a swap, and approve a token allowance has to wait for nonce N to land before nonce N+1 can be processed. With a 2D nonce, the user's smart account can use key 0 for routine operations and key 1 for parallel batches — both run independently. This matters for application UX: a wallet running a recurring payment can use a separate key from a manually-initiated swap and they will not block each other.

The EntryPoint contract is the on-chain singleton that validates and executes user operations from any compatible smart account. When a user signs a UserOperation, the EntryPoint checks the user's smart account contract for the expected `nonce` value, and the account contract returns whatever it tracks internally — usually the 2D scheme above, but contracts are free to define their own logic. Some smart accounts use a Merkle-tree of nonces for batched approvals; others use a bitmap so any 256 nonces can be invalidated in a single storage slot.

EIP-7702, activated as part of Pectra in 2025, brought a related capability to externally owned accounts. An EOA can temporarily delegate execution to a smart contract, then route operations through that contract's logic. The EOA's account nonce still increments per outer transaction, but the delegated contract can layer its own nonce semantics on top. EIP-7702 in more detail covers how the delegation pattern works.

Smart contract wallets like Safe and Argent have used custom nonce schemes long before ERC-4337. Safe's contract uses a single nonce counter combined with operation hashing so each multisig confirmation maps to a specific nonce. Argent uses session keys and a guardian-recovery flow that introduces additional nonces for time-locked operations. Externally owned accounts and social recovery are the two related concepts to keep in view here.

"Account abstraction has been an unfinished part of Ethereum's roadmap for years. The complexity is not in the cryptography — it is in the migration story for the existing EOA base." — Vitalik Buterin, "Account abstraction roadmap," ethereum.org notes

What are common nonce problems and how do you fix them?

The three most common nonce problems are stuck transactions, "nonce too low" errors, and "replacement transaction underpriced" warnings. Stuck transactions are fixed with replace-by-fee or a zero-value self-transaction at the stuck nonce. Nonce-too-low is fixed by requerying the canonical nonce. Replacement-underpriced is fixed by raising the gas price at least 10% over the original.

A stuck transaction is one that has been broadcast to the mempool but not mined, usually because the gas price is below what miners or block builders are currently including. EIP-1559 type-2 transactions have separate `maxPriorityFeePerGas` and `maxFeePerGas` fields, and a stuck tx is typically one where `maxFeePerGas` was set below the current base fee. Replace-by-fee submits a new transaction with the same nonce but a higher fee; nodes that support RBF replace the original in the mempool with the new one. Geth's transaction pool requires a 10% bump as the default policy.

The zero-value self-transaction trick is useful when replace-by-fee is not available or fails. The user sends a 0 ETH transaction to their own address at the stuck nonce, with a high gas price. If the new tx confirms, it consumes the nonce slot and the originally stuck transaction becomes obsolete. This pattern is exposed in MetaMask's cancel-transaction guidance as the recommended fallback.

"Nonce too low" usually appears after a wallet's local nonce diverges from the chain's view of the account. This happens when a user has multiple wallets pointing at the same address, or when a node is out of sync, or when a transaction was processed by a different relayer. The fix is to query the canonical nonce via eth_getTransactionCount at block tag `pending`, and reset the wallet's local counter to that value. Most wallets expose a "reset account" or "clear activity" option that does this.

"Replacement transaction underpriced" is what miners or builders return when an RBF attempt does not bump the fee enough. The protocol does not require RBF support — it is a node-level policy — and the canonical Geth threshold is a 10% increase in both `maxFeePerGas` and `maxPriorityFeePerGas`. Some block builders enforce stricter thresholds; Flashbots's documentation notes that bundle replacement uses different rules.

Skipped nonces are rarer but worth knowing. If a user manually submits transactions with a gap — say nonce 5 then nonce 7 — the higher nonce stays in the mempool indefinitely until nonce 6 is supplied. Some wallets warn about gaps; some just queue the transaction silently. The recovery is to send a transaction at the missing nonce, which unblocks all higher-nonce transactions in the mempool.

How do nonces affect wallet UX?

Nonces are mostly invisible to users when wallets work correctly, but they create real UX friction in three situations: parallel actions, multi-device wallets, and recovery from network outages. Each one stems from the same root constraint: the account nonce is a single global counter for that address, and only one transaction per nonce slot can land.

Parallel actions are the most common pain point. A user trying to claim an airdrop while a swap is mid-broadcast may see the second transaction stall behind the first. This is one of the larger drivers of the account-abstraction push: smart accounts can run parallel transaction streams via the 2D nonce, while EOAs cannot. Layer 2 networks partly mitigate the friction by lowering fees and reducing block time, but the underlying nonce constraint is unchanged.

Multi-device wallets — the same key on a phone and a hardware wallet, for example — can produce nonce drift. Both devices independently track what they think the next nonce should be. If both submit transactions in parallel, the network accepts the first and rejects the second as "nonce too low." Wallets handle this with varying degrees of grace. Coinbase Wallet and MetaMask both query the canonical nonce on every transaction; older wallets cached the local nonce and broke. The lesson for users is to avoid signing simultaneously from two devices.

Recovery from network outages is the third category. If a wallet's RPC endpoint goes offline and the user signs a transaction against a stale state, the cached nonce may be ahead of the network's view. When the RPC comes back, the transaction is broadcast with a too-high nonce and queued indefinitely. The fix is the same as nonce-too-low — query canonical nonce, resync, resubmit.

Block explorers expose nonces as a debugging tool. Etherscan shows the nonce on every transaction page; the address-level transaction list is sortable by nonce. Block explorers are the first place to look when a transaction stalls, because the explorer's view of the canonical nonce is more reliable than any individual wallet's local cache.

Hardware wallets add an additional wrinkle. Devices like Ledger and Trezor sign transactions but do not track nonces — they rely on the host computer to supply the correct nonce in the unsigned transaction payload. If the host's nonce is wrong, the hardware wallet will sign whatever it is given, and the resulting transaction will fail with nonce-too-low or queue indefinitely. The mitigation is for the wallet software running on the host to query canonical nonce on every signing request rather than caching.

One subtle UX category is the difference between "pending nonce" and "latest nonce." A wallet querying eth_getTransactionCount with the `latest` block tag gets the count of confirmed transactions. With the `pending` tag, it gets the count including transactions sitting in the mempool. The two values diverge whenever the user has a pending transaction. Wallets that query `latest` for new transactions while `pending` ones are unconfirmed will reuse a nonce, producing the "replacement transaction underpriced" error. Most modern wallets default to `pending`, but the inconsistency surfaces as a real bug in older or custom integrations.

The cumulative effect of these UX edges is that nonce handling is one of the larger sources of wallet-side complexity that users do not need to know exists — until it breaks. Wallets that get nonce handling right are invisible. Wallets that get it wrong produce the "my transaction is stuck and I don't know why" support tickets that dominate community channels.

How does Eco handle nonces in cross-chain stablecoin flows?

Eco Routes uses standard account nonces for any user transaction originating from an EOA. When a user requests a stablecoin transfer between chains, the source-chain transaction increments their source-chain nonce normally. The orchestration layer adds no new nonce requirements on the user side; solvers on the destination chain manage their own nonces to fulfill the intent.

The user-facing experience is one signature per intent, not one nonce per chain. Eco's intent model means the user signs a message describing what they want — "deliver 1,000 USDC on Base, given 1,000 USDC committed on Optimism" — and a solver on the destination chain produces the matching transfer. The user's source-chain nonce increments once when they post the intent; the solver's destination-chain nonce increments when they fulfill it. Intents and solvers covers the broader architecture.

Per the live data snapshot pulled on April 29, 2026, USDT supply is around $189.5B and USDC supply is around $77.3B (DeFiLlama stablecoin tracker). Stablecoin transactions across multiple chains generate substantial nonce churn: every cross-chain transfer touches at least two account nonces, plus any solver and relayer nonces in between. The orchestration layer's job is to make that complexity invisible to the end user.

Eco Routes is live on 15 chains as of March 2026. Hyperlane is the only currently-live partner-rail; CCTP is used as internal transport for USDC settlement. Each chain maintains its own account nonce space, so a user with the same EOA address active on Optimism, Base, and Ethereum has three independent nonce counters that increment separately. Wallet UIs and block explorers display these per-chain.

Permit3 is the relevant Eco-specific primitive. It uses a domain-separated nonce so a single signed permit can authorize spending across multiple chains without exposing the user to cross-chain replay. The nonce in this case is bound to the Permit3 contract's domain rather than to the account itself, which means the user's account nonce stays untouched while the permit nonce tracks the gas-payment authorization. This is the same anti-replay logic as ERC-2612, applied to the cross-chain stablecoin gas problem.

Frequently asked questions about crypto nonces

Can two transactions share the same nonce?

No, only one transaction per (sender, nonce) pair can land. If two transactions are submitted with the same sender and nonce, the network keeps one and discards the other. This is the basis of replace-by-fee: a higher-fee transaction replaces a lower-fee one at the same nonce.

Why does my transaction say "nonce too low"?

"Nonce too low" means the wallet sent a transaction with a nonce equal to or below the next expected one. This usually happens after a wallet's local nonce drifts from the chain's view. The fix is to reset the wallet's account state, which forces it to requery the canonical nonce via eth_getTransactionCount.

What is the difference between a nonce and a transaction hash?

A nonce is a counter; a transaction hash is a 32-byte digest of the entire signed transaction. The nonce uniquely identifies which slot in a sender's stream the transaction occupies. The hash uniquely identifies the transaction itself across the entire chain. Two transactions can never share a hash; two transactions with the same nonce can only have one land.

Do Solana transactions use nonces?

Solana transactions use a recent blockhash as their default replay-prevention mechanism, with a short expiration window. Durable nonces are a separate primitive for transactions that need to remain valid past the blockhash window — useful for offline signing or scheduled execution.

Can I cancel a stuck transaction?

Yes, by submitting a higher-gas-price transaction at the same nonce. The simplest pattern is a zero-value self-transaction with a high gas price, which consumes the nonce slot and supersedes the stuck transaction. Most wallet UIs expose a "speed up" or "cancel" button that automates this.

Related reading

Sources and methodology. Stablecoin supplies sourced from DeFiLlama on April 29, 2026. EIP references verified against eips.ethereum.org. Bitcoin block-header mechanics cross-checked against the 2008 Bitcoin whitepaper and Bitcoin Wiki. Ethereum nonce semantics verified against the Yellow Paper and current go-ethereum source. Figures refresh quarterly.

Did this answer your question?