Agreement (consensus) · 2 min read

What is a nonce?

By Oliver James Whitmore · Updated 20 October 2026

In one sentence

A nonce is a "number used once": in proof-of-work mining it is the header field that miners change again and again to get a new block hash, and on Ethereum it is also the counter that numbers each account's transactions.

The mining loop: change the nonce, hash the header, compare with the target, repeat.Block headernonce = nHash it(SHA-256 ×2)belowtarget?Blockfoundyesno: nonce + 1, try again
The mining loop: change the nonce, hash the header, compare with the target, repeat.

How it works

The word comes from cryptography, where a nonce is any value meant to be used only one time, often to stop old messages from being replayed. Blockchains use it in two different places.

In mining. A Bitcoin block header has a 4-byte nonce field, which allows about 4.29 billion values. A miner fills in the header, sets the nonce, hashes the header and checks whether the result is below the target. If not, it changes the nonce and tries again. Because the hash function is unpredictable, every attempt is a fresh, independent guess. Modern mining machines run through all 4.29 billion values in a fraction of a second, so miners also change the timestamp and an "extra nonce" placed inside the block's first transaction. That changes the Merkle root and opens up a fresh range of headers to try.

In accounts. On Ethereum, each account that sends transactions keeps a counter: its first transaction has nonce 0, the next 1, and so on. Nodes process an account's transactions strictly in that order and refuse to process the same number twice, which prevents a signed transaction from being replayed. Since Ethereum moved to proof of stake, the nonce field in its block headers is simply set to zero.

A simple example

A miner tries nonce 0 and gets a hash beginning "8f3a…". Nonce 1 gives "3c07…". Billions of attempts later, one value happens to give a hash that starts with enough zeros to fall below the target. The miner broadcasts the block; every node needs exactly one hash calculation to confirm the result.

Common misconception

Misconception: Miners solve a difficult equation to work out the right nonce.

In fact: There is no equation to solve and no shortcut. Finding a valid nonce is pure trial and error. "Difficulty" only describes how unlikely each single attempt is to succeed.

Where you meet it

  • The header of every proof-of-work block.
  • Ethereum transaction details, where the nonce shows the order of an account's transactions.
  • "Stuck" transactions, which are often caused by a missing number in the sequence.

Sources

This card explains a technical concept for general education. It is not a recommendation to acquire, sell or hold any crypto-asset, and it is not financial advice.