<p><em>What are the meanings of pdiff, bdiff, and ldiff?</em></p>

<p>The numbers are the current difficulty of the network(s).</p>

<ul>
<li><p><code>bdiff</code> is the target difficulty of the whole Bitcoin network.</p></li>
<li><p><code>ldiff</code> is the target difficulty of the whole Litecoin network.</p></li>
<li><p><code>pdiff</code> is your pool's target difficulty.</p></li>
</ul>

<p>As you may know, the difficulty is a measure of how difficult it is to find a hash below a given target value.</p>

<hr>

<p><em>In what way do they differ?</em></p>

<p><em>Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?</em></p>

<p><strong>TL;DR:</strong> No. That defeats the purpose of having multiple difficulties.</p>

<p>This is a multi-part answer; I'll try to divide it in a manner that it makes sense.</p>

<p><br></p>

<hr>

<h1>Bitcoin</h1>

<h2>Difficulty</h2>

<p>The Bitcoin network has a global block difficulty (<code>bdiff</code>). Valid blocks must have a hash less than or equal to this target. Mining pools also have a pool-specific share difficulty setting a lower limit for shares (<code>pdiff</code>, usually 1).</p>

<h2>Calculation</h2>

<p><strong>How is <code>bdiff</code> calculated?</strong></p>

<p><code>bdiff</code> is an approximation based off of a known hash where the leading 32 bits are zero and the rest are one.</p>

<blockquote>
  <p>difficulty = difficulty_1_target / current_target</p>
  
  <p>(target is a 256 bit number)</p>
  
  <p>difficulty_1_target can be different for various ways to measure difficulty.
  Traditionally, it represents a hash where the leading 32 bits are zero and the rest are
  one (this is known as "pool difficulty" or "pdiff"). The Bitcoin protocol represents
  targets as a custom floating point type with limited precision; as a result, Bitcoin
  clients often approximate difficulty based on this (this is known as "bdiff").</p>
</blockquote>

<p><strong>How is that value stored?</strong></p>

<blockquote>
  <p>Each block stores a packed representation [...] for its actual hexadecimal
  target. The target can be derived from it via a predefined formula. For example, if the
  packed target in the block is <code>0x1b0404cb</code>, the hexadecimal target is</p>

<pre>0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000</pre>
</blockquote>

<p>Note that the <code>0x0404cb</code> value is a signed value in this format. The largest legal value for this field is <code>0x7fffff</code>, while the smallest is <code>0x008000</code>. To make a larger value you must shift it down one full byte positive valid value.</p>

<p><strong>How does one calculate (estimate) <code>bdiff</code>?</strong></p>

<p>Say your value is 1 (<code>0x1d00ffff</code>) <pre>0x00ffff * 2**(8*(0x1d - 3)) = 0x00000000FFFF0000000000000000000000000000000000000000000000000000</pre></p>

<p>That would be <pre>0x00000000FFFF0000000000000000000000000000000000000000000000000000 /
0x00000000000404CB000000000000000000000000000000000000000000000000 
= 16307.420938523983</pre></p>

<p><a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow">Source</a></p>

<hr>

<h1>Litecoin</h1>

<h2>Difficulty</h2>

<p>Because Litecoin is based on Bitcoin <code>ldiff</code> is calculated the same as <code>bdiff</code>. It is an approximation relative to a known hash (256-bit number where the leading 32 bits are zero and the rest are one).</p>

<h2>Calculation</h2>

<p><code>ldiff</code> is calculated in the same way <code>bdiff</code> is.</p>

<p>They both have a maximum of infinity (basically), and a minimum of 1/4096</p>

<p>Because Litecoin takes its roots in Bitcoin, this also means <code>ldiff</code> is an approximation, not a precise value.</p>

<p><a href="https://litecoin.info/Difficulty" rel="nofollow">Source</a></p>

<hr>

<h1>Pools</h1>

<h2>Difficulty</h2>

<p><code>pdiff</code> is relative to the crypto-currency in question. In the cases of Bitcoin and Litecoin pools, it represents the same thing; but in, for example, a Namecoin pool, the difficulty may not be 1, or it may be calculated differently. This is confusing because the 256-bit number in question is <code>0x1d00ffff</code>. The number was not called anything initially. But once pooled mining started, it colloquially became known as <code>pdiff</code>. But it was around before pooled mining. Pools just happened to use it as their target difficulty, and because <code>bdiff</code> was already a thing, the name <code>pdiff</code> was transposed to the number <code>0x1d00ffff</code>.</p>

<p>Note that pools <em>usually</em> use non-truncated-targets, and <em>usually</em> use a difficulty of 1. This means that even within the same crypto-currencies there really is no set definition of what <code>pdiff</code> is; however, I know of no pools/pool software that contradict these rules, because they are desirable. Just remember that anyone can make his pool do whatever he wants it to.</p>

<p><strong><code>pdiff</code> is relative.</strong></p>

<h2>Calculation</h2>

<p>Assuming this is a standard pool, calculation follows basically the same as <code>bdiff</code>, but with one exception:</p>

<p>Let's say the target value is still <code>0x1d00ffff</code>. <a href="https://en.bitcoin.it" rel="nofollow">The Wiki</a> says pools usually use "non-truncated targets" So, instead of <pre>0x00000000FFFF0000000000000000000000000000000000000000000000000000</pre> we get <pre>0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</pre></p>

<p>Which, when calculated, yields <pre>0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF /
0x00000000000404CB000000000000000000000000000000000000000000000000 
= 16307.669773817162</pre></p>

<p><a href="https://en.bitcoin.it/wiki/Target" rel="nofollow">Source</a></p>

CC BY-SA 3.0
2014-04-06T18:15:42.743Z
Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?
Dr.Haribo
CC BY-SA 3.0
2014-04-06T19:24:28.923Z
@Dr.Haribo added more information.
KJ O
CC BY-SA 3.0
2014-04-25T19:43:40.687Z
Someone care to dig up some info on ldiff so we can complete this? :)
Dr.Haribo
CC BY-SA 3.0
2014-04-06T14:12:08.313Z
2016-05-02T03:33:26.667Z
2016-05-02T03:33:26.667Z
KJ O
<p>In pooled mining, there seem to be three different terms for difficulty in use. Apparently, the Stratum protocol uses <code>bdiff</code>, BTCGuild uses <code>pdiff</code>, and <code>Ldiff</code> is common for various Scrypt pools as mentioned in this <a href="https://bitcointalk.org/index.php?topic=557991.msg6078779#msg6078779" rel="nofollow">bitcointalk thread</a>.</p>

<p>What are the meanings of <code>pdiff</code>, <code>bdiff</code>, and <code>ldiff</code>? In what way do they differ?</p>

CC BY-SA 3.0
2014-05-05T23:12:12.563Z
Updated my answer to reflect, and answer, the updated question.
KJ O
CC BY-SA 3.0
2016-05-02T07:31:12.347Z
@KJO: Out of curiosity, why did you remove [tag:stratum]? I'm not much of a miner myself.
Murch
CC BY-SA 3.0
2016-05-02T14:14:59.667Z
@Murch I looked at other questions tagged with stratum, and they had more to do with stratum-pool issues. Questions about stratum can pertain to difficulty, but questions about difficulty aren't limited to stratum.
KJ O
<mining-pools><difficulty><mining-technical-details><terminology>
In pooled mining, what is pdiff, bdiff and ldiff?
Dr.Haribo
# In pooled mining, what is pdiff, bdiff and ldiff?

(Asked by: username_0 on 2014-04-06)

In pooled mining, there seem to be three different terms for difficulty in use. Apparently, the Stratum protocol uses `bdiff`, BTCGuild uses `pdiff`, and `Ldiff` is common for various Scrypt pools as mentioned in this [bitcointalk thread](https://bitcointalk.org/index.php?topic=557991.msg6078779#msg6078779).

What are the meanings of `pdiff`, `bdiff`, and `ldiff`? In what way do they differ?

**Tags:** mining-pools, difficulty, mining-technical-details, terminology

> **Comments:**
> **username_1**: Updated my answer to reflect, and answer, the updated question.  
> **username_2**: @KJO: Out of curiosity, why did you remove [tag:stratum]? I'm not much of a miner myself.  
> **username_1**: @username_2 I looked at other questions tagged with stratum, and they had more to do with stratum-pool issues. Questions about stratum can pertain to difficulty, but questions about difficulty aren't limited to stratum.  

---

## 1 answers

### Answer by username_1 on 2014-04-06. Score: 2 | Accepted answer

What are the meanings of pdiff, bdiff, and ldiff?
The numbers are the current difficulty of the network(s).

bdiff is the target difficulty of the whole Bitcoin network.
ldiff is the target difficulty of the whole Litecoin network.
pdiff is your pool's target difficulty.

As you may know, the difficulty is a measure of how difficult it is to find a hash below a given target value.

In what way do they differ?
Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?
TL;DR: No. That defeats the purpose of having multiple difficulties.
This is a multi-part answer; I'll try to divide it in a manner that it makes sense.


Bitcoin
Difficulty
The Bitcoin network has a global block difficulty (bdiff). Valid blocks must have a hash less than or equal to this target. Mining pools also have a pool-specific share difficulty setting a lower limit for shares (pdiff, usually 1).
Calculation
How is bdiff calculated?
bdiff is an approximation based off of a known hash where the leading 32 bits are zero and the rest are one.

difficulty = difficulty_1_target / current_target
(target is a 256 bit number)
difficulty_1_target can be different for various ways to measure difficulty.
  Traditionally, it represents a hash where the leading 32 bits are zero and the rest are
  one (this is known as "pool difficulty" or "pdiff"). The Bitcoin protocol represents
  targets as a custom floating point type with limited precision; as a result, Bitcoin
  clients often approximate difficulty based on this (this is known as "bdiff").

How is that value stored?

Each block stores a packed representation [...] for its actual hexadecimal
  target. The target can be derived from it via a predefined formula. For example, if the
  packed target in the block is 0x1b0404cb, the hexadecimal target is
0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000

Note that the 0x0404cb value is a signed value in this format. The largest legal value for this field is 0x7fffff, while the smallest is 0x008000. To make a larger value you must shift it down one full byte positive valid value.
How does one calculate (estimate) bdiff?
Say your value is 1 (0x1d00ffff) 0x00ffff * 2**(8*(0x1d - 3)) = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
That would be 0x00000000FFFF0000000000000000000000000000000000000000000000000000 /
0x00000000000404CB000000000000000000000000000000000000000000000000 
= 16307.420938523983
Source

Litecoin
Difficulty
Because Litecoin is based on Bitcoin ldiff is calculated the same as bdiff. It is an approximation relative to a known hash (256-bit number where the leading 32 bits are zero and the rest are one).
Calculation
ldiff is calculated in the same way bdiff is.
They both have a maximum of infinity (basically), and a minimum of 1/4096
Because Litecoin takes its roots in Bitcoin, this also means ldiff is an approximation, not a precise value.
Source

Pools
Difficulty
pdiff is relative to the crypto-currency in question. In the cases of Bitcoin and Litecoin pools, it represents the same thing; but in, for example, a Namecoin pool, the difficulty may not be 1, or it may be calculated differently. This is confusing because the 256-bit number in question is 0x1d00ffff. The number was not called anything initially. But once pooled mining started, it colloquially became known as pdiff. But it was around before pooled mining. Pools just happened to use it as their target difficulty, and because bdiff was already a thing, the name pdiff was transposed to the number 0x1d00ffff.
Note that pools usually use non-truncated-targets, and usually use a difficulty of 1. This means that even within the same crypto-currencies there really is no set definition of what pdiff is; however, I know of no pools/pool software that contradict these rules, because they are desirable. Just remember that anyone can make his pool do whatever he wants it to.
pdiff is relative.
Calculation
Assuming this is a standard pool, calculation follows basically the same as bdiff, but with one exception:
Let's say the target value is still 0x1d00ffff. The Wiki says pools usually use "non-truncated targets" So, instead of 0x00000000FFFF0000000000000000000000000000000000000000000000000000 we get 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Which, when calculated, yields 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF /
0x00000000000404CB000000000000000000000000000000000000000000000000 
= 16307.669773817162
Source

> **Comments:**
> **username_0**: Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?  
> **username_1**: @username_0 added more information.  
> **username_0**: Someone care to dig up some info on ldiff so we can complete this? :)  

---

