Visit the new website The new BestChange website is live — take a look and tell us what you think!
Exchange rates:
1253940
Exchangers:
477
Updated:
09:06:50

Nonce in blockchain: what it is, how it works, and why it is needed

In a blockchain, transactions and blocks form a single chain in which each element is inextricably linked to the previous one. To make this possible, a strict order must be maintained when adding transactions to the network.

This is precisely why the nonce parameter was introduced in blockchain: it is used to order transactions and blocks.

What is a nonce in cryptocurrency?

A nonce is a numerical value used to determine the order of transactions when they are submitted to the network or to identify a block number. Depending on the implementation, a nonce may be random, pseudorandom, or increase sequentially.

The term "nonce" is derived from the English phrase "number used once," meaning a number that is used only once.

A nonce in blockchain is one of the key elements that help ensure the security of decentralized networks. The nonce parameter ensures that each transaction is unique and cannot be replayed.

Without the use of a nonce, any blockchain operation, whether adding a block or sending a transaction, could become the target of an attack and be replayed. Thanks to a nonce in cryptocurrency, any duplicates of the original transactions will be rejected.

Types

There are several types of nonce in cryptocurrency, depending on how exactly it is used.

Transaction nonce

In user transactions, the nonce parameter acts as a counter assigned to each new wallet. Because of this feature, the unique sequential transaction number is also often referred to as an account nonce.

A wallet with no transaction history is assigned a nonce with a value of zero. With each completed transaction, the nonce value increases by one. At the same time, there cannot be two confirmed transactions with the same nonce value in a single wallet.

The transaction nonce model is used by networks operating on the Proof-of-Stake (PoS) consensus mechanism, such as Ethereum, as well as EVM-compatible blockchains, including Layer-2 solutions, for example:

Mining nonce

A nonce is also a key component of blockchains operating on the Proof-of-Work (PoW) consensus mechanism.

Like transactions, each block has its own unique nonce in the blockchain. Miners change the nonce value in the block header to generate different hashes* and find one that meets the specified network difficulty*.

* Hash — a unique fixed-length sequence of characters generated from a specific set of data using a special algorithm called a hash function. In blockchain, a hash is used to verify data integrity and link blocks together. If even a small part of the original data is changed, the resulting hash will also change.

* Network difficulty — an indicator that determines how difficult it is for miners to find a suitable hash to create a new block in a blockchain based on the Proof-of-Work consensus mechanism. The higher the network difficulty, the more computational operations must be performed on average to find a suitable value. The difficulty is periodically adjusted by the network to maintain the block creation rate specified by the protocol.

It is the nonce, along with other key parameters such as the transaction tree* and timestamps*, that ensures each block has a unique hash.

* Transaction tree (Merkle tree) — a data structure that makes it possible to combine information about all transactions in a block into a single final value called the Merkle root. To achieve this, transaction hashes are progressively combined and hashed. This mechanism makes it possible to quickly verify whether a particular transaction is included in a block without having to process all of its transactions.

* Timestamp — a value containing information about the time a block was created or a particular event occurred in the blockchain. Timestamps help the network maintain the chronological sequence of blocks and are used in the operation of the consensus mechanism.

Finding the nonce in cryptocurrency is one of the tasks performed by miners. When they successfully solve this task, they earn the right to add a new block and, accordingly, receive a reward for it.

In addition, the mining nonce in blockchain protects against manipulation and fraudulent transactions. To alter the transaction history, an attacker would have to recalculate the hashes of all previous blocks.

This makes attacking the blockchain resource-intensive and expensive and requires control over a dominant share of the network's hashrate*.

* Hashrate — a measure of the computing power of equipment involved in mining cryptocurrencies based on Proof-of-Work. It shows how many hash calculation attempts a piece of mining equipment or the entire network can perform per second. The higher the network's total hashrate, the more computing resources are required to obtain a significant share of its mining power.

However, nonce also has a downside. In PoW-based blockchains, finding a suitable nonce requires significant computing power. At the same time, the more miners join the network, the greater the difficulty of finding the nonce in the blockchain becomes.

Signature nonce

When signing transactions, the nonce in the blockchain parameter is used as a one-time code, similar to those used for account authentication.

Once the transaction is confirmed, the nonce becomes invalid and can no longer be reused. A new nonce is created for the next signature, protecting transactions from being reused by attackers.

Request nonce

In some networks, such as Chainlink, the nonce parameter is used in more complex scenarios, including cross-chain interactions.

The Chainlink network operates using the CCIP cross-chain interoperability protocol, in which the nonce is used to ensure the uniqueness of requests and serves as one of the elements of the request-processing mechanism.

This protects the infrastructure from malicious actions aimed at disrupting the operation of decentralized applications.

What is a nonce used for in blockchain?

A transaction nonce protects a transaction from interception and replay.

However, from a user's perspective, a nonce in cryptocurrency not only helps protect the blockchain against various types of threats but also makes it possible to cancel or replace a transaction sent by mistake.

For example, to cancel a transaction on the Ethereum blockchain, you need to send another transaction with the same nonce value, which can be specified in the wallet settings, but with a zero amount.

To replace a transaction, you need to specify a new amount while using the same nonce value.

However, there are two important points to consider:

  1. A transaction can be replaced or canceled using the same nonce only if it has not yet been confirmed;
  2. The replacement transaction must have a higher transaction fee than the first one — only then can it be included in the blockchain before the previous transaction.

In addition to allowing transactions to be canceled or replaced, the nonce determines the order in which they are executed. Each new transaction from the same address receives the next sequential nonce value.

For example, if five transactions with nonce values from 0 to 4 have already been sent from an Ethereum wallet, the next transaction must receive nonce 5.

If, instead of nonce 5, nonce 10 is specified, for example, the transaction will not be processed immediately. It will remain pending until transactions with the missing nonce values from 5 to 9 have been processed.

Nonce-related errors

Because a nonce determines the sequence in which transactions are processed, an incorrect value may cause an operation to be rejected by the network. Such situations are usually accompanied by a corresponding error message in the cryptocurrency wallet.

The most common errors related to the nonce parameter are:

  • "Nonce too low" — the nonce value is too low, has already been used, and needs to be increased;
  • "Nonce too high" — the nonce value is too high and needs to be decreased; otherwise, you will have to wait for the preceding transactions to be processed.

To check the nonce value on the blockchain, you can use block explorers such as Etherscan, Blockchain, BSCScan, Arbiscan, or Polygonscan, depending on the specific network.

© BestChange.com – , updated 10/07/2026
Reprints are allowed only with permission of BestChange

See also