first, do we talk about fields or values. is it correct to say that it is a 32 or 256 bit value ? or should we call it a 32 or 256 bit field ?

Why do some authors like say that the size is 32 bit . The bitcoin wiki states that it is 256 bit. See https://en.bitcoin.it/wiki/Difficulty it says (target is a 256 bit number) .

who is correct and where in the core can i take a look at it ?

  • update: so some texts also misleading quote that pow is sha256 > = target for pow. but the code stipulates that sha256 (hash) > target. So equality is incorrect , correct ? – peter Jul 20 '18 at 5:54

The target is a 256 bit integer. However it is stored and represented in block headers as a 32 bit integer. This is a compact representation of the actual 256 bit value.

Operations involving the target are done as both 256 bit integers. However because the target is stored as a 32 bit integer in the block header, calculations involving the previous block use the 32 bit integer expanded out to the 256 bit representation. Unfortunately this compression is lossy so some data is lost in this process.

The code relevant to target adjustment can be found here: https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp

| improve this answer | |

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.