Allow creating and injecting a custom coinbase into a block template #28475

issue supertestnet openend this issue on September 14, 2023
  1. supertestnet commented at 2:56 am on September 14, 2023: none

    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.

    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.

  2. supertestnet added the label Feature on Sep 14, 2023
  3. levantah commented at 2:45 pm on July 31, 2024: none

    Make it raw in hex. Read and try (UNIX shell with tools like fold and printf is enough).

    https://x.com/AnyoneOReally1/status/1818658150439919827


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me