In crypto, a nonce is short for “number used once.” It is a simple but crucial number, usually a 32-bit integer, that miners change repeatedly to solve a mathematical puzzle and add new blocks to the chain.
In proof-of-work systems like Bitcoin, each block has a block header with fixed information. This information includes the previous block hash, Merkle root (summary of transactions), timestamp, difficulty target, and the nonce.ย
What happens is that miners take all this information, run it through a hash function, and get a hash with 256 bits.ย
The network sets a difficulty target that the hash must be below a very small number (lots of leading zeros, e.g., starting with many 0s). Because the hash function is deterministic and extremely sensitive to input changes, even flipping one bit produces a completely different hash.
Since most header fields are fixed, miners can’t easily alter them without invalidating the block. The nonce is the adjustable field. Miners start with nonce = 0, hash the block, and check if the result meets the target. If not, increment nonce to 1, hash again, and repeat billions or trillions of times per second across the network.
The “proof” in proof-of-work is the discovery of a valid nonce, which indicates that the miner actually put in computational effort. After being located, the block is added to the chain, broadcast, and confirmed by others. The block reward and fees are given to the victorious miner.
Similar nonces were used for mining in Ethereum (prior to The Merge), but Ethereum also makes use of a transaction nonce, or a per-account counter, to guard against replay attacks and guarantee that transactions are completed in the correct order.
Mining nonce transforms brute-force guessing into the energy-intensive competition that maintains the integrity and tamper-resistance of proof-of-work chains.