<p>I searched for a few days and finally fixed my problem, thanks to <a href="https://bitcoin.stackexchange.com/a/23112/123635">https://bitcoin.stackexchange.com/a/23112/123635</a>, it solved many problems that the documentation didn't clear up (like block hashing).</p>
<p>Basically, just do (in my case, with scrypt coins):</p>
<pre><code>target = 0x0000FFFF00000000000000000000000000000000000000000000000000000000 / stratum difficulty
</code></pre>
<p>so:</p>
<pre><code>target = 0x0000FFFF00000000000000000000000000000000000000000000000000000000 / 8

target = &quot;00001fffe0000000000000000000000000000000000000000000000000000000&quot;
</code></pre>

CC BY-SA 4.0
2021-06-29T18:07:27.683Z
2021-06-29T18:07:27.683Z
bot
<p>I'm developing a miner to study how mining works and I've connected it to a pool using Stratum. When I use the bits provided by the pool to calculate the target, it is different from the miner that I use (cpuminer). The target from cpuminer is easier than mine, like, the cpuminer target has 4 leading zeroes and mine has like 13 leading zeroes. I also noticed that the pool sends the difficulty, but I have no idea how should I use it.</p>
<p>How should I use the difficulty provided by the pool to calculate my target?</p>
<p><strong>Edit:</strong> I've set it up to get difficulty 8 only.</p>
<pre><code>cpuminer target: 00002000 00000000 00000000 00000000 ffffffff ffffffff ffffffff ffffffff

my target      : 00000000 0071c175 00000000 00000000 00000000 00000000 00000000 00000000
</code></pre>

CC BY-SA 4.0
2021-06-19T20:48:30.357Z
Is one using testnet and the other using mainnet?
RedGrittyBrick
CC BY-SA 4.0
2021-06-20T15:10:45.897Z
Both are using the same stratum pool with the same difficulty (16). I also think cpuminer target is always the same for this difficulty, idk if there is another formula to calculate the target by difficulty number.
bot
CC BY-SA 4.0
2021-06-20T15:28:43.410Z
Ops, difficulty 8*
bot
CC BY-SA 4.0
2021-06-20T16:00:52.553Z
Are you talking about the block's "nbits" value, because that refers to the network-wide difficulty. Perhaps the other thing you see is the pool's share difficulty?
Pieter Wuille
CC BY-SA 4.0
2021-06-20T19:35:26.707Z
When the pool sends a work, it contains the "nbits" value which, in theory, should be used in [block header](https://en.bitcoin.it/wiki/Block_hashing_algorithm), so I used it. The work also contains the mining difficulty, which I set to "8", but I don't know how I should use it. I asked this question because I don't know why cpuminer target is easier than mine, so probably I did something wrong and I want to know what.
bot
<mining-pools><development><miner-configuration><stratum><cpuminer>
Why is my target different from a miner?
bot
# Why is my target different from a miner?

(Asked by: username_0 on 2021-06-19)

I'm developing a miner to study how mining works and I've connected it to a pool using Stratum. When I use the bits provided by the pool to calculate the target, it is different from the miner that I use (cpuminer). The target from cpuminer is easier than mine, like, the cpuminer target has 4 leading zeroes and mine has like 13 leading zeroes. I also noticed that the pool sends the difficulty, but I have no idea how should I use it.

How should I use the difficulty provided by the pool to calculate my target?

**Edit:** I've set it up to get difficulty 8 only.

```
cpuminer target: 00002000 00000000 00000000 00000000 ffffffff ffffffff ffffffff ffffffff

my target      : 00000000 0071c175 00000000 00000000 00000000 00000000 00000000 00000000

```

**Tags:** mining-pools, development, miner-configuration, stratum, cpuminer

> **Comments:**
> **username_1**: Is one using testnet and the other using mainnet?  
> **username_0**: Both are using the same stratum pool with the same difficulty (16). I also think cpuminer target is always the same for this difficulty, idk if there is another formula to calculate the target by difficulty number.  
> **username_0**: Ops, difficulty 8*  
> **username_2**: Are you talking about the block's "nbits" value, because that refers to the network-wide difficulty. Perhaps the other thing you see is the pool's share difficulty?  
> **username_0**: When the pool sends a work, it contains the "nbits" value which, in theory, should be used in [block header](https://en.bitcoin.it/wiki/Block_hashing_algorithm), so I used it. The work also contains the mining difficulty, which I set to "8", but I don't know how I should use it. I asked this question because I don't know why cpuminer target is easier than mine, so probably I did something wrong and I want to know what.  

---

## 1 answers

### Answer by username_0 on 2021-06-29. Score: 0 | Accepted answer

I searched for a few days and finally fixed my problem, thanks to <https://bitcoin.stackexchange.com/a/23112/123635>, it solved many problems that the documentation didn't clear up (like block hashing).

Basically, just do (in my case, with scrypt coins):

```
target = 0x0000FFFF00000000000000000000000000000000000000000000000000000000 / stratum difficulty

```

so:

```
target = 0x0000FFFF00000000000000000000000000000000000000000000000000000000 / 8

target = "00001fffe0000000000000000000000000000000000000000000000000000000"

```


---

