<p>Bitcoin Core does not set the payout address. It can only do that when you use the internal miner (i.e. use the <code>generatetoaddress</code> command, but only on regtest). Otherwise, external mining software sets the address. This is because Bitcoin Core does not just send a complete block that the mining software just works on.</p>

<p>Rather, those mining software use the <code>getblocktemplate</code> RPC which returns a block template. This template does not include a coinbase transaction. It just includes information necessary to construct the coinbase (such as amounts) as well as the transaction data to include in the block. But it is not a block itself and the external miner still has to construct their own coinbase transaction and block given the information in the block template.</p>

<p>So Bitcoin Core cannot force an external mining software to use a particular output script in the coinbase transaction. You have to configure your mining software to do that.</p>

CC BY-SA 4.0
2020-02-18T18:34:42.613Z
Thanks for the insight, Andrew. I understand that the mining software would submit a block with transactions via RPC to the Core software, which gets validated and checked. My goal is to override the Coinbase transaction during validation. My aim is to prove that in a distributed consensus system like bitcoin, this type of override should fork the network and leave the attacker/overrider on a different chain than the rest of the network - since consensus on the transaction was to the miner; not to the attacker. With that in mind, can you describe where these checks would take place?
n64
CC BY-SA 4.0
2020-02-19T03:28:00.590Z
There is none because what you are suggesting is not how Bitcoin works. The miner's "pubkey" is not part of validation and there is no consensus on who the miner is or who gets paid for a block except what is given in the coinbase transaction. The miner can choose to pay someone else if he wanted to. And immediately in the next block pay himself. There is nowhere where miners are identified nor their blocks identified and tied to them.
Ava Chow
CC BY-SA 4.0
2020-02-18T16:03:36.483Z
2020-02-18T16:03:36.483Z
Ava Chow
<p>I understand that a miner using an application like pooler’s cpuminer can set a Coinbase-txn address where new coins that are generated to. I’m trying to override this setting in the code of the core client for an academic project to demonstrate bitcoin’s consensus mechanism. When I try to set a fixed address in the core client, the miner is still being paid out to the address they set rather than the hardcoded one in the miner.cpp file</p>

<p>How does the address get sent for a miner’s Coinbase transaction payout? Having some insight into where the logic is would allow me to further try and troubleshoot my project.</p>

<p>Thank you</p>

<mining-reward><bitcoin-core-development>
How does a miner’s pubkey get passed into miner.cpp?
n64
# How does a miner’s pubkey get passed into miner.cpp?

(Asked by: username_0 on 2020-02-17)

I understand that a miner using an application like pooler’s cpuminer can set a Coinbase-txn address where new coins that are generated to. I’m trying to override this setting in the code of the core client for an academic project to demonstrate bitcoin’s consensus mechanism. When I try to set a fixed address in the core client, the miner is still being paid out to the address they set rather than the hardcoded one in the miner.cpp file

How does the address get sent for a miner’s Coinbase transaction payout? Having some insight into where the logic is would allow me to further try and troubleshoot my project.

Thank you

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


---

## 1 answers

### Answer by username_1 on 2020-02-18. Score: 1 | Accepted answer

Bitcoin Core does not set the payout address. It can only do that when you use the internal miner (i.e. use the `generatetoaddress` command, but only on regtest). Otherwise, external mining software sets the address. This is because Bitcoin Core does not just send a complete block that the mining software just works on.

Rather, those mining software use the `getblocktemplate` RPC which returns a block template. This template does not include a coinbase transaction. It just includes information necessary to construct the coinbase (such as amounts) as well as the transaction data to include in the block. But it is not a block itself and the external miner still has to construct their own coinbase transaction and block given the information in the block template.

So Bitcoin Core cannot force an external mining software to use a particular output script in the coinbase transaction. You have to configure your mining software to do that.

> **Comments:**
> **username_0**: Thanks for the insight, Andrew. I understand that the mining software would submit a block with transactions via RPC to the Core software, which gets validated and checked. My goal is to override the Coinbase transaction during validation. My aim is to prove that in a distributed consensus system like bitcoin, this type of override should fork the network and leave the attacker/overrider on a different chain than the rest of the network - since consensus on the transaction was to the miner; not to the attacker. With that in mind, can you describe where these checks would take place?  
> **username_1**: There is none because what you are suggesting is not how Bitcoin works. The miner's "pubkey" is not part of validation and there is no consensus on who the miner is or who gets paid for a block except what is given in the coinbase transaction. The miner can choose to pay someone else if he wanted to. And immediately in the next block pay himself. There is nowhere where miners are identified nor their blocks identified and tied to them.  

---

