<blockquote>
  <p>SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction.</p>
</blockquote>

<p>This is false.</p>

<p>Input 2 is essentially a blank check. <code>SIGHASH_NONE</code> signs none of the outputs (I don't care where the BTC goes), and <code>SIGHASH_ANYONECANPAY</code> signs only input 2 (I don't care who else is participating in the tx. This essentially creates an input, which if you give to anyone else, is the equivalent of "Here's a blank check for X BTC, do what you want with it".</p>

<blockquote>
  <p>Are they able to spend Input 1 (the SIGHASH_SINGLE) in another transaction without Input 2 included?</p>
</blockquote>

<p>Since Input 1 is signed using <code>SIGHASH_SINGLE</code>, only output 1 is signed under it. However, the <code>SIGHASH_ANYONECANPAY</code> flag means that only input 1 is signed as well, which completely decouples it from input 2.</p>

<p>Now, if you were to remove the <code>SIGHASH_ANYONECANPAY</code> flag from input 1, then you end up with a tx that is able to spend up to <code>input 1 + input 2</code> BTC, but is only spending <code>output 1</code>. In this scenario, spending input 1 is dependent on spending input 2 as well. However, since input 1 is <code>SIGHASH_SINGLE</code>, and input 2 is <code>SIGHASH_NONE</code>, anyone you share the tx with is able to add their own outputs to it, but not add any more inputs.</p>

<p>Moreover, since input 2 is <code>SIGHASH_NONE | SIGHASH_ANYONECANPAY</code>, anyone you share the tx with can extract just input 2, and reuse it in a completely different tx without requiring input 1. The way to counter that would be to remove the <code>SIGHASH_ANYONECANPAY</code> , so that it is at least locked to being spent with, and only with, input 1. </p>

<blockquote>
  <p>What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?</p>
</blockquote>

<p>You could spend to to a single output, then create a new partial tx with that single output being spent with your required destination and amount, and sign that with <code>SIGHASH_SINGLE | SIGHASH_ANYONECANPAY</code></p>

CC BY-SA 4.0
2019-03-30T20:42:16.877Z
2019-03-30T20:42:16.877Z
Raghav Sood
<p>Say I am building a transaction in private:</p>

<ol>
<li>Input 1 is signed with SIGHASH_SINGLE  ( | SIGHASH_ANYONECANPAY)</li>
<li>Input 2 is signed with SIGHASH_NONE | SIGHASH_ANYONECANPAY</li>
</ol>

<p>SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction. Am I able to communicate this privately-signed transaction in such a way that Input 1 is also locked on the condition that Input 2 is included?</p>

<p>For example, I send this partially-signed transaction, with both signatures, to a person I do not trust. </p>

<p>Are they able to spend Input 1 (the SIGHASH_SINGLE) in another transaction without Input 2 included? </p>

<p>What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?</p>

<utxo><checksig><sighash-flags><sighash>
Is SIGHASH_NONE encompassing of other signature types?
nick carraway
# Is SIGHASH_NONE encompassing of other signature types?

(Asked by: username_0 on 2019-03-30)

Say I am building a transaction in private:

1. Input 1 is signed with SIGHASH\_SINGLE ( | SIGHASH\_ANYONECANPAY)
2. Input 2 is signed with SIGHASH\_NONE | SIGHASH\_ANYONECANPAY

SIGHASH\_NONE implies that Input 2 will only spend if Input 1 is included in the transaction. Am I able to communicate this privately-signed transaction in such a way that Input 1 is also locked on the condition that Input 2 is included?

For example, I send this partially-signed transaction, with both signatures, to a person I do not trust.

Are they able to spend Input 1 (the SIGHASH\_SINGLE) in another transaction without Input 2 included?

What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?

**Tags:** utxo, checksig, sighash-flags, sighash


---

## 1 answers

### Answer by username_1 on 2019-03-30. Score: 3

> SIGHASH\_NONE implies that Input 2 will only spend if Input 1 is included in the transaction.

This is false.

Input 2 is essentially a blank check. `SIGHASH_NONE` signs none of the outputs (I don't care where the BTC goes), and `SIGHASH_ANYONECANPAY` signs only input 2 (I don't care who else is participating in the tx. This essentially creates an input, which if you give to anyone else, is the equivalent of "Here's a blank check for X BTC, do what you want with it".

> Are they able to spend Input 1 (the SIGHASH\_SINGLE) in another transaction without Input 2 included?

Since Input 1 is signed using `SIGHASH_SINGLE`, only output 1 is signed under it. However, the `SIGHASH_ANYONECANPAY` flag means that only input 1 is signed as well, which completely decouples it from input 2.

Now, if you were to remove the `SIGHASH_ANYONECANPAY` flag from input 1, then you end up with a tx that is able to spend up to `input 1 + input 2` BTC, but is only spending `output 1`. In this scenario, spending input 1 is dependent on spending input 2 as well. However, since input 1 is `SIGHASH_SINGLE`, and input 2 is `SIGHASH_NONE`, anyone you share the tx with is able to add their own outputs to it, but not add any more inputs.

Moreover, since input 2 is `SIGHASH_NONE | SIGHASH_ANYONECANPAY`, anyone you share the tx with can extract just input 2, and reuse it in a completely different tx without requiring input 1. The way to counter that would be to remove the `SIGHASH_ANYONECANPAY` , so that it is at least locked to being spent with, and only with, input 1.

> What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?

You could spend to to a single output, then create a new partial tx with that single output being spent with your required destination and amount, and sign that with `SIGHASH_SINGLE | SIGHASH_ANYONECANPAY`


---

