Nonce

On account-based blockchains such as Ethereum, a nonce is a counter that orders the transactions sent from an address, so each is processed once and in sequence. In Bitcoin mining, a nonce is the number miners change while searching for a valid block.

A nonce is a number that is used once. In Bitcoin mining it is the value miners change while hunting for a valid block. On Ethereum it is a counter on each account that puts transactions in order. Traders meet it most when a transaction gets stuck or needs replacing.

Category
Cryptocurrency and Blockchain
Reading time
4 min
Also called
Number used once, Transaction nonce, Block nonce
Updated

Nonce in plain words

On Ethereum, every transaction carries a nonce: a counter that goes up by one with each transaction an account sends.1

Each nonce can be used only once per account, so a signed transaction can't be broadcast again and replayed.2

In Bitcoin mining the nonce means something else: miners keep changing it until the block's hash meets the difficulty target.3

How an account nonce works

  1. Start at zero

    A new account has sent no transactions yet.

  2. Count each send

    Read the nonce as the count of transactions this account has sent so far.2

  3. Sign with the next number

    Your wallet attaches the next unused nonce to each new transaction.

  4. Process in order

    A transaction with a higher nonce waits until all lower ones are included.

  5. Block replays

    Remember only one transaction per nonce can ever go through.2

  6. Replace if stuck

    Send a new transaction with the same nonce and a higher fee to replace a pending one.

Worked examples

Example 1 — Next nonce

Nonce 14

A hypothetical wallet has already sent 14 transactions starting from nonce 0.

Example 1 — Next nonce — calculation
Nonces used0 to 13
Next nonce14

The nonce counts transactions sent from the account, so the next one is 14.2

Example 2 — A stuck queue

3 trades stuck

A hypothetical trader sends nonce 20 with a low fee, then nonces 21 and 22 to buy a token.

Example 2 — A stuck queue — calculation
Pending3 transactions
Executed0 until nonce 20 clears

Because the counter is sequential, the later trades wait behind the stuck one.1

Example 3 — Mining nonce search

About 8.3 minutes

A hypothetical miner tries 2 billion nonces a second, and a valid block needs about 1 trillion tries on average.

Example 3 — Mining nonce search — calculation
Seconds needed1,000,000,000,000 ÷ 2,000,000,000 = 500 s
Minutes500 ÷ 60 ≈ 8.3 min

Miners increment the nonce until the block's hash has the required zero bits, so more tries per second finds blocks faster.3

Account nonce vs block nonce

AspectAccount nonce (Ethereum)Block nonce (Bitcoin)
PurposeOrder transactions and stop replaysSearch for a valid block hash
Who sets itThe sender's walletThe miner
How it changesGoes up by one per transactionChanged over and over while mining
When traders notice itStuck or replaced transactionsRarely; it is a mining detail

Where the nonce matters for traders

  • Unsticking orders

    Replace a low-fee Order by reusing its nonce with a higher fee.

  • Fee planning

    Underpriced Trading Fees and Commissions can block a whole queue.

  • Fast markets

    In Volatility spikes, a stuck nonce can mean missed entries and Slippage.

  • Bot trading

    Automated Day Trading tools must track nonces to avoid clashes.

Advantages and disadvantages

Advantages

  • Stops the same signed transaction running twice.
  • Keeps transactions in a clear order.
  • Lets users replace a stuck transaction.

Disadvantages

  • One stuck transaction blocks later ones.
  • Gaps in nonces stall the queue.
  • Using two wallets on one account can cause clashes.
  • The word means different things on different chains.

Going deeper

Read as far as you need. Each level builds on the one before it.

A simple counter

Beginner

Ethereum's nonce is simply a running transaction count for the account.1

Nonces and contract addresses

Intermediate

It also determines contract addresses, which are derived from the creator's address and its transaction count.2

The mining nonce

Advanced

Block headers include fields that are easy to change, such as the nonce, so miners can generate fresh hashes without waiting for new transactions.4

Common mistakes

  1. Sending more after a stuck one

    New transactions just queue behind it.

  2. Skipping a nonce

    A gap stops everything after it.

  3. Confusing the two meanings

    Account and mining nonces do different jobs.

  4. Cancelling without a higher fee

    A replacement needs a better fee to be picked up.

Check your understanding

Test yourself before moving on. Each answer comes with an explanation.

Q1An account has sent 7 transactions from nonce 0. What is the next nonce?
Q2Why does a nonce stop replay attacks?

Key points to remember

  1. A nonce is a number used once.
  2. Ethereum accounts use it as a transaction counter.
  3. It blocks replays and keeps order.
  4. Bitcoin miners change a block nonce to find a valid hash.
  5. A stuck low nonce holds up later transactions.

Frequently asked questions

How do I fix a stuck Ethereum transaction?

Send a new one with the same nonce and a higher fee, often via your wallet's speed-up or cancel button.

Is the nonce secret?

No. It is public and visible on block explorers.

Does Bitcoin use account nonces?

No. Bitcoin uses a different transaction model; its nonce is a mining field.

Further learning

Sources

This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.

  1. ethereum.org. Transactions (opens in a new tab) Checked .
  2. ethereum.org. Ethereum accounts (opens in a new tab) Checked .
  3. Satoshi Nakamoto. Bitcoin: A Peer-to-Peer Electronic Cash System (opens in a new tab) Checked .
  4. Bitcoin Project (developer.bitcoin.org). Block Chain developer guide (opens in a new tab) Checked .

Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.