3

The last block of my private net has the difficulty of 5162920460. But what unit is it? Because it is not hash rate, the hash rate is when you divide the difficulty by the average block time which in my case is 5162920460/14 = 368780032.857142857 , which is 368.7 Mega hashes per second. Are my calculations correct?

Then, what is the unit for difficulty?

2
  • Just to note, the term isn't described in the glossary (github.com/ethereum/wiki/wiki/Glossary) but posting here as the link may help some people in the future.
    – ʰᵈˑ
    Commented Nov 2, 2017 at 16:24
  • that glossary has a mistake. they are saying that the average time for finding a block in Ethereum is 1 min, this is incorrect, it is 14 seconds. quote: eg. N = 10 for Bitcoin and 1 for Ethereum
    – Nulik
    Commented Nov 2, 2017 at 16:43

2 Answers 2

3

TL;DR: hash/solution

Difficulty units are basically "hash/solution" (sort of). It's a measure of how much work is required to find a hash with some # of leading 0s.

Your calculations are correct, difficult is designed to float with hash power, so you can estimate the current hash rate from the difficulty.

(X hash/solution) / (Y second/solution) = Z hash/second

In the case of Ethereum, Y=~14 seconds. The calculation for difficultly attempts to keep Y at ~14 seconds by modifying difficulty (X) to match the current hash rate (Z). However, the protocol is not inherently aware of Z, so it estimates Z based on the time between the current and previous blocks.

Therefore we usually don't think of difficulty as having any specific units, except to act as a measure of how much work is required to find a block solution.

5

If dividing the difficulty by seconds gives you Hashes/second then the unit of difficulty must by Hashes.

However, the way it's defined in the yellow paper implies that it's a number that does not have any units (similar to coefficient of friction in physics or many other coefficients that don't have units of measure). This is how difficulty is defined in the yellow paper:

difficulty: A scalar value corresponding to the difficulty level of this block. This can be calculated from the previous block’s difficulty level and the timestamp;

Then in the section 4.4.4:

a smaller period between the last two blocks results in an increase in the difficulty level and thus additional computation required, lengthening the likely next period. Conversely, if the period is too large, the difficulty, and expected time to the next block, is reduced.

Then they give the formula for the mix-hash validity which depends on the difficulty and from this formula the difficulty can be interpreted as the average number of PoW function executions (which involves hash function execution) required to satisfy the formula (think mine a block):

enter image description here

So from the way it's defined difficulty is a number proportional to the average number of PoW function executions needed to mine a block. It doesn't have any units. However since the proportion is one-to-one it is equal to the number of PoW function executions, or simply "hashes".

Your Answer

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

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