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