Nonce

From Bitcoin Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search
Cryptographic nonce

Nonce ( «number that can only be used once») in cryptography is one-time code, vibrant overcome or pseudorandom manner, which is used to biopsy the main to do transmission, preventing to take the power of reproduction.

In Bitcoin's mining process, the goal is to find a hash below a target number which is calculated based on the difficulty. Proof-of-work in Bitcoin's mining takes an input consists of Merkle Root, timestamp, previous block hash and few other things plus a nonce which is completely random number. If the output results in hash is smaller than the target hash you win the block and the consensus is reached. You need to brute force all possible nonce in order to luckily find a hash smaller than the target hash[1].

Description[edit]

Blockchain Nonce

The server generates the nonce (a nonce) and sends it to the client. The client uses the received code, adding it to the password before encryption, encrypts the received string, and returns the resulting message to the server. The server decrypts the message from the received string to "subtract" the known nonce and verifies the password. This nonce is used once and only once, all subsequent transfers of passwords with the same nonce will be rejected by the server, so an attacker who intercepts a message with an encrypted password will not be able to gain access by resending the intercepted message to the server[2].

Often, nonce includes a timestamp to limit the nonce lifetime, but this requires synchronization between the server and the client. Nonce, defined by the client ("cnonce"), can also be used to improve security.

To ensure nonce uniqueness for an authentication session, nonce is often generated based on system time, from a sufficiently accurate timestamp source.

Bitcoin[edit]

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.

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 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.

Bitcoin appliance[edit]

Nonces are used in proof-of-work systems to vary the input to a cryptographic hash function so as to obtain a hash for a certain input that fulfills certain arbitrary conditions. In doing so, it becomes far more difficult to create a "desirable" hash than to verify it, shifting the burden of work onto one side of a transaction or system.

For Bitcoin Nonce example, proof of work, using hash functions, was considered as a means to combat email spam by forcing email senders to find a hash value for the email (which included a timestamp to prevent pre-computation of useful hashes for later use) that had an arbitrary number of leading zeroes, by hashing the same input with a large number of nonce values until a "desirable" hash was obtained.

Similarly, the bitcoin block-chain hashing algorithm can be tuned to an arbitrary difficulty by changing the required minimum/maximum value of the hash so that the number of bitcoins awarded for new blocks does not increase linearly with increased network computation power as new users join. This is likewise achieved by forcing bitcoin miners to add nonce values to the value being hashed to change the hash algorithm output. Because cryptographic hash algorithms cannot easily be predicted based on their inputs, this makes the act of blockchain hashing and the possibility of being awarded bitcoins something of a lottery, where the first "miner" to find a nonce that delivers a desirable hash is awarded valuable bitcoins.

Golden Nonce[edit]

A golden nonce in Bitcoin mining is a nonce which results in a hash value lower than the target difficulty. In many practical mining applications, this is simplified to any nonce which has 32 leading zeroes https://bitcointalk.org/index.php?topic=75609.msg837556#msg837556, with a secondary test checking if the actual value is lower than the target difficulty.

Etymology[edit]

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.

External links[edit]

See also[edit]

References[edit]

  1. What is a nonce? - Bitcoin StackExchange
  2. Medium - Decoding the enigma of Bitcoin Mining


Licence.png