Post
Topic
Board Development & Technical Discussion
Re: How to structure mutually conditional transactions?
by
Qoheleth
on 08/12/2013, 18:53:44 UTC
A & B send to a 4-signature address and get a refund transaction from C&D that is timelocked in the future.
C & D send to a 4-signature address and get a refund transaction from A&B that is timelocked in the future.

Once all funds arrive, make a transaction that spends both going into 4-sig, invalidating the refunds.

If time expires, each pair can decide to execute a refund.
Here's the problem with this: in order for A&C's spent UTXOs to remain secret, the A->{ABCD} and C->{ABCD} transactions have to be secret as well, with A and C sharing only their TXID hash. Once you've set up all of this, A and C have to publish those transactions, and whoever publishes first reveals their UTXOs without guaranteeing that the other team will publish their own transaction and let the deal go through.

If you could solve the issue of simultaneously revealing A and C's spent UTXOs, there wouldn't be a need for anything more exotic than SIGHASH_ANYONECANPAY, because you could just make a single transaction with B and D's outputs, A and C could individually write their inputs and prove (using SNARKs or some other zero-knowledge mechanism) that an encrypted form decrypts to some valid input of the proper amount, and then the two teams simultaneously reveal their decryption keys, so the moment either team knows the other team's input, both teams have the full transaction and can submit it at will.

But how do you simultaneously reveal? That's the trick.