<p>As you say, the result of <code>sha256</code> is a <strong>hexadecimal</strong> string.  Hexadecimal only uses the digits 0-9 and a-f, which is 16 possibilities, not 36.</p>

<p>If you redo your calculation with 16^18 instead of 36^18, you get an average time of around 3600 seconds, or 1 hour.</p>

CC BY-SA 3.0
2017-09-18T13:29:36.833Z
2017-09-18T13:29:36.833Z
Nate Eldredge
<p>I understand that the Bitcoin mining problem is to find a string <code>s</code> (hash of previous block + transaction hashes + nonce) such that <code>sha256(s)</code> has <code>n</code> leading zeros, where <code>n</code> determines the mining difficulty. </p>

<p>The result of <code>sha256(s)</code> is a 64-length hexadecimal string. Each position of 64 has 36 possibilities (a-z, 0-9). So, the expected number of guesses would be <code>36^n</code>. </p>

<p>The hash of block #485891 is </p>

<pre><code>0000000000000000007ea3c67381ecfcf8e44e9941dcef554e8b029068857b55 
</code></pre>

<p>which has 18 leading zeros. Thus, the expected number of guesses is </p>

<pre><code>36^18 = 10314424798490535546171949056.
</code></pre>

<p>This hash was found by Antpool which has a hash power of 1284.32 PH/s. Therefore, the expected time for Antpool to find the hash would be</p>

<pre><code>36^18 / (1284.32 * 10^15) = 8.03104*10^9 s = 255 years.
</code></pre>

<p>This time is obviously incorrect. Is there anything I missed out? </p>

<mining-theory>
Question regarding mining difficulty
Purboo
# Question regarding mining difficulty

(Asked by: username_0 on 2017-09-18)

I understand that the Bitcoin mining problem is to find a string `s` (hash of previous block + transaction hashes + nonce) such that `sha256(s)` has `n` leading zeros, where `n` determines the mining difficulty.

The result of `sha256(s)` is a 64-length hexadecimal string. Each position of 64 has 36 possibilities (a-z, 0-9). So, the expected number of guesses would be `36^n`.

The hash of block #485891 is

```
0000000000000000007ea3c67381ecfcf8e44e9941dcef554e8b029068857b55 

```

which has 18 leading zeros. Thus, the expected number of guesses is

```
36^18 = 10314424798490535546171949056.

```

This hash was found by Antpool which has a hash power of 1284.32 PH/s. Therefore, the expected time for Antpool to find the hash would be

```
36^18 / (1284.32 * 10^15) = 8.03104*10^9 s = 255 years.

```

This time is obviously incorrect. Is there anything I missed out?

**Tags:** mining-theory


---

## 1 answers

### Answer by username_1 on 2017-09-18. Score: 4 | Accepted answer

As you say, the result of `sha256` is a **hexadecimal** string. Hexadecimal only uses the digits 0-9 and a-f, which is 16 possibilities, not 36.

If you redo your calculation with 16^18 instead of 36^18, you get an average time of around 3600 seconds, or 1 hour.


---

