<oembed><type>rich</type><version>1.0</version><author_name>npub1za0a9afyj7um5feva0d5xmhfsah3zxm252hna2duq0numa952frqvuua2a</author_name><author_url>https://nostr.ae/npub1za0a9afyj7um5feva0d5xmhfsah3zxm252hna2duq0numa952frqvuua2a</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-02-07&#xA;📝 Original message:&#xA;Hi ZmnSCPxj and Laolu,&#xA;&#xA;&gt;  Indeed, the existence of per-hop fees (`fee_base_msat`) means, splitting&#xA;the&#xA;&gt;  payment over multiple flows will be, very likely, more expensive,&#xA;compared to&#xA;&gt;  using a single flow.&#xA;&#xA;As Laolu pointed out, we have yet to see how fees evolve on mainnet or what&#xA;will&#xA;emerge as a sane, default fee schedules. I agree that if the same&#xA;proportional&#xA;fee is used across all partial payments, then it could certainly be more&#xA;expensive.&#xA;&#xA;However, it could also be the case that you were paying a needlessly high&#xA;proportional fee to begin with, because paths of sufficient capacity to the&#xA;destination were scarce. In an AMP world, there will be an abundance of&#xA;channels&#xA;that can route small, partial payments, which may itself drive down the&#xA;competitive fee rate for smaller payments. Just a hypothesis, we shall see&#xA;where&#xA;supply meets demand!&#xA;&#xA;At the end of the day, the user can always fall back to regular payment if&#xA;they&#xA;expect to end up paying more fees using an AMP.&#xA;&#xA;&gt; (If we want to support multiple routes converging to an intermediate node,&#xA;&gt; then continue routing to a different final node after routes have merged&#xA;(i.e.&#xA;&gt; A-&gt;B-&gt;C-&gt;D, and A-&gt;E-&gt;C-&gt;D, with the payment being merged by C, who&#xA;forwards&#xA;&gt; the combination to D), then we need to follow the current hop data&#xA;format, but&#xA;&gt; I think supporting AMP at final payees is actually enough...&#xA;&#xA;I think this is an interesting idea, sounds maybe like a&#xA;recursive/hierarchical&#xA;AMP? The ability to merge the payments seems like it would result in a&#xA;decent privacy&#xA;leak, as I believe an intermediary would have enough evidence to prove that&#xA;two&#xA;payments were merged/correlated. Simple traffic analysis would also reveal a&#xA;discrepancy in the number of incoming and outgoing packets, and possibly&#xA;other&#xA;observable differences in routing (some) AMPs vs regular payments.&#xA;&#xA;FWIW the current proposal allows the paths of partial payments to overlap,&#xA;in such a scenario C would just forward the HTLCs independently. One could&#xA;send&#xA;them all along the same path if they desired! I&#39;m assuming the intent here&#xA;is to&#xA;try and reduce total fees?&#xA;&#xA;Minor correction^2:&#xA;&#xA;&gt; This should actually be (H(s_0 || s_1 || ...), s_i).&#xA;&#xA;This assumes the receiver knows the indexes of each share. Without this&#xA;knowledge they would have to brute force all orderings to check the&#xA;fingerprint.&#xA;&#xA;To maintain order invariance on the receiving end, I would propose sending&#xA;(0, s_i) for the first n-1 partial payments, and then (n, s_i) on the final&#xA;one.&#xA;As in the description of the basic AMP scheme, the receiver maintains a&#xA;persistent count of how many partial payments have been received for ID. If&#xA;the&#xA;receiver does not get the last payment last, the receiver just waits until&#xA;all n&#xA;have been received before deciding that its reconstructed value is BP.&#xA;&#xA;The receiver can verify they&#39;ve received the correct BP and n by rederiving&#xA;the&#xA;partial preimages r_i = H(BP || i) and checking that there are n outstanding&#xA;payments, one for each h_i = H(r_i). This also saves the receiving node n&#xA;additional hash invocations.&#xA;&#xA;-Conner&#xA;&#xA;On Tue, Feb 6, 2018 at 4:04 PM Olaoluwa Osuntokun &lt;laolu32 at gmail.com&gt; wrote:&#xA;&#xA;&gt; Hi ZmnSCPxj,&#xA;&gt;&#xA;&gt; &gt; This is excellent work!&#xA;&gt;&#xA;&gt; Thanks!&#xA;&gt;&#xA;&gt; &gt; I think, a `globalfeatures` odd bit could be used for this.  As it is&#xA;&gt; &gt; end-ot-end, `localfeatures` is not appropriate.&#xA;&gt;&#xA;&gt; Yep, it would need to be a global feature bit. In the case that we&#39;re&#xA;&gt; sending to a destination which isn&#39;t publicly advertised, then perhaps an&#xA;&gt; extension to BOLT-11 could be made to signal receiver support.&#xA;&gt;&#xA;&gt; &gt; I believe, currently, fees have not this super-linear component&#xA;&gt;&#xA;&gt; Yep they don&#39;t. Arguably, we should also have a component that scales&#xA;&gt; according to the proposed CLTV value of the outgoing HTLC. At Scaling&#xA;&gt; Bitcoin Stanford, Aviv Zohar gave a talked titled &#34;How to Charge Lightning&#34;&#xA;&gt; where the authors analyzed the possible evolution of fees on the network&#xA;&gt; (and also suggested adding this super-linear component to extend the&#xA;&gt; lifetime of channels).  However, the talk itself focused on a very simple&#xA;&gt; &#34;mega super duper hub&#34; topology. Towards the end he alluded to a&#xA;&gt; forthcoming&#xA;&gt; paper that had more comprehensive analysis of more complex topologies. I&#xA;&gt; look forward to the publication of their finalized work.&#xA;&gt;&#xA;&gt; &gt; Indeed, the existence of per-hop fees (`fee_base_msat`) means, splitting&#xA;&gt; &gt; the payment over multiple flows will be, very likely, more expensive,&#xA;&gt; &gt; compared to using a single flow.&#xA;&gt;&#xA;&gt; Well it&#39;s still to be seen how the fee structure on mainnet emerges once&#xA;&gt; the&#xA;&gt; network is still fully bootstrapped. AFAIK, most running on mainnet atm are&#xA;&gt; using the default fee schedules for their respective implementations. For&#xA;&gt; example, the default fee_base_msat for lnd is 1000 msat (1 satoshi).&#xA;&gt;&#xA;&gt; &gt; I believe the `realm` byte is intended for this.&#xA;&gt;&#xA;&gt; The realm byte is meant to signal &#34;forward this to the dogecoin channel&#34;.&#xA;&gt; ATM, we just default to 0 as &#34;Bitcoin&#34;. However, the byte itself only&#xA;&gt; really&#xA;&gt; need significance between the sender and the intermediate node. So there&#xA;&gt; isn&#39;t necessarily pressure to have a globally synchronized set of realm&#xA;&gt; bytes.&#xA;&gt;&#xA;&gt; &gt; Thus, you can route over nodes that are unaware of AMP, and only provide&#xA;&gt; &gt; an AMP realm byte to the destination node, who, is able to reconstruct&#xA;&gt; this&#xA;&gt; &gt; your AMP data as per your algorithm.&#xA;&gt;&#xA;&gt; Yes, the intermediate nodes don&#39;t need to be aware of the end-to-end&#xA;&gt; protocol. For the final hop, there are actually 53 free bytes (before one&#xA;&gt; needs to signal the existence of EOBs):&#xA;&gt;&#xA;&gt;   * 1 byte realm&#xA;&gt;   * 8 bytes next addr (all zeroes to signal final dest)&#xA;&gt;   * 32 bytes hmac (also all zeroes for the final dest)&#xA;&gt;   * 12 bytes padding&#xA;&gt;&#xA;&gt; So any combo of these bytes can be used to signal more advanced protocols&#xA;&gt; to&#xA;&gt; the final destination.&#xA;&gt;&#xA;&gt;&#xA;&gt; A correction from the prior email description:&#xA;&gt;&#xA;&gt; &gt; We can further modify our usage of the per-hop payloads to send&#xA;&gt; &gt; (H(BP), s_i) to consume most of the EOB sent from sender to receiver.&#xA;&gt;&#xA;&gt; This should actually be (H(s_0 || s_1 || ...), s_i). So we still allow them&#xA;&gt; to check this finger print to see if they have all the final shares, but&#xA;&gt; don&#39;t allow them to preemptively pull all the payments.&#xA;&gt;&#xA;&gt;&#xA;&gt; -- Laolu&#xA;&gt;&#xA;&gt;&#xA;&gt; On Mon, Feb 5, 2018 at 11:12 PM ZmnSCPxj &lt;ZmnSCPxj at protonmail.com&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Good morning Laolu,&#xA;&gt;&gt;&#xA;&gt;&gt; This is excellent work!&#xA;&gt;&gt;&#xA;&gt;&gt; Some minor comments...&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; (Atomic Multi-path Payments). It can be experimented with on Lightning&#xA;&gt;&gt; *today* with the addition of a new feature bit to gate this new&#xA;&gt;&gt; feature. The beauty of the scheme is that it requires no fundamental&#xA;&gt;&gt; changes&#xA;&gt;&gt; to the protocol as is now, as the negotiation is strictly *end-to-end*&#xA;&gt;&gt; between sender and receiver.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; I think, a `globalfeatures` odd bit could be used for this.  As it is&#xA;&gt;&gt; end-ot-end, `localfeatures` is not appropriate.&#xA;&gt;&gt;&#xA;&gt;&gt;   - Potential fee savings for larger payments, contingent on there being a&#xA;&gt;&gt;     super-linear component to routed fees. It&#39;s possible that with&#xA;&gt;&gt;     modifications to the fee schedule, it&#39;s actually *cheaper* to send&#xA;&gt;&gt;     payments over multiple flows rather than one giant flow.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; I believe, currently, fees have not this super-linear component.  Indeed,&#xA;&gt;&gt; the existence of per-hop fees (`fee_base_msat`) means, splitting the&#xA;&gt;&gt; payment over multiple flows will be, very likely, more expensive, compared&#xA;&gt;&gt; to using a single flow.  Tiny roundoffs in computing the proportional fees&#xA;&gt;&gt; (`fee_proportional_millionths`) may make smaller flows give a slight fee&#xA;&gt;&gt; advantage, but I think the multiplication of per-hop fees will dominate.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;   - Using smaller payments increases the set of possible paths a partial&#xA;&gt;&gt;     payment could have taken, which reduces the effectiveness of static&#xA;&gt;&gt;     analysis techniques involving channel capacities and the plaintext&#xA;&gt;&gt;     values being forwarded.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Strongly agree!&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; In order to include the three tuple within the per-hop payload for the&#xA;&gt;&gt; final&#xA;&gt;&gt; destination, we repurpose the _first_ byte of the un-used padding bytes in&#xA;&gt;&gt; the payload to signal version 0x01 of the AMP protocol (note this is a PoC&#xA;&gt;&gt; outline, we would need to standardize signalling of these 12 bytes to&#xA;&gt;&gt; support other protocols).&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; I believe the `realm` byte is intended for this.  Intermediate nodes do&#xA;&gt;&gt; not need to understand realm bytes that are understood by other nodes in&#xA;&gt;&gt; the route, including the realm bytes understood by the final destination,&#xA;&gt;&gt; as intermediate nodes cannot, indeed, read the hop data of other nodes.&#xA;&gt;&gt; Thus, you can route over nodes that are unaware of AMP, and only provide an&#xA;&gt;&gt; AMP realm byte to the destination node, who, is able to reconstruct this&#xA;&gt;&gt; your AMP data as per your algorithm.&#xA;&gt;&gt;&#xA;&gt;&gt; Indeed, the `realm` byte controls the interpretation of the rest of the&#xA;&gt;&gt; 65-byte packet.  If you define, instead, a separate `realm` that is&#xA;&gt;&gt; understood by the destination node, you can redefine the entire 64 bytes of&#xA;&gt;&gt; the final hop data as you wish.&#xA;&gt;&gt;&#xA;&gt;&gt; If we support AMP only at final payees, we can completely redefine the 64&#xA;&gt;&gt; bytes in the final hop data for the new AMP `realm`, and not consume the&#xA;&gt;&gt; next hop (which would reduce route length by 1).&#xA;&gt;&gt;&#xA;&gt;&gt; (If we want to support multiple routes converging to an intermediate&#xA;&gt;&gt; node, then continue routing to a different final node after routes have&#xA;&gt;&gt; merged (i.e. A-&gt;B-&gt;C-&gt;D, and A-&gt;E-&gt;C-&gt;D, with the payment being merged by&#xA;&gt;&gt; C, who forwards the combination to D), then we need to follow the current&#xA;&gt;&gt; hop data format, but I think supporting AMP at final payees is actually&#xA;&gt;&gt; enough... AMP at intermediate nodes might not be used often enough by&#xA;&gt;&gt; senders for it to matter, as taking advantage of that seems more complex&#xA;&gt;&gt; than just asking your routing algo to provide you multiple routes to a&#xA;&gt;&gt; destination, which you are probably already doing)&#xA;&gt;&gt;&#xA;&gt;&gt; ----&#xA;&gt;&gt;&#xA;&gt;&gt; Overall, good work I think.&#xA;&gt;&gt;&#xA;&gt;&gt; Regards,&#xA;&gt;&gt; ZmnSCPxj&#xA;&gt;&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/20180207/686a561b/attachment.html&gt;</html></oembed>