Glossary · Mining

Nonce

By the CloudMineCrypto teamUpdated Also called number used once

Definition

The nonce is a 32-bit number in the Bitcoin block header that miners change on every attempt to find a valid block. Each new nonce gives a completely different hash, so trying nonces is how miners make their guesses.

Part of the Bitcoin mining glossary, 88 terms in plain English.

Every nonce there is

4,294,967,296

possible values, from 0 to 4,294,967,295 (32 bits)

The whole Bitcoin network runs through all of them about 221 billion times a second.Live estimate from the network hashrate, updated hourly.

How do miners use the nonce?

A miner builds a block header, sets the nonce to 0 and hashes it. If the hash is above the target, it sets the nonce to 1 and tries again, then 2, and so on. The name is short for “number used once”.

No nonce is better than another. The hash can’t be predicted, so every try has the same tiny chance of winning. That’s what makes mining fair: more tries a second means more chances, and nothing else helps.

What happens when the nonce runs out?

Four bytes only hold 4,294,967,296 values. A modern machine gets through all of them in well under a thousandth of a second. So miners change something else in the block and start the nonce over.

The miner’s loop

  1. 01

    Try every nonce

    0, 1, 2 and on up to 4,294,967,295. That’s all the values 4 bytes can hold.

  2. 02

    Run out, fast

    A single 100 TH/s machine gets through all of them in about 43 millionths of a second.

  3. 03

    Change the extra nonce

    The miner edits a spare field in its own reward transaction (the coinbase).

  4. 04

    New merkle root

    That transaction changed, so the merkle root changes and every nonce gives fresh hashes again.

Then back to step 1. Miners can also nudge the timestamp a little, which changes the header too.

The usual choice is the extra nonce, a spare field in the coinbase transaction. Changing it changes the Merkle root, which gives a whole new set of headers to try. Miners can also nudge the timestamp and, on many machines today, roll a few bits of the version field.

Sources

  1. Nonce · Bitcoin Wiki
  2. Block hashing algorithm · Bitcoin Wiki
  3. Block chain reference: headers, Merkle trees, target · Bitcoin developer documentation

Live figures on this page come from the CloudMineCrypto API and public chain data, refreshed regularly, and are labelled where they appear. Educational only, not financial advice.

Now watch mining happen.

Claim a free 8-hour mining plan in the CloudMineCrypto app and watch your BTC balance grow from live network data. Withdraw to your own wallet, Lightning included. Rewards are estimates.