Bitcoin Asked by tseries on October 24, 2021
I would like to generate a transaction with createrawtransaction
such that it can be passed to submitblock
along with the block header.
I tried to use:
[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0}]{"bc1qd8hza5w3mz7t3tudtlplm9xht4sjwg0e3t9gy2":6.25000000}
but it’s not outputting a coinbase transaction:
020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0140be40250000000016001469ee2ed1d1d8bcb8af8d5fc3fd94d75d612721f900000000
It is not possible to create a coinbase transaction using createrawtransaction
. There are numerous rules that coinbase transactions must follow that the createrawtransaction
RPC does not have the ability to set the fields to meet those rules. For example, BIP 34 requires the coinbase contain the block's height in the scriptSig. However createrawtransaction
does not allow you to set the anything in the scriptSig.
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 so that when they run out of nonces, they don't necessarily have to re-select the transactions to include in the block. Instead they can change the coinbase to cause the merkle root to change.
Answered by Andrew Chow on October 24, 2021
According to BIP 34, you must include the block Height to your Coinbase transaction, otherwise, it will be invalid,
The scryptSig of your coinbase transaction, must begin with number of pushed bytes (Actually is 0x03) and then the hex representation of your candidate block, dont forget the little endian conversion
Answered by Hamita on October 24, 2021
1 Asked on December 10, 2021 by diagon
1 Asked on December 4, 2021 by subhra-mazumdar
1 Asked on November 30, 2021
1 Asked on November 30, 2021
1 Asked on November 28, 2021 by user96505
0 Asked on November 25, 2021
1 Asked on November 21, 2021 by capgros
1 Asked on November 19, 2021 by rahulgarg12342
1 Asked on November 15, 2021 by dg-br
1 Asked on November 13, 2021
2 Asked on November 11, 2021 by btc_beginner
1 Asked on November 11, 2021 by user76194
1 Asked on November 8, 2021
2 Asked on November 8, 2021 by jimmy-yu
1 Asked on October 24, 2021 by hisham-yem
1 Asked on October 24, 2021 by dennis-concepcin-martn
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP