Bitcoin Forum
June 06, 2024, 07:20:33 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: cloning bitcoin MAX_MONEY not working  (Read 235 times)
chicodosbitcoin (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 01, 2018, 08: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://bitcointalk.org/index.php?topic=331069.0
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.
chicodosbitcoin (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 03, 2018, 12:02:04 AM
 #2

up
Velkro
Legendary
*
Offline Offline

Activity: 2296
Merit: 1014



View Profile
April 03, 2018, 12:49:35 AM
 #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.
hushan
Member
**
Offline Offline

Activity: 61
Merit: 15


View Profile
April 18, 2018, 08:29:13 AM
Merited by amishmanish (2)
 #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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!