Author

Topic: I am changing the Subsidy algorithm, any feedback? (Read 123 times)

full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
I am doing an altcoin:
I want to have an halving every year (210000/4 block or so) and I want to distribute 28028* COIN to the miners with a halving of 1.61
Also I pre-mine 100 Billions
Am I doing anything wrong?

Programmers, let me know your feedback  Shocked

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
        CAmount nSubsidy=0;
double halvings = nHeight / consensusParams.nSubsidyHalvingInterval; // no need to be an int with new algo

if(nHeight  == 3)  // block 3 is pre-mining
{
CAmount nSubsidy = 100000000000 * COIN;  // premine 100 billions
halvings=1.0;
}else {
CAmount nSubsidy = 28028 * COIN;
int years = (int) nHeight/52560; // 210000/4
halvings = (years/1.618033988750);
}

if (halvings<=1.0) halvings=1.0;
nSubsidy =   nSubsidy / halvings;

    return nSubsidy;
}

Jump to: