homecryptocurrency NewsExplained: What is a nonce, the heart of blockchain security

Explained: What is a nonce, the heart of blockchain security

The word nonce is short for 'number used only once.' It may sound like a simple concept, but its use cases range from small transactions to space stations. In finance and cryptography, a nonce refers to a randomly generated number, and it is used to verify transactions or perform security checks.

Profile image

By CNBCTV18.com Sept 21, 2022 5:11:36 PM IST (Published)

Listen to the Article(6 Minutes)
3 Min Read
Explained: What is a nonce, the heart of blockchain security
Three things make cryptocurrencies unique: decentralisation, scalability and security. Firstly, cryptos can function without a central governing body. They can also scale enough to challenge fiat currencies. And finally, they employ one of the highest forms of security available to humankind: cryptographic encryption. In this article, we will learn about a concept at the heart of blockchain security — the nonce —what it is and how it is used in crypto.

What is a nonce?
The word nonce is short for 'number used only once.' It may sound like a simple concept, but its use cases range from small transactions to space stations. In finance and cryptography, a nonce refers to a randomly generated number, and it is used to verify transactions or perform security checks.
For example, the captchas we often find on websites are nonces (albeit with letters included) as they are used just once. In a much simpler case, even the OTPs sent to verify transactions are nonces that have the singular use of verifying something for a limited period of time.
What is the use of a nonce in blockchain?
Within several proof-of-work blockchains, including Bitcoin, a nonce is a random 32-bit number that miners use as a base for their hash calculations. Miners compete with each other, trying to guess a valid nonce as they attempt to calculate a block hash.
A block hash is like a reference number for a block in the blockchain. This reference number needs to meet certain requirements, i.e., it needs to begin with a specific number of zeroes. Bitcoin miners perform a maddening number of hash functions with many different nonce values until a valid output is produced.
The first miner to find a nonce that results in a valid block hash gets to add the next block to the blockchain and is rewarded for doing so.
Miners employ a trial-and-error approach, in which every calculation takes a new nonce value. Blockchains employ this method as the probability of guessing a valid nonce is close to zero. Therefore, miners must possess advanced computing systems to test and discard millions of different nonce possibilities to calculate a valid block hash. The nonce that results in a valid block hash is known as a golden nonce.
Do note that, since it is a 32-bit number, a nonce can have more than 4 billion possibilities. Moreover, the inclusion of an “extra nonce” creates space for a much longer number, one that can have tens of billions of combinations.
Of course, as the number of miners increase over time, the frequency of finding a nonce and calculating a valid block hash is bound to increase. Therefore, mining difficulty is adjusted to keep the block time consistent, which is around 10 minutes in the case of Bitcoin.
To do this, the protocol will adjust the number of zeroes in the block hash, thereby changing the nonce requirements and keeping mining machines on their toes. The process of trying different nonces until a valid hash is found constitutes the 'work' in the proof-of-work consensus mechanism.
Conclusion
Therefore, as you can see, a nonce is at the heart of the PoW consensus mechanism. Without the right nonce, it is impossible to add new blocks to the blockchain. It is also a great way of securing the network and building trust among users.

Most Read

Share Market Live

View All
Top GainersTop Losers
CurrencyCommodities
CurrencyPriceChange%Change