3

Many coins have dynamic block reward over the time, for example Bitcoin was 50BTC/block years ago and now 25BTC. My question is how is it defined in the source code ? I searched in Litecoin's source code but found nothing... Is it done manually by releasing a new version each xxxx blocks ?

1 Answer 1

4

The relevant function in the current latest git revision:

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; } 

Which is used later in ConnectBlock(), as follows :

 if (block.vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees)) return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRId64" vs limit=%"PRId64")", block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)), REJECT_INVALID, "coinbase too large"); 
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.