Hi, could you please explain these:
Line 36/44 of source code "main.h":
static const unsigned int MAX_INV_SZ = 50000;
static const int64_t MIN_TX_FEE = 1000;
static const int64_t MIN_RELAY_TX_FEE = MIN_TX_FEE;
static const int64_t MAX_MONEY = 2000000000 * COIN;
static const int64_t COIN_YEAR_REWARD = 1 * CENT; // 1% per year
static const int64_t MAX_MINT_PROOF_OF_STAKE = 0.01 * COIN; // 1% annual interest
static const int MODIFIER_INTERVAL_SWITCH = 1000;
inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
Thanks.
It is the theoretical max amount to be sent in a transaction. It's posted way high as to never have an issue. It's been trolled to death on several coins. It has nothing to do with the amount of coins.
static const int64_t MAX_MONEY = 2000000000 * COIN;
It is the theoretical max amount to be sent in a transaction The generated coin depends on the formula in 3 functions:- GetProofOfWorkReward()
- GetProofOfStakeReward()
- GetProofOfWorkBonusRewardFactor()
No way. This function determines the max amount for a TX :
inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
The parameter :
static const int64_t MAX_MONEY = 2000000000 * COIN
set exactly the total coins that the code is allowed to produce ever.
Dear my friend, i'm not spreading FUD, i just want to warn you about. And please study coding before, cause it's not health for you, and your community, to trust what people says around. You can find any explanation on the bit coin wiki also.
I think somebody should fix this for the wealth of the coin and the community itself.
EDIT: Please explain in which way they are related and how they determines the total amount of generated coins, on your theory.
The generated coin depends on the formula in 3 functions:
- GetProofOfWorkReward()
- GetProofOfStakeReward()
- GetProofOfWorkBonusRewardFactor()
Thanks
Cheers.
From: https://twitter.com/DiamondDoge/status/478009875478634496A whole Supercoin discussion on Max_MoneyThis is called SLOPPY CODING you noobs.
if (dAmount <= 0.0 || dAmount > 150000000.0)
static const int64_t MAX_MONEY = 150000000 * COIN;
static const int64_t POW_MAX_MONEY = 50000000 * COIN;
This is how to do it, without hardcoding values
if (dAmount <= 0.0 || dAmount > MAX_MONEY)
But then, too much greed to see the truth
That value (150 million) is left over from SUPER's initial specs, prior to the recent fork. That line of code is innocuous. Read the thread, Polo-shill.
+1
MAX_MONEY is non issue, this has been repeated multiple times in the thread. At this point Busoni stuck his neck out and made a post on code he himself did not fully understand at all. Unfortunately for him his comments were incorrect and the code is clean, looks like he already knows this, based on his backpedaling posts once it was verified by other parties that it was incorrect.
Its just Amateur moves, all new entrepreneurs make stupid mistakes like this early in their career,
it either makes them or breaks them.
The take away here is, if you discover a "securtiy hole' prior to disclosing it publicly, one may review all the code that is affected in their software ecosystem. The entire process of disclosing security holes must be take serious[1], especially when you are dealing with high volume of BTC. He could of just said, "we found out super coin has funky code, and upon further research we found out that 70% of the other coins listed on our exchange suffer from the same venerability, we will look into the matter". Off course if he the above statement massive panic would ensue, and it would be difficult for poloneix recover, but not impossible. Tough decisions.
If busoni was acting in good faith of the community as he has repeated many times in this thread, then he would just clean up his OP, apologize and say that his initial comments were way off with his findings, it was dumb to post with out it being verified by multiple sources, and that he did not hire an expert in to conduct the coder review. Or he can just ignore it, and pray that we all forget in a few days how unprofessional their exchange currently looks to the community.
[1]
https://www.schneier.com/essays/archives/2007/01/schneier_full_disclo.htmlOK, let me tell (or teach, for some) you how the total coin is calculated:
1st, look at this function
int64_t GetProofOfWorkReward(int nHeight, int64_t nFees, const CBlockIndex* pindex)
and this
int64_t GetProofOfWorkBonusRewardFactor(CBlockIndex* pindex)
1st function calculates the regular pow payout, and the 2nd calculates the superblocks.
Now, block 1 = 2.5 mil coins (was a mini IPO I think)
block 2 - block 19200: 512 coins/block
next 9600 (10 days) blocks: 256 coins/block
next 9600 (10 days) blocks: 128 coins/block
next 9600 (10 days) blocks: 64 coins/block
next 9600 (10 days) blocks: 32 coins/block
next 9600 (10 days) blocks: 16 coins/block
next 9600 (10 days) blocks: 8 coins/block
next 9600 (10 days) blocks: 4 coins/block
next 9600 (10 days) blocks: 2 coins/block
afterwards: 1 coins/block
now the pow will be cut off at 1-2 coins/block.
Next, look at the superblocks: superblock
- Every 3 hours there will be a block with 4X normal payment (initial 2048 coins)
- Every day there will be a block with 16X normal payment (initial 8192 coins)
- Every 5 days there will be a block with 128X normal payment (initial 65536 coins)
So at initial phase, the 1 block day
average coin is:
1 day = 960 * 512 + 8 * (2,048 - 512) + (8,192 - 512) + 1/5 * (65,536 - 512)
= 491,520 + 12,288 + 7,680 + 13,004.8
= 524,492.8 coins
Total = 524,492.8 * (20 + 10 * 0.5 * ( 1 + 1/2 + 1/4 + 1/8 + ... ))
= 524,492.8 * 10 * (2 + 1) = 15,734,784 coins
This adds 2.5 mil mini IPO,
total PoW = 18.2 millions.
On top of this, you can calculate the PoS, PoS is difficult to calculate precisely, but you can estimate max possible value. My estimate is that it is under 50 millions as devs of Supercoin said.
Simple math, isn't it?
This issue has also been discussed back in February with 42 coinIntroductionWith a market capitalization ranking of 61
[1], the coin "42"
[2] is advertised as the "Highest Priced Crypto Coin Ever"
[3]. This high price is attributed to the coin's rarity, which is advertised to be limited to 42 total coins. Unfortunately, it looks like 42 coin and descendents thereof (like 8 coin) do not cap the money supply at the advertised number of coin. In fact, unlike most cryptocoins, the money supply of 42 appears to be unlimited.
Money GenerationIn bitcoin and most descendents the money supply is capped algorithmically in the function that calculates the mining subsidy. This function is called
GetBlockValue() in the source file "main.cpp". In the bitcoin code base, the source for this function is:
int64_t GetBlockValue(int nHeight, int64_t nFees)
{
int64_t nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval());
return nSubsidy + nFees;
}
Here, the subsidy is halved for each "halving interval", measured in blocks (although the calculation is obfuscated somewhat for the sake of computational efficiency). It can be proven
[4] that if all halving intervals are the same length (210,000), then the maximum amount of bitcoin ever produced will be
21,000,000 = 2 * 50 * 210,000
42 (and probably several descendants, such as
uses a
GetBlockValue() function like the following, taken from the 42 code base:
int64 static GetBlockValue(int nHeight, int64 nFees)
{
int64 nSubsidy = 0.000042 * COIN;
if(nHeight < 419)
{
nSubsidy = 0.0000001 * COIN;
}
if(nHeight == 1)
{
nSubsidy = 0.42 * COIN;
}
if(nHeight == 420) // yay its 420 :) Time for a smoke
{
nSubsidy = 0.00042 * COIN;
}
if(nHeight == 4242)
{
nSubsidy = 0.00042 * COIN;
}
if(nHeight == 42424)
{
nSubsidy = 0.00042 * COIN;
}
if(nHeight == 424242)
{
nSubsidy = 0.00042 * COIN;
}
if(nHeight == 4242424)
{
nSubsidy = 0.00042 * COIN;
}
return nSubsidy + nFees;
}
Except in a few cases (blocks 1-420, 4242, 42424, ...) all blocks will have the same reward of 0.000042 coin (ignoring fees). Notice that the 42 version of
GetBlockValue() has no halving interval and makes no attempt to curtail coin generation at the advertised maximum of 42 coin. Without a geometrically decreasing reward value, the money supply will grow indefinitely.
For 42, the advertised coin maximum of 42 coin will be produced before block 1,000,000 (42 / 0.000042), or in about 1.33 years. But the existing 42 code makes no provision to stop coin production at that time.
MAX_MONEYOne part of the code for most cryptocoins that may be confusing to developers is the MAX_MONEY constant in the source file called "main.h". MAX_MONEY has two uses in the 42 code: (1) as a sentinel return value (which won't be discussed) and (2) to check some transaction values to ensure that they make sense. For the latter purpose, MAX_MONEY is used in the inline function called
MoneyRange() in the "main.h" file:
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
This function simply checks to ensure that a value is not negative and does not exceed MAX_MONEY. Nowhere in the 42 codebase is MAX_MONEY checked against a sum of the balances of all accounts, which would require the computationally expensive task of either (1) calculating every account balance in the block chain and then adding them up, or (2) summing the coinbase (money generating) transactions over all blocks. The running total of money supply is not explicitly kept in the block chain.
The
MoneyRange() function is used a few times in the 42 code. An arbitrary example is checking the the sanity of a transaction, as in the
CTransaction::CheckTransaction() function within "main.cpp":
if (!MoneyRange(nValueOut))
return DoS(100, error("CTransaction::CheckTransaction() : txout total out of range"));
Nowhere in the code for 42 does is
MoneyRange() used to validate the total money supply of 42.
Notes:[1] http://coinmarketcap.com/[2] My screen name, tx42, is unrelated to 42 coin.
[3] http://www.42coin.org/[4] http://en.wikipedia.org/wiki/1/2_%2B_1/4_%2B_1/8_%2B_1/16_%2B_%E2%8B%AF