bitcoin candy pow function : 함수패턴 변화 필요합니다

in #cdy6 years ago (edited)

https://steemit.com/cdy/@bluejaytodd/18-5-1
위에서 단순히 조건문만 바꾸면 된다고 판단했는데, 이것으로 부족할 것 같습니다.
고래 채굴자가 20~60개 블럭을 빠른 속도로 채굴하기 때문에 난이도 조정이 더욱 빠르게 되야 합니다.

581683블럭 9시17분
581646블럭 9시 8분 9분동안 37개발견 8.2배 속도로 발견

581645블럭 8시8분
581624블럭 7시 53분 15분동안 21개발견 2.8배 속도로 발견

581623블럭 7시21분
581567블럭 7시 12분 9분동안 56개발견 12.4배 속도로 발견

그래서 weight 함수 패턴을 k weight 에서 k*k weight 패턴으로 바꿉니다. 그리고 averaging window도 현재 60개에서 20개 정도로 축소 시킵니다. 바꿔야 할부분이 별로 많지 않습니다. 다음과 같이 바꾸면 될것같습니다. 그러면 고래채굴자가 갑자기 해시를 폭증시켜도 빠른 속도로 난이도 조절이 가능합니다.

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;

위 자료를 캔디 개발진에게 전달가능 하신분 부탁드립니다 . 고래채굴자 이걸로 충분히 견제가 가능합니다.

Coin Marketplace

STEEM 0.20
TRX 0.16
JST 0.030
BTC 66297.29
ETH 2682.98
USDT 1.00
SBD 2.87