1

I know about

createrawtransaction '[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0}]' '{"39jbHRLG6Z2KgXLHR3BWgbccZde1Moo15k":6.5}' 

its give

020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff018036be260000000017a914583daf881525ddfcb891e1ab715a2a790b62f03c8700000000

19:10:24 

decoderawtransaction 020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff018036be260000000017a914583daf881525ddfcb891e1ab715a2a790b62f03c8700000000


{
  "txid": "b95321ea560dbdf48581c0ff451699e4240c86021bd10791585b3bc4078681cf",
  "hash": "b95321ea560dbdf48581c0ff451699e4240c86021bd10791585b3bc4078681cf",
  "version": 2,
  "size": 83,
  "vsize": 83,
  "weight": 332,
  "locktime": 0,
  "vin": [
    {
      "txid": "0000000000000000000000000000000000000000000000000000000000000000",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 6.50000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 583daf881525ddfcb891e1ab715a2a790b62f03c OP_EQUAL",
        "hex": "a914583daf881525ddfcb891e1ab715a2a790b62f03c87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "39jbHRLG6Z2KgXLHR3BWgbccZde1Moo15k"
        ]
      }
    }
  ]
}

but if i try decode tx from blockchain as example tx d56e6eccf09e3b2993326b86d95bf79919ec98ff576c2cc6b550d7fd90187080 from block 00000000000000000005c8f82be414604a30f33fa35028079d0d012079c8f3ea

getrawtransaction d56e6eccf09e3b2993326b86d95bf79919ec98ff576c2cc6b550d7fd90187080




01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5b0300f60941d7e1f2e7560aff41d7e1f2e755ef2a2f45324d2026204254432e544f502ffabe6d6d1c3eb14eb586c97d05cb6333184280d0d86e081a6ccc1cbbc0367888f2368b2b8000000000000000e7000a064122000000000000ffffffff0140be4025000000001976a9140b904a4a8590d0ccff680bb8adc4ae4fe49f890a88ac00000000




decoderawtransaction 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5b0300f60941d7e1f2e7560aff41d7e1f2e755ef2a2f45324d2026204254432e544f502ffabe6d6d1c3eb14eb586c97d05cb6333184280d0d86e081a6ccc1cbbc0367888f2368b2b8000000000000000e7000a064122000000000000ffffffff0140be4025000000001976a9140b904a4a8590d0ccff680bb8adc4ae4fe49f890a88ac00000000




{
  "txid": "d56e6eccf09e3b2993326b86d95bf79919ec98ff576c2cc6b550d7fd90187080",
  "hash": "d56e6eccf09e3b2993326b86d95bf79919ec98ff576c2cc6b550d7fd90187080",
  "version": 1,
  "size": 176,
  "vsize": 176,
  "weight": 704,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "0300f60941d7e1f2e7560aff41d7e1f2e755ef2a2f45324d2026204254432e544f502ffabe6d6d1c3eb14eb586c97d05cb6333184280d0d86e081a6ccc1cbbc0367888f2368b2b8000000000000000e7000a064122000000000000",
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 6.25000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 0b904a4a8590d0ccff680bb8adc4ae4fe49f890a OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9140b904a4a8590d0ccff680bb8adc4ae4fe49f890a88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1249HZzzG5YSi8juRXPXYopcCYBx3CQYW7"
        ]
      }
    }
  ]
}

i see coinbase value

"coinbase": "0300f60941d7e1f2e7560aff41d7e1f2e755ef2a2f45324d2026204254432e544f502ffabe6d6d1c3eb14eb586c97d05cb6333184280d0d86e081a6ccc1cbbc0367888f2368b2b8000000000000000e7000a064122000000000000",

what is this ? How to create working coinsbase tx what can be puted to block and it will be correct for mining , all what if find there is not incorrect info and link to outdatet wiki. tx created by any of that solution dont have this field so they are invalid .

Problem is there no info how to add that coinbase to coinbase tx .

maybe some where exist some python script what can do coinbase tx ? For look at logic how it creation that tx.

1 Answer 1

1

The coinbase transaction is a special transaction that has to satisfy the following:

  1. Only has 1 input
  2. The input is using 0x0000000000000000000000000000000000000000000000000000000000000000 as its txid and 0xFFFFFFFF as its index (vout)
  3. The signature script of this input has to have a length between 2 and 100 (2<= length <=100)
  4. Any block after BIP-34 activation (height>=227931) must have the block height pushed at the beginning of the signature script using strict push lengths. (The rest of the script is ignored.)
  5. Like any other transaction it has to have at least one output
  6. If the block contained any transaction that had witness, the coinbase tx must have* a single witness (corresponding to its single input) containing a 32 byte witness commitment and an output that contains the computed witness merkle root hash and starts with OP_Return followed by 0x24aa21a9ed and is at least 38 bytes total
  7. The sum of output amounts must be smaller than or equal to the block reward + sum of fees

*This is optional in case there were no witnesses (so SegWit tx inside the block)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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