Nonce: What It Means and How It's Used in Blockchain (2024)

What Is a Nonce?

"Nonce" is a portmanteau of "number used only once." It is a four-byte number added to a hashed—or encrypted—block in a blockchain that, when rehashed, meets the difficulty level restrictions. The nonce is the number that blockchain miners are solving for. When the solution is found, the blockchain miner that solves it is given the block reward.

Learn more about the nonce and why it is important to some blockchains.

Key Takeaways

  • Nonce, a "number only used once," refers to the number a blockchain miner needs to discover before solving for a block in the blockchain.
  • Once the miner solves the hash, they receive the block reward.
  • Miners open new blocks by generating a nonce that makes the hash they create less than the hash from the block they are validating.

Understanding the Nonce

A blockchain's security relies on its ability to create and validate long, encrypted numbers, sometimes called a "hash." The cryptographic function used to generate a hash is deterministic, meaning that it will produce the same result each time the same input is used.

It also means that the function can generate a hashed input efficiently. This makes determining the input difficult (leading to the blockchain's security), and small changes to the input result in a different hash. This complex system creates the security net of a blockchain.

To keep the blockchain secure, data from previous blocks are encrypted or “hashed” into a series of numbers that is the block header for the next block. The block header is one of the fields in a block on a blockchain.

Transactions on a blockchain are aggregated into blocks from a memory pool based on the age of the transaction or the amount of fees paid.

The header is metadata, which contains the blockchain version number, the previous block's hash, the Merkel Root, timestamp, the difficulty target, and the nonce. The nonce is the value that miners are trying to solve for.

How Is the Nonce Used?

The nonce is used to validate the information contained within a block. The mining program generates a random number, appends it to the hash of the current header, rehashes the value, and compares this to the target hash. If the resulting hash value meets the requirements, the miner has created a solution and is awarded the block. If the value doesn't match the target, the nonce is increased by one, and the process starts again. This continues until one miner meets the target.

Most blocks are opened by mining pools because the mining difficulty is so high a single miner is unlikely to have enough hashing power to keep up, measured in the number of hashes per second that a miner is capable of. A home computer with the latest equipment might have a hashrate of 100 mega hashes per second (6 zeros, or million), where a mining farm full of ASIC miners might hash around 30 exa hashes per second (18 zeros, or quintillion).

It is highly unlikely that the nonce will be guessed on the first try. Miners generally have to test a large number of nonce options before getting it right. The greater the difficulty—a measure of how hard it is to create a hash less than the target—the longer it is likely to take to generate a solution.

Block difficulty is kept the same across the entire network, meaning that all miners have the same chance of figuring out the correct hash. Cryptocurrency networks typically establish a target number of blocks they want to be processed during a specific period and occasionally adjust the difficulty to ensure that this target is met. If the number of blocks processed does not meet this target, the difficulty will be reduced, with the reduction in difficulty set to how much time the process was over the limit.

What Does Nonce Stand for?

In cryptocurrency, a nonce is an abbreviation for "number only used once," whichis a number added to a hashed—or encrypted—block in a blockchain that, when rehashed, meets the difficulty level restrictions. The nonce is the number that blockchain miners are solving to receive the block reward.

What Is a Blockchain Nonce?

A blockchain nonce is a number added to a hashed—or encrypted—block in a blockchain.

How Are Nonces Used?

In cryptocurrency, nonces are used as the number that is used in a hash to verify the transactions and other data contained in a block.

Nonce: What It Means and How It's Used in Blockchain (2024)
Top Articles
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 5793

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.