What Is A Bitcoin Nonce [Simple]?

We talked about Bitcoin’s proof of work system in which the Bitcoin miners engage to earn their lotteries, i.e. Block reward of 12.5 BTC.

A vital part of Bitcoin’s proof of work system is Bitcoin Nonce, and in this article, we are going to touch upon its significance.

So for starters let’s begin:

What is a nonce in Bitcoin Mining or an extraNonce?

https://www.youtube.com/watch?v=NEpmDdM6pm0

Bitcoin Nonce is a 4-byte (32-bit) field in the input (block’s header, to be explained later…) of the SHA-256 function that is used to produce Bitcoin Hashes. The nonce needs to be set in such a way that its hashed output should have a certain number of leading zeros and to achieve these miners keep playing with this 4-byte field.

Does it sound complicated?

Well, don’t get overwhelmed because I am going explain it again in simple terms by giving you a more broader picture of Bitcoin’s proof of work mining.

So let’s dive in:

By now we all know that new bitcoins are introduced to the system through Bitcoin Mining – energy and cost-intensive process, in which the miners engage to prove that they have done a certain amount of work before writing on new blocks to the Bitcoin’s chain.

And in return of this work and cost incurred they are incentivized by 12.5 BTC block reward plus the block mining fee.

If you see the Bitcoin mining process closely you will understand that miner just vary the Bitcoin nonce in the Bitcoin’s block header to produce the right Bitcoin hash.

But it is not as simple as it sounds!

This Bitcoin hash should be less than or equal to the current Bitcoin difficulty or Target.

And well, let me tell you, Bitcoin miners struggle a lot to produce this correct Bitcoin hash as per the target because many iterations need to be done before arriving at the correct hash which is as per the target.

  • hash(“The Money Mongers rocks!!“) = 66925f1da83c54354da73d81e013974d
  • hash(“The Money Mongers rocks!!!“) = c8de96b4cf781a6373766c668ceac0f0
  • hash(“The Money Mongers rocks!!!!“) = 9ea367cea6a2cc4a6f5a1d9a334d0d9e
  • hash(“The Money Mongers rocks!!!!!“) = b8d43387d98f035e2f0ac49740a5af38
  • hash(“The Money Mongers rocks!!!!!!“) = 0fe46518541f4739613b9ce29ecea6b6
You can consider ‘!‘ (symbol) as Nonce here which is being iterated to achieve an output that starts with a ‘0

So let’s see how that goes:

While mining the miners needs to hash the block header in such a way that it is always equal or less than the ‘Target hash’ because only then they can add successfully add their mined block to the blockchain.

And a block header is a combination of Root Hash + Previous Hash + Nonce + TimeStamp which is then put in SHA-256 function to produce a Bitcoin Hash as per target.

The target at the time writing (current bitcoin target) should be an alphanumeric number which must have 18 or more zeros and should be less than the target value. And the target changes every 2016 blocks.

Miners arrive at this hash by applying SHA-256 hash function to block header, but this process is not so simple as it looks. To obtain the acceptable hash, miners need to play with the ‘nonce‘ incrementally.

And whenever all the possible combinations of Nonces are tried and yet the required hashed output is not produced then extraNonce space is also utilized. This is called Nonce overflows and then, the extraNonce portion of the generation transaction is incremented, which changes the Merkle root.

Since this is a hit and miss exercise, hence chances are very less that one might obtain the required hash (Target) with a particular number of leading zeros without making many attempts. And this Target is what is called a ‘Bitcoin Hash.’

What is a nonce in Blockchain?

The same thing which we discussed above is called nonce in blockchain too and sometimes in Bitcoin mining community the correct nonce that produces the required Bitcoin hash is also known as Golden Nonce.

Conclusion: Bitcoin Mining Nonce

Bitcoin’s blockchain uses this concept of nonce via HashCash proof of work algorithm.

This algorithm is simple and easy to compute one way, i.e., for a given input it is easy to calculate the output, but vice-versa is not entirely feasible.

Moreover, for a slight change in the input of this proof of work algorithm the whole output changes completely that’s why miners are forced to do many iterations despite knowing the required target or output.

So this proves that cryptographic hashing algorithms cannot be predicted based on their inputs and thus miners need to keep trying to win the lottery, i.e., block reward.

That’s all from our side in this article on Bitcoin Nonce, and we hope that it has helped in increasing your Bitcoin knowledge even if a little bit.

If you enjoyed this article? Do share it with your friends and do tell us in the comments below, what topic would you like us to cover next on TheMoneyMongers.

Sudhir Khatwani

Contents

Leave a Reply

Your email address will not be published. Required fields are marked *