0

Is it possible to write a Bitcoin script that pays multiple recipients? For instance, a script funded with 2 BTC by Alice that pays 1 BTC each to Bob and Charlie.

Eventually I'd like to build a system using Lightning, where Alice, Bob and Charlie are all part of a channel. Alice would fund the channel and the script would determine how much of the funds go to Bob and Charlie.

3 Answers 3

2

Bitcoin Script has only one function: determining the conditions under which a transaction output can be spent, in its entirety. The result of evaluating a script is just "true" or "false".

So no, you cannot have a single script that corresponds to two payouts, because every output has exactly one script. You can have an output with a script that lets it be spent when two keys sign off, or one that lets it be spent when one of them signs off. But it's always going to be the entire output, with the entirety of the value it has.

1

No, currently scripts have no way to inspect the outputs of the spending transaction and require. There is no way to restrict what scripts can be created, nor what amounts outputs can be.

There are ideas for covenants where a script can do those things, but these are not deployed, and there are currently no plans to deploy them.

1

Is it possible to write a Bitcoin script that pays multiple recipients? For instance, a script funded with 2 BTC by Alice that pays 1 BTC each to Bob and Charlie.

Alice creates a 2 of 3 multisig using public keys for Alice, Bob and Charlie.

Alice sends 2 BTC to multisig address.

Bob and Charlie could spend this and send 1 BTC to each of them. So the payment part isn't enforced by script but we could create conditions under which an output can be spent. In this case Bob and Charlie can use their keys to do the payment. If one of them doesn't agree, Alice can use her key to still do the payment.

Eventually I'd like to build a system using Lightning, where Alice, Bob and Charlie are all part of a channel. Alice would fund the channel and the script would determine how much of the funds go to Bob and Charlie.

I am not sure but maybe 3 channels could be opened between them using the concept of channel factories to create a setup in which closing the channels sends bitcoin to Bob and Charlie.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.