Difference between revisions of "Nonce"

From Bitcoin Wiki
Jump to: navigation, search
(clarifying the position and meaning of the "zeros' needed in the hash to validate the nonce.)
(changed "leading zeros" to explain how it must meet the target. Removed confusing language mixing up the terms "target" and "difficulty")
 
Line 1: Line 1:
The "nonce" in a bitcoin [[block]] is a 32-bit (4-byte) field whose value is set so that the [[hash]] of the block will contain a run of leading zeros. The rest of the fields may not be changed, as they have a defined meaning.
+
The "nonce" in a bitcoin [[block]] is a 32-bit (4-byte) field whose value is adjusted by miners so that the [[hash]] of the block will be less than or equal to the current [[target]] of the network. The rest of the fields may not be changed, as they have a defined meaning.
  
Any change to the block data (such as the nonce) will make the block hash completely different. Since it is [[wikipedia:Cryptographic hash function|believed infeasible]] to predict which combination of bits will result in the right hash, many different nonce values are tried, and the hash is recomputed for each value until a hash containing the required number of zero bits is found. The number of zero bits required is set by the [[difficulty]]. The resulting hash has to be a value less than the current [[difficulty]] and so will have  to have a certain number of leading zero bits  to be less than that. As this iterative calculation requires time and resources, the presentation of the block with the correct nonce value constitutes [[proof of work]].
+
Any change to the block data (such as the nonce) will make the block hash completely different. Since it is [[wikipedia:Cryptographic hash function|believed infeasible]] to predict which combination of bits will result in the right hash, many different nonce values are tried, and the hash is recomputed for each value until a hash less than or equal to the current [[target]] of the network is found. The [[target]] required is also represented as the [[difficulty]], where a higher [[difficulty]] represents a lower [[target]]. As this iterative calculation requires time and resources, the presentation of the block with the correct nonce value constitutes [[proof of work]].
  
 
== Golden Nonce ==
 
== Golden Nonce ==
A ''golden nonce'' in Bitcoin [[mining]] is a nonce which results in a [[block hashing algorithm|hash]] value lower than the target [[difficulty]].   
+
A ''golden nonce'' in Bitcoin [[mining]] is a nonce which results in a [[block hashing algorithm|hash]] value lower than the [[target]].   
In many practical mining applications, this is simplified to any nonce which has 32 leading zeroes<ref>https://bitcointalk.org/index.php?topic=75609.msg837556#msg837556</ref>, with a secondary test checking if the actual value is lower than the target difficulty.
+
In many practical mining applications, this is simplified to any nonce which results in a block [[block hashing algorithm|hash]] which has 32 leading zeroes<ref>https://bitcointalk.org/index.php?topic=75609.msg837556#msg837556</ref>, with a secondary test checking if the actual value is lower than the target difficulty.
  
 
=== Etymology ===
 
=== Etymology ===

Latest revision as of 17:27, 11 July 2018

The "nonce" in a bitcoin block is a 32-bit (4-byte) field whose value is adjusted by miners so that the hash of the block will be less than or equal to the current target of the network. The rest of the fields may not be changed, as they have a defined meaning.

Any change to the block data (such as the nonce) will make the block hash completely different. Since it is believed infeasible to predict which combination of bits will result in the right hash, many different nonce values are tried, and the hash is recomputed for each value until a hash less than or equal to the current target of the network is found. The target required is also represented as the difficulty, where a higher difficulty represents a lower target. As this iterative calculation requires time and resources, the presentation of the block with the correct nonce value constitutes proof of work.

Golden Nonce

A golden nonce in Bitcoin mining is a nonce which results in a hash value lower than the target. In many practical mining applications, this is simplified to any nonce which results in a block hash which has 32 leading zeroes[1], with a secondary test checking if the actual value is lower than the target difficulty.

Etymology

The term golden nonce most likely evolved from the term golden ticket as used to refer to a nonce satisfying the mining requirements as early as April 8th, 2011[2]

References