Apologies for the double post*, but I just had a follow up idea that's pretty interesting to me.

You can make the close portion of a DLC be an "optimistic" execution with a choice of justice scheme. This enables closing a DLC somewhat securely without exposing the oracles on-chain at all.

Assuming honest oracles, the only cost of this mechanism over previous is that you have to do a script path spend (but it can be a top-level branch, since it's the "most likely" one).


For every DLC branch like:

<CET-hash-i> CHECKTEMPLATEVERIFY
<attestation-point1> CHECKSIG
<attestation-point2> CHECKSIGADD
<attestation-point3> CHECKSIGADD
2 EQUAL

add a 2 branches:

<CET-hash-A> CHECKTEMPLATEVERIFY
<Alice> CHECKSIG
<CET-hash-B> CHECKTEMPLATEVERIFY
<Bob> CHECKSIG

This enables Alice or Bob to "lock in" a redemption of the contract that becomes spendable by them after <period>. CET-hash-* should include a nLockTime/nSequence such that it is at the same time as the attestation points should be known.

Where CET-hash-T sends funds to a DLC that has the following conditions:

(cooperate):
pk_internal=musig(Alice, Bob)
or (unilateral timeout)
<T> Checksig <2 weeks> CSV
or (show oracles for this outcome)
<CET-hash-i> CHECKTEMPLATEVERIFY
<attestation-point1> CHECKSIG
<attestation-point2> CHECKSIGADD
<attestation-point3> CHECKSIGADD
2 EQUAL
or (justice with no punishment), forall j !=i:
<CET-hash-j> CHECKTEMPLATEVERIFY
<attestation-point1> CHECKSIG
<attestation-point2> CHECKSIGADD
<attestation-point3> CHECKSIGADD
2 EQUAL
or (justice with punishment), forall j!=i:
<CET-hash-punish-j, send funds to not-T> CHECKTEMPLATEVERIFY
<attestation-point1> CHECKSIG
<attestation-point2> CHECKSIGADD
<attestation-point3> CHECKSIGADD
2 EQUAL

Justice with punishment seems to me to be the better option since T is actively choosing this resolution (the CTV transition is signed), but justice with no punishment might be better if you think the oracles might screw you over and collude to steal.
One interesting question is if the justice transactions can be "compressed" to be fewer for a given outcome. I.e., if Bob has claimed that the outcome is 35, and there are 100 total outcomes, do we need 99 justice paths or is there a way to make fewer of them? Intuitively, it would seem so, because if we have a 8-10 threshold for picking a path, a 3-10 proof would be sufficient to prove Bob claimed to know the 8-10 falsely. However, that then means 3-10 could collude, v.s. the fraud proof requiring a full 8-10 counter. Things to think about!

Best,

Jeremy

* this might actually be a triple or quadruple post depending on how you count, I adjusted which email was the subscriber on my mailing list account and resultantly sent from the old address... sincere apologies if you are seeing this message >1 times to those who were on the CC.
--
@JeremyRubin


On Fri, Jan 28, 2022 at 9:21 AM Jeremy <jlrubin@mit.edu> wrote:
Lloyd,

This is an excellent write up, the idea and benefits are clear.

Is it correct that in the case of a 3/5th threshold it is a total 10x * 30x = 300x improvement? Quite impressive.

I have a few notes of possible added benefits / features of DLCs with CTV:

1) CTV also enables a "trustless timeout" branch, whereby you can have a failover claim that returns funds to both sides.

There are a few ways to do this:

A) The simplest is just an oracle-free <STH(timeout tx)> CTV whereby the timeout transaction has an absolute/relative timelock after the creation of the DLC in question.

B) An alternative approach I like is to have the base DLC have a branch `<STH(begin timeout)> CTV` which pays into a DLC that is the exact same except it removes the just-used branch and replaces it with `<STH(timeout tx)> CTV` which contains a relative timelock R for the desired amount of time to resolve. This has the advantage of always guaranteeing at least R amount of time since the Oracles have been claimed to be non-live to "return funds"  to parties participating


2) CTV DLCs are non-interactive asynchronously third-party unilaterally creatable.

What I mean by this is that it is possible for a single party to create a DLC on behalf of another user since there is no required per-instance pre-signing or randomly generated state. E.g., if Alice wants to create a DLC with Bob, and knows the contract details, oracles, and a key for Bob, she can create the contract and pay to it unilaterally as a payment to Bob.

This enables use cases like pay-to-DLC addresses. Pay-to-DLC addresses can also be constructed and then sent (along with a specific amount) to a third party service (such as an exchange or Lightning node) to create DLCs without requiring the third party service to do anything other than make the payment as requested.


3) CTV DLCs can be composed in interesting ways

Options over DLCs open up many exciting types of instrument where Alice can do things like:
A) Create a Option expiring in 1 week where Bob can add funds to pay a premium and "Open" a DLC on an outcome closing in 1 year
B) Create an Option expiring in 1 week where one-of-many Bobs can pay the premium (on-chain DEX?).

 See https://rubin.io/bitcoin/2021/12/20/advent-23/ for more concrete stuff around this.

There are also opportunities for perpetual-like contracts where you could combine into one logical DLC 12 DLCs closing 1 per month that can either be payed out all at once at the end of the year, or profit pulled out partially at any time earlier.

4) This satisfies (I think?) my request to make DLCs expressible as Sapio contracts in https://rubin.io/bitcoin/2021/12/20/advent-23/

5) An additional performance improvement can be had for iterative DLCs in Lightning where you might trade over a fixed set of attestation points with variable payout curves (e.g., just modifying some set of the CTV points). Defer to you on performance, but this could help enable some more HFT-y experiences for DLCs in LN

Best,

Jeremy



On Mon, Jan 24, 2022 at 3:04 AM Lloyd Fournier via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
Hi dlc-dev and bitcoin-dev,

tl;dr OP_CTV simplifies and improves performance of DLCs by a factor of *a lot*.