Bitcoin Forum
June 20, 2019, 04:04:38 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is maximum possible number for MAX_MONEY variable?  (Read 145 times)
wsxdrfv
Newbie
*
Offline Offline

Activity: 322
Merit: 0


View Profile WWW
March 20, 2018, 03:27:51 AM
 #1

So bitcoin's Max_Money is 21,000,000

From programming perspective, what number this can be at its max?

Is that can be like 100000000000000000?

I know Bitcoin go down to up to 8 decimal places, 0.00000001 Bitcoin.

Is this right?

Then I think this also can affect to maximum possible number?
1561003478
Hero Member
*
Offline Offline

Posts: 1561003478

View Profile Personal Message (Offline)

Ignore
1561003478
Reply with quote  #2

1561003478
Report to moderator
1561003478
Hero Member
*
Offline Offline

Posts: 1561003478

View Profile Personal Message (Offline)

Ignore
1561003478
Reply with quote  #2

1561003478
Report to moderator
1561003478
Hero Member
*
Offline Offline

Posts: 1561003478

View Profile Personal Message (Offline)

Ignore
1561003478
Reply with quote  #2

1561003478
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Thanks1
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
March 20, 2018, 04:51:38 AM
 #2

So bitcoin's Max_Money is 21,000,000

From programming perspective, what number this can be at its max?

Is that can be like 100000000000000000?

I know Bitcoin go down to up to 8 decimal places, 0.00000001 Bitcoin.

Is this right?

Then I think this also can affect to maximum possible number?
Max 21,000,000
Heisenberg_Hunter
Sr. Member
****
Offline Offline

Activity: 546
Merit: 379



View Profile
March 20, 2018, 05:16:38 AM
Merited by achow101 (5), malevolent (1), ETFbitcoin (1)
 #3

No, I think you might be wrong in understanding the Max_Money variable. Max_Money is rather a sanity check and not the total money supply which when said in bitcoin is less than 21,000,000. This Max_Money constant is used to prevent people from doing a transaction not more than 21,000,000. For example if there happens to be a overflow bug within the network that happens to create a coin out of simple modification leads to a fork.

The total supply of btc will always be less than 21,000,000.

Code:
Subsidy is cut in half every 210000 blocks, which will occur approximately every 4 years
    nSubsidy >>= (nHeight / 210000);

Which means when the first 210000 blocks are created, the mining rewards were 50btc, and the next 210,000 blocks the reward is cut in half to 25 btc and the next 210000 blocks the reward is cut in half to 12.5 btc. This process continues till the total coins are mined out which will be equal to 20999999.9769btc which is approximately equal to 21 million.

We can even change the original value, to a higher value but it would disturb the integrity of community and the limit set by satoshi

I am not good in explaining programming techniques. Correct me if I am wrong Tongue

HeRetiK
Legendary
*
Offline Offline

Activity: 1148
Merit: 1062


the forkings will continue until morale improves


View Profile
March 20, 2018, 01:06:50 PM
 #4

From programming perspective, what number this can be at its max?

If by programming perspective you mean the data type being used -- currently Bitcoin uses 64 bit integers for transaction amounts.

Since one bit is being used for the sign (+/-) the largest number this data type can handle is 2^63 = 9,223,372,036,854,775,807 (= 9.22e+18)

So yeah, from a data type perspective it could be "something like 100000000000000000" (= 1.0e+17).

But no, from a protocol perspective such a transaction would be invalid.

wsxdrfv
Newbie
*
Offline Offline

Activity: 322
Merit: 0


View Profile WWW
March 21, 2018, 04:00:56 AM
 #5

From programming perspective, what number this can be at its max?

If by programming perspective you mean the data type being used -- currently Bitcoin uses 64 bit integers for transaction amounts.

Since one bit is being used for the sign (+/-) the largest number this data type can handle is 2^63 = 9,223,372,036,854,775,807 (= 9.22e+18)

So yeah, from a data type perspective it could be "something like 100000000000000000" (= 1.0e+17).

But no, from a protocol perspective such a transaction would be invalid.

Yes, so I meant, when someone make new alt-coin, I wondered how much that MAX_MONEY variable's value could be.

So then, Bitcoin's cases used 21,000,000 * COIN, so this COIN variable means so-called, Satoshi, and this can go below decimal 8

places, then actual Bitcoin's program can handle 21,000,000 * 10,000,000 = 210,000,000,000,000?

So this places in range of above you mentioned, 9,223,372,036,854,775,807

Then, new alt-coin's maximum possible value also should be in range of above, 9,223,372,036,854,775,807 / 10,000,000 (for satoshi, COIN variable) = 92,233,720,368

So total supply of alt-coin should be below than 92,233,720,368 ?
DannyHamilton
Legendary
*
Offline Offline

Activity: 2198
Merit: 1406



View Profile
March 21, 2018, 03:20:29 PM
 #6

From programming perspective, what number this can be at its max?

If by programming perspective you mean the data type being used -- currently Bitcoin uses 64 bit integers for transaction amounts.

Since one bit is being used for the sign (+/-) the largest number this data type can handle is 2^63 = 9,223,372,036,854,775,807 (= 9.22e+18)

So yeah, from a data type perspective it could be "something like 100000000000000000" (= 1.0e+17).

But no, from a protocol perspective such a transaction would be invalid.

Yes, so I meant, when someone make new alt-coin, I wondered how much that MAX_MONEY variable's value could be.

So then, Bitcoin's cases used 21,000,000 * COIN, so this COIN variable means so-called, Satoshi, and this can go below decimal 8

places, then actual Bitcoin's program can handle 21,000,000 * 10,000,000 = 210,000,000,000,000?

So this places in range of above you mentioned, 9,223,372,036,854,775,807

Then, new alt-coin's maximum possible value also should be in range of above, 9,223,372,036,854,775,807 / 10,000,000 (for satoshi, COIN variable) = 92,233,720,368

So total supply of alt-coin should be below than 92,233,720,368 ?

Unless you ALSO change the value of COIN or you change the code to use something larger than 64 bit integers.  If you do that then you can have ANY VALUE YOU WANT.

btcton
Legendary
*
Offline Offline

Activity: 1190
Merit: 1007

Professional SysAdmin / Hobbyist Developer


View Profile
March 21, 2018, 10:23:41 PM
 #7

From programming perspective, what number this can be at its max?

If by programming perspective you mean the data type being used -- currently Bitcoin uses 64 bit integers for transaction amounts.

Since one bit is being used for the sign (+/-) the largest number this data type can handle is 2^63 = 9,223,372,036,854,775,807 (= 9.22e+18)

So yeah, from a data type perspective it could be "something like 100000000000000000" (= 1.0e+17).

But no, from a protocol perspective such a transaction would be invalid.

Yes, so I meant, when someone make new alt-coin, I wondered how much that MAX_MONEY variable's value could be.

So then, Bitcoin's cases used 21,000,000 * COIN, so this COIN variable means so-called, Satoshi, and this can go below decimal 8

places, then actual Bitcoin's program can handle 21,000,000 * 10,000,000 = 210,000,000,000,000?

So this places in range of above you mentioned, 9,223,372,036,854,775,807

Then, new alt-coin's maximum possible value also should be in range of above, 9,223,372,036,854,775,807 / 10,000,000 (for satoshi, COIN variable) = 92,233,720,368

So total supply of alt-coin should be below than 92,233,720,368 ?

Unless you ALSO change the value of COIN or you change the code to use something larger than 64 bit integers.  If you do that then you can have ANY VALUE YOU WANT.

At this point I would be drawing at hypotheticals, but depending on the data type you use (in this case int64 or wider) it could also have effects on the kind of network protocol used. The bigger the data type, the more data would be required per possible transaction. To be fair, this would have to be an extremely large number, but it is nonetheless also important to consider in cases in which an altcoin could potentially be used as a more private, smaller coin that is not used by many and does not require a high quantity thereof. In such a case, one could use an int32 that would occupy only half of the space, albeit it would be much more limited in quantity to around 4 million minimum-denomination coins (satoshi equivalents) or around 40 coins if the same decimal levels as Bitcoin were used. It is worth mentioning that there are definitely useful use-cases for this, although maybe not so much for, say, a 128-bit data type.

Nothing to say.
samson
Legendary
*
Offline Offline

Activity: 1694
Merit: 1017


View Profile
March 24, 2018, 09:55:13 AM
 #8

From programming perspective, what number this can be at its max?

If by programming perspective you mean the data type being used -- currently Bitcoin uses 64 bit integers for transaction amounts.

Since one bit is being used for the sign (+/-) the largest number this data type can handle is 2^63 = 9,223,372,036,854,775,807 (= 9.22e+18)

So yeah, from a data type perspective it could be "something like 100000000000000000" (= 1.0e+17).

But no, from a protocol perspective such a transaction would be invalid.

Yes, so I meant, when someone make new alt-coin, I wondered how much that MAX_MONEY variable's value could be.

So then, Bitcoin's cases used 21,000,000 * COIN, so this COIN variable means so-called, Satoshi, and this can go below decimal 8

places, then actual Bitcoin's program can handle 21,000,000 * 10,000,000 = 210,000,000,000,000?

So this places in range of above you mentioned, 9,223,372,036,854,775,807

Then, new alt-coin's maximum possible value also should be in range of above, 9,223,372,036,854,775,807 / 10,000,000 (for satoshi, COIN variable) = 92,233,720,368

So total supply of alt-coin should be below than 92,233,720,368 ?

Unless you ALSO change the value of COIN or you change the code to use something larger than 64 bit integers.  If you do that then you can have ANY VALUE YOU WANT.

At this point I would be drawing at hypotheticals, but depending on the data type you use (in this case int64 or wider) it could also have effects on the kind of network protocol used. The bigger the data type, the more data would be required per possible transaction. To be fair, this would have to be an extremely large number, but it is nonetheless also important to consider in cases in which an altcoin could potentially be used as a more private, smaller coin that is not used by many and does not require a high quantity thereof. In such a case, one could use an int32 that would occupy only half of the space, albeit it would be much more limited in quantity to around 4 million minimum-denomination coins (satoshi equivalents) or around 40 coins if the same decimal levels as Bitcoin were used. It is worth mentioning that there are definitely useful use-cases for this, although maybe not so much for, say, a 128-bit data type.

He could double up by using a uint32 instead of int32, why use int32 anyway ? Are negative numbers used anywhere ?

There's a few weird decisions made long ago which seem to be trivial and add complexity where it's not really needed, I guess this was the programming style of the original programmer.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!