Sunday, October 11, 2026
Learn / How blockchains work

What is a nonce in blockchain?

A nonce is a number used once. In Bitcoin mining it is changed to find a valid block hash, and on Ethereum it counts and orders an account's transactions.

How blockchains work Illustration: Cryptoweek

A nonce is a "number used once." In blockchain it has two main jobs. In Bitcoin mining, it is the value miners keep changing while searching for a valid block. On account-based chains like Ethereum, it is a counter that numbers every transaction an account sends.

What is the nonce in Bitcoin mining?

Every Bitcoin block has a header that includes a 32-bit field called the nonce. To win a block, a miner must produce a hash of that header that falls below the network's target.

Since there is no shortcut, miners start the nonce at zero and increase it by one with each attempt, hashing the header every time. A 32-bit field runs out of values quickly at modern speeds. When that happens, the miner changes another value called the extraNonce inside the block's first transaction. That changes the header's Merkle root, giving the miner a fresh set of hashes to try. See how Bitcoin mining works for the bigger picture.

What is an Ethereum nonce?

On Ethereum, every account has a nonce. For a regular wallet, it is the number of transactions that account has sent, and ethereum.org describes it as a counter that goes up one step at a time. For a contract account, it counts the contracts it has created.

The nonce prevents replay attacks. Only one transaction with a given nonce can ever run for an account, so nobody can copy a signed transaction and broadcast it again to make it execute twice.

Why does a stuck transaction block others?

Because the nonce enforces order, a transaction with nonce 10 cannot go through until nonce 9 is confirmed. If nonce 9 was sent with a fee too low for current conditions, it can sit pending, and everything you send after it waits in line.

How do you fix a stuck transaction using the nonce?

Wallets such as MetaMask offer two options, both of which reuse the stuck transaction's nonce:

  • Speed up. Resubmit the same transaction with a higher fee. Since the nonce is the same, only one of the two can confirm.
  • Cancel. Send a zero-value transaction to your own address with the same nonce and a higher fee. If it confirms first, the original is dropped.

MetaMask's help pages say a replacement needs a meaningfully higher fee than the original, and that you must deal with the oldest pending nonce first. A replacement only works while the original is still pending. Once a transaction is confirmed, it cannot be cancelled.

This guide explains how things work. It is not financial, legal or tax advice. Last updated .