Author

Topic: cloning bitcoin MAX_MONEY not working (Read 244 times)

member
Activity: 61
Merit: 15
April 18, 2018, 04:29:13 AM
#4
The MAX_MONEY does not control the money supply, total coins is controlled by the mining process. In bitcoin, you have to change block reward to achieve what you want.

The comment of MAX_MONEY explained it clealy:
Code:
/** No amount larger than this (in satoshi) is valid.                           
 *                                                                             
 * Note that this constant is *not* the total money supply, which in Bitcoin   
 * currently happens to be less than 21,000,000 BTC 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 = 21000000 * COIN;                               

In fact, the total coins is calculated by block reward and halving intervals.
Code:
in validation.cpp
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 = 50 * COIN;
    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
    nSubsidy >>= halvings;
    return nSubsidy;
}

For example, if here you only change nSubsidy from 50 to 100, then max money will be close to 42000000. If you also change consensusParams.nSubsidyHalvingInterval, you will need to take it into calculation too.
legendary
Activity: 2296
Merit: 1014
April 02, 2018, 08:49:35 PM
#3
up
Search the code and look for value of all coins maybe is somewhere else that you did'nt change yet.
Maybe you didnt actually use that changes yet, check this two possibilities first.
newbie
Activity: 9
Merit: 0
April 02, 2018, 08:02:04 PM
#2
up
newbie
Activity: 9
Merit: 0
April 01, 2018, 04:08:33 PM
#1
I just clonned bitcoin and created a altcoin, the altcoin it is working , but the coin ammount seams not working well.

total of coins I chosed was: 1000

I have changed the amount of coins to be mined, to be 1000 but looks did not work, I have already 8000 coins mined, can someone explain why it is not working?

main.h

Code:
static const int64 MAX_MONEY = 1000 * COIN;  //coin limit

someone answer this but i kinda did not understand:

Code:
static const int64 MAX_MONEY = 1000 * COIN;  //coin limit

Maximum amount (in satoshi) allowed anywhere (in the whole network). COIN is equal to 10^8 This is NOT the total amount of coins which your software is going to produce.     Huh Huh Huh Huh Huh

I could find litecoin uses:
Code:
static const int64 MAX_MONEY = 84000000 * COIN;

potcoin uses:
Code:
static const int64 MAX_MONEY = 420000000 * COIN;

feathercoin uses:
Code:
static const CAmount MAX_MONEY = 336000000 * COIN;

why when I changed my coin did not work?

I found some links on google talking about it but I still not understand well how to fix the coin limit:
https://bitcointalksearch.org/topic/mainh-maxmoney-21000000-331069
https://bitcoin.stackexchange.com/questions/36612/why-doesnt-changing-max-money-change-the-maximum-number-of-coins

how the calculation I need to do?

can someone explain me that.


thank you.
Jump to: