Pages:
Author

Topic: The maximum number of coins in BC 0.8? (Read 226 times)

legendary
Activity: 4018
Merit: 1299
May 09, 2018, 10:16:49 AM
#21
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? Smiley

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.
member
Activity: 252
Merit: 11
Lord Shiva
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? Smiley

Just because he does not ask questions on the forum, but just silently makes mistakes in the code? ))
member
Activity: 252
Merit: 11
Lord Shiva

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?
legendary
Activity: 3388
Merit: 4615
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.
legendary
Activity: 1624
Merit: 2481
int128?  Smiley

 Roll Eyes




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.
member
Activity: 252
Merit: 11
Lord Shiva
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?
member
Activity: 252
Merit: 11
Lord Shiva
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?  Smiley

Tell me please.

member
Activity: 252
Merit: 11
Lord Shiva

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?
legendary
Activity: 3388
Merit: 4615
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

 Huh

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.
member
Activity: 252
Merit: 11
Lord Shiva
Mind telling us what you are trying to create? Another bitcoin fork?

Yes Smiley

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

 Huh
legendary
Activity: 1624
Merit: 2481
...hmmm

But when I try to compile it, it say to me:

Code:
src/main.h:55:47: warning: integer overflow in expression [-Woverflow]
 static const int64 MAX_MONEY = 13000000000000 * COIN;

What can I do with it?

//Or nothing needs to be done?



An 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?
member
Activity: 252
Merit: 11
Lord Shiva
...hmmm

But when I try to compile it, it say to me:

Code:
src/main.h:55:47: warning: integer overflow in expression [-Woverflow]
 static const int64 MAX_MONEY = 13000000000000 * COIN;

What can I do with it?

//Or nothing needs to be done?
member
Activity: 252
Merit: 11
Lord Shiva

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!  Smiley
legendary
Activity: 4018
Merit: 1299
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?




member
Activity: 252
Merit: 11
Lord Shiva
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".
legendary
Activity: 1583
Merit: 1276
Heisenberg Design Services
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?
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)
member
Activity: 252
Merit: 11
Lord Shiva
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?
legendary
Activity: 3388
Merit: 4615
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.


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.
sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
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!

As Danny said, Max_money has no effect whatsoever on the amount of coins.
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.
legendary
Activity: 3388
Merit: 4615
Since MAX_MONEY isn't actually used for controling how many coins are created, setting it bigger will just introduce some potential bugs.
Pages:
Jump to: