Bitcoin

Transaction – hashTypeCode/sighash flag example byte array for each type

Let’s say I confirm this (randomly selected) transaction.

txprev.txid: 64891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2
    txprev.version : 01000000
    txprev.input count : 01
    txprev.input0_txid : ed9dffb6254b960099300838a2619adea6382c793d72c8650f6ffd835a85e6af
    txprev.input0_vout : 00000000
    txprev.input0_ScriptSigSize : 6b
    txprev.input0_ScriptSig: 483045022100f74aa29ac94ba5efe26d25c4982027626b82a4e0ba7feb63469ac9031ae200f202207472fd3e9ebbbbeaa7023326f99cd13a3e8ffd09ab1d2665f596767d01acd90a012102c74ccf231111f2acc0594f070c0f522d25b326a503270637dade5edfa90f123b
    txprev.sequence : ffffffff
    txprev.output_count : 02
    txprev.output0_amount: ae619a0700000000
    txprev.output0_scriptPubKeySize: 19
    txprev.output0_scriptPubKey: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
    txprev.output1_amount: bfaaf20000000000
    txprev.output1_scriptPubKeySize: 19
    txprev.output1_scriptPubKey: 76a914ec14773ce9ff6e40d60ce8c44f31a0677f8a817088ac
    txprev.locktime: 00000000

And pretend you want to spend money txprev.output0 In ~ txnew.input1 Create a new transaction and configure:One:

   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 6b
   txnew.input0_ScriptSig: 483045022100c61382dc9b8611bd077d9931685321dd8e48f3a0532873d16d5a00e18647ff2402202bbca562ab2f6e01e55f20d3106dabd8a1208a0276bb552720968902385f1e610121034e6ae18eda57aa491ae3dd0b49b656fbcdf2282e6d47e0241b875d0122602ac3
   txnew.sequence : ffffffff
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txnew.input1_ScriptSigSize: 6a
   txnew.input1_ScriptSig: 47304402200165a5966fb459ca5f6c4e2b25108b6e187e6ac8e7ca75f302564abd12d37c58022006bd7de403310dd10e0eaade55ca5fbccf24cd3906c0b720096f13db78303175012103345e24df2e1f69f2056fe650c8af607659d28795f355f639f894aafacc6ae2cd
   txnew.input1_sequence: ffffffff
   txnew.output_count : 02
   txnew.output0_amount: d273110800000000
   txnew.output0_scriptPubKeySize: 19
   txnew.output0_scriptPubKey: 76a91406f723b0acdefec3b50e7e318951c69dff77bd5688ac
   txnew.output1_amount: 5f95f40000000000
   txnew.output1_scriptPubKeySize: 19
   txnew.output1_scriptPubKey: 76a9145b639f973c812eb23adda40465acabd336c6092888ac
   txnew.locktime: 00000000

For each of the six possible Sighashflags / hashTypeCodecandle (0x01, 0x02, 0x03, 0x81, 0x82, 0x83), what is the exact byte array that will be the signature pre-image for spending? txprev.output0In ~ txnew.input1 (retirement txnew.input0 just the way it is)? What will look different? txnew?

One Based on this

Related Articles

Back to top button