0

How to know which sighash type we have to append to the trimmed transaction at the time of input scripts verification, take reference from the below example:

{
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "f7268fdc3dd4ab2ce606a9857f321f9c9d94a7cc4ca7d31db481938ce222403e",
      "vout": 28,
      "prevout": {
        "scriptpubkey": "76a9145ae0dedcb9a96b8d4310e4ff137a22e0233258e988ac",
        "scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 5ae0dedcb9a96b8d4310e4ff137a22e0233258e9 OP_EQUALVERIFY OP_CHECKSIG",
        "scriptpubkey_type": "p2pkh",
        "scriptpubkey_address": "19HXCYbrynpvTMYkQoneBgo3xEnXPFDd4z",
        "value": 150653
      },
      "scriptsig": "483045022100cfa7d65576fafd8f827904a1292b55d234898c1e444cd2dfc05f5e15b6f69e4402200b7ea6a9e3da80ea771fe1170795adcbea88d67eb8d82828e85d4b5883b9f9a80121038e464810ac06e1a7589e58bd9050ff1fc4d4768f00aaeedb2d4b5c231ac8851d",
      "scriptsig_asm": "OP_PUSHBYTES_72 3045022100cfa7d65576fafd8f827904a1292b55d234898c1e444cd2dfc05f5e15b6f69e4402200b7ea6a9e3da80ea771fe1170795adcbea88d67eb8d82828e85d4b5883b9f9a801 OP_PUSHBYTES_33 038e464810ac06e1a7589e58bd9050ff1fc4d4768f00aaeedb2d4b5c231ac8851d",
      "witness": null,
      "is_coinbase": false,
      "sequence": 4294967293,
      "inner_redeemscript_asm": null
    }
  ],
  "vout": [
    {
      "scriptpubkey": "0014bc2870381de4d706a92105419f0c3072e26532d1",
      "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 bc2870381de4d706a92105419f0c3072e26532d1",
      "scriptpubkey_type": "v0_p2wpkh",
      "scriptpubkey_address": "bc1qhs58qwqauntsd2fpq4qe7rpswt3x2vk3krdvhh",
      "value": 147107
    }
  ]
}

1 Answer 1

1

Inside script sig, there's a signature 3045022100cfa7d65576fafd8f827904a1292b55d234898c1e444cd2dfc05f5e15b6f69e4402200b7ea6a9e3da80ea771fe1170795adcbea88d67eb8d82828e85d4b5883b9f9a801, and signature itself is appended with sighash type(which is '01' here, SIGHASH_ALL).

If there's nothing appended within signature, it's SIGHASH_DEFAULT(can only be used in taproot transaction)

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.