<oembed><type>rich</type><version>1.0</version><author_name>npub14ca6vjq25eaema6zxke2g8hjc6ztkf5ej698f5fhyg98zqq85zsqu0m739</author_name><author_url>https://nostr.ae/npub14ca6vjq25eaema6zxke2g8hjc6ztkf5ej698f5fhyg98zqq85zsqu0m739</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-09-23&#xA;📝 Original message:Hi everyone,&#xA;&#xA;I&#39;m writing to propose a very simple set of mempool/transaction relay&#xA;policies intended to aid L2/contract protocols. I realized that&#xA;the previously proposed Package Mempool Accept package RBF [1]&#xA;had a few remaining problems after digging into the RBF logic more [2].&#xA;This additional set of policies solves them without requiring a huge RBF&#xA;overhaul.&#xA;&#xA;I&#39;ve written an implementation (and docs) for Bitcoin Core:&#xA;https://github.com/bitcoin/bitcoin/pull/25038&#xA;&#xA;(You may notice that this proposal incorporates feedback on the PR - thanks&#xA;Suhas Daftuar, Gregory Sanders, Bastien Teinturier, Anthony Towns, and&#xA;others.)&#xA;&#xA;If you are interested in using package RBF/relay to bump presigned&#xA;transactions, I think you may be interested in reviewing this proposal.&#xA;This should solve Rule 3 pinning and perhaps allow us&#xA;to get rid of CPFP carve-out (yay!). I&#39;m keen to hear if people find&#xA;the 1-anchor-output, 1000vB child limit too restrictive. Also, if you find a&#xA;pinning attack or something that makes it unusable for you, I would&#xA;really really like to know.&#xA;&#xA;Note that transactions with nVersion=3 (&#34;V3 transactions&#34;) are&#xA;currently non-standard in Bitcoin Core. That means **anything that was&#xA;standard before this policy change would still be standard&#xA;afterwards.** If you don&#39;t want your transactions to be subject to&#xA;these rules, just continue whatever you&#39;re doing and don&#39;t use&#xA;nVersion=3. AFAICT this shouldn&#39;t break anything, but let me know if&#xA;this would be disruptive for you?&#xA;&#xA;**New Policies:**&#xA;&#xA;This includes:&#xA;- a set of additional policy rules applying to V3 transactions&#xA;- modifications to package RBF rules&#xA;&#xA;**V3 transactions:**&#xA;&#xA;Existing standardness rules apply to V3 (e.g. min/max tx weight,&#xA;standard output types, cleanstack, etc.). The following additional&#xA;rules apply to V3:&#xA;&#xA;1. A V3 transaction can be replaced, even if it does not signal BIP125&#xA;   replaceability. (It must also meet the other RBF rules around fees,&#xA;etc. for replacement to happen).&#xA;&#xA;2. Any descendant of an unconfirmed V3 transaction must also be V3.&#xA;&#xA;*Rationale*: Combined with Rule 1, this gives us the property of&#xA;&#34;inherited&#34; replaceability signaling when descendants of unconfirmed&#xA;transactions are created. Additionally, checking whether a transaction&#xA;signals replaceability this way does not require mempool traversal,&#xA;and does not change based on what transactions are mined. It also&#xA;makes subsequent rules about descendant limits much easier to check.&#xA;&#xA;*Note*: The descendant of a *confirmed* V3 transaction does not need to be&#xA;V3.&#xA;&#xA;3. An unconfirmed V3 transaction cannot have more than 1 descendant.&#xA;&#xA;*Rationale*: (Upper bound) the larger the descendant limit, the more&#xA;transactions may need to be replaced. This is a problematic pinning&#xA;attack, i.e., a malicious counterparty prevents the transaction from&#xA;being replaced by adding many descendant transactions that aren&#39;t&#xA;fee-bumping.&#xA;&#xA;(Lower bound) at least 1 descendant is required to allow CPFP of the&#xA;presigned transaction. The contract protocol can create presigned&#xA;transactions paying 0 fees and 1 output for attaching a CPFP at&#xA;broadcast time (&#34;anchor output&#34;). Without package RBF, multiple anchor&#xA;outputs would be required to allow each counterparty to fee-bump any&#xA;presigned transaction. With package RBF, since the presigned&#xA;transactions can replace each other, 1 anchor output is sufficient.&#xA;&#xA;4. A V3 transaction that has an unconfirmed V3 ancestor cannot be&#xA;   larger than 1000 virtual bytes.&#xA;&#xA;*Rationale*: (Upper bound) the larger the descendant size limit, the&#xA;more vbytes may need to be replaced. With default limits, if the child&#xA;is e.g. 100,000vB, that might be an additional 100,000sats (at&#xA;1sat/vbyte) or more, depending on the feerate.&#xA;&#xA;(Lower bound) the smaller this limit, the fewer UTXOs a child may use&#xA;to fund this fee-bump. For example, only allowing the V3 child to have&#xA;2 inputs would require L2 protocols to manage a wallet with high-value&#xA;UTXOs and make batched fee-bumping impossible. However, as the&#xA;fee-bumping child only needs to fund fees (as opposed to payments),&#xA;just a few UTXOs should suffice.&#xA;&#xA;With a limit of 1000 virtual bytes, depending on the output types, the&#xA;child can have 6-15 UTXOs, which should be enough to fund a fee-bump&#xA;without requiring a carefully-managed UTXO pool. With 1000 virtual&#xA;bytes as the descendant limit, the cost to replace a V3 transaction&#xA;has much lower variance.&#xA;&#xA;*Rationale*: This makes the rule very easily &#34;tacked on&#34; to existing&#xA;logic for policy and wallets. A transaction may be up to 100KvB on its&#xA;own (`MAX_STANDARD_TX_WEIGHT`) and 101KvB with descendants&#xA;(`DEFAULT_DESCENDANT_SIZE_LIMIT_KVB`). If an existing V3 transaction&#xA;in the mempool is 100KvB, its descendant can only be 1000vB, even if&#xA;the policy is 10KvB.&#xA;&#xA;**Package RBF modifications:**&#xA;&#xA;1. The rule around unconfirmed inputs was&#xA;originally &#34;A package may include new unconfirmed inputs, but the&#xA;ancestor feerate of the child must be at least as high as the ancestor&#xA;feerates of every transaction being replaced.&#34;&#xA;&#xA;The package may still include new unconfirmed inputs. However,&#xA;the new rule is modified to be &#34;The minimum between package feerate&#xA;and ancestor feerate of the child is not lower than the individual&#xA;feerates of all directly conflicting transactions and the ancestor&#xA;feerates of all original transactions.&#34;&#xA;&#xA;*Rationale*: We are attempting to ensure that the replacement&#xA;transactions are not less incentive-compatible to mine. However, a&#xA;package/transaction&#39;s ancestor feerate is not perfectly representative&#xA;of its incentive compatibility; it may overestimate (some subset of&#xA;the ancestors could be included by itself if it has other high-feerate&#xA;descendants or are themselves higher feerate than this&#xA;package/transaction). Instead, we use the minimum between the package&#xA;feerate and ancestor feerate of the child as a more conservative value&#xA;than what was proposed originally.&#xA;&#xA;2. A new rule is added, requiring that all package transactions with&#xA;mempool conflicts to be V3. This also means the &#34;sponsoring&#34;&#xA;child transaction must be V3.&#xA;&#xA;*Note*: Combined with the V3 rules, this means the package must be&#xA;a child-with-parents package. Since package validation is only&#xA;attempted if the transactions do not pay sufficient fees to be&#xA;accepted on their own, this effectively means that only V3&#xA;transactions can pay to replace their ancestors&#39; conflicts, and only&#xA;V3 transactions&#39; replacements may be paid for by a descendant.&#xA;&#xA;*Rationale*: The fee-related rules are economically rational for&#xA;ancestor packages, but not necessarily other types of packages.&#xA;A child-with-parents package is a type of ancestor package. It&#xA;may be fine to allow any ancestor package, but it&#39;s more difficult&#xA;to account for all of the possibilities. For example, it gets much&#xA;harder to see that we&#39;re applying the descendant limits correctly if&#xA;the package has a gnarly, many-generation, non-tree shape. I&#39;m also&#xA;not sure if this policy is 100% incentive-compatible if the sponsor&#xA;is not a direct descendant of the sponsee.&#xA;&#xA;Please see doc/policy/version3_transactions.md and&#xA;doc/policy/packages.md in the PR for the full set of rules.&#xA;&#xA;**Intended usage for LN:**&#xA;&#xA;Commitment transactions should be V3 and have 1 anchor output. They&#xA;can be signed with 0 fees (or 1sat/vbyte) once package relay is deployed&#xA;on a significant portion of the network. If the commitment tx must&#xA;be broadcast, determine the desired feerate at broadcast time and&#xA;spend the anchor output in a high feerate transaction. I&#39;m going to&#xA;call the broadcasted commitment tx &#34;the parent&#34; and the attached&#xA;fee-bumping tx &#34;the child.&#34;&#xA;&#xA;- This child must be V3.&#xA;- This child must be at most 1000vB. Note this restricts the&#xA;  number of inputs you can use to fund the fee bump. Depending&#xA;on the output types, this is around 6-15.&#xA;- One child may fund fees for multiple commitment tx (&#34;batched&#xA;  fee-bumping&#34;).&#xA;- To do a second fee-bump to add more fees, replace the&#xA;  *child* with a higher-feerate tx. Do not try to attach a grandchild.&#xA;&#xA;Otherwise, never try to spend from an unconfirmed V3 transaction. The&#xA;descendant limits for V3 transactions are very restrictive.&#xA;&#xA;**Expected Questions:**&#xA;&#xA;&#34;Does this fix Rule 3 Pinning?&#34;&#xA;Yes. The V3 descendant limit restricts both you and your counterparty.&#xA;Assuming nodes adopted this policy, you may reasonably assume that you&#xA;only need to replace the commitment transaction + up to 1000vB.&#xA;&#xA;&#34;Only 1 anchor output? What if I need to bump counterparty&#39;s commitment tx&#xA;in mempool?&#34;&#xA;You won&#39;t need to fee-bump a counterparty&#39;s commitment tx using CPFP.&#xA;You would just package RBF it by attaching a high-feerate child to&#xA;your commitment tx.&#xA;&#xA;&#34;Is this a privacy issue, i.e. doesn&#39;t it allow fingerprinting LN&#xA;transactions based on nVersion?&#34;&#xA;Indeed it may be unrealistic to assume V3 transactions will be in&#xA;widespread use outside of L2. IIUC, unilateral closes are already&#xA;obvious LN transactions because of the HTLC inputs. For e.g.&#xA;cooperative closes and opens, I think it makes sense to continue using&#xA;V2. So, unless I&#39;m missing something, this shouldn&#39;t make it worse.&#xA;&#xA;&#34;So a V3 transaction that doesn&#39;t signal BIP125 replaceability is&#xA;replaceable? Is that a backward compatibility issue?&#34;&#xA;Yes it&#39;s replaceable. It&#39;s not an issue AFAICT because,&#xA;under previous policy, the V3 transaction wouldn&#39;t have been&#xA;in the mempool in the first place.&#xA;&#xA;&#34;Can a V2 transaction replace a V3 transaction and vice versa?&#34;&#xA;Yes, otherwise someone can use V3 transactions to censor V2&#xA;transactions spending shared inputs. Note if the&#xA;original V3 transaction has an unconfirmed V3 parent, this would&#xA;violate the &#34;inherited V3&#34; rule and would be rejected.&#xA;&#xA;Thanks for reading! Feedback and review would be much appreciated.&#xA;&#xA;[1]:&#xA;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#xA;[2]:&#xA;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#xA;&#xA;Best,&#xA;Gloria&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220923/9b52c0c4/attachment.html&gt;</html></oembed>