<p>To create the signature pre-image for spending txprev.output0 in txnew.input1, we need to construct the byte array that includes the necessary data fields and hashTypeCode for each sighashflag. Here's the byte array for each sighashflag (0x01, 0x02, 0x03, 0x81, 0x82, 0x83):</p>
<ol>
<li><strong>sighashflag 0x01 (SIGHASH_ALL):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964000000001976a91406f723b0acdefec3b50e7e318951c69dff77bd5688ac00000000ffffffff00000001
</code></pre>
<ol start="2">
<li><strong>sighashflag 0x02 (SIGHASH_NONE):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c89640100000000ffffffff00000002
</code></pre>
<ol start="3">
<li><strong>sighashflag 0x03 (SIGHASH_SINGLE):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c896400000000ffffffff00000003
</code></pre>
<ol start="4">
<li><strong>sighashflag 0x81 (SIGHASH_ALL | SIGHASH_ANYONECANPAY):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964000000001976a91406f723b0acdefec3b50e7e318951c69dff77bd5688ac00000000ffffffff00000081
</code></pre>
<ol start="5">
<li><strong>sighashflag 0x82 (SIGHASH_NONE | SIGHASH_ANYONECANPAY):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c89640100000000ffffffff00000082
</code></pre>
<ol start="6">
<li><strong>sighashflag 0x83 (SIGHASH_SINGLE | SIGHASH_ANYONECANPAY):</strong></li>
</ol>
<pre><code>&lt;version&gt;&lt;prev_txid&gt;&lt;prev_vout&gt;&lt;prev_output_scriptPubKey&gt;&lt;input_sequence&gt;&lt;txnew.txid&gt;&lt;txnew.vout&gt;&lt;txnew.output_scriptPubKey&gt;&lt;txnew.amount&gt;&lt;sequence&gt;&lt;sighashflag&gt;
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c896400000000ffffffff00000083
</code></pre>
<p>In each case, the differences in the byte array are mainly due to the inclusion of the specific sighashflag and the serialization of the transaction data.</p>

CC BY-SA 4.0
2024-05-06T11:06:39.240Z
I think `SIGHASH_NONE` should end with `<sequence><locktime><sighashflag>`
Lee
CC BY-SA 4.0
2024-05-04T20:01:38.070Z
2024-05-04T20:01:38.070Z
Shaikh Muhammed
<p>0x01 SIGHASH_ALL</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : ffffffff
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   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
   hashTypeCode : 00000001
</code></pre>
<p>0x02 SIGHASH_NONE</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : 00000000
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 00
   txnew.locktime: 00000000
   hashTypeCode : 00000002
</code></pre>
<p>0x03 SIGHASH_SINGLE</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : 00000000
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 02
   txnew.output0_amount: ffffffffffffffff
   txnew.output0_scriptPubKeySize: 00
   txnew.output1_amount: 5f95f40000000000
   txnew.output1_scriptPubKeySize: 19
   txnew.output1_scriptPubKey: 76a9145b639f973c812eb23adda40465acabd336c6092888ac
   txnew.locktime: 00000000
   hashTypeCode : 00000003
</code></pre>
<p>0x81 SIGHASH_ANYONECANPAY &amp; SIGHASH_ALL</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   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
   hashTypeCode : 00000081
</code></pre>
<p>0x82 SIGHASH_ANYONECANPAY &amp; SIGHASH_NONE</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 00
   txnew.locktime: 00000000
   hashTypeCode : 00000082
</code></pre>
<p>0x83 SIGHASH_ANYONECANPAY &amp; SIGHASH_SINGLE</p>
<pre><code>   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 02
   txnew.output0_amount: ffffffffffffffff
   txnew.output0_scriptPubKeySize: 00
   txnew.output1_amount: 5f95f40000000000
   txnew.output1_scriptPubKeySize: 19
   txnew.output1_scriptPubKey: 76a9145b639f973c812eb23adda40465acabd336c6092888ac
   txnew.locktime: 00000000
   hashTypeCode : 00000083
</code></pre>

CC BY-SA 4.0
2024-05-04T19:11:36.987Z
2024-05-06T13:54:01.983Z
2024-05-06T13:54:01.983Z
Lee
<p>Say I have this (<a href="https://learnmeabitcoin.com/explorer/tx/64891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2" rel="nofollow noreferrer">randomly selected</a>) transaction confirmed:</p>
<pre><code>txprev.txid: 64891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2
</code></pre>
<pre><code>    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

</code></pre>
<p>And pretend I want to spend <code>txprev.output0</code> in <code>txnew.input1</code> of a new transaction and construct the following<sup>1</sup>:</p>
<pre><code>   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

</code></pre>
<p>For each of the 6 possible sighashflags / <code>hashTypeCode</code>s (<code>0x01</code>, <code>0x02</code>, <code>0x03</code>, <code>0x81</code>, <code>0x82</code>, <code>0x83</code>), what is the exact byte array that would be the signature pre-image for spending <code>txprev.output0</code>in <code>txnew.input1</code> (leaving <code>txnew.input0</code> as is)? What would look different in <code>txnew</code>?</p>
<p><sup>1</sup> Based on <a href="https://learnmeabitcoin.com/explorer/tx/22b03b79f996ab7e48fa39e17ae885dfb252733b8fd560361532b0d8b59b9951" rel="nofollow noreferrer">this</a></p>

<transactions><signature><transaction-verification><sighash><sighash-flags>
hashTypeCode/sighash flag example byte arrays for each type
Lee
# hashTypeCode/sighash flag example byte arrays for each type

(Asked by: username_0 on 2024-05-04)

Say I have this ([randomly selected](https://learnmeabitcoin.com/explorer/tx/64891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2)) transaction confirmed:

```
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 I want to spend `txprev.output0` in `txnew.input1` of a new transaction and construct the following1:

```
   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 6 possible sighashflags / `hashTypeCode`s (`0x01`, `0x02`, `0x03`, `0x81`, `0x82`, `0x83`), what is the exact byte array that would be the signature pre-image for spending `txprev.output0`in `txnew.input1` (leaving `txnew.input0` as is)? What would look different in `txnew`?

1 Based on [this](https://learnmeabitcoin.com/explorer/tx/22b03b79f996ab7e48fa39e17ae885dfb252733b8fd560361532b0d8b59b9951)

**Tags:** transactions, signature, transaction-verification, sighash, sighash-flags


---

## 2 answers

### Answer by username_1 on 2024-05-04. Score: 1 | Accepted answer

To create the signature pre-image for spending txprev.output0 in txnew.input1, we need to construct the byte array that includes the necessary data fields and hashTypeCode for each sighashflag. Here's the byte array for each sighashflag (0x01, 0x02, 0x03, 0x81, 0x82, 0x83):

1. **sighashflag 0x01 (SIGHASH\_ALL):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964000000001976a91406f723b0acdefec3b50e7e318951c69dff77bd5688ac00000000ffffffff00000001

```

2. **sighashflag 0x02 (SIGHASH\_NONE):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c89640100000000ffffffff00000002

```

3. **sighashflag 0x03 (SIGHASH\_SINGLE):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c896400000000ffffffff00000003

```

4. **sighashflag 0x81 (SIGHASH\_ALL | SIGHASH\_ANYONECANPAY):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964000000001976a91406f723b0acdefec3b50e7e318951c69dff77bd5688ac00000000ffffffff00000081

```

5. **sighashflag 0x82 (SIGHASH\_NONE | SIGHASH\_ANYONECANPAY):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c89640100000000ffffffff00000082

```

6. **sighashflag 0x83 (SIGHASH\_SINGLE | SIGHASH\_ANYONECANPAY):**

```
<version><prev_txid><prev_vout><prev_output_scriptPubKey><input_sequence><txnew.txid><txnew.vout><txnew.output_scriptPubKey><txnew.amount><sequence><sighashflag>
0100000064891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2000000001976a91471ba0c0827171ef16859048b5157ef1f5b7d516288acffffffffc2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c896400000000ffffffff00000083

```

In each case, the differences in the byte array are mainly due to the inclusion of the specific sighashflag and the serialization of the transaction data.

> **Comments:**
> **username_0**: I think `SIGHASH_NONE` should end with `<sequence><locktime><sighashflag>`  

---

### Answer by username_0 on 2024-05-04. Score: 0

0x01 SIGHASH\_ALL

```
   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : ffffffff
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   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
   hashTypeCode : 00000001

```

0x02 SIGHASH\_NONE

```
   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : 00000000
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 00
   txnew.locktime: 00000000
   hashTypeCode : 00000002

```

0x03 SIGHASH\_SINGLE

```
   txnew.version : 01000000
   txnew.input count : 02
   txnew.input0_txid : fb8d928e7f7bf64a21628f568ec1cc85b5acd4bd30292d96db00e4b4beb1d19b 
   txnew.input0_vout : 01000000
   txnew.input0_ScriptSigSize : 00
   txnew.input0_sequence : 00000000
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 02
   txnew.output0_amount: ffffffffffffffff
   txnew.output0_scriptPubKeySize: 00
   txnew.output1_amount: 5f95f40000000000
   txnew.output1_scriptPubKeySize: 19
   txnew.output1_scriptPubKey: 76a9145b639f973c812eb23adda40465acabd336c6092888ac
   txnew.locktime: 00000000
   hashTypeCode : 00000003

```

0x81 SIGHASH\_ANYONECANPAY & SIGHASH\_ALL

```
   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   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
   hashTypeCode : 00000081

```

0x82 SIGHASH\_ANYONECANPAY & SIGHASH\_NONE

```
   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 00
   txnew.locktime: 00000000
   hashTypeCode : 00000082

```

0x83 SIGHASH\_ANYONECANPAY & SIGHASH\_SINGLE

```
   txnew.version : 01000000
   txnew.input count : 01
   txnew.input1_txid: c2558cdf3fe33c523f5316f55d86d233861950783643b375df1a77a9d61c8964
   txnew.input1_vout: 00000000
   txprev.output0_ScriptSigSize: 19
   txprev.output0_ScriptSig: 76a91471ba0c0827171ef16859048b5157ef1f5b7d516288ac
   txnew.input1_sequence: ffffffff
   txnew.output_count : 02
   txnew.output0_amount: ffffffffffffffff
   txnew.output0_scriptPubKeySize: 00
   txnew.output1_amount: 5f95f40000000000
   txnew.output1_scriptPubKeySize: 19
   txnew.output1_scriptPubKey: 76a9145b639f973c812eb23adda40465acabd336c6092888ac
   txnew.locktime: 00000000
   hashTypeCode : 00000083

```


---

