<oembed><type>rich</type><version>1.0</version><title>lisa neigut [ARCHIVE] wrote</title><author_name>lisa neigut [ARCHIVE] (npub1sp…s64t2)</author_name><author_url>https://yabu.me/npub1sprhp66c693av0c0n9had046hcdcckp2th25fnmphwstc5e4wg9qxs64t2</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-02-06&#xA;📝 Original message:&#xA;&gt; I am unsure what is the purpose of this minus 6.&#xA;&#xA;The original motivation was to keep the funding transaction from being&#xA;rejected from the mempool in the case of a re-org, but as you pointed out,&#xA;the &#39;next block&#39; is always at -par or ahead of the current chain tip, so&#xA;I&#39;m not sure this accomplishes this goal.  I&#39;m not sure how bitcoind&#xA;handles the mempool in the case of the &#39;best block&#39; moving to another tip,&#xA;the goal of setting it to -6 is to avoid the funding transaction being&#xA;evicted.&#xA;&#xA;In practice, setting the locktime back a few blocks makes the funding&#xA;transaction eligible for inclusion in any of the previous six blocks, so in&#xA;case of a reorg there&#39;s a higher probability it will have been included in&#xA;the reorganization. In other words, it enables fee-sniping for up to 6&#xA;blocks in the hopes that any &#39;eligible&#39; re-org includes the funding&#xA;transaction (the short channel id will change, but otherwise the channel&#xA;open will be the same).&#xA;&#xA;On second thought, this doesn&#39;t seem like something that we should include&#xA;at the protocol level; if a peer wanted to &#39;allow fee-sniping for up to X&#xA;blocks&#39;, then they&#39;d simply relay the &#34;blocktip&#34; that they&#39;re using for the&#xA;nLocktime to be at the depth they&#39;d desire. Though it might be worth&#xA;imposing a limit as to how far back in the past a peer can allow&#xA;fee-sniping for... no more than 6 blocks from our current tip seems&#xA;reasonable. (This would then limit the &#39;acceptable range&#39; for an offset of&#xA;an initiator to 5, as your peer may be off from your tip by one.)&#xA;&#xA;On that note, I believe bitcoind fuzzes the nLocktime value to obfuscate&#xA;exactly what blockheight the outgoing transaction was composed / broadcast&#xA;at, which is probably something we should encourage in lightning&#xA;implementations as well.&#xA;&#xA;&#xA;&#xA;On Wed, Feb 5, 2020 at 8:25 PM ZmnSCPxj &lt;ZmnSCPxj at protonmail.com&gt; wrote:&#xA;&#xA;&gt; Good morning niftynei,&#xA;&gt;&#xA;&gt;&#xA;&gt; &gt; Rusty had some suggestions about how to improve the protocol messages&#xA;&gt; for this, namely adding a serial_id to the inputs and outputs, which can&#xA;&gt; then be reused for deletions.&#xA;&gt; &gt;&#xA;&gt; &gt; The serial id can then also be used as the ordering heuristic for&#xA;&gt; transaction inputs during construction (replacing current usage of BIP69).&#xA;&gt; Inputs can be shared amongst peers by flipping the bottom bit of the&#xA;&gt; serial_id before relaying them to another peer (as your own).&#xA;&gt;&#xA;&gt; What happens if the initiator deliberately provides serial IDs 0x1, 0x3,&#xA;&gt; .... while the acceptor naively provides serial IDs from `/dev/urandom`?&#xA;&gt;&#xA;&gt; Then the balance of probability is that the initiator inputs and outputs&#xA;&gt; are sorted before the acceptor.&#xA;&gt; Now, this is probably not an issue, since the initiator and acceptor both&#xA;&gt; know which inputs and outputs are theirs and not theirs, so they could just&#xA;&gt; reveal this information to anyone, so an actor providing such lousy serial&#xA;&gt; IDs is just hurting its own privacy relative to blockchain analysts, so&#xA;&gt; probably will not happen in practice.&#xA;&gt;&#xA;&gt; My initial reaction was to propose adding a secret-sharing round where the&#xA;&gt; resulting key is XORed to each serial ID before sorting by the XORed serial&#xA;&gt; ID, but this might be too overweight, and again the initiator is only&#xA;&gt; hurting its own privacy, and the two participants already know whose money&#xA;&gt; is whose anyway....&#xA;&gt;&#xA;&gt; &gt;&#xA;&gt; &gt; See below for details.&#xA;&gt; &gt;&#xA;&gt; &gt; &gt; 1. type:   440 `tx_add_input`&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; 2. data:&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`32*byte`:`channel_identifier`]&#xA;&gt; &gt;&#xA;&gt; &gt;         * [`32*byte`:``serial_id`]&#xA;&gt; &gt;&#xA;&gt; &gt; Add a serial id.&#xA;&gt; &gt;&#xA;&gt; &gt; Each input addition must have a unique serial id.&#xA;&gt; &gt;&#xA;&gt; &gt; No addition may have a repeated id number.&#xA;&gt; &gt;&#xA;&gt; &gt; The initiator&#39;s serial id&#39;s must be odd. The non-initiator&#39;s serial id&#39;s&#xA;&gt; must be even.&#xA;&gt; &gt;&#xA;&gt; &gt; Serial ids are used as sorting heuristic for input ordering in final&#xA;&gt; transaction, replaces BIP69&#xA;&gt; &gt;&#xA;&gt; &gt;&#xA;&gt; &gt; &gt;     * [`u64`:`sats`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`sha256`:`prevtx_txid`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`u32`:`prevtx_vout`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`u16`:`prevtx_scriptpubkey_len`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`prevtx_scriptpubkey_len*byte`:`prevtx_scriptpubkey`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`u16`:`max_witness_len`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`u16`:`scriptlen`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`scriptlen*byte`:`script`]&#xA;&gt; &gt;&#xA;&gt; &gt; Removes the signal_rbf; everything will be flagged as RBF eligible.&#xA;&gt; (This makes verifying RBF eligibility during a RBF round simpler.)&#xA;&gt;&#xA;&gt; Yes. Ish.&#xA;&gt; RBF and privacy do not work well together unfortunately.&#xA;&gt; This is still initiator-pays, right?&#xA;&gt;&#xA;&gt;&#xA;&gt; &gt; &gt; 1. subtype: `witness_element`&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; 2. data:&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`u16`:`len`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt;     * [`len*byte`:`witness`]&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; ## General Notes&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; - All output scripts must be standard&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; - nLocktime is always set to 0x00000000&#xA;&gt; &gt;&#xA;&gt; &gt; - If a blockheight to be used as nLocktime is communicated in the&#xA;&gt; initiation step, is set to blockheight-6; otherwise set to zero-&#xA;&gt;&#xA;&gt; I am unsure what is the purpose of this minus 6.&#xA;&gt;&#xA;&gt; If you fear blockheight disagreements, this is probably a good time to&#xA;&gt; introduce block headers.&#xA;&gt; So for example if the acceptor thinks the initiator blockheight is too&#xA;&gt; high, it could challenge the initiator to give block headers from its known&#xA;&gt; blockheight to the initiator blockheight.&#xA;&gt; If the acceptor thinks the initiator blockheight is too low, it could&#xA;&gt; provide block headers itself as proof.&#xA;&gt; This could be limited so that gross differences in blockheight are&#xA;&gt; outright rejected by the acceptor (it could `error` the temporary channel&#xA;&gt; ID rather than accept it).&#xA;&gt;&#xA;&gt; This is SPV, but neither side is actually making or accepting a payment&#xA;&gt; *yet*, just synchronizing clocks, so maybe not as bad as normal SPV.&#xA;&gt;&#xA;&gt; Massive chain reorgs cannot reduce blockheight, only increase it (else the&#xA;&gt; reorg attempt fails in the first place) so there must still exist at least&#xA;&gt; one chain(split) with the highest known blockheight already given a&#xA;&gt; proof-of-header-chain, and all you really need is some mining activity on&#xA;&gt; top of *one* split that confirms your funding transaction.&#xA;&gt;&#xA;&gt; If it is not because of blockheight disagreements or massive chain reorgs,&#xA;&gt; what is the purpose of `blockheight - 6`?&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; &gt; - Serial ids should be chosen at random&#xA;&gt; &gt; - For multiparty constructions, the initiator MUST flip the bottom bit&#xA;&gt; of any received inputs before relaying them to a peer.&#xA;&gt; &gt;&#xA;&gt; &gt; - Collisions of serial ids between peers is a protocol error&#xA;&gt;&#xA;&gt; I suppose we should define collision to mean &#34;equal in all bits except the&#xA;&gt; lowest bit&#34;.&#xA;&gt;&#xA;&gt; Regards,&#xA;&gt; ZmnSCPxj&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200206/f7cc9d4e/attachment-0001.html&gt;</html></oembed>