<oembed><type>rich</type><version>1.0</version><title>Lloyd Fournier [ARCHIVE] wrote</title><author_name>Lloyd Fournier [ARCHIVE] (npub1kh…y05yp)</author_name><author_url>https://yabu.me/npub1khlhcuz0jrjwa0ayznq2q9agg4zvxfvx5x7jljrvwnpfzngrcf0q7y05yp</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2019-10-10&#xA;📝 Original message:&#xA;Hi ZmnSCPxj,&#xA;&#xA;&gt; I think, it is possible to make, a miniscript-like language for such&#xA;things.&#xA;&gt; Indeed, the only material difference, between SCRIPT-based `OP_CHECKSIG`s&#xA;and Lightning, would be the requirement to reveal scalars rather than prove&#xA;your knowledge of them.&#xA;&#xA;I&#39;ve thought about this too. I&#39;ve been pitching the language name as&#xA;&#34;Improv&#34; (since it&#39;s scriptless!). I think it would allow you to specify&#xA;the rules by which each output on each transaction can be spent and would&#xA;compile those rules into a protocol that does the secure key and signature&#xA;exchange for all the transactions in the scaffold. In other words, a&#xA;protocol compiler. I think this could be really useful for formal&#xA;specification of layer-2 protocols.&#xA;&#xA;LL&#xA;&#xA;On Thu, Oct 10, 2019 at 3:31 PM ZmnSCPxj via Lightning-dev &lt;&#xA;lightning-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; Good morning Nadav,&#xA;&gt;&#xA;&gt; Thank you very much for this framework!&#xA;&gt; It seems very good idea, kudos to making this framework.&#xA;&gt;&#xA;&gt; I think, it is possible to make, a miniscript-like language for such&#xA;&gt; things.&#xA;&gt; Indeed, the only material difference, between SCRIPT-based `OP_CHECKSIG`s&#xA;&gt; and Lightning, would be the requirement to reveal scalars rather than prove&#xA;&gt; your knowledge of them.&#xA;&gt;&#xA;&gt;&#xA;&gt; &gt; Idea 2: DLCs Routed over Lightning&#xA;&gt; &gt; Say that some DLC oracle will either broadcast s_A or s_B whose public&#xA;&gt; points are S_A and S_B (which can be computed from public information as&#xA;&gt; per the DLC scheme). Then say that Alice and Bob enter into a contract&#xA;&gt; under which Alice wins some amount if s_A is broadcasted and Bob if s_B is&#xA;&gt; broadcasted. Say Alice has a point A and Bob has a point B. They each send&#xA;&gt; the other a payment with the amount that party must receive if they win&#xA;&gt; with the payment point A + S_A for Bob&#39;s payment to Alice and B + S_B for&#xA;&gt; Alice&#39;s payment to Bob. And this is it! If s_A is broadcasted then Alice&#xA;&gt; gets paid (and Bob gets proof of payment a, which is the scalar to A),&#xA;&gt; otherwise s_B is broadcasted and Bob gets paid (with Alice receiving b as&#xA;&gt; PoP). An interesting note is that under this scheme neither party is forced&#xA;&gt; to pay extra on-chain fees in the case of a counter-party who doesn&#39;t&#xA;&gt; cooperate whilst in the wrong.&#xA;&gt; &gt; One wrinkle with this scheme is that setup isn&#39;t trustless. Although it&#xA;&gt; is generally true that one party must sign the funding transaction for a&#xA;&gt; DLC before the other party for on-chain DLCs, at least there is the&#xA;&gt; mitigation that when your counter-party goes silent, you can move your&#xA;&gt; input funds invalidating the funding transaction you signed (at a cost&#xA;&gt; because fees). So what can we do here to ensure that both payments are&#xA;&gt; setup at the same time in the case that Alice and Bob don&#39;t trust each&#xA;&gt; other?&#xA;&gt; &gt; Say that although they don&#39;t trust each other, they&#39;re both willing to&#xA;&gt; trust some escrow entity who generates some point E for their payment.&#xA;&gt; Alice&#39;s payment point to Bob becomes B + S_B + E and Bob&#39;s to Alice becomes&#xA;&gt; A + S_A + E. The escrow now waits to hear from Alice and Bob that they have&#xA;&gt; incoming payments setup and only once both of them attest to this (using&#xA;&gt; signatures, for example) does the escrow release the scalar to E to them&#xA;&gt; both. The escrow can also have a timeout at which it will never reveal the&#xA;&gt; scalar to E: forcing both parties to commit to the contract well before the&#xA;&gt; DLC event. In this way, trust has been moved from counter-party to&#xA;&gt; trustworthy (hopefully) escrow in such a way that the Escrow learns nothing&#xA;&gt; about the contract itself (other than that there is one of some kind).&#xA;&gt;&#xA;&gt; I think we can call this a &#34;barrier escrow&#34;.&#xA;&gt;&#xA;&gt; * It is similar to the concept of synchronization barriers for multithread&#xA;&gt; coordination: https://en.wikipedia.org/wiki/Barrier_(computer_science)&#xA;&gt; * In effect, each sub-transaction of the entire arrangement is a &#34;thread&#34;&#xA;&gt; of operation, and the &#34;barrier escrow&#34; ensures that all the threads have&#xA;&gt; reached it before letting them continue to claim the payments.&#xA;&gt;&#xA;&gt;&#xA;&gt; I seem, this is applicable to *not only* DLC, but others as well.&#xA;&gt; Instead, it seems to me to also provide an alternate solution to the&#xA;&gt; Premium-free American Call Option Problem.&#xA;&gt;&#xA;&gt; Let us introduce our characters:&#xA;&gt;&#xA;&gt; * B, a supposed buyer, holding some Bitcoin.&#xA;&gt; * S, a supposed seller, who wishes to be paid in another asset.&#xA;&gt; * X, a cross-currency exchange Lightning node.&#xA;&gt; * E, a tr\*sted escrow.&#xA;&gt;&#xA;&gt; X would like to facilitate exchanges across different assets, but wants to&#xA;&gt; be paid a premium in order to prevent the Premium-free American Call Option&#xA;&gt; Problem.&#xA;&gt; B would like to swap its Bitcoin for another asset to pay S, and would be&#xA;&gt; willing to pay the above premium, but only conditional on S actually&#xA;&gt; getting the asset it wants to be paid in.&#xA;&gt; X and B are non-trusting to each other, but are willing to tr\*st escrow E.&#xA;&gt;&#xA;&gt; This again is another &#34;two transactions&#34; setup, where we move tr\*st from&#xA;&gt; X and B and transfer it to E.&#xA;&gt;&#xA;&gt; * B forwards the payment to be exchanged through X and onward to S,&#xA;&gt; conditional on receiving the scalar behind `S + E`.&#xA;&gt; * B gives a payment to X conditional on receiving the scalar behind `X +&#xA;&gt; E`.&#xA;&gt; * X continues to forward the payment, in the target asset, to S.&#xA;&gt; * X contacts E and requests for the secret behind `E`.&#xA;&gt; * S, on receiving the incoming payment, contacts E and requests for the&#xA;&gt; secret behind `E`.&#xA;&gt; * As E has now received both requests, it releases the secret&#xA;&gt; simultaneously to both branches.&#xA;&gt; * S and X can now claim their payments.&#xA;&gt;&#xA;&gt; Now, I would also like to observe the below fact:&#xA;&gt;&#xA;&gt; * Proof-of-payment can be reconsidered, under payment point + scalar&#xA;&gt; scheme, to be &#34;pay-for-scalar&#34; scheme.&#xA;&gt;&#xA;&gt; I would also like to point out the below assumption, which underlies Bass&#xA;&gt; Amplifier (&#34;multipath payments&#34;, &#34;base AMP&#34;) and its claim to atomicity:&#xA;&gt;&#xA;&gt; * If we agree that my secret `s` is worth `m` millisatoshi, then I (as a&#xA;&gt; perfectly rational economic agent) will not claim any payments conditional&#xA;&gt; on my revelation of `s` that sum up to less than `m` millisatoshi: I will&#xA;&gt; only claim *all* of them when I can get multiple payments conditional on my&#xA;&gt; revelation of `s` that sum up to `m` millisatoshi or more.&#xA;&gt;   * I now call this &#34;economically-rational atomicity&#34;, and describe also&#xA;&gt; them mildly here:&#xA;&gt; https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-March/001109.html&#xA;&gt;&#xA;&gt; The above is *exactly* the behavior we want E to perform: only if it&#xA;&gt; receives both requests to reveal its secret `e` behind `E`, will it&#xA;&gt; actually reveal the secret.&#xA;&gt; In our case, we turn the requests to E into partial payments of a single&#xA;&gt; invoice (though of course, the payment from S to E would be in the asset&#xA;&gt; that S wants rather than in Bitcoin).&#xA;&gt; E would not like to &#34;sell short&#34; its secret `e` for less than the price of&#xA;&gt; its service, thus if E is economically rational, it would only claim&#xA;&gt; payments (and reveal `e`) once *all* incoming payments sum up to the price&#xA;&gt; of its service.&#xA;&gt;&#xA;&gt; In particular, the existing High AMP scheme would be reused to implement&#xA;&gt; the escrow E, and all that would be needed would be some way to request&#xA;&gt; invoices from E!&#xA;&gt; No additional code on top of High AMP is needed (very important, being a&#xA;&gt; lazy developer is hard work).&#xA;&gt; This should help make setting up new Es to be very simple, improving&#xA;&gt; competition in this space and helping further ensure economically-rational&#xA;&gt; behavior.&#xA;&gt;&#xA;&gt; If we squint, we can even say that:&#xA;&gt;&#xA;&gt; * This is actually a payment from B to E.&#xA;&gt; * The payment is split into two paths, B-&gt;X-&gt;E and B-&gt;X-&gt;S-&gt;E.&#xA;&gt; * X and S are just being paid surprisingly high fees, and are not in fact&#xA;&gt; being paid premiums or payment-for-product/service.&#xA;&gt;&#xA;&gt; Thus, any argument that we could make, about the safety of Bass Amplifier,&#xA;&gt; would also serve as an argument we could make about E behaving as we would&#xA;&gt; like it to behave!&#xA;&gt; This should greatly reduce the tr\*st requirement from B and X to E: they&#xA;&gt; only need to trust that E operates econmically-rationally, and not trust&#xA;&gt; that E will, from the goodness of its own heart, operate correctly.&#xA;&gt;&#xA;&gt; (A remaining issue for the above scheme is that B learns `s + e` and `x +&#xA;&gt; e`, not either `s` or `x`, and thus does not actually get full&#xA;&gt; proof-of-payment.)&#xA;&gt;&#xA;&gt;&#xA;&gt; Further, this lets us extend this scheme to more than just two&#xA;&gt; simultaneous transactions.&#xA;&gt; If for example we need to set up 5 simultaneous transactions, and E&#xA;&gt; charges 1000 millisatoshi for its service, then we just have each receiver&#xA;&gt; forward 200 millisatoshi each to E once their incoming payment has been set&#xA;&gt; up.&#xA;&gt;&#xA;&gt; In fact, the above problem, where B learns `s + e` and `x + e` but not&#xA;&gt; either `s` or `x`, could be solved by splitting the payment to E three&#xA;&gt; ways, with a third split from B to E, so that B learns `e` and can solve&#xA;&gt; `(s + e) - e` == `s` and `(x + e) - e` == `x` to get proof-of-payment for&#xA;&gt; both the actual purchase, and the premium charged by the exchange.&#xA;&gt;&#xA;&gt; In all of these, E remains unaware of the exact details of the&#xA;&gt; arrangement, it only cares that it is paid, with the use of High AMP being&#xA;&gt; the &#34;coordination&#xA;&gt;&#xA;&gt;&#xA;&gt; Thus this scheme is surprisingly flexible, and may solve more problems&#xA;&gt; than you might think.&#xA;&gt; Thank you for this insight, Nadav!&#xA;&gt;&#xA;&gt; Regards,&#xA;&gt; ZmnSCPxj&#xA;&gt;&#xA;&gt; _______________________________________________&#xA;&gt; Lightning-dev mailing list&#xA;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20191011/0c0cc4f2/attachment.html&gt;</html></oembed>