<<  >> (p.5)
    Author Topic: Devcoin  (Read 413047 times)
    Shattienator
    Newbie
    *
    Offline Offline

    Activity: 57
    Merit: 0


    View Profile
    August 14, 2011, 10:18:46 AM
    Last edit: August 14, 2011, 11:12:57 AM by Shattienator
     #81

    Because the devcoin difficulty is lower than the bitcoin difficulty, miners can switch in and out of the chain, which means the block generation rate varies wildly.  To fix this problem, the difficulty can be determined with a continous average rather a step function, and it can calculated over one day instead of two weeks.  This will lead to greater daily variation than bitcoin because it is being averaged over a small time; but it would be a much smaller variation than the current factor of more than two as a miner switches in and out.  The original code follows:

    Code:
       const int64 nTargetTimespan = 14 * 24 * 60 * 60;/ two weeks
        const int64 nTargetSpacing = 10 * 60;
        const int64 nInterval = nTargetTimespan nTargetSpacing;

        // Genesis block
        if (pindexLast == NULL)
            return bnProofOfWorkLimit.GetCompact();

        // Only change once per interval
        if ((pindexLast->nHeight+1) % nInterval != 0)
            return pindexLast->nBits;

    The new smooth average code, with a switch over at block 10,700 to give people time to download the new devcoin, follows:

    Code:
       // Genesis block
        if (pindexLast == NULL)
            return bnProofOfWorkLimit.GetCompact();

        int64 nTargetTimespan = 24 * 60 * 60;/ one day
        const int nSmoothBlock = 10700;
        if (pindexLast->nHeight < nSmoothBlock)
            nTargetTimespan *= 14;/ two weeks
        const int64 nTargetSpacing = 10 * 60;
        const int64 nInterval = nTargetTimespan nTargetSpacing;

        // Only change once per interval
        if (((pindexLast->nHeight+1) % nInterval != 0) && (pindexLast->nHeight < nSmoothBlock))
            return pindexLast->nBits;

    While this would fix the step change difficulty problem, would this create another other problem in turn?

    Bitcoin difficulty change is based on 2016 blocks generation rate. Two weeks - is just a milestone for averaging, but not an averaging interval.
    But the diffuculty change for daily average (or 144 blocks as 144*14=2016) can be set up much smaller then bitcoins 25-400%. Say - 10% increase/decrease based on daily average. So in two weeks we can get 22%-379% difficulty change rate (approximatelly) which is close to bitcoin but much more flexible.
    Namecoin have terrible difficulty problem due 2016 diffuculty averaging interval. Take a look at Namecoin next difficulty. Current generation rate is about 12% of required and next difficulty change is projected to early November. So namecoin have less then one block per hour! And this will last for several months.
Page 4
Viewing Page: 5