What Is a Nonce in Crypto? Understanding Transaction Nonces

July 13, 2026 3 min read

A nonce is a number used once in cryptocurrency transactions to prevent double-spending and replay attacks.

What a Nonce Does

FunctionHow It Works
Unique identifierEach transaction has a unique nonce
Replay preventionSame transaction can’t be submitted twice
OrderingTransactions are processed in nonce order
Mining (PoW)Miners increment nonce to find a valid hash

Nonce in Bitcoin Mining

ElementValue
Nonce range0 to 4,294,967,295
PurposeFind a hash below the target
How miners use itIncrement nonce → re-hash → check
Extra nonceCoinbase transaction changes for more range

Nonce in Ethereum Accounts

ElementValue
Account nonceStarts at 0, increments by 1 per transaction
PurposePrevent replay and ensure order
GapsIf nonce 2 is pending, nonce 3 won’t process
Stuck transactionsCan’t send new txs until pending nonce clears

Why Nonces Matter for Users

ScenarioProblem
Stuck transactionNonce 5 is pending, can’t send nonce 6
Replace transactionSend same nonce with higher gas to override
Duplicate transactionSame nonce prevents duplicate execution
Metamask nonce managementCustom nonce overrides default

Managing Stuck Transactions

SolutionHow
Speed upResend with higher gas price (same nonce)
CancelSend 0 ETH to yourself with higher gas (same nonce)
Custom nonceManually set nonce to skip a stuck one

Nonce in Ethereum Account Abstraction

With ERC-4337 (account abstraction), nonce management changes:

Old (EOA)New (ERC-4337)
Sequential nonce per accountNonce can be custom
Stuck if nonce gapNonce gap doesn’t block
Hard to manageEasier UX

Developer View

TaskHow Nonce Is Used
Send transactionInclude nonce + 1
Get pending nonceeth_getTransactionCount
Build transactionSign with correct nonce
Handle failuresTrack nonce on chain

Bottom Line

A nonce is a counter that prevents replay attacks and ensures transaction ordering. In Bitcoin, miners use it for proof-of-work. In Ethereum, each account has a sequential nonce starting at 0. If a transaction gets stuck (nonce pending), you need to clear it before sending more transactions from that account. Use speed-up or cancel with higher gas.

← Back to Crypto Answers Search all articles
This content is for educational purposes only. Not financial advice. Do your own research before investing.