Bitcoin

bitcoin core – How do miners manually add transactions to block templates?

  1. Does it work like this?

No really.

generateblock This is a test-only RPC that actually mines blocks using the internal CPU miner, and does not create block templates. So this has absolutely nothing to do with this.

There are basically two ways to insert a transaction:

  1. The miner puts the transaction into his mempool (and probably broadcasts it) using: sendrawtransaction. Then they use prioritisetransaction We artificially set the transaction fee to appear in the generated block template. getblocktemplate.
  2. They are using some external block template generator that does the insertion itself. The software can be started with a block template created by: getblocktemplateHowever, much of the block assembly code itself must also be implemented to ensure that the final generated template is valid.
  1. I imagine that the node software is constantly updating blocks to maximize the amount of fees received. Does this mean it will override transactions I added manually?

If you used method 1, bitcoind will remember the modified fee and continue to account for it until the transaction is confirmed, so it will not override your manual transaction.

For Method 2, the external template software performs the insertion and is thus remembered. External software might (re)build the template anyway, so that’s basically what bitcoind does in method 1.

  1. Is there a UI that can do this? For example, is it possible to display the transactions in the current block template + mempool and replace the transactions in the block template with the transactions in the mempool? If not, you could try to build something that way.

I don’t think there is any software that is publicly available. Nowadays, block templates are created in pools, and these pools often use custom software, so there may be tools to do this. However, it will not be open to the public.

Related Articles

Back to top button