<p>The <a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow noreferrer">difficulty</a>, the <a href="https://en.bitcoin.it/wiki/Target" rel="nofollow noreferrer">target</a> and the <a href="https://en.wikipedia.org/wiki/SHA-2" rel="nofollow noreferrer">hash</a> value are all integer numbers. They can all be compared numerically in much the same way we can compare three and seven.</p>
<p>Since these are large numbers it is more convenient to use a more compact representation of the number when displaying the number. Just as base-16 (hexadecimal) is a more compact way of writing a number than base-10 (decimal). So the network target is transmitted in a compact representation known in the Bitcoin context as the &quot;bits&quot; representation. But the choice of representation doesn't affect the fact that these are just integers and can be compared to other integers in the usual ways that large integers are compared. I think of the &quot;bits&quot; representation as being a little like writing down a number rounded to the nearest thousand or a little like writing down a number as three significant digits and an order of magnitude. You lose some precision but the result is still useful.</p>
<p>The difficulty is a kind of inverse of the target. The larger the difficulty, the smaller the target. The target is a number that is adjusted every 2016 blocks using relatively simple arithmetic. It is not the result of hashing.</p>
<p>The hash is produced by an algorithm that I wouldn't characterise as simple arithmetic but it is still just an integer value. One whose value cannot be predicted more easily than by performing the hashing operation and whose results do not follow a predictable pattern and which are uniformly spread through the range of possible results. Those characteristics make it useful.</p>
<p>So to take your example</p>
<blockquote>
<p><strong>how does an SHA256 hash, i.e: 58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201, have a value higher or lower than 27Trillion</strong></p>
</blockquote>
<p>Consider</p>
<ul>
<li>The number three is the number 3. They are the same number written down in two different ways.</li>
</ul>
<p>Similarly</p>
<ul>
<li><p>The number 58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201
is the number 40095921297356466623732964073191944615316514476168542186617738139837166494209. They are the same number written down in two different ways.</p>
</li>
<li><p>The number 27 Trillion is the number 27000000000000. They are the same number written down in two different ways.</p>
</li>
</ul>
<p>The first step in comparing two numbers which are represented two different ways is to convert them both into the same representation. We choose any representation that will make a subsequent comparison easier for us.</p>
<p>We can immediately see that 40095921297356466623732964073191944615316514476168542186617738139837166494209 is a larger number than 27000000000000.</p>
<p>We need to be careful to compare the hash with the target and not with the difficulty.</p>

CC BY-SA 4.0
2022-03-01T15:28:49.580Z
2022-03-01T16:00:05.590Z
2022-03-01T16:00:05.590Z
RedGrittyBrick
<p>So, essentially what my question is what does the &quot;syntax&quot; of a bdiff (bitcoin target difficulty) look like? I know that its a number, i.e the current network difficulty is set at around 27Trillion. Your node must output an SHA256 hash below that target.</p>
<p>However, mathematically speaking, how does an SHA256 hash, i.e: <code>58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201</code>, have a value higher or lower than 27Trillion, which is what the bdiff is configured to.</p>
<p>Is the network difficulty really just a number, i.e 27Trillion, or is it also a 256-bit hash/number of some kind that would be more comparable?</p>

<difficulty><sha256>
How does the bitcoin network difficulty syntax work?
bitcash complex
# How does the bitcoin network difficulty syntax work?

(Asked by: username_0 on 2022-03-01)

So, essentially what my question is what does the "syntax" of a bdiff (bitcoin target difficulty) look like? I know that its a number, i.e the current network difficulty is set at around 27Trillion. Your node must output an SHA256 hash below that target.

However, mathematically speaking, how does an SHA256 hash, i.e: `58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201`, have a value higher or lower than 27Trillion, which is what the bdiff is configured to.

Is the network difficulty really just a number, i.e 27Trillion, or is it also a 256-bit hash/number of some kind that would be more comparable?

**Tags:** difficulty, sha256


---

## 1 answers

### Answer by username_1 on 2022-03-01. Score: 1

The [difficulty](https://en.bitcoin.it/wiki/Difficulty), the [target](https://en.bitcoin.it/wiki/Target) and the [hash](https://en.wikipedia.org/wiki/SHA-2) value are all integer numbers. They can all be compared numerically in much the same way we can compare three and seven.

Since these are large numbers it is more convenient to use a more compact representation of the number when displaying the number. Just as base-16 (hexadecimal) is a more compact way of writing a number than base-10 (decimal). So the network target is transmitted in a compact representation known in the Bitcoin context as the "bits" representation. But the choice of representation doesn't affect the fact that these are just integers and can be compared to other integers in the usual ways that large integers are compared. I think of the "bits" representation as being a little like writing down a number rounded to the nearest thousand or a little like writing down a number as three significant digits and an order of magnitude. You lose some precision but the result is still useful.

The difficulty is a kind of inverse of the target. The larger the difficulty, the smaller the target. The target is a number that is adjusted every 2016 blocks using relatively simple arithmetic. It is not the result of hashing.

The hash is produced by an algorithm that I wouldn't characterise as simple arithmetic but it is still just an integer value. One whose value cannot be predicted more easily than by performing the hashing operation and whose results do not follow a predictable pattern and which are uniformly spread through the range of possible results. Those characteristics make it useful.

So to take your example

> **how does an SHA256 hash, i.e: 58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201, have a value higher or lower than 27Trillion**

Consider

* The number three is the number 3. They are the same number written down in two different ways.

Similarly

* The number 58a57cbaefb39229b8bb7f7f5ba4dae105cd4a75aa1cd72873ee74fdb323a201
  is the number 40095921297356466623732964073191944615316514476168542186617738139837166494209. They are the same number written down in two different ways.
* The number 27 Trillion is the number 27000000000000. They are the same number written down in two different ways.

The first step in comparing two numbers which are represented two different ways is to convert them both into the same representation. We choose any representation that will make a subsequent comparison easier for us.

We can immediately see that 40095921297356466623732964073191944615316514476168542186617738139837166494209 is a larger number than 27000000000000.

We need to be careful to compare the hash with the target and not with the difficulty.


---

