Post
Topic
Board Development & Technical Discussion
Merits 57 from 9 users
Re: Multi-User transaction with Bitcoin.
by
o_e_l_e_o
on 02/11/2022, 15:10:07 UTC
⭐ Merited by mprep (25) ,Welsh (8) ,PowerGlove (8) ,NotATether (5) ,pooya87 (4) ,n0nce (2) ,ETFbitcoin (2) ,igor72 (2) ,DdmrDdmr (1)
I wouldn't use multi-sig for this at all. Instead I would use either SIGHASH_ALL | SIGHASH_ANYONECANPAY.

Essentially, Alice creates a transaction which contains her 0.1 mBTC input and a 0.2 mBTC output to the society. She signs it with SIGHASH_ALL | SIGHASH_ANYONECANPAY. This signs her input and the output, but allows the addition of further inputs. She then passes this transaction to Bob. Bob cannot broadcast it as it stands, because the outputs are higher than the inputs and so it is invalid. However, Bob can then add his own 0.1 mBTC input to the transaction, which would make it valid, and can then be broadcast.

Alternatively, Alice could sign with SIGHASH_SINGLE | SIGHASH_ANYONECANPAY, allowing Bob to add his own input as well as a change address, in case he doesn't have a 0.1 mBTC ready to go.