How Difficulty Rate Is Calculated

Can someone please explain to me exactly how the level of difficulty is calculated?

Why is it different than what the hash rate is? Seem’s like if the hash rate drops, it takes more time before the difficulty starts to decrease. Does difficulty scale up faster than it scales down? Looks almost looks like difficulty might go up at like 3/4th the speed of the hash rate, but it’s almost like it goes down at 1/4th the speed of the hash rate?

Difficulty: http://bitinfocharts.com/comparison/difficulty-ppc.html

Hash Rate: http://bitinfocharts.com/comparison/hashrate-ppc.html

The proof-of-work difficulty is adjusted to keep the average time between proof-of-work blocks between 10 and 120 minutes, and within those constraints to keep the average time between all blocks (proof-of-work AND proof-of-stake together) at approximately 10 minutes. As a result, the PoW difficulty responds to changes in PoS hash rate.

I’m not sure if the rate of change is different for scaling up vs scaling down. The code seems to try to smooth everything to a time constant of one week. However PPC is seeing very dramatic changes in PoW hash rate and perhaps that triggers some sort of bias in one direction or the other. I don’t understand the dynamics of the difficulty adjustment very well.

The puzzle is more complicated because those two plots do not only show a causal relation between hash rate and difficulty. There is also a causal relation in the other direction: when difficulty becomes high, all miners walk away to bitcoin and vice versa. This second effect is very non-linear: rational miners walk away in huge numbers as soon as the difficulty crosses a certain threshold.

Does anybody know why the PoW block spacing is variable? I have been wondering about that for a while.

The code says:
“proof-of-stake block is always favored over proof-of-work block. this is to preserve the energy efficiency property”

Do you think this has something to do with it?

[quote=“Alertness, post:3, topic:377”]The code says: “proof-of-stake block is always favored over proof-of-work block. this is to preserve the energy efficiency property”
Do you think this has something to do with it?[/quote]

No. That comment is with respect to resolving competing blocks.

If the goal was maximum energy efficiency, PoW spacing could have been fixed to 120 minutes.
Perhaps the goal was low initial PoW spacing for stability, followed by gradual larger PoW spacing once PoS became popular. But what we have now is PoW spacing bouncing around like crazy.

Sunny K. has said he is planning on answering this question and explaining it along with several other questions currently in the community, but he is currently devoting his time to working on PPC v0.4, and will get to to these topics once it has been released and he has more time.
:slight_smile: so just be patient for now.