user15435: I want to make an altcoin and since I am new, I wanted to know what sets the reward of a block after being mined.

user14109: main.cpp:
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;
}

miner.cpp (within CreateNewBlock):
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);


15435: <p>I want to make an altcoin and since I am new, I wanted to know what sets the reward of a block after being mined.</p>
 14109: <p>main.cpp:</p>

<pre><code>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 &gt;&gt;= (nHeight / Params().SubsidyHalvingInterval());

    return nSubsidy + nFees;
}
</code></pre>

<p>miner.cpp (within CreateNewBlock):</p>

<pre><code>pblock-&gt;vtx[0].vout[0].nValue = GetBlockValue(pindexPrev-&gt;nHeight+1, nFees);
</code></pre>
