Author

Topic: What's wrong with PPCoin's difficulty algorithm? (Read 2589 times)

legendary
Activity: 1205
Merit: 1010
February 12, 2013, 01:48:35 AM
#5
Looking at your chart my guess is that you just feed an array of actual block spacing to the calculation of block difficulty. If this is not what you did then you can disregard this post.

If you did that say keep feeding a 9-minute actual spacing into the difficulty calculation, yeah I could imagine your result in the chart. However that's not the correct way of simulating things. With a different difficulty adjustment algorithm, you wont get the same actual spacing series. This is because unlike bitcoin's 2-week adjustment, ppcoin's adjustment is every block. You would quickly raise the difficulty and then given the same network hashrate, you would see a completely different series of actual block spacing. If you still doubt it, you can try devcoin's adjustment as well I bet it's gonna look the same as ppcoin's on your chart.

I hope this would clear some misunderstandings here.
legendary
Activity: 1205
Merit: 1010
I wonder if Sunny King will talk to me about this without DDoSing me off the internet for 3 days? Like he did the last time?

Can you not throw baseless accusations around? What do you mean that I 'DDoSing you off the internet'? Why do I even do that assuming even if I have such capability? I genuinely view all altcoin developers as all part of a big team and I truly hope all can be friends of each other and help each other.

The above is the code I used to get PPCoin difficulty on the Bitcoin blockchain. To reduce the amount of data I only printed it to the debug file once every 72 blocks and plotted the result with GNU Octave.

As you can see, your equation
Quote
hash rate = difficulty * (2**32) / spacing target
is quite wrong. PPcoin uses the interblock spacing, not the hash rate, to determine its difficulty. In fact, its pretty impossible to know the exact hash rate of a cryptocurrency. Why would you think your own coin uses hash rate in the calculation?

Please do describe details the process you derive the chart. The equation I gave is the way to estimate network hash rate, I never said you could get exact hash rate of the network, it's an approximation.

The difficulty adjustment is not complicated but based on a very easy to understand moving average. And it has been observed to produce difficulty matching the formula above. If you set spacing target to a fixed 600 second (the same as bitcoin), then it should generally match the bitcoin curve only a bit smoother. Please do describe how you derive your chart in more detail so we can look at what might have gone wrong.
sr. member
Activity: 966
Merit: 311
I wonder if Sunny King will talk to me about this without DDoSing me off the internet for 3 days? Like he did the last time?

Let's take another shot now that "NovaCoin" has released with the PPCoin difficulty algorithm.

Quote

    int64 nActualSpacing = (pindexLast->GetBlockTime() - pindexLast->pprev->GetBlockTime());


    CBigNum bnPPC;
    bnPPC.SetCompact(nPPCBits);

  //  printf("\n\nBefore: %08x  %s\n", bnPPC.GetCompact(), bnPPC.getuint256().ToString().c_str() );

    int64 nTargetSpacing = 600;
    int64 nInterval = nTargetTimespan / nTargetSpacing;
    bnPPC *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
    bnPPC /= ((nInterval + 1) * nTargetSpacing);

    if (bnPPC > bnProofOfWorkLimit)
        bnPPC = bnProofOfWorkLimit;

   // printf("PPC  : %08x  %s\n\n", bnPPC.GetCompact(), bnPPC.getuint256().ToString().c_str());

    nPPCBits = bnPPC.GetCompact();


The aboive is the code I used to get PPCoin difficulty on the Bitcoin blockchain. To reduce the amount of data I only printed it to the debug file once every 72 blocks and plotted the result with GNU Octave.

As you can see, your equation
Quote
hash rate = difficulty * (2**32) / spacing target
is quite wrong. PPcoin uses the interblock spacing, not the hash rate, to determine its difficulty. In fact, its pretty impossible to know the exact hash rate of a cryptocurrency. Why would you think your own coin uses hash rate in the calculation?
legendary
Activity: 1205
Merit: 1010
I have no idea how you get this graph but I think you need to review some basics as I have already mentioned in ppcoin thread:

Code:
hash rate = difficulty * (2**32) / spacing target

ppcoin proof-of-work spacing target: between 10 minutes and 2 hours (1x-12x of bitcoin's)
bitcoin spacing target: 10 minutes

So ppcoin's proof-of-work difficulty is at most 12x of bitcoin's difficulty at the same hash rate, and most likely much less than that.
sr. member
Activity: 966
Merit: 311
I decided to make a quick graph of what would happen if Bitcoin used PPCoin's difficulty adjustment. The results are kind of strange, as you can see in the graph below.

The results are on a semi-log plot, with the Y axis being difficulty and the X axis being blocks. As you can see, when Bitcoin has a difficulty of 10^6 (one million) PPCoin has a difficulty of 10^10 (10 billion).



I think that's a little high. Do you think Bitcoin would be successful if it had a mining difficulty of 10 billion right now? Is this how SunnyKing will achieve his goals of a coin that nobody wants to mine?
Jump to: