---
title: "Nonce — definition | Nuri Glossary"
description: "A number used once; miners vary it while searching for a valid block hash."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/nonce"
---

# Nonce

A number used once; miners vary it while searching for a valid block hash.

## Basically

A nonce is a number used once. Bitcoin miners keep changing it until they find a valid block.

## Key Takeaways

- A nonce is the 32-bit field in a block header that miners increment to search for a valid SHA-256 hash below the current difficulty target.
- Modern ASIC miners exhaust all 4.29 billion nonce values in microseconds, so they use techniques such as the extraNonce and version rolling to expand the search space.
- Beyond Bitcoin mining, nonces are foundational cryptographic primitives used in TLS handshakes, authentication protocols and encryption to prevent replay attacks and ensure uniqueness.

## What Is a Nonce?

A nonce, short for "number used once", is a value that exists to be tried, changed and tried again. In Bitcoin mining, it is a 32-bit field in the block header that miners change repeatedly while searching for a hash output that meets the network's difficulty target. Each nonce value produces a completely different hash, and miners must find one below a specific threshold to produce a valid block.
The concept comes from cryptography, where a nonce is any arbitrary number used exactly once in a cryptographic operation. Reusing a nonce can catastrophically compromise security in many protocols. In Bitcoin's proof-of-work system, the nonce is the primary variable that miners adjust in the brute-force search for a valid block hash.

## How It Works

Every Bitcoin block begins with an 80-byte block header containing six fields. The nonce occupies the final four bytes.
The mining process applies double SHA-256, hashing the header twice, to produce a 256-bit output. If the resulting hash, interpreted as a number, is less than the current difficulty target, the block is valid. If not, the miner increments the nonce and hashes again.

## The Nonce Search Process

Mining follows a straightforward brute-force pattern. Miners test one nonce after another until they find a valid hash.
SHA-256 is a one-way function, so there is no shortcut to finding which nonce produces a valid hash. Every attempt is a random trial, making mining a probabilistic process where success scales linearly with hashrate.

## ExtraNonce: Expanding the Search Space

The 32-bit nonce provides only 4,294,967,296 possible values. Modern ASIC miners operating at hundreds of terahashes per second exhaust this entire space in microseconds. A machine running at 500 TH/s cycles through every nonce value in roughly 8.6 microseconds.
Miners modify the extraNonce to continue searching. The extraNonce is arbitrary data embedded in the coinbase transaction's scriptSig field, and changing the coinbase transaction changes its transaction ID, which propagates up the Merkle tree to produce a new Merkle root in the header. This change effectively resets the entire 4-billion nonce search space with a completely different set of hash outputs.
Miners typically allocate 8 bytes for the extraNonce. Combined with the 4-byte header nonce, this provides 2^96 total combinations, approximately 7.9 × 10^28 possibilities. That is more than enough for any foreseeable hashrate level.

## Version Rolling and ASICBoost

Recalculating the Merkle root every time the extraNonce changes is computationally expensive. Version rolling is a more efficient technique that modifies unused bits in the block header's version field. BIP 320 designates 16 bits, bits 13 through 28, of the version field for general-purpose use, giving miners 65,536 additional header variations per nonce sweep without touching the Merkle tree.
Version rolling is closely related to overt ASICBoost, an optimisation that reduces the number of SHA-256 operations by approximately 15%. ASICBoost exploits SHA-256's internal structure: the first 64 bytes of the 80-byte header are processed in a separate "midstate", so changing only the version field in the first chunk lets miners reuse work across multiple nonce sweeps. Overt ASICBoost is visible on-chain and widely adopted, while the covert variant manipulates the Merkle root instead, is incompatible with SegWit and has largely fallen out of use.

## Nonce Distribution Analysis

If SHA-256 were perfectly random and all nonce values were equally likely to win, the distribution of winning nonces across all mined blocks would be uniform. In practice, it is not. Observed winning nonces skew towards lower values because miners universally start searching from nonce zero and increment upwards, so they encounter lower values first.
Researchers noticed four distinct gap regions in the nonce distribution of mined blocks starting around 2016, most prominently in blocks produced by Antpool. BitMEX Research investigated the anomaly but concluded that the cause "remains a mystery", probably a benign artefact of specific mining firmware implementations rather than a protocol vulnerability. These patterns show that nonce distribution can reveal information about mining hardware and software strategies, even if the hashing itself is cryptographically random.

## Bitcoin Mining

Proof-of-work mining is the primary use case for nonces in Bitcoin, and every block ever added to the Bitcoin blockchain was found by a miner who discovered a nonce, combined with other header adjustments, that produced a valid hash. The global hashrate represents the collective rate at which miners cycle through nonce values across the network. As of 2026, it exceeds 800 exahashes per second, approximately 8 × 10^20 nonce trials every second worldwide.

## Cryptographic Protocols

Nonces are critical in numerous cryptographic systems outside mining. They are foundational cryptographic primitives in TLS handshakes, authentication protocols and encryption, where they prevent replay attacks and ensure uniqueness.

## Bitcoin Signature Schemes

Nonces also play a critical role in Bitcoin's digital signature schemes. When creating a Schnorr signature or ECDSA signature, the signer generates a random nonce to compute the signature. If two signatures reuse the same nonce with the same private key, an attacker can algebraically recover the private key, and nonce reuse vulnerabilities have led to real-world key compromises on the Bitcoin network.

## Why It Matters

The nonce is the mechanism that makes Bitcoin's proof-of-work function. Without a variable to iterate, miners would have no way to search for valid blocks, and the network could not reach consensus on transaction ordering. The difficulty of finding a valid nonce makes blocks expensive to produce and the blockchain resistant to tampering: reversing a confirmed transaction requires re-mining all subsequent blocks, each demanding its own successful nonce search.
Nonce mechanics explain to developers building on Bitcoin why mining economics evolve over time. As the difficulty increases, miners must cycle through exponentially more nonce attempts per block, driving demand for faster hardware and more efficient search techniques. Layer-2 solutions like Spark reduce the burden on the base layer by settling transactions off-chain, making the per-block nonce search more efficient per economic transaction.

## Nonce Space Exhaustion

The 32-bit nonce was designed in 2009, when CPU mining was the norm, but today ASIC miners exhaust the nonce space in microseconds. The extraNonce and version rolling techniques provide vastly more search space, but they add complexity to mining software and hardware design. The Stratum mining protocol must account for how miners request new work templates when their local search space runs out.

## Nonce Reuse in Signatures

Reusing a nonce when generating ECDSA or Schnorr signatures is catastrophic because it leaks the private key. Wallet implementations must use cryptographically secure random number generators or deterministic nonce derivation, defined in RFC 6979, to prevent this. Hardware wallets and signing devices are specifically designed to ensure nonce uniqueness across signatures.

## Privacy Implications

Nonce distribution patterns in mined blocks can reveal information about the mining hardware and software that produced them. Researchers have used nonce analysis to fingerprint specific mining pools and hardware manufacturers, creating a form of miner identification that cannot be easily obscured. For mining operations that value privacy, this represents an information leak tied directly to how their firmware iterates through nonce values.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. You should always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
