Post
Topic
Board Announcements (Altcoins)
Re: [ANN] Bitcoin Candy - Fork 1:1000 of Bitcoin Cash
by
gusterdd
on 02/05/2018, 01:55:39 UTC
candy need to change pow function.
ref) https://steemit.com/cdy/@bluejaytodd/bitcoin-candy-pow-function

chainparams.cpp
https://github.com/bitcoincandyofficial/bitcoincandy/blob/master/src/chainparams.cpp
 ################################################
        consensus.nZawyLwmaAveragingWindow = 60;

     change from 60 to 20  : decrease averaging window

        consensus.nZawyLwmaAveragingWindow = 20;

     //This(20) make change block time to 2 minute more faster.



pow.cpp
https://github.com/bitcoincandyofficial/bitcoincandy/blob/master/src/pow.cpp
unsigned int LwmaCalculateNextWorkRequired(const CBlockIndex* pindexPrev, const Consensus::Params& params)

 ################################################
        sum_time += solvetime * nWeight;  // Weighted solvetime sum. The nearsest blocks get the most weight.
        change to k^2 weight
        sum_time += solvetime * nWeight * nWeight;  // Weighted solvetime sum. The nearsest blocks get the most weight. with k^2 weight

 ################################################
 // Keep t reasonable in case strange solvetimes occurred.
// sum( k ) is N(N+1)/2
// next_target could be divided by 10 under extreme case

    if (sum_time < N * N * T / 2 /10) {
        sum_time = N * N * T /2 /10;
    }

change to k^2 weight pattern

 // Keep t reasonable in case strange solvetimes occurred.
// sum( k^2 ) is N(N+1)(2N+1)/6
// next_target could be divided by 100 under extreme case
    
if (sum_time < N * N * 2 * N * T /6 / 100) {
        sum_time = N * N * 2 * N * T /6 / 100 ;
    }

 ################################################
    arith_uint256 next_target = 2 * (sum_time/(N*(N+1)))* (sum_target/N) * adjust/T; // next_target = LWMA * avgTarget * adjust /T;

change to k^2 weight pattern

    arith_uint256 next_target = 6 * (sum_time/(N*(N+1)*(2*N+1)) )* (sum_target/N) * adjust/T; // next_target = LWMA * avgTarget * adjust /T;