<p>To accomplish this you could create a single transaction that you both supplies inputs to, and that creates an output paying to your multi sig address. In order for the transaction to be valid you will both need to sign it, and of course neither of you should sign it unless the other has supplied an input with the agreed upon value.</p>
<p>See: <a href="https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki" rel="nofollow noreferrer">BIP 174 Partially signed bitcoin transactions</a></p>

CC BY-SA 4.0
2022-06-04T17:36:29.270Z
Very interesting. How does the bitcoin logic allow the unlocking of the input based on a signature that signs both inputs? Does the verifier check for each input to see whether one of the unlocking scripts satisfies it? but the unlocking script (with signature of all inputs) depends on multiple inputs (both Alive and Bobs) being there?
miketery
CC BY-SA 4.0
2022-06-05T18:55:49.717Z
I did further research, I think what I'm looking for is called a coinjoin.
miketery
CC BY-SA 4.0
2022-06-05T21:44:25.980Z
@miketery re: signatures: you'll want to learn about 'sighash flags', they are used to designate which parts of a transaction the signature covers. re: coinjoins: that term generally describes a more specific type of multi-party transaction, that seeks to improve the on-chain privacy of participants, I wouldn't really use that term to describe what you're trying to achieve.
chytrik
CC BY-SA 4.0
2022-06-06T06:09:18.620Z
I found this https://wiki.bitcoinsv.io/index.php/SIGHASH_flags (hopefully this is the same in BTC?). What does BIP-174 add if N people can agree on a X inputs and Y outputs, and then use `SIGHASH_ALL`?
miketery
CC BY-SA 4.0
2022-06-06T06:46:48.523Z
@miketery BSV is an altcoin, I would definitely not recommend using that reference. Try perhaps https://raghavsood.com/blog/2018/06/10/bitcoin-signature-types-sighash ?   re: BIP174: it is a standardized protocol for passing partially constructed bitcoin transactions between users/software. Using software that employs it will make collaborating on a multi-party transaction much easier.
chytrik
CC BY-SA 4.0
2022-06-04T07:47:35.493Z
2022-06-04T07:47:35.493Z
chytrik
<p>Say I'm creating a multi-sig wallet with a friend to bet on the election. Can my deposit to the multi-sig wallet be dependent on the my friends deposit to the wallet?</p>
<p>Say I'm Alice, and my friend is Bob. Our shared multi-sig wallet is S. Would the following work?</p>
<pre><code>Block N:
TxA
  Input1: A.amountX
  Input2: B.amountX
  Output1: S.amountY
  A.sig
  B.sig
</code></pre>
<p>Edit: Received good answer below, to summarize use <a href="https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki" rel="nofollow noreferrer">Partially Signed Bitcoin Transactions (PSBT) BIP-174</a>, it relies on <code>Sighash Flags</code>, this enables parties to sign more than just their own input.</p>

<bip174-psbt><sighash><shared-wallet>
Can a transaction be dependent on another in the same block?
miketery
# Can a transaction be dependent on another in the same block?

(Asked by: username_0 on 2022-06-03)

Say I'm creating a multi-sig wallet with a friend to bet on the election. Can my deposit to the multi-sig wallet be dependent on the my friends deposit to the wallet?

Say I'm Alice, and my friend is Bob. Our shared multi-sig wallet is S. Would the following work?

```
Block N:
TxA
  Input1: A.amountX
  Input2: B.amountX
  Output1: S.amountY
  A.sig
  B.sig

```

Edit: Received good answer below, to summarize use [Partially Signed Bitcoin Transactions (PSBT) BIP-174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki), it relies on `Sighash Flags`, this enables parties to sign more than just their own input.

**Tags:** bip174-psbt, sighash, shared-wallet


---

## 1 answers

### Answer by username_1 on 2022-06-04. Score: 2 | Accepted answer

To accomplish this you could create a single transaction that you both supplies inputs to, and that creates an output paying to your multi sig address. In order for the transaction to be valid you will both need to sign it, and of course neither of you should sign it unless the other has supplied an input with the agreed upon value.

See: [BIP 174 Partially signed bitcoin transactions](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki)

> **Comments:**
> **username_0**: Very interesting. How does the bitcoin logic allow the unlocking of the input based on a signature that signs both inputs? Does the verifier check for each input to see whether one of the unlocking scripts satisfies it? but the unlocking script (with signature of all inputs) depends on multiple inputs (both Alive and Bobs) being there?  
> **username_0**: I did further research, I think what I'm looking for is called a coinjoin.  
> **username_1**: @username_0 re: signatures: you'll want to learn about 'sighash flags', they are used to designate which parts of a transaction the signature covers. re: coinjoins: that term generally describes a more specific type of multi-party transaction, that seeks to improve the on-chain privacy of participants, I wouldn't really use that term to describe what you're trying to achieve.  
> **username_0**: I found this https://wiki.bitcoinsv.io/index.php/SIGHASH_flags (hopefully this is the same in BTC?). What does BIP-174 add if N people can agree on a X inputs and Y outputs, and then use `SIGHASH_ALL`?  
> **username_1**: @username_0 BSV is an altcoin, I would definitely not recommend using that reference. Try perhaps https://raghavsood.com/blog/2018/06/10/bitcoin-signature-types-sighash ?   re: BIP174: it is a standardized protocol for passing partially constructed bitcoin transactions between users/software. Using software that employs it will make collaborating on a multi-party transaction much easier.  

---

