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

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

<p>The code relevant to target adjustment can be found here: <a href="https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp</a></p>

CC BY-SA 4.0
2018-07-20T05:44:04.783Z
2018-07-20T05:44:04.783Z
Ava Chow
<p>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 ?</p>

<p>Why do some authors like say that the size is 32 bit . 
The bitcoin wiki states that it is 256 bit. See <a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Difficulty</a>  it says  (target is a 256 bit number)
. </p>

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

CC BY-SA 4.0
2018-07-20T05:54:57.907Z
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
<bitcoin-core><blockchain><whitepaper>
is target a 256 bit field or a 32 bit field
peter
# is target a 256 bit field or a 32 bit field

(Asked by: username_0 on 2018-07-20)

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 ?

**Tags:** bitcoin-core, blockchain, whitepaper

> **Comments:**
> **username_0**: 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 ?  

---

## 1 answers

### Answer by username_1 on 2018-07-20. Score: 2

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>


---

