<oembed><type>rich</type><version>1.0</version><author_name>npub1g6vxlp4e0nyhs2dqxxcryztyf5f5hyuaq93nw4r87zcnv0sdsa0qqsl5wd</author_name><author_url>https://nostr.ae/npub1g6vxlp4e0nyhs2dqxxcryztyf5f5hyuaq93nw4r87zcnv0sdsa0qqsl5wd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2017-02-06&#xA;📝 Original message:&#xA;I created a possible step by step protocol with checks that each step is&#xA;safe.&#xA;&#xA;I think your scheme needs a 2nd timeout, so Bob has a time between Alice&#xA;broadcasting AliceSecret and Alice closing the channel with TX2.&#xA;&#xA;TX1&#xA;&#xA;Input&#xA;1 from Alice&#xA;1 from Bob&#xA;&#xA;Output&#xA;1:  (Alice + Bob + timeout(2T)) OR (Bob + AliceSecret)&#xA;1:  (Bob + timeout(T)) OR (Alice + AliceSecret)&#xA;&#xA;TX2&#xA;&#xA;Input&#xA;TX1:1: signed by (Alice + Bob)&#xA;Output&#xA;Initial channel paying Alice 100%&#xA;&#xA;Process:&#xA;&#xA;Step 1&#xA;&#xA;Alice creates TX1, signs it and sends it to Bob.&#xA;&#xA;If Alice refuses this step, then nothing has happened, so it is a safe&#xA;abort.&#xA;&#xA;Step 2&#xA;&#xA;Bob signs it and sends Alice the tx hash.&#xA;&#xA;Bob could sign and broadcast it.  If he does that, then Alice spends her&#xA;output to get her money back, so it is a safe abort.&#xA;&#xA;If Bob refuses to complete this step, Alice should spend her input to&#xA;prevent Bob broadcasting the TX1 later.  This is also a safe abort.&#xA;&#xA;NOTE:&#xA;*  This is an ongoing check Alice must perform.&#xA;*  If (timeout / 2) passes before all the steps are completed, Alice should&#xA;try to&#xA;**    double spend her input into TX1&#xA;**    spend her output from TX1&#xA;&#xA;Step 3&#xA;&#xA;Alice creates TX2, signs it and sends it to Bob.&#xA;&#xA;If Alice refuses to complete this step, then Bob simply discards TX1.&#xA;Alice can&#39;t broadcast it since she does not have a fully signed version of&#xA;TX1.&#xA;&#xA;Step 4&#xA;&#xA;Bob signs TX2 and sends it to Alice.&#xA;&#xA;If Bob refuses to complete this step, the Alice should spend her input or&#xA;her output of TX1 (if Bob has broadcast TX1).  This is a safe abort.&#xA;&#xA;Step 5&#xA;&#xA;Bob broadcasts TX1&#xA;&#xA;If Bob refuses to complete this step, the Alice should spend her input.&#xA;This is a safe abort.&#xA;&#xA;Step 6&#xA;&#xA;Alice should make sure TX1 is included in the chain without mutation.&#xA;&#xA;If it is ok, then Alice does nothing.&#xA;&#xA;If it is mutated, then Alice should spend her output immediately.&#xA;&#xA;If Alice refuses to complete this step, then Bob can reclaim his money&#xA;after the timeout and Alice loses access to her money.  Alice has an&#xA;incentive to complete this step.&#xA;&#xA;Step 7 (mutated TX only)&#xA;&#xA;Bob can spend his output using AliceSecret.&#xA;&#xA;If Bob refuses to complete this step, then he doesn&#39;t get his money, but&#xA;Alice is not harmed.&#xA;&#xA;Step 7 (valid setup)&#xA;&#xA;Bob spends his output after the timeout.  Once he has spent his output,&#xA;then the channel is setup.&#xA;&#xA;There is a potential race condition here.&#xA;&#xA;After the timeout has expired, Alice could broadcast 2 transactions&#xA;- TX2 (to close the channel paying Alice 100%)&#xA;- transaction to spend TX1/1 (i.e. Alice + Alice secret)&#xA;&#xA;Bob would be broadcasting his transaction to claim TX1/1 at around the same&#xA;time.&#xA;&#xA;The network might accept Alice&#39;s 2 transactions, before Bob has a chance to&#xA;claim TX1/0 (with Bob + AliceSecret).&#xA;&#xA;Adding an extra timeout with the later expiry to TX1/0 means that Alice&#xA;cannot broadcast TX2 until Bob has a chance to claim his output.&#xA;&#xA;&#xA;On Mon, Feb 6, 2017 at 2:25 AM, Nicolas Dorier &lt;nicolas.dorier at gmail.com&gt;&#xA;wrote:&#xA;&#xA;&gt; Alice opening channel of 1BTC&#xA;&gt;&#xA;&gt; Input:&#xA;&gt; 1 BTC From Alice&#xA;&gt; 1 BTC From Bob&#xA;&gt; Output:&#xA;&gt; 1 BTC Alice+Bob OR Bob+AliceSecret&#xA;&gt; 1 BTC Bob+Timeout OR Alice+AliceSecret (aka the bounty)&#xA;&gt;&#xA;&gt; If bob is unresponsive, Alice can get the bounty.&#xA;&gt; If Alice unresponsive, bob can get the bounty after timeout.&#xA;&gt; If Alice takes the bounty, Bob can take the escrow .&#xA;&gt;&#xA;&gt; If Alice responsive, bob wait for getting the bounty. The use of the&#xA;&gt; channel will start after bob get the bounty back.&#xA;&gt;&#xA;&gt;&#xA;&gt;&#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;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20170206/ea7b8785/attachment.html&gt;</html></oembed>