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.


1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.