23

I don't understand what "difficulty" means and how it really relates to "target".

I understand what "target" is - it tells the miners, how small the resulting hash should be. (Basically, how many zeroes are there at the beginning, altough not exactly.)

But I don't understand what "difficulty" is, how it relates to the target and why it's important. I tried to read the article on wiki - https://en.bitcoin.it/wiki/Difficulty - but I don't have a clue what is it trying to say either.

20

Difficulty is basically a different representation of the target to make it easier for normal humans to understand it.

Difficulty represents how difficult the current target makes it to find a block, relative to how difficult it would be at the highest possible target (highest target=lowest difficulty). The current difficulty of 6,695,826 means that at a given hash rate, it will, on average, take ~6.6 million times as long to find a valid block as it would at a difficulty of 1, or alternatively, it will take, again on average, ~6.6 million times as many hashes to find a valid block.

Difficulty is the largest possible target (0x00000000FFFF0000000000000000000000000000000000000000000000000000) divided by the current target (as of right now, 0x00000000000002816E0000000000000000000000000000000000000000000000).

  • So the largest possible target is a lifetime constant of the blockchain, but the current target is variable and increases/decreases respectively to maintain a 10-minute block generation? – Olshansk Jun 17 '17 at 2:21
  • 1
    @Olshansk Indeed. – Pieter Wuille Aug 4 '17 at 9:22
12

Difficulty is simply the ratio between the max target and the current target. It's easier to speak in terms of difficulty than in terms of the target.

The max target is defined as (2^16 - 1) * 2^208 or approximately 2^224. Since there are 2^256 different values a hash can take, a random hash has a chance of about 2^(-32) to be lower than the max target.

It follows that if the difficulty is D, the target is (2^224 / D) and it takes on average 2^32 * D hashes to find a block.

  • Can you relate it to the number of zero's, please? – user153465 Aug 6 '17 at 16:30
  • The number of zeroes required is 8 + log(D)/log(16). But that is only an approximation. – Meni Rosenfeld Aug 6 '17 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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