<p>The <a href="http://github.com/bitcoin/bitcoin/blob/6e7792003b5c520fcc81d223f07471d690594081/src/main.cpp#L996" rel="nofollow">relevant function</a> in the current latest git revision:</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>Which is used <a href="http://github.com/bitcoin/bitcoin/blob/6e7792003b5c520fcc81d223f07471d690594081/src/main.cpp#L1667" rel="nofollow">later in ConnectBlock()</a>, as follows :</p>

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

CC BY-SA 3.0
2014-01-02T19:27:59.483Z
2014-01-02T19:27:59.483Z
Stéphane Gimenez
<p>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 ?</p>

<block><mining-reward>
How is block reward set in time?
DevAnaly
# How is block reward set in time?

(Asked by: username_0 on 2014-01-02)

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 ?

**Tags:** block, mining-reward


---

## 1 answers

### Answer by username_1 on 2014-01-02. Score: 4 | Accepted answer

The [relevant function](http://github.com/bitcoin/bitcoin/blob/6e7792003b5c520fcc81d223f07471d690594081/src/main.cpp#L996) 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()](http://github.com/bitcoin/bitcoin/blob/6e7792003b5c520fcc81d223f07471d690594081/src/main.cpp#L1667), 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");

```


---

