3

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.

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

3
  • Updated my answer to reflect, and answer, the updated question.
    – KJ O
    May 5, 2014 at 23:12
  • @KJO: Out of curiosity, why did you remove stratum? I'm not much of a miner myself.
    – Murch
    May 2, 2016 at 7:31
  • @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
    May 2, 2016 at 14:14

1 Answer 1

2

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

3
  • Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?
    – Dr.Haribo
    Apr 6, 2014 at 18:15
  • @Dr.Haribo added more information.
    – KJ O
    Apr 6, 2014 at 19:24
  • Someone care to dig up some info on ldiff so we can complete this? :)
    – Dr.Haribo
    Apr 25, 2014 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.