What is a Nonce in Block Chain?

Cryptocurrency like Bitcoin uses the Block chain as a decentralized, distributed, public digital ledger that records all the transactions of the Bitcoin. Block Chain has a unique feature of storing the value of previous block as a hash value in the current block, which makes it impossible to alter any block without changing all the subsequent blocks.

The miners create a block and verify it and will be rewarded for using their CPU power to do so. The block which gets more than 50% consensus will be added to the block chain. During the verification of Block, the miners will complete the Proof of Work which covers all the data of the block, and checks whether the hash value of the current block is lesser than the target.

To create a block which will be accepted by most of the network participants, Miners compete to complete the Proof of Work at the earliest. The difficulty of the work is adjusted to take at least 10 minutes per Block, which has become a standard time to add a block to the block chain in case of Bitcoin Network.

Nonce is the central part of this Proof of Work. The Nonce is a random whole number, which is a 32-bit (4 byte) field, which is adjusted by the miners, so that it becomes a valid number to be used for hashing the value of block. Nonce is the number which can be used only once. Once the perfect Nonce is found, it is added to the hashed block. Along with this number, the hash value of that block will get rehashed and creates a difficult algorithm.

It is compared to the existing target, whether it is lower or equal to the current target. Miners test and discard millions of Nonce per second until they find that Golden Nonce which is valid. In order to complete the verification faster than other miners, miners compete with each other using their computer hashing power. Once the Golden Nonce is found, they can complete the Block and add it to the Block Chain and there by receive the Block reward.

This rules out the possibility of any duplication, or using the same bitcoin twice. Whether rest of the fields are changed or not, Nonce will change because it is unique and thus became the most important component of the Proof of Work. In cryptography, a nonce is an arbitrary number that can be used just once in a cryptographic communication. It is often a random number issued in an authentication protocol to ensure that, same communication is not reused.

There will be some constant information, timestamp, hash value with difficulty, and the nonce which when passed through Hash algorithm – SHA256 will become a new block. Here nonce plays a very important role. As we have already discussed, millions of nonce values are tried until the Golden Nonce is found.The target hash value is defined as the difficulty and the iterative calculation of the hash value requires the miner’s computer resources. Only with the correct Nonce value, proof of work can be created and thus giving birth to a new Block in the Block chain.