Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: dafa_ce on August 11, 2021, 06:59:16 AM



Title: Block rewards
Post by: dafa_ce on August 11, 2021, 06:59:16 AM
Hi All

Just creating an altcoin based of bitcoin. Was just wondering the following:

- In amount.h if i cahnge the maxmoney (for sanity check)

static const CAmount COIN = 100000000;

/** No amount larger than this (in satoshi) is valid.
 *
 * Note that this constant is *not* the total money supply, which in Cerebralcoin
 * currently happens to be less than 21,000,000 CEB for various reasons, but
 * rather a sanity check. As this sanity check is used by consensus-critical
 * validation code, the exact value of the MAX_MONEY constant is consensus
 * critical; in unusual circumstances like a(nother) overflow bug that allowed
 * for the creation of coins out of thin air modification could lead to a fork.
 * */
static const CAmount MAX_MONEY = 63000000000 * COIN;

That would imply the max money would be 63000000000 * 100000000.. that wont overflow will it?

- Also in regards to GetBlockSubsidy

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

    CAmount nSubsidy = 150000 * COIN;
   
    nSubsidy >>= halvings;
    return nSubsidy;
}

I've change the nsubsidy to the above. So it should the above maths be right?