Bitcoin Forum
August 17, 2024, 02:17:51 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to send portion of mining reward to different wallet address?  (Read 155 times)
Ealex (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
December 09, 2017, 08:27:15 AM
 #1

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?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!