2

Where are the rewards sent when using the submitblock function in the case the block is okay?

Murch
  • 75,206
  • 34
  • 186
  • 622

1 Answers1

5

The payout address that subsidy/fees are sent to is part of the block itself. The very first transaction in every block is called the coinbase transaction. This coinbase transaction has no inputs (it implicitly receives the subsidy and fees of the block) and its outputs define where these new coins are sent to.

So the answer is simply: the rewards are sent wherever the block says they go. This has to be decided before submitblock is invoked. In fact, it has to be decided before mining can even start: as the coinbase is part of the block, modifying it would invalidate the block's proof of work. This also prevents other parties on the network from changing the block to pay them instead.

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308
  • Ok, thank you. But it's not very clear to me. If I use bitcoin-cli with the submitblock function, how can I specify my wallet address for receiving the rewards if the block is ok ? – Invest Data Systems FR Sep 16 '22 at 17:23
  • 1
    You can't specify it. It's something you have decided before you started mining. The mining software and/or hardware you used to build the block needs to be aware of the payout address. – Pieter Wuille Sep 16 '22 at 17:38
  • 2
    @InvestDataSystemsFR If you could specify the wallet address after making the block, what would stop someone from taking your block after you submitted it and changing the reward address? – David Schwartz Sep 16 '22 at 19:37
  • Ok, so if I understand well, the reward bitcoin wallet address is in the data submitted with submitblock (coded in the block sent), isn't it ? – Invest Data Systems FR Sep 16 '22 at 20:41
  • 1
    Yes, that's correct. The block you submit already has its own payout encoded in it. It's added there by the software you used to mine it in the first place. – Pieter Wuille Sep 16 '22 at 21:41
  • Thank you very much ! I'll try to find some pieces of source code that can do that ;) – Invest Data Systems FR Sep 17 '22 at 19:25