TL;DR: Can be done with
____ pk_B
____ | |------->
Alice | |2-of-{pk_A, pk_B} 2-of-{pk_A, pk_B} | | 0.5
----->|tx_1|------------------> ----------------->|tx_2|
1 |____| 1 | | pk_C
|____|------->
0.5
There is currently no such script. You can do it though with a little protocol and two transactions:
- Alice knows Bob's and Carol's keys (pk_B, pk_C). Bob knows Alice's and Carol's keys. Alice and Bob have already agreed to do this kind of payment out-of-band.
- Alice creates tx_1 that spends her 1 BTC and has a single (1, 2-of-{pk_A, pk_B}) output [where the output is (coins, script) and n-of-{m public keys} is an n-of-m-multisig]. She does not broadcast tx_1 yet.
- Alice creates tx_2 with a 2-of-{pk_A, pk_B} input that spends tx_1 and two outputs: (0.5, pk_B), (0.5, pk_C). She signs tx_2 with her sk_A and sends the signature, sig_A, to Bob.
- Bob recreates tx_2, verifies sig_A with pk_A and replies "OK" to Alice.
- Alice broadcasts tx_1.
- Bob signs tx_2 with his sk_B, adds the two signatures to tx_2 and broadcasts it.
The only way for Bob to get any coins is if he uses Alice's signature, which is valid only for tx_2, which splits Alice's coin equally among Bob and Carol. So Bob is incentivized to play along.
The drawbacks compared to a single script are that
- Alice and Bob must establish a communication channel,
- Bob must save Alice's signature and use it later,
- If Bob doesn't publish tx_2, the money is stuck,
- Two transactions are needed instead of one.
You can avoid the first two issues by having Alice put sig_A in an additional OP_RETURN in tx_1. OP_RETURN is big enough to fit sig_A and tx_1 will still be standard. Making sig_A public is secure because only Bob can create the other signature needed to spend tx_1. The third issue can be avoided by adding a timelock to the output of tx_1, after which Alice can spend the coin as she pleases. I don't see any way to avoid the last issue.