Back to Glossary

Entry · Investing

Nonce

A nonce is a number or short piece of data that is used only once in a given context. In finance and technology it appears in blockchain mining, where miners change the nonce until they find a valid result, and in payment security, where it stops a message being replayed by a fraudster.

From the Money Master HQ dictionary, founded by Shihan Sheriff (FCMA, VP of Finance at Nomod, CFO at Esanjo Ventures). How these definitions are written.

What it means

The word comes from the phrase "number used once". Its job is to make each message or calculation unique so it cannot be reused.

This simple idea is behind important parts of modern digital finance. In proof-of-work blockchains such as Bitcoin, miners assemble a block of transactions and add a nonce.

They then run the block through a hashing function (a mathematical process that turns data into a fixed-length code) and check whether the result is below a target set by the network. If it is not, they change the nonce and try again, billions of times, until one attempt succeeds.

The first miner to find a valid nonce can add the block to the chain and receive a reward. Because the output of a hash function is unpredictable, there is no shortcut, and the only way to find a winning nonce is to keep guessing.

That effort, and the electricity it uses, is what makes the system costly to attack. Nonces also protect ordinary payments.

A server may issue a nonce for each login or payment request so that a copied message cannot be sent again later, which is known as a replay attack. Some blockchain networks also use a transaction nonce to number an account's transactions in order, ensuring each is processed once.

Difficulty adjusts to the total computing power on the network, so the more miners there are, the more guesses are needed per block. For a business, this explains why mining is an industrial operation where power costs and hardware efficiency decide profit.

The nonce is not a secret and it does not need to be random in every context. It only needs to be unique within the system that relies on it, which is why simple counters often work.

In practice

Real-world examples.

1

Example

A payment gateway includes a unique nonce in each card authorisation request. When a fraudster tries to resend a captured $250 request, the server rejects it because the nonce has already been used. The genuine customer's $250 payment is unaffected and the fraud attempt is logged for review.

2

Example

A crypto mining company runs 5,000 machines that each test billions of nonces per second. Its monthly power bill of $400,000 is the largest cost in the business. The company therefore negotiates power contracts and tracks cost per unit of computing work.

3

Example

A developer builds a wallet application for a network that numbers each outgoing transaction. If the wallet reuses a nonce, the network treats the second payment of $1,000 as a duplicate and ignores it. The developer fixes the bug by letting the wallet read the next free number from the network before it signs.

Formula

Calculation

Expected number of attempts = 1 / Probability of success per attempt Suppose a miner needs a hash that begins with eight zeros in hexadecimal (a base-16 number system), which has a probability of 1 in 16^8 = 4,294,967,296 per attempt. The expected number of attempts is therefore about 4,294,967,296, or roughly 4.3 billion. If electricity and hardware cost an assumed $0.40 per billion attempts, the expected cost of finding one valid nonce is 4.295 x $0.40 = $1.72. Real networks set much harder targets, so a valid nonce costs far more, which is why only large operations earn steady rewards.

Case study

Seen in the real world.

Kilnworth Digital is a fictional mining operator invented to illustrate this idea. It ran 200 machines and earned rewards by finding valid nonces ahead of other miners.

When network difficulty doubled over a few months, the expected number of guesses per block doubled too, and Kilnworth's revenue per machine fell by half. Its power cost stayed at $60,000 a month, so profit nearly disappeared. Revenue per machine had dropped, but the cost of running each machine had not.

The owners replaced older machines with more efficient ones, moved to a site with cheaper power and began to model profit against difficulty before ordering new hardware. They also learned that mining returns depend on the price of the coin, which they could not control.

Watch out

Common mistakes.

  • Treating a nonce as a password. It is not secret, and its purpose is uniqueness.
  • Thinking miners can calculate the right nonce. Only trial and error works, because the hash output cannot be predicted.
  • Reusing a nonce in a payment system. This can break the protection against replays or lead to rejected transactions.

Questions

People also ask.

Why is it called a nonce?

It is short for a "number used once", which describes its purpose.

Does a nonce guarantee a block will be accepted?

No. It must produce a hash that meets the network's target, and the block must also follow all the other rules.

Where else do nonces appear?

They are used in secure web logins, encryption schemes and many forms of digital signing. In each case the aim is the same, which is to make sure that a message or request is fresh.

Was this explanation helpful?

From the founder's library

Accounting Fundamentals: A Non-Finance Manager's Guide to Finance and Accounting, by Shihan Sheriff

Take it further with the book.

Build your financial confidence beyond this definition. Shihan's full-length guide, Accounting Fundamentals, takes the same plain-English approach and turns it into a complete, practical playbook for non-finance managers, business owners and students - with chapter-end quiz answers and presentation slides included.

US$2.24US$2.99

25% off with code MMHQ25, applied at checkout. Priced in USD - checkout may show the equivalent in your local currency.

View the book and save 25%

Related

Keep reading.

Proof of WorkHash RateBlockchainCryptocurrency MiningReplay AttackDigital SignatureBlock RewardCryptography
Last updated · October 8, 2026
Browse all terms →

Disclaimer

The information provided in this finance dictionary is for educational and informational purposes only. It should not be construed as financial, investment, legal, or tax advice. Always consult with a qualified professional before making any financial decisions. Money Master HQ makes no representations or warranties about the accuracy, completeness, or suitability of this information. Use of this content is at your own risk.