How create coinbase transaction with createrawtransaction?

i try use as example createrawtransaction


but it's give me not coinbase


what i meen , try create valid coinbase transaction what can be used at submitblock with header.

  • How is that not a coinbase? The null input is the key characteristic. – pinhead Jul 18 at 11:02
  • i was test it with fresh blockchain with 100% valid block , with markle root from this tx , submitblock was no accept it and say "Block does not start with a coinbase (code -22)" – tseries Jul 18 at 12:06
  • there are also other coinbase rules as well such as bip34 height in scriptSig. – pinhead Jul 18 at 12:08
  • ok, but how add them for make coinbase valid for submit block ? a dont see any other rules at createrawtransaction help. – tseries Jul 18 at 12:15
  • Oh I see one more thing -- the vout for coinbase input should be 0xffffffff not 0 – pinhead Jul 18 at 12:17

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.