1 where is the code for subsidy cut in half every 4 years
src/validation.cpp, line 1128
============================================================================
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return 0;
CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= halvings;
return nSubsidy;
}
============================================================================
2 where is 21 million hard cap .
src/amount.h
============================================================================
/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;
static const CAmount COIN = 100000000;
static const CAmount CENT = 1000000;
/** 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;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
============================================================================
✅ @jasonjiang73, let me be the first to welcome you to Steemit! Congratulations on making your first post!
I gave you a $.05 vote!
Would you be so kind as to follow me back in return?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @jasonjiang73! You received a personal award!
Click here to view your Board
Vote for @Steemitboard as a witness and get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @jasonjiang73! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit