3

When a miner hashes a blocksheader and it produces a hash that is lower than the value represented by nBits then the PoW is considered solved.

What exactly does this mean? For example a SHA256 hash has the following structure: c45bc3de9bff9ee27fc7303a3aa4fa8022ab6608d42bbea4d72bbee9b719703b how do you determine whether this is below an nBits value?

2

nBits refers to the target. The target is a 256 bit number and inversely proportional to the difficulty.

You can calculate the difficulty from the target with the following formula:

difficulty = difficulty_1_target / current_target

where difficulty_1_target represents the target corresponding to the first difficulty on the network which was a 256 bit number with the leading 32 bits set to zero and the rest set to 1. Alternatively, the formula works out to:

difficulty = 2^208 * 65535 / current_target.

Back to blocks:
While we often see the block hash represented as hexadecimal numbers which include the letters from A–F for the numbers 10-15, block hashes result from SHA256d hashing. The output of SHA256 is a 256 bit number (hence the name). When miners are searching for a valid block, they create a multitude of block candidates. When one of these candidates' hash digests (interpreted as a 256 bit number) is smaller than or equal to the difficulty, the miner has found a valid block.

  • Okay, my question is then how is a hashoutput below that? This sounds super dumb, but I mean it has letters etc in it? Is it because we convert the hashoutput to a binary value? And then if that has a value lower than the nBit then we have solved the proof of work problem? Thanks for the help by the way! – no nein Jul 27 '17 at 16:00
  • @nonein: Hey, I've updated my answer to cover your follow-up questions. – Murch Jul 27 '17 at 16:41
  • Thanks! So in effect the A's etc are all numbers, thus making the whole thing correspond to a string of numbers? – no nein Jul 27 '17 at 18:04
  • Hexadecimal is a base sixteen number system. Each position may have values from 0-15 (as the decimal system can have values of 0-9 and the binary system can have values of 0-1). The sixteen "digits" are represented by 0-9 and A-F, where A stands for 10 and F stands for 15. – Murch Jul 27 '17 at 18:49
  • @nonein: Yeah, the letters correspond to numbers. Each character in a hexadecimal number corresponds to four characters in binary. E.g. c45b would translate to 1100010001011011. – Murch Jul 28 '17 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.