it is any command line to check the ammout of coins willl be create after build the wallet?

i just cloned bitcoin and changed the ammount of coins to be 10 million

MAX_MONEY = 10000000

so i would like to know if it is any command to check this value I inserted.

i know i can check the amount in circulation using the RPC call gettxoutsetinfo


First of all, changing MAX_MONEY won't change the total money supply. See Why doesn't changing MAX_MONEY change the maximum number of coins? You will instead have to specify a new initial block reward and halving interval.

There isn't a command line option to display the total number of coins to be created. But there is a unit test in the source code, called subsidy_limit_test that computes this value and compares it with the correct number for Bitcoin. You could adapt this code to do the computation and print out the result, and then change the test so that your code will pass.

  • many thanks to share your time and knowledge
    – chico lima
    Apr 11 '18 at 16:22

No, there is no way to display the value of this constant. However, I am not sure that this constant is really doing what you want to do, so let me explain its meaning.

The constant MAX_MONEY is the maximum amount that can appear in an individual bitcoin transaction, for instance in tx_verify.cpp in CheckTransaction. Here, actually two checks are done:

  1. The amount in each transaction output is checked against this value
  2. The total across all transaction outputs is checked

So you could theoretically check that your new value is used after a recompile by submitting a transaction violating these constraints and wait for the error message.

However, what you actually want to do (if I read your question correctly) is to increase the total amount of bitcoin that can be mined. This number is not directly hardcoded, but the limit results out of the fact that every 210000 blocks, the subsidy, i.e. the amount of BTC that a miner earns in addition to the transaction fees for mining a block, is halved. This is done in GetBlockSubsidy in validation.cpp, using the parameter nSubsidyHalvingInterval in chainparams.cpp. Thus if you want to change that value (destroying consensus), you would have to make changes at these locations in the source code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.