Please describe the feature you’d like to see added.
I would like a command in bitcoin core for creating a raw coinbase transaction and another command for injecting it into a block template.
Is your feature related to a problem, if so please describe it.
I am working on a project that lets users purchase coinbase utxos directly from miners, who are expected to send their customers these utxos in whatever block they mine next. It is difficult to test my software on regtest because I can’t specify what outputs coinbase transactions should create. The console commands “generateblock,” “generatetoaddress,” and “generatetodescriptor” all automatically create a coinbase transaction that sends the block subsidy plus fees to a single address which you must specify as an argument. They do not, however, let you customize your coinbase transaction.
Describe the solution you’d like
I would love to use the “createrawtransaction” method to create a coinbase transaction with several outputs where I send most of the subsidy as well as a final output that lets me specify a value of “remainder” or something like that to catch whatever is left over after the initial outputs are created.
With this custom coinbase transaction in hand, I’d love to put it in an array of transactions and pass that array to the “generateblock” command. The latter command would need to “notice” that the first transaction in the array is a coinbase transaction and use it as a replacement for whatever coinbase transaction it was going to create automatically.
Describe any alternatives you’ve considered
I could reach out to a miner and ask them to send me whatever software they use to create custom coinbase transactions but I fear their professional setups would be vastly more complex than mine and it just wouldn’t work.
Please leave any additional context
I checked on stack overflow and found this q-and-a which says, in part, “It is not possible to create a coinbase transaction using createrawtransaction. … Miners must use software that can independently create the coinbase transaction. Miners actually prefer doing this because they want to be able to modify the coinbase to use as an extra nonce…” Miners may already have software for independently creating custom coinbase transactions, but as someone who just wants to do it on my local regtest environment, it’s frustrating that there are no good methods for this.