<p>Each new block starts with a "coinbase" transaction, which specifies the generated coins for the block. </p>

<p>The code at the top of CreateNewBlock in main.cpp adds the coinbase tx to the new block, and later on calls GetBlockValue to determine the number of generated coins. </p>

<p>The coinbase transaction uses the scriptPubKey parameter of CreateNewBlock to specify the recipient of the generated coins. </p>

CC BY-SA 3.0
2014-03-22T17:15:48.183Z
2014-03-22T17:15:48.183Z
hsmiths
<p>I was just looking through the Bitcoin code but since I am relatively new to C++ I was wondering, if anybody could tell me where the code responsible for sending coins generated through mining to the wallet is located.</p>

<p>Thanks.</p>

<mining-reward><bitcoin-core-development><coinbase-transaction>
Where is the code that sends generated Bitcoins from mining to the wallet?
Cheese
# Where is the code that sends generated Bitcoins from mining to the wallet?

(Asked by: username_0 on 2014-03-22)

I was just looking through the Bitcoin code but since I am relatively new to C++ I was wondering, if anybody could tell me where the code responsible for sending coins generated through mining to the wallet is located.

Thanks.

**Tags:** mining-reward, bitcoin-core-development, coinbase-transaction


---

## 1 answers

### Answer by username_1 on 2014-03-22. Score: 2 | Accepted answer

Each new block starts with a "coinbase" transaction, which specifies the generated coins for the block.

The code at the top of CreateNewBlock in main.cpp adds the coinbase tx to the new block, and later on calls GetBlockValue to determine the number of generated coins.

The coinbase transaction uses the scriptPubKey parameter of CreateNewBlock to specify the recipient of the generated coins.


---

