<p>The function is called <code>GetBlockSubsidy</code> now and it can be found in <code>validation.cpp</code>.</p>

CC BY-SA 4.0
2019-08-03T15:30:59.673Z
it looks like this method returns the amount how does this amount get accepted into a block. As this would be a transaction with no inputs and only the output of the reward.
Patrick W. McMahon
CC BY-SA 4.0
2019-08-03T15:45:15.697Z
does IsCoinBase() have to do with that?
Patrick W. McMahon
CC BY-SA 4.0
2019-08-03T15:50:36.853Z
Coinbase transactions have a special txid and vout combination that marks them as being coinbase transactions, which is what IsCoinbase() returns. If a transaction is a coinbase transaction, all input checks are just skipped. You can see that in `ConnectBlock`. The block reward is then checked after the inputs are checked here: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1940
Ava Chow
CC BY-SA 4.0
2019-08-03T15:59:58.843Z
I see thank you this gets  me on the right path. This looks to have solved two questions i had with removing the reward from the block and how to change how the reward is given out. Thank you.
Patrick W. McMahon
CC BY-SA 4.0
2019-08-03T15:27:09.837Z
2019-08-03T15:27:09.837Z
Ava Chow
<p>I have managed to build an altcoin (from litecoin source) but my coin requires that I make changes to the way rewards are made. I have been looking at the source code to try to find where block reward is handled and what method does all the work. I did find this (<a href="https://bitcoin.stackexchange.com/questions/24866/in-what-line-of-what-file-does-the-block-reward-depend-on">In what line of what file does the block reward depend on?</a>) however this looks to be old as i don't see a main.cpp file in the litecoin source. </p>

<p>does anyone know the modern files/methods that handle this. I already managed to follow the steps for creating my genesis block and everything looks to be working. I'm now in the phase of making changes. I would like to find the method that handles creating a block with a block reward. I will be changing how the block reward is done. </p>

<p>while I see <code>chainparams.cpp</code> has an ability to change the reward amount. I'm looking for a way to build a new type of reward system so i will need to look at how a coin is made from nothing. My coin will not be minting coins on block creation so i need to change how that method works.</p>

<block><litecoin><mining-reward><altcoin-development>
what file/method is block reward processed?
Patrick W. McMahon
# what file/method is block reward processed?

(Asked by: username_0 on 2019-08-03)

I have managed to build an altcoin (from litecoin source) but my coin requires that I make changes to the way rewards are made. I have been looking at the source code to try to find where block reward is handled and what method does all the work. I did find this ([In what line of what file does the block reward depend on?](https://bitcoin.stackexchange.com/questions/24866/in-what-line-of-what-file-does-the-block-reward-depend-on)) however this looks to be old as i don't see a main.cpp file in the litecoin source.

does anyone know the modern files/methods that handle this. I already managed to follow the steps for creating my genesis block and everything looks to be working. I'm now in the phase of making changes. I would like to find the method that handles creating a block with a block reward. I will be changing how the block reward is done.

while I see `chainparams.cpp` has an ability to change the reward amount. I'm looking for a way to build a new type of reward system so i will need to look at how a coin is made from nothing. My coin will not be minting coins on block creation so i need to change how that method works.

**Tags:** block, litecoin, mining-reward, altcoin-development


---

## 1 answers

### Answer by username_1 on 2019-08-03. Score: 0 | Accepted answer

The function is called `GetBlockSubsidy` now and it can be found in `validation.cpp`.

> **Comments:**
> **username_0**: it looks like this method returns the amount how does this amount get accepted into a block. As this would be a transaction with no inputs and only the output of the reward.  
> **username_0**: does IsCoinBase() have to do with that?  
> **username_1**: Coinbase transactions have a special txid and vout combination that marks them as being coinbase transactions, which is what IsCoinbase() returns. If a transaction is a coinbase transaction, all input checks are just skipped. You can see that in `ConnectBlock`. The block reward is then checked after the inputs are checked here: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1940  
> **username_0**: I see thank you this gets  me on the right path. This looks to have solved two questions i had with removing the reward from the block and how to change how the reward is given out. Thank you.  

---

