<p>The difficulty is a part of the block header called "bits". It is the 72nd to 75th bytes of the block header and looks like this in hex:</p>

<p>bits = 0x76270618</p>

<p>Remember this is little-endian! Actual big-endian version is 0x18062776
Take the first byte as the “exponent” and the other three bytes as the “coefficient”</p>

<p>Exponent = 0x18 = 24</p>

<p>Coefficient = 0x062776</p>

<p>Plug into this formula:</p>

<p>Coefficient * 2**(8*(Exponent - 3)) =
0x0000000000000000062776000000000000000000000000000000000000000000</p>

<p>And that's how you can calculate difficulty from bits.</p>

CC BY-SA 3.0
2016-07-28T20:59:51.173Z
2016-07-28T20:59:51.173Z
Jimmy Song
<p>Default share difficulty is 1 (big-endian target for difficulty 1 is 0x00000000ffff0000000000000000000000000000000000000000000000000000)</p>

<p><strong>How to calculate this?<br>
How it look like on Java code?<br>
What algorithm of calculate this value?</strong></p>

<mining-theory><bitcoinj><mining-software><mining-technical-details><algorithms>
Bitcoin mining algorithm - target - Java
Oleg D
# Bitcoin mining algorithm - target - Java

(Asked by: username_0 on 2016-07-27)

Default share difficulty is 1 (big-endian target for difficulty 1 is 0x00000000ffff0000000000000000000000000000000000000000000000000000)

**How to calculate this?  
How it look like on Java code?  
What algorithm of calculate this value?**

**Tags:** mining-theory, bitcoinj, mining-software, mining-technical-details, algorithms


---

## 1 answers

### Answer by username_1 on 2016-07-28. Score: 1 | Accepted answer

The difficulty is a part of the block header called "bits". It is the 72nd to 75th bytes of the block header and looks like this in hex:

bits = 0x76270618

Remember this is little-endian! Actual big-endian version is 0x18062776
Take the first byte as the “exponent” and the other three bytes as the “coefficient”

Exponent = 0x18 = 24

Coefficient = 0x062776

Plug into this formula:

Coefficient \* 2\*\*(8\*(Exponent - 3)) =
0x0000000000000000062776000000000000000000000000000000000000000000

And that's how you can calculate difficulty from bits.


---

