- 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 it has absolutely nothing to do with this.
There are basically two ways to insert a transaction:
- Miners put transactions into their mempool (and possibly broadcast them) using:
sendrawtransaction
. Then they useprioritisetransaction
Artificially sets the transaction fee to appear in the generated block template.getblocktemplate
. - They are using some external block template generator that does the insertion itself. The software can be started with a block template created by:
getblocktemplate
However, much of the block assembly code itself must also be implemented to ensure that the final generated template is valid.
- 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 that transaction is confirmed, so it will not override your manual transaction.
For Method 2, the external template software performs the insertion and is therefore remembered. External software might (re)build the template anyway, so that’s basically what bitcoind does in method 1.
- Is there a UI that can do this? For example, does it display transactions from the current block template + mempool and allow transactions in the block template to be replaced by transactions from 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.