Author

Topic: How max money works? (Read 238 times)

member
Activity: 364
Merit: 13
Killing Lightning Network with a 51% Ignore attack
July 26, 2018, 09:04:42 PM
#7
After I pre-mined whole max money at once, still I can earn mining reward when I mining.

And my immature balance shows over max_money variable I set at source code.

Then if I get and spend more than max money, what happen?

Is this normal, no problem?


Max_Money variable does not limit the total amount of coins that can be mined or staked.
It merely limits the size of the largest amount you can send in a single transaction, nothing else.
legendary
Activity: 3122
Merit: 2178
Playgram - The Telegram Casino
July 26, 2018, 06:30:09 AM
#6
But above MAX_MONEY value's sanity check, how it work?

For instance by declining any transaction including an amount larger than MAX_MONEY

Code:
if (txout.nValue > MAX_MONEY)
      return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-toolarge");
https://github.com/bitcoin/bitcoin/blob/3c098a8aa0780009c11b66b1a5d488a928629ebf/src/consensus/tx_verify.cpp#L176

Follow bob123's advice from above and do a simple text search on Bitcoin's repo.


And what happen pre-mine 100% of coin and still mining reward is not 0?

...then you probably didn't set the mining reward / block subsidy to 0?
legendary
Activity: 1624
Merit: 2481
July 26, 2018, 02:09:30 AM
#5
Not that your threads are annoying /s

No.. not at all..  Roll Eyes



But above MAX_MONEY value's sanity check, how it work?

The source code can be found here: https://github.com/bitcoin/bitcoin.
You can find all neccessary information there.



And what happen pre-mine 100% of coin and still mining reward is not 0?

Well, obviously you didn't premine 100% then  Roll Eyes
jr. member
Activity: 413
Merit: 5
July 25, 2018, 10:36:42 PM
#4
MAX_MONEY is bitcoin's source code is not the limit of the number of coin you can mine in the chain. This is controlled by a set of other parameters & algorithm defined in the protocol (difficulty, rewards through time, etc). MAX_MONEY is used for some controls/checks (do a quick "grep -r MAX_MONEY src", you'll be able to see by yourself).

It is even written in source code (src/amount.h):

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;

Most cheap altcoins developers would think that it is sufficient to change this number, but in fact, this is whole wrong. Controlling the whole supply of a Bitcoin fork protocol is not as easy as changing a simple number.

So actual supply decided by subsidy (Reward) and halving rate. I know it.

But above MAX_MONEY value's sanity check, how it work? And what happen pre-mine 100% of coin and still mining reward is not 0?
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
July 11, 2018, 04:05:01 AM
#3
I thought you'd already asked something related to this, and yes you had: MAX_MONEY's possible max value is?

Not that your threads are annoying /s, just for your information:
Mostly all of your questions can be easily answered through custom google search (skip past through the ads) or Forum Search.
Here's one example: cloning bitcoin MAX_MONEY not working
full member
Activity: 198
Merit: 130
Some random software engineer
July 11, 2018, 03:55:40 AM
#2
MAX_MONEY is bitcoin's source code is not the limit of the number of coin you can mine in the chain. This is controlled by a set of other parameters & algorithm defined in the protocol (difficulty, rewards through time, etc). MAX_MONEY is used for some controls/checks (do a quick "grep -r MAX_MONEY src", you'll be able to see by yourself).

It is even written in source code (src/amount.h):

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;

Most cheap altcoins developers would think that it is sufficient to change this number, but in fact, this is whole wrong. Controlling the whole supply of a Bitcoin fork protocol is not as easy as changing a simple number.
jr. member
Activity: 413
Merit: 5
July 11, 2018, 03:46:13 AM
#1
After I pre-mined whole max money at once, still I can earn mining reward when I mining.

And my immature balance shows over max_money variable I set at source code.

Then if I get and spend more than max money, what happen?

Is this normal, no problem?
Jump to: