<oembed><type>rich</type><version>1.0</version><author_name>npub1uqcrlv7gf6hwmmm2n2dr5kdqwjct7pyf8r9zpumwgk297r3el6ssdc9gv6</author_name><author_url>https://nostr.ae/npub1uqcrlv7gf6hwmmm2n2dr5kdqwjct7pyf8r9zpumwgk297r3el6ssdc9gv6</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-01-20&#xA;📝 Original message:&#xA;Hi Subhra,&#xA;&#xA;thanks for your question.&#xA;&#xA;&gt; So as of now if we consider transfer of a file (may of few KB) then you&#xA;split it into several blocks and use atomic multi path payment whole using&#xA;the blocks for embedding with the preimage inorder to obtain payment.&#xA;&gt; But it might be the case you may not have sufficient number of path to&#xA;transfer all the blocks at one go because of preimage size limitation of&#xA;256 bit (I didn&#39;t get the point that there is no limitation on data size,&#xA;can anyone explain that ?).&#xA;&#xA;Yes. It needs many blocks and paths if large file.&#xA;But it has no problem because it can use the same path several times.&#xA;&#xA;Of course it needs much money to transfer large file. But this is good&#xA;point in order to retain lightning network stable.&#xA;&#xA;For DOS attack, OG AMP has the same problem. It might that recipient needs&#xA;a limit how many split blocks the recipient accept&#xA;&#xA;&gt; So may be you need several iteration and I presume thats what lightning&#xA;network will pitch in where we have several such microtransactions going on.&#xA;&gt; What happens if it fails in an iteration ? So the recipient of the file&#xA;remains happy with the partial content ? Or will the payment be revoked&#xA;(not sure how) if recipient doesn&#39;t get the full content ?&#xA;&#xA;This is about the DLAS-up protocol.&#xA;The protocol uses OG AMP so the payments and data transfers are revoked in&#xA;case that it fails.&#xA;&#xA;Thanks,&#xA;Takaya Imai&#xA;&#xA;2020年1月16日(木) 16:14 Subhra Mazumdar &lt;subhra.mazumdar1993 at gmail.com&gt;:&#xA;&#xA;&gt; Hello Takaya,&#xA;&gt;         I really liked the idea of data atomic swap mentioned over here.&#xA;&gt; So as of now if we consider transfer of a file (may of few KB) then you&#xA;&gt; split it into several blocks and use atomic multi path payment whole using&#xA;&gt; the blocks for embedding with the preimage inorder to obtain payment. But&#xA;&gt; it might be the case you may not have sufficient number of path to transfer&#xA;&gt; all the blocks at one go because of preimage size limitation of 256 bit (I&#xA;&gt; didn&#39;t get the point that there is no limitation on data size, can anyone&#xA;&gt; explain that ?). So may be you need several iteration and I presume thats&#xA;&gt; what lightning network will pitch in where we have several such&#xA;&gt; microtransactions going on. What happens if it fails in an iteration ? So&#xA;&gt; the recipient of the file remains happy with the partial content ? Or will&#xA;&gt; the payment be revoked (not sure how) if recipient doesn&#39;t get the full&#xA;&gt; content ?&#xA;&gt;&#xA;&gt; On Mon, Nov 11, 2019 at 6:29 AM Takaya Imai &lt;&#xA;&gt; takaya.imai at frontier-ptnrs.com&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Hi all,&#xA;&gt;&gt;&#xA;&gt;&gt; I propose Data Lightning Atomic Swap.&#xA;&gt;&gt; Anyone already have the same idea?&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; [Abstract]&#xA;&gt;&gt; This proposal is a way to swap data and lightning payment atomically.&#xA;&gt;&gt; It has two patterns, one is for a payer to swap data-download with&#xA;&gt;&gt; lightning payment to a payee (DLAS-down), the other is for a payer to swap&#xA;&gt;&gt; data-upload with lightning payment to a payee (DLAS-up).&#xA;&gt;&gt;&#xA;&gt;&gt; The data is embedded to preimage so sending and receiving the data need&#xA;&gt;&gt; lightning payment at the same time.&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt; [Motivation]&#xA;&gt;&gt; Atomic Swaps among crypto currencies has various ways to implement&#xA;&gt;&gt; (on-chain to on-chain[1], on-chain to of-chain(Submarine Swap[2])). And&#xA;&gt;&gt; Atomic Swaps between data and crypto currencies are also proposed as a part&#xA;&gt;&gt; of TumbleBit mechanism[3], Storm mechanism[4] and so on.&#xA;&gt;&gt;&#xA;&gt;&gt; Recently Joost Jager proposed Instant messages with lightning onion&#xA;&gt;&gt; routing, whatsat[5], which use recent sphinx payload change[6]. This is&#xA;&gt;&gt; very awesome but not atomic with lightning payment.&#xA;&gt;&gt;&#xA;&gt;&gt; Atomic lightning mechanism for data is useful in use cases below.&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt; [Pros &amp; Cons]&#xA;&gt;&gt;&#xA;&gt;&gt; * DLAS-down&#xA;&gt;&gt; ** Pros&#xA;&gt;&gt; *** Atomic data download exchange with lightning payment&#xA;&gt;&gt; ** Cons&#xA;&gt;&gt; *** It needs better mechanism to expand data size&#xA;&gt;&gt;&#xA;&gt;&gt; * DLAS-up&#xA;&gt;&gt; ** Pros&#xA;&gt;&gt; *** Atomic data upload exchange with lightning payment&#xA;&gt;&gt; ** Cons&#xA;&gt;&gt; *** OG AMP[7] is needed to implement&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt; [What I describe]&#xA;&gt;&gt; * A way to swap data with lightning payment atomically.&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt; [What I do not describe]&#xA;&gt;&gt; * A way to detect that data is correct or not, namely zero knowledge&#xA;&gt;&gt; proof process.&#xA;&gt;&gt;&#xA;&gt;&gt; For example, probabilistic checkable proof like TumbleBit[3] proposed.&#xA;&gt;&gt; Just message as data is no problem because no need to check the message&#xA;&gt;&gt; is correct or not.&#xA;&gt;&gt;&#xA;&gt;&gt; * A way in case that different preimages are used in a payment route like&#xA;&gt;&gt; Multi-hop locks.&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt; [Specification]&#xA;&gt;&gt;&#xA;&gt;&gt; Lightning Network(LN) has a mechanism about preimage like a brief image&#xA;&gt;&gt; below.&#xA;&gt;&gt;&#xA;&gt;&gt; Payer                             Mediators&#xA;&gt;&gt;  Payee&#xA;&gt;&gt;&#xA;&gt;&gt; =================================================================================&#xA;&gt;&gt;&#xA;&gt;&gt; Preimage&#xA;&gt;&gt; Preimage Hash  &lt;--------------------- invoice ------------------------&#xA;&gt;&gt;  Preimage Hash&#xA;&gt;&gt; Preimage Hash  ----------------&gt;   Preimage Hash --------------------&gt;&#xA;&gt;&gt;  Preimage Hash&#xA;&gt;&gt; Preimage       &lt;—-------------—-   Preimage      &lt;--------------------&#xA;&gt;&gt;  Preimage&#xA;&gt;&gt;&#xA;&gt;&gt; As you know, preimage Payer gets can be a proof of payment because Payer&#xA;&gt;&gt; can not get it if the payment is executed correctly.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; 1, Data download &lt;-&gt;  lightning (DLAS-down)&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Payer sends lightning payment and receives data from Payee atomically.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Payer                             Mediators&#xA;&gt;&gt;  Payee&#xA;&gt;&gt;&#xA;&gt;&gt; =================================================================================&#xA;&gt;&gt; Payer Channel Pubkey &lt;-----------------------------------------------&gt;&#xA;&gt;&gt; Payee Channel Pubkey&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;  data(256bit, padded)&#xA;&gt;&gt;&#xA;&gt;&gt;  enc_key = (Payee Channel Secret Key * Payer Channel Pubkey).x  (256bit)&#xA;&gt;&gt; enc_key = (Payer Channel Secret Key * Payee Channel Pubkey).x  (256bit)&#xA;&gt;&gt;&#xA;&gt;&gt;  enc_data = data XOR enc_key&#xA;&gt;&gt; sha256(enc_data) &lt;--------------------- invoice ----------------------&#xA;&gt;&gt; sha256(enc_data)&#xA;&gt;&gt; sha256(enc_data) ----------------&gt; sha256(enc_data) -----------------&gt;&#xA;&gt;&gt; sha256(enc_data)&#xA;&gt;&gt; enc_data         &lt;---------------- enc_data &lt;-------------------------&#xA;&gt;&gt; enc_data&#xA;&gt;&gt; data = enc_data XOR enc_key&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; * The size of data is restricted to 256 bits. Identically, it should be&#xA;&gt;&gt; extended to larger data and the data should be transferred in several&#xA;&gt;&gt; payment paths like DLAS-up.&#xA;&gt;&gt; * Channel Pubkey is only one for one channel and the data can be&#xA;&gt;&gt; decrypted if enc_key is leaked. So enc_key should be generated newly every&#xA;&gt;&gt; time by a way like hash chain but the protocol image above is just example&#xA;&gt;&gt; for simplicity.&#xA;&gt;&gt; * .x means X axis value of points on Elliptic Curve.&#xA;&gt;&gt; * If data is less than 256 bits, then 0x00 is padded (I am not sure which&#xA;&gt;&gt; of big endian and little endian is better).&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; 2, Data upload &lt;-&gt;  lightning (DLAS-down)&#xA;&gt;&gt;&#xA;&gt;&gt; Payer sends data and lightning payment from Payee atomically.&#xA;&gt;&gt; This is like OG AMP(Atomic Multi-path Payment)[7] system.&#xA;&gt;&gt;&#xA;&gt;&gt; Payer                             Mediators&#xA;&gt;&gt;  Payee&#xA;&gt;&gt;&#xA;&gt;&gt; =================================================================================&#xA;&gt;&gt; data(512bit, padded)&#xA;&gt;&gt;&#xA;&gt;&gt; share1(256bit)&#xA;&gt;&gt; share2(256bit)&#xA;&gt;&gt;&#xA;&gt;&gt; base_s = share1 XOR share2&#xA;&gt;&gt; data1(256bit) ||  data2(256bit) = data(512bit)&#xA;&gt;&gt; XOR_d1 = data1 XOR base_s&#xA;&gt;&gt; XOR_d2 = data2 XOR base_s&#xA;&gt;&gt; PreImg1 = sha256(base_s || data || 1)&#xA;&gt;&gt; PreImg2 = sha256(base_s || data || 2)&#xA;&gt;&gt;&#xA;&gt;&gt; sha256(PreImg1), XOR_d1, share1 -&gt; sha256(PreImg1), XOR_d1, share1  -&gt;&#xA;&gt;&gt; sha256(PreImg1), XOR_d1, share1&#xA;&gt;&gt; sha256(PreImg2), XOR_d2, share2 -&gt; sha256(PreImg2), XOR_d2, share2  -&gt;&#xA;&gt;&gt; sha256(PreImg2), XOR_d2, share1&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;  base s = share1 XOR share2&#xA;&gt;&gt;&#xA;&gt;&gt;  data = (XOR_d1 XOR base_s) || (XOR_d2 XOR base_s)&#xA;&gt;&gt;&#xA;&gt;&gt;  PreImg1 = sha256(base_s || data || 1)&#xA;&gt;&gt;&#xA;&gt;&gt;  PreImg2 = sha256(base_s || data || 2)&#xA;&gt;&gt;&#xA;&gt;&gt; PreImg1    &lt;-------------------    PreImg1    &lt;---------------------&#xA;&gt;&gt; PreImg1&#xA;&gt;&gt; PreImg2    &lt;-------------------    PreImg2    &lt;---------------------&#xA;&gt;&gt; PreImg2&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; * This protocol example has 512 bits data and they are transferred in two&#xA;&gt;&gt; paths. However, it can transfer larger data in several payment paths like&#xA;&gt;&gt; [5].&#xA;&gt;&gt; * || means string concatenation.&#xA;&gt;&gt; * If data is less than 512 bits, then 0x00 is padded(I am not sure which&#xA;&gt;&gt; of big endian and little endian is better).&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; ---------&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; [Use Cases]&#xA;&gt;&gt;&#xA;&gt;&gt; 1, Lightning Network ecosystem&#xA;&gt;&gt;&#xA;&gt;&gt; * Hosting Incentives like Acai Protocol&#xA;&gt;&gt; ** Watchtower Hosting incentive, Backup Hosting incentive&#xA;&gt;&gt; *** Commitment tx data sending to Data Host(DLAS-up)&#xA;&gt;&gt; **** Commitment tx data is embedded in preimage so that Payer can not&#xA;&gt;&gt; send the data without remittance&#xA;&gt;&gt; *** Channel backup data receiving from Data Host(DLAS-down)&#xA;&gt;&gt; **** Channel backup data is embedded in preimage so that Payer can not&#xA;&gt;&gt; receive the data without remittance&#xA;&gt;&gt;&#xA;&gt;&gt; 2, Crypto currency Problems&#xA;&gt;&gt;&#xA;&gt;&gt; * Distributed secret key sharing (just come up with an idea though)&#xA;&gt;&gt; ** As a key backup, one of secret key shares is distributed with&#xA;&gt;&gt; encryption(DLAS-up) to some nodes, which nodes receive lightning payment as&#xA;&gt;&gt; key managing fee. And the nodes send a proof for managing the key as&#xA;&gt;&gt; response of bloom filter periodically, and exchange encrypted secret key&#xA;&gt;&gt; share with lightning payment to asset holder(DLAS-down).&#xA;&gt;&gt; ** For example 2 out of 3 multi signature key sharing, asset holder puts&#xA;&gt;&gt; the first key, the custodial has the second key, and the third key at the&#xA;&gt;&gt; lightning distribution nodes. Asset holders usually spend assets using&#xA;&gt;&gt; their key and the key on Distributed Nodes.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; 3, Problems so far&#xA;&gt;&gt;&#xA;&gt;&gt; * Prevention email spam and DDoS attack with large data&#xA;&gt;&gt; ** Payer can not send email or data without remittance(DLAS-up)&#xA;&gt;&gt; ** Payer can not receive reply-email without remittance(DLAS-down)&#xA;&gt;&gt;&#xA;&gt;&gt; * Incentive of receiving advertisements on browser or desktop/mobile app&#xA;&gt;&gt; ** Payer can not send advertisements without remittance(DLAS-up)&#xA;&gt;&gt;&#xA;&gt;&gt; * Bounty for code bug fixes based on cryptographic proofs or secret&#xA;&gt;&gt; computations&#xA;&gt;&gt; ** (DLAS-down)&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; [References]&#xA;&gt;&gt;&#xA;&gt;&gt; [1] https://bitcointalk.org/index.php?topic=321228&#xA;&gt;&gt; [2] https://twitter.com/roasbeef/status/964608261830750208&#xA;&gt;&gt; [3] https://eprint.iacr.org/2016/575&#xA;&gt;&gt; [4] https://github.com/storm-org/storm-spec&#xA;&gt;&gt; [5] https://twitter.com/joostjgr/status/1190714028626251779&#xA;&gt;&gt; [6] https://github.com/lightningnetwork/lightning-rfc/pull/619&#xA;&gt;&gt; [7]&#xA;&gt;&gt; https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-February/000993.html&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; document on github:&#xA;&gt;&gt; https://github.com/takaya-imai/data_lightning_atomic_swap&#xA;&gt;&gt;&#xA;&gt;&gt; Best regards,&#xA;&gt;&gt; Takaya Imai&#xA;&gt;&gt; Email: takaya.imai at frontier-ptnrs.com, takaya.imai at unitedbitcoiners.com&#xA;&gt;&gt; _______________________________________________&#xA;&gt;&gt; Lightning-dev mailing list&#xA;&gt;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; --&#xA;&gt; Yours sincerely,&#xA;&gt; Subhra Mazumdar.&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200120/dd3a091b/attachment-0001.html&gt;</html></oembed>