2

Excerpt from page 6 of the yellow paper:

enter image description here

The paper focuses more on the difficulty bomb ε but says little about the rationale of mandating 131072 and 2048 as scalars. I guess the former is merely an arbitrary value, but I'm not sure about the other. Is it because with a smaller difficulty the incentives wouldn't work?

2 Answers 2

1

Short answer:

1/2048 here is the highest possible natural (i.e. not taking time bomb into account) relative difficulty increase for a block with no uncles. For a block with uncles this number is twice as high: 1/1024. So if previous block had difficulty of x, then current block will have difficulty of at most x + x/2048, in case current block doesn't have any uncles, and x + x/1024 if it does have.

Long answer:

Let's explain the notation used in the yellow paper:

D_0: Difficulty of the first block and minimum possible difficulty for any other block (131072)

H: Header of current block

P(H): Parent block of H

P(H)_{H_d}: Parent block difficulty

x: Maximum possible absolute difficulty increase in case current block has no uncles (P(H)_{H_d} / 2048)

\varsigma_2: Difficulty change factor [-99 .. +2]

\epsilon: Difficulty bomb addition

y: Maximum possible difficulty change factor (1 if current block has no uncles, 2 otherwise)

H_s: Current block timestamp in seconds

P(H)_{H_s}: Parent block timestamp seconds

9: Target block mining time in seconds

-99: Minimum possible difficulty change factor

So, basically, for block with no uncles, difficulty change factor is 1 - t / 9, where t is the mining time of current block. If mining time is exactly 9 seconds, change factor will be zero. If mining time is less than one, then change factor is positive, i.e. difficulty increases when blocks are being mined too fast. If mining time is greater than 9, then change factor is negative, thus difficulty decreases when blocks are being mined too slow.

For blocks with uncles, difficulty change factor is 2 - t / 9, so “neutral” mining time is 18 seconds. Thus, if many blocks have uncles, then block mining time will drift towards 18 seconds, while if there are few blocks with uncles, it will drift towards 9 seconds.

Difficulty change factor is that multiplied by x, i.e. by the difficulty of the parent block divided by 2048. So in case difficulty change factor is +1, then the dificculty will be changed by 1/2048 of the part block's difficulty.

0

They are both a power of 2.

Since D0 only matter when creating the genesis block any large constant should have been fine.

Since 2048 is a power of 2 then the division can be optimized into a shift operation.

1
  • I see, but I guess it's also about choosing a value which is both a power of 2 and a non-trivial one. That is, a difficulty such as 16 would've been too small, wouldn't it? Commented Sep 24, 2018 at 21:22

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.