0

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

1 Answer 1

1

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.

2
  • 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
    Feb 18, 2020 at 18:34
  • 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.
    – Andrew Chow
    Feb 19, 2020 at 3:28

Your Answer

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

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