QTube LearnFoundations Intermediate
What Is a Nonce in Crypto?
A nonce is a context-specific value used to vary, order, or prevent reuse of a cryptographic message. The important question is which protocol and which nonce.
In brief
A nonce is a context-specific value used to vary, order, or prevent reuse of a cryptographic message. The important question is which protocol and which nonce.
Proof-of-work nonce (Bitcoin): a 4-byte unsigned field in the 80-byte block header that miners vary to produce new hashes. The same numeric nonce can appear in different block candidates because the entire header is the proof-of-work input; the field is not a network-wide sequence number.
Account nonce (Ethereum): a counter in account state. For an externally owned account it records transactions sent; for a contract account it records contracts created by that account. Only one transaction at a given nonce can execute for an account, preventing repeated same-chain execution after that nonce is consumed.
Solana does not use an Ethereum-style per-account nonce for ordinary transfers. Transactions expire against a recent blockhash. There is a separate durable-nonce account feature for transactions that must live longer; do not treat that as the default.
Never say “the nonce” as if every chain shares Ethereum’s counter.
Bitcoin: a knob on the hash lottery
Proof of work needs a way to try another header without waiting for a new transaction. Bitcoin’s serialized block header includes a 32-bit nonce field. Change it, hash the complete 80-byte header again, and compare the result with the target.
If all 32-bit nonce values are exhausted, miners can update the header time or alter an extra nonce inside the coinbase transaction, which changes the transaction ID, Merkle root, and therefore the header. “Extra nonce” is a mining convention in coinbase data, not a second fixed field in the block header.
This nonce is not tied to your wallet. Users do not pick it. Wallets do not increment it when they send bitcoin.
Ethereum: the account’s sequence number
ethereum.org’s accounts page lists four fields. Nonce is the first: a counter for transactions sent from an EOA, or contracts created by a contract.
Effects:
- Ordering. A transaction with a future nonce cannot execute until preceding account nonces are consumed. Client transaction pools may retain the future transaction until the gap fills.
- Replay protection (same chain). A signed tx with nonce 12 cannot be broadcast again after 12 has been consumed.
- Replacement. Many clients let a sufficiently higher-fee pending transaction with the same sender and nonce replace another in their local pool. That threshold is client policy, not the account-nonce consensus rule itself.
- Stuck queues. If nonce 7 is underpriced and sits forever, 8, 9, 10 wait. Canceling means sending a new 7 (often to yourself) with a higher fee.
Contract addresses from the original CREATE scheme are derived from the creator’s address and nonce. CREATE2 (EIP-1014) instead hashes 0xff, the creator address, a 32-byte salt, and the initialization-code hash, allowing the address to be calculated before deployment.
Validator BLS keys are a different key type. They are not this nonce.
Two nonces, one sentence people get wrong
“My Bitcoin transaction has a nonce.” Usually they mean Ethereum, or they saw a block explorer field on a block, not on their payment.
“Ethereum miners increment my account nonce to mine.” No. Account nonces are state. Mining/proposing does not search them.
EIP-155 incorporated the chain ID into legacy Ethereum transaction signing, making those signatures specific to a chain ID. Modern typed transaction formats also include chain ID. The account nonce prevents reuse within the same account history; chain ID addresses cross-chain replay.
Solana and others
Ordinary Solana transactions carry a recent blockhash that acts as a freshness marker, while the status cache rejects an already processed message. The blockhash expires after 150 slots under the current documented processing rule. This is an expiry and deduplication design, not a monotonic sender counter.
Optional durable nonce accounts store a value that can replace the recent blockhash so a transaction can be signed offline and submitted later. The first instruction must advance that nonce; after validation it advances even if later instruction execution fails, preventing replay. Solana’s docs warn that durable nonces may be deprecated in a future release, so integrations should recheck current guidance.
Other account-model chains often copy Ethereum’s counter. UTXO chains generally do not need one: each spend names specific outputs, so replay would require those outputs to still be unspent.
What users actually do
On Ethereum wallets you sometimes see “nonce too low,” “replacement transaction underpriced,” or a custom-nonce advanced panel.
- Too low — that number already landed, or the RPC’s view of your account is ahead of what you think.
- Stuck — raise the fee on the same nonce or wait.
- Custom nonce — easy to brick a queue if you skip.
Do not increment a nonce as a superstition. Do not publish a signed raw transaction with a future nonce unless you understand it can sit until the gap closes.
Sources & further reading
-
Ethereum accounts
Primary · Documentation
Account nonce field; replay; CREATE vs CREATE2
-
Transactions
Primary · Documentation
Nonce as incrementing counter on the signed tx
-
Block Chain (Proof of Work)
Primary · Documentation
Header nonce; only 80-byte header hashed
-
Block Chain: Block Headers
Primary · Documentation
Normative 4-byte nonce field and alternatives after exhausting its range
-
Transactions
Primary · Documentation
Coinbase extra-nonce convention and Merkle-root effect
-
EIP-1014: Skinny CREATE2
Primary · Improvement proposal
Exact CREATE2 address formula and salt
-
EIP-155: Simple replay attack protection
Primary · Improvement proposal
Chain-ID signing for legacy transactions
-
Transaction Structure
Primary · Documentation
Recent blockhash freshness, deduplication, and 150-slot expiry
-
Durable Nonces
Primary · Documentation
Nonce-account lifecycle, validation, failure behavior, and deprecation caveat