Bitcoin Forum
November 05, 2024, 02:57:50 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How max money works?  (Read 234 times)
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 413
Merit: 5


View Profile WWW
July 11, 2018, 08: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?
starmyc
Full Member
***
Offline Offline

Activity: 198
Merit: 130

Some random software engineer


View Profile
July 11, 2018, 08:55:40 AM
Merited by ABCbits (1), AdolfinWolf (1)
 #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.

Hi, I'm just some random software engineer.
You can check my projects: Bitcoin & altcoin balances/addresses listing dumps: https://balances.crypto-nerdz.org/
nc50lc
Legendary
*
Offline Offline

Activity: 2590
Merit: 6329


Self-proclaimed Genius


View Profile
July 11, 2018, 09: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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 413
Merit: 5


View Profile WWW
July 26, 2018, 03:36:42 AM
 #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?
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
July 26, 2018, 07: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

HeRetiK
Legendary
*
Offline Offline

Activity: 3108
Merit: 2177


Playgram - The Telegram Casino


View Profile
July 26, 2018, 11: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?

▄▄███████▄▄███████
▄███████████████▄▄▄▄▄
▄████████████████████▀░
▄█████████████████████▄░
▄█████████▀▀████████████▄
██████████████▀▀█████████
████████████████████████
██████████████▄▄█████████
▀█████████▄▄████████████▀
▀█████████████████████▀░
▀████████████████████▄░
▀███████████████▀▀▀▀▀
▀▀███████▀▀███████

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 
Playgram.io
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

▄▄▄░░
▀▄







▄▀
▀▀▀░░
▄▄▄███████▄▄▄
▄▄███████████████▄▄
▄███████████████████▄
▄██████████████▀▀█████▄
▄██████████▀▀█████▐████▄
██████▀▀████▄▄▀▀█████████
████▄▄███▄██▀█████▐██████
█████████▀██████████████
▀███████▌▐██████▐██████▀
▀███████▄▄███▄████████▀
▀███████████████████▀
▀▀███████████████▀▀
▀▀▀███████▀▀▀
██████▄▄███████▄▄████████
███▄███████████████▄░░▀█▀
███████████░█████████░░
░█████▀██▄▄░▄▄██▀█████░
█████▄░▄███▄███▄░▄█████
███████████████████████
███████████████████████
██░▄▄▄░██░▄▄▄░██░▄▄▄░██
██░░░░██░░░░██░░░░████
██░░░░██░░░░██░░░░████
██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▄▄████
███████████████████████
███████████████████████
 
PLAY NOW

on Telegram
[/
Zin-Zang
Member
**
Offline Offline

Activity: 364
Merit: 13

Killing Lightning Network with a 51% Ignore attack


View Profile
July 27, 2018, 02:04:42 AM
 #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.

I was Red Tagged because Lauda Blows Theymos to get back on DT
The rest are just lauda's personal butt monkeys=> Hhampuz , Vod, TMAN , achow101
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!