![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 09, 2017, 08:27:15 AM |
|
I am learning about the Bitcoin core code, and am attempting to make some small changes for learning purposes.
I am trying to implement logic that sends a portion of a block reward to an address decided by the developer, when any miner on the network successfully mines a block. My understanding is that I will need to change / add one of the outputs of the coinbase's transaction in miner.cpp at the function CreateNewBlock() by adding something like this to the vector of outputs in the coinbase transaction.
coinbaseTx.vout[1].scriptPubKey = <scriptPubKey with developers chosen address>;
Then, I will need to update the validation rules in Validation.cpp so that hackers couldn't change the address I added in miner.cpp to their own address, to bypass sending some of their reward to the fixed address.
My question
Firstly, how do I send some of the mining reward to a hardcoded address?
Secondly, how would I add this address to the validation rules such that nodes can verify this new rule when a new block is mined?
|