<p>To use the terminology on <a href="https://litecoin.info/Difficulty" rel="nofollow">Litecoin's wiki</a>, <code>~uint256(0) &gt;&gt; 20</code> is the target, and <code>1 / 2^12</code> is (approximately) the difficulty. You can see that by running the following in Python (or anything that can handle calculations on large numbers).</p>

<pre><code>target = 0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff # or 2**236-1
diff = 0xFFFF * 2**208 / target
print(diff) # 0.00024413689970970154
print(1/2**12) # 0.000244140625
</code></pre>

<p>I believe the <code>1 / 2^20</code> figure you calculated is the probability that each hash will succeed, which is not the same as (although related to) the difficulty.</p>

CC BY-SA 3.0
2014-05-05T18:48:15.390Z
Oh interesting, I didn't realize they had a convention for what the difficulty is. That does elucidate matters.
Claudiu
CC BY-SA 3.0
2018-02-24T10:09:55.067Z
Hi. At recent source, there is no CBigNum, what it have been changed?
creator
CC BY-SA 3.0
2014-05-05T18:01:18.210Z
2014-05-05T18:28:57.893Z
2014-05-05T18:28:57.893Z
Tim S.
<p>In the Litecoin source it is written:</p>

<pre><code>static CBigNum bnProofOfWorkLimit(~uint256(0) &gt;&gt; 20); // Litecoin: starting difficulty is 1 / 2^12
</code></pre>

<p>How does that compute? <code>~uint256(0) &gt;&gt; 20</code> is <code>0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</code>. Hashes have an equal probability of being any given number, so the chance of getting a valid Litecoin hash (i.e. one that is smaller than this number) is <code>0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff / 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</code> = <code>1 / 2^20</code>, <strong>not</strong> <code>1 / 2^12</code>. Is this a typo in the Litecoin source code or am I misunderstanding something?</p>

CC BY-SA 3.0
2014-05-05T18:57:05.377Z
A good way to remember it is that a difficulty of 1 means an average of `2^32` hashes are needed to mine one block, and it scales linearly from there.  This convention comes from Bitcoin where the minimum difficulty is in fact 1.
Nate Eldredge
CC BY-SA 3.0
2018-02-24T10:09:51.203Z
Hi. At recent source, there is no CBigNum, what it have been changed?
creator
<litecoin><development><difficulty><hash>
How does a proof of work limit of `~uint256(0) >> 20` translate into a difficulty of `1 / 2^12`?
Claudiu
# How does a proof of work limit of `~uint256(0) >> 20` translate into a difficulty of `1 / 2^12`?

(Asked by: username_0 on 2014-05-05)

In the Litecoin source it is written:

```
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Litecoin: starting difficulty is 1 / 2^12

```

How does that compute? `~uint256(0) >> 20` is `0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`. Hashes have an equal probability of being any given number, so the chance of getting a valid Litecoin hash (i.e. one that is smaller than this number) is `0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff / 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff` = `1 / 2^20`, **not** `1 / 2^12`. Is this a typo in the Litecoin source code or am I misunderstanding something?

**Tags:** litecoin, development, difficulty, hash

> **Comments:**
> **username_1**: A good way to remember it is that a difficulty of 1 means an average of `2^32` hashes are needed to mine one block, and it scales linearly from there.  This convention comes from Bitcoin where the minimum difficulty is in fact 1.  
> **username_2**: Hi. At recent source, there is no CBigNum, what it have been changed?  

---

## 1 answers

### Answer by username_3 on 2014-05-05. Score: 2 | Accepted answer

To use the terminology on [Litecoin's wiki](https://litecoin.info/Difficulty), `~uint256(0) >> 20` is the target, and `1 / 2^12` is (approximately) the difficulty. You can see that by running the following in Python (or anything that can handle calculations on large numbers).

```
target = 0x00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff # or 2**236-1
diff = 0xFFFF * 2**208 / target
print(diff) # 0.00024413689970970154
print(1/2**12) # 0.000244140625

```

I believe the `1 / 2^20` figure you calculated is the probability that each hash will succeed, which is not the same as (although related to) the difficulty.

> **Comments:**
> **username_0**: Oh interesting, I didn't realize they had a convention for what the difficulty is. That does elucidate matters.  
> **username_2**: Hi. At recent source, there is no CBigNum, what it have been changed?  

---

