Title: The maximum number of coins in BC 0.8? Post by: Many Coins on May 06, 2018, 04:07:16 PM Can I set the
Code: static const int64 MAX_MONEY = 84000000 * COIN; from 84.000.000 to 1.000.000.000.000 in src/main.h ? Will not this be too large a number? Thank you! Title: Re: The maximum number of coins in BC 0.8? Post by: DannyHamilton on May 06, 2018, 04:13:10 PM Since MAX_MONEY isn't actually used for controling how many coins are created, setting it bigger will just introduce some potential bugs.
Title: Re: The maximum number of coins in BC 0.8? Post by: Xynerise on May 06, 2018, 04:21:33 PM Can I set the As Danny said, Max_money has no effect whatsoever on the amount of coins.Code: static const int64 MAX_MONEY = 84000000 * COIN; from 84.000.000 to 1.000.000.000.000 in src/main.h ? Will not this be too large a number? Thank you! Instead bitcoin uses the block subsidy and halving schedule in order to calculate the total max amount of coins. There are 50 Bitcoins created every block (starting from genesis block) and the amount halves every 210,000 blocks (~4 years) Summing that gives us 21,000,000 coins max for bitcoin. https://i.stack.imgur.com/tTVgM.gif Title: Re: The maximum number of coins in BC 0.8? Post by: DannyHamilton on May 06, 2018, 04:40:43 PM There are 50 Bitcoins created every block (starting from genesis block) and the amount halves every 210,000 blocks (~4 years) Summing that gives us 21,000,000 coins max for bitcoin. https://i.stack.imgur.com/tTVgM.gif Additionally, the number of coins created are managed as integers at the satoshi (0.00000001 BTC) level. Any decimal amount is simply truncated. Therefore, when the block reward is cut in half from 0.09765625 the next reward is 0.048828120 instead of 0.048828125. Then again when the block reward is cut in half from 0.01220703 the next reward is 0.006103510 instead of 0.006103515. Then from there the next reward is 0.003051750 instead of 0.003051755 Then 0.001525870 instead of 0.001525875 and so on... After you subtract out all those missing half-satoshis, the end result when the reward is cut from 0.00000001 to 0.0 is that only 20999999.9769 BTC have actually been mined. Furthermore, early on, there was a bug in someone's mining software. Because of the bug, they awarded themselves LESS than the maximum allowed block reward. This (along with other transaction effects) has resulted in more than 135.20897145 BTC missing from the UTXO in the blockchain. As such, there will never actually be more than 20999864.7679 BTC in the UTXO once all the bitcoins have been mined. Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 06, 2018, 05:30:46 PM Thank you, but I'm not talking about this.
Suppose I set a reward of 1.000.000 per block. Than Code: static const int64 MAX_MONEY = 1000000000000 * COIN; Will this number (1000000000000) exceed the maximum allowed? Title: Re: The maximum number of coins in BC 0.8? Post by: Heisenberg_Hunter on May 06, 2018, 06:11:42 PM Thank you, but I'm not talking about this. No. MAX_MONEY constant will prevent us to from doing a transaction not more than 1000000000000 . Max_Money has nothing to do with supply, it will just check weather the transaction is valid and is the transaction not more than the maximum coins. Your rewards (1 million) are for the initial blocks, it would decrease as years pass by and the final coin count will be surely less than 1000000000000 (considering your case) Suppose I set a reward of 1.000.000 per block. Than Code: static const int64 MAX_MONEY = 1000000000000 * COIN; Will this number (1000000000000) exceed the maximum allowed? Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 06, 2018, 08:22:36 PM No. MAX_MONEY constant will prevent us to from doing a transaction not more than 1000000000000 . Max_Money has nothing to do with supply, it will just check weather the transaction is valid and is the transaction not more than the maximum coins. Your rewards (1 million) are for the initial blocks, it would decrease as years pass by and the final coin count will be surely less than 1000000000000 (considering your case) Thank you! But can there be any limitations in the language (C++)? I remember that this is possible and somehow related to data types. For example, a "nonce" can not be more than a certain value - it is necessary to increment the value of "time". Title: Re: The maximum number of coins in BC 0.8? Post by: cr1776 on May 06, 2018, 08:41:55 PM No. MAX_MONEY constant will prevent us to from doing a transaction not more than 1000000000000 . Max_Money has nothing to do with supply, it will just check weather the transaction is valid and is the transaction not more than the maximum coins. Your rewards (1 million) are for the initial blocks, it would decrease as years pass by and the final coin count will be surely less than 1000000000000 (considering your case) Thank you! But can there be any limitations in the language (C++)? I remember that this is possible and somehow related to data types. For example, a "nonce" can not be more than a certain value - it is necessary to increment the value of "time". There are obviously limitations in every programming language. If you are still talking about Code: static const int64 MAX_MONEY = 84000000 * COIN; then you are dealing with an int64 value 8 bytes, 64 bits: Int64 -- (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807). (Or if it uint64 is unsigned, then 0 to double that.) Is that what you are asking? Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 06, 2018, 09:13:20 PM There are obviously limitations in every programming language. If you are still talking about Code: static const int64 MAX_MONEY = 84000000 * COIN; then you are dealing with an int64 value 8 bytes, 64 bits: Int64 -- (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807). (Or if it uint64 is unsigned, then 0 to double that.) Is that what you are asking? YES! This is it! Thank you SO MUCH, Bro! :) Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 12:47:26 PM ...hmmm
But when I try to compile it, it say to me: Code: src/main.h:55:47: warning: integer overflow in expression [-Woverflow] What can I do with it? //Or nothing needs to be done? Title: Re: The maximum number of coins in BC 0.8? Post by: bob123 on May 07, 2018, 12:53:12 PM ...hmmm But when I try to compile it, it say to me: Code: src/main.h:55:47: warning: integer overflow in expression [-Woverflow] What can I do with it? //Or nothing needs to be done? An overflow (https://en.wikipedia.org/wiki/Integer_overflow) is accomplished when you perform an arithmetic operation (e.g. multiplying) which results in an result bigger than possible to be represented by the chosen size of the data type. So you have either to choose another data type or use a work around. Mind telling us what you are trying to create? Another bitcoin fork? Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 01:30:17 PM Mind telling us what you are trying to create? Another bitcoin fork? Yes :) With MAX_MONEY = 13000000000000. And it is unclear what exactly needs to be changed if Quote Int64 -- (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807). (Or if it uint64 is unsigned, then 0 to double that.) 13000000000000 < 9,223,372,036,854,775,807 ??? Title: Re: The maximum number of coins in BC 0.8? Post by: DannyHamilton on May 07, 2018, 02:02:50 PM And it is unclear what exactly needs to be changed if Quote Int64 -- (-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807). (Or if it uint64 is unsigned, then 0 to double that.) 13000000000000 < 9,223,372,036,854,775,807 ??? What did you set the value of COIN to? What is the result of multiplying the value of COIN by 13000000000000? Is it greater than 9,223,372,036,854,775,807 ? You probably shouldn't be messing around with programming if you don't understand anything about programming. You are likely to introduce bugs and security flaws without knowing it. Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 02:17:18 PM What did you set the value of COIN to? What is the result of multiplying the value of COIN by 13000000000000? Is it greater than 9,223,372,036,854,775,807 ? I do not know what this variable is - COIN. Can you tell me? This is for example also here: Code: int64 nSubsidy = 50 * COIN; I do not understand why "50" for something else to multiply? Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 03:35:08 PM found this
Code: static const int64 COIN = 100000000; Now it is clear... ...but it is unclear what to do)) Can I change variable type int64 in Code: int64 nSubsidy = 1000000000000 * COIN; to... what? int128? :) Tell me please. Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 03:44:13 PM And if I just make less value
Code: static const int64 COIN = 100000000; in src\util.h This will simply reduce the value after the decimal point? And do not have to change anything else? Title: Re: The maximum number of coins in BC 0.8? Post by: bob123 on May 07, 2018, 04:12:00 PM int128? :) ::) And if I just make less value Code: static const int64 COIN = 100000000; in src\util.h This will simply reduce the value after the decimal point? And do not have to change anything else? You do realize that 'reducing the value after the decimal point' does give you less (smallest) possible units? It doesn't matter whether you have 100.000.000 ShitCoins with 100.000.000 shitoshis each or 100.000.000.000.000 shitcoins with 100 shitoshis each. You are basically just changing what you define as one shitcoin (1 shitcoin = x shitoshis). You are not only missing the whole point, but also seem to be unable to set up a proper crypto currency design. Please do not create another forked coin (excluding educational purpose, of course). It won't have any value. Title: Re: The maximum number of coins in BC 0.8? Post by: DannyHamilton on May 07, 2018, 04:14:02 PM This forum is to discuss Bitcoin. If you want to gain a beginner level understanding of how to program in C or C++, you'll need to look elsewhere.
Read this book until you understand it. It will answer most of your questions. https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628 Then, if you still have questions, come back and ask. Your profile says: "I can make a bitcoin clone for your money". I am not going to do the work for you. You want to get paid, then do the work yourself. If you are unable, then your customers need to pay SOMEONE ELSE that actually knows what they are doing. Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 04:42:08 PM It doesn't matter whether you have 100.000.000 ShitCoins with 100.000.000 shitoshis each or 100.000.000.000.000 shitcoins with 100 shitoshis each. Yes, I understand that. You are not only missing the whole point, but also seem to be unable to set up a proper crypto currency design. And it is possible more in detail? What does "proper crypto currency design" mean? Title: Re: The maximum number of coins in BC 0.8? Post by: Many Coins on May 07, 2018, 05:03:55 PM I am not going to do the work for you. You want to get paid, then do the work yourself. If you are unable, then your customers need to pay SOMEONE ELSE that actually knows what they are doing. And how do you know that he really knows this? :) Just because he does not ask questions on the forum, but just silently makes mistakes in the code? )) Title: Re: The maximum number of coins in BC 0.8? Post by: cr1776 on May 09, 2018, 02:16:49 PM I am not going to do the work for you. You want to get paid, then do the work yourself. If you are unable, then your customers need to pay SOMEONE ELSE that actually knows what they are doing. And how do you know that he really knows this? :) Just because he does not ask questions on the forum, but just silently makes mistakes in the code? )) You ask for references or examples of code that he has written or open source projects to which s/he has contributed code along with links to the code s/he has written. All that aside though, knowing how to declare of variable and what different data types are in various programming languages are is quite basic. For example, int vs float vs int64 etc. The book Danny mentioned above is a good reference to help you learn as you are going through the code. I read somewhere there was an ebook version of it, if you search for "the c programming language by brian w kernighan ebook" you may find it. At worst, having it as a reference is a good thing and you'll learn something. |