Wednesday, 15 November 2017

Investopedia: What is a 'Nonce'?

Nonce

DEFINITION of 'Nonce'

A nonce ("number only used once") is a number added to a hashed block that, when rehashed, meets the difficulty level restrictions. The nonce is the number that blockchain miners are solving for.
BREAKING DOWN 'Nonce'

The blockchain is the cornerstone of cryptocurrency. In order to keep the blockchain secure, data from previous blocks are encrypted or “hashed” into a series of numbers and letters. This is done by processing the block input through a function, which produces an output of a fixed length. The function used to generate the hash is deterministic, meaning that it will produce the same result each time the same input is used; can generate a hashed input efficiently; makes determining the input difficult (leading to mining); and makes small changes to the input result in a very different hash.

Adding transactions to the blockchain requires substantial computer processing power. The individuals and companies who process blocks are called miners. Miners are compensated only if they are the first to create a hash that meets a certain set of requirements, called the target hash.

The process of guessing the hash starts in the block header. It contains the block version number, a timestamp, the hash used in the previous block, the hash of the Merkle Root, the nonce, and the target hash. Successfully mining a block requires a miner to be the first to guess the nonce, which is a random string of numbers. This number is appended to the hashed contents of the block, and then rehashed. If the hash meets the requirements set forth in the target, then the block is added to the blockchain. Cycling through solutions in order to guess the nonce is referred to as proof of work, and the miner who is able to find the value is awarded the block and paid in cryptocurrency.

Determining which string to use as the nonce requires significant amount of trial-and-error, as it is a random string. A miner must guess a nonce, append it to the hash of the current header, rehash the value, and compare this to the target hash. If the resulting hash value meets the requirements, the miner has created a solution and is awarded the block. It is highly unlikely that a miner will successfully guess the nonce on the first try, meaning that the miner may potentially test a large number of nonce options before getting it right. The greater the difficulty - a measure of how hard it is to create a hash that is less than the target - the longer it is likely to take to generate a solution.

Block difficulty is kept the same across the entire network, meaning that all miners have the same chance of figuring out the correct hash. Cryptocurrency networks typically establish a target number of blocks they want processed during a specific time period, and periodically adjust the difficulty in order to ensure that this target is met. If the number of blocks processed does not meet this target then the difficulty will be reduced, with the reduction in difficulty set to the amount of time over the limit the processing time was.
Block (Bitcoin Block)
Share

Blocks are files where data pertaining to the Bitcoin network is permanently recorded. A block records some or all of the most recent Bitcoin transactions that have not yet entered any prior blocks. Thus a block is like a page of a ledger or record book. Each time a block is ‘completed’, it gives way to the next block in the blockchain. A block is thus a permanent store of records which, once written, cannot be altered or removed.
BREAKING DOWN 'Block (Bitcoin Block)'

The Bitcoin network witnesses a great deal of transaction activity. Maintaining a record of these transactions helps users track what was paid to and by whom. The transactions executed during a given period of time are recorded into a file called a block.
Read More +

    Work With Investopedia
    About Us Advertise With Us Contact Us Careers

© 2017, Investopedia, LLC. Feedback All Rights Reserved Terms Of Use Privacy Policy

No comments: