entekhab.netentekhab.nettrilingual encyclopedia

Nonce

ENGLISHNoncereference
فارسینانسEnglish term retained
کوردینانسEnglish term retained
Category
Blockchain
Level
Professional

Simple definition

A number a miner changes again and again, hunting for one that makes the block's hash small enough to pass the network's test.

Professional definition

In proof-of-work mining, the header field varied in search of a hash at or below the current target. In account-based chains the word carries a second, unrelated meaning: a per-account counter that orders a sender's transactions and blocks replay.

Technical definition

A search variable, not a secret. Because the header hash behaves as unpredictable, no strategy beats brute force, so expected attempts scale with difficulty and the winning nonce carries no information. Bitcoin's header nonce is 32 bits, about 4.3 billion candidates, which modern hardware exhausts in a fraction of a second, so miners also vary the coinbase extranonce, the timestamp and the transaction set to enlarge the search space.

Academic definition

A free parameter of a block header searched until the header hash satisfies a predicate fixed by the consensus target; in account-based ledgers, alternatively a monotonic per-account sequence number enforcing transaction ordering and replay protection.

Mechanism

The search works only because the hash is unpredictable: flipping one bit of the nonce rewrites the whole output, so candidates cannot be ordered or pruned. That is what makes the work measurable and unforgeable — each attempt is an independent draw, and the only way to show you made many is to produce a winner.

In practice

Who uses it
Mining firmware and pool engineers, protocol implementers, and wallet developers who must manage account nonces correctly.
Why it matters
The mining nonce is where the cost of proof of work is actually paid; the account nonce is what keeps a signed transaction from being replayed.
Limitations
A nonce proves nothing on its own. Only the resulting hash against the target has meaning, and account nonces are protocol-specific.

Common mistakes

  • Confusing the mining nonce with the account nonce in Ethereum.
  • Thinking a lucky nonce can be predicted or precomputed.
  • Reusing or skipping an account nonce and stalling a wallet's queue.

Examples

crypto

A pool hands each machine a different extranonce range so two workers never test the same header twice. The nonce field alone is far too small to keep an industrial farm busy.

numeric

If a hash is modelled as uniform over 256 bits and the target is 2^224, one attempt in about 4.3 billion succeeds, so the expected number of nonces tried before a valid block is roughly 2^32.

Given
  • hash output = 256 bits, modelled as uniform
  • target T = 2^224
  • trials are independent
Steps
  1. P(success per attempt) = (T + 1) / 2^256 ~ 2^224 / 2^256 = 2^-32
  2. E[attempts] = 1 / 2^-32 = 2^32
about 4.29 x 10^9 attempts per valid block

An idealisation. Real targets are not powers of two and real hash functions are only assumed to behave uniformly.

Mathematical foundation

H(\text{header} \, \| \, \text{nonce}) \le T, \qquad \mathbb{E}[\text{attempts}] = \frac{2^{256}}{T + 1}

Variables

HThe chain's hash function, here a 256-bit digestbit string
TCurrent target: the largest hash value accepted as validinteger
\text{nonce}The searched header fieldinteger

Procedure

Assemble the header, hash it, and compare the digest read as an integer with the target. If it is larger, change the nonce and hash again. When the nonce range is exhausted, change the extranonce, timestamp or transaction set and continue.

Worked example

Given
  • T = 2^224
  • H outputs 256 bits, modelled as uniform
Steps
  1. P = 2^224 / 2^256 = 2^-32
  2. E[attempts] = 2^32
about 4.29 x 10^9 hash attempts expected per valid block

Interpretation

The expected attempt count is the protocol's price list: it says how much computation a valid block should cost at the current target. Any single block can be found on the first try or the trillionth.

Assumptions

  • The hash function is modelled as a uniform random function; this is an assumption about SHA-256, not a proven property.
  • Attempts are independent, so the search is memoryless and past failures do not raise the next attempt's chance.
  • Written for a 256-bit digest; the exponent changes with the digest length.
Limits of the formula
  • The formula gives an expectation, not a schedule: realised times per block are exponentially distributed.
  • It describes the mining nonce only. The account nonce of an account-based chain has no probabilistic content at all.

Related terminology

related
Proof of Work Cryptographic Hash Difficulty Adjustment Block Hash Rate Account Model Mempool
Commonly confused with

Cryptographic Hash

The hash is the function. The nonce is one input fed to it over and over. Changing the nonce does not change the function, only the attempt.

Sources

Bitcoin: A Peer-to-Peer Electronic Cash System
bitcoin.org · 2008-10-31 · section 4: proof-of-work, incrementing a nonce until the hash meets the required zero bits
https://bitcoin.org/bitcoin.pdf URL verified
Mastering Bitcoin, 2nd ed.
O'Reilly · 2017 · mining chapter: nonce range, extranonce and the search space
Print source
Ethereum Glossary
Ethereum Foundation · entry for nonce, account sequence number sense
https://ethereum.org/glossary/ URL verified

Editorial status

Needs expert reviewconsensusv1.02026-11-05

Flagged by the editor as uncertain on a linguistic, mathematical or regulatory point.

The expected-attempts formula holds under the random-oracle idealisation of the hash function; this is flagged in math.assumptions because it is a modelling assumption, not a theorem about SHA-256. The word carries two unrelated protocol meanings and the entry keeps them separate, which is the commonest source of confusion in translated glossaries.