<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>2023-06-07T02:01:10Z</updated>
  <generator>https://njump.me</generator>

  <title>Nostr notes by Gloria Zhao [ARCHIVE]</title>
  <author>
    <name>Gloria Zhao [ARCHIVE]</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://njump.me/npub14ca6vjq25eaema6zxke2g8hjc6ztkf5ej698f5fhyg98zqq85zsqu0m739.rss" />
  <link href="https://njump.me/npub14ca6vjq25eaema6zxke2g8hjc6ztkf5ej698f5fhyg98zqq85zsqu0m739" />
  <id>https://njump.me/npub14ca6vjq25eaema6zxke2g8hjc6ztkf5ej698f5fhyg98zqq85zsqu0m739</id>
  <icon></icon>
  <logo></logo>




  <entry>
    <id>https://njump.me/nevent1qqsf0cng00e3qqnqc6q7yqdzggv5n2zjaykq48u6n46arrc9m5q52aczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qvqc8yw</id>
    
      <title type="html">📅 Original date posted:2022-11-01 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsf0cng00e3qqnqc6q7yqdzggv5n2zjaykq48u6n46arrc9m5q52aczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qvqc8yw" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs9n5uef2wvv58kc7p3xj8p837slp9ydc56ke77szr3s7kdlvkm45g88kazt&#39;&gt;nevent1q…kazt&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-11-01&lt;br/&gt;📝 Original message:Hi everyone,&lt;br/&gt;&lt;br/&gt;I&amp;#39;ve made some significant changes to my package relay proposal based on&lt;br/&gt;observations while implementing, feedback on this thread, and offline&lt;br/&gt;discussions [1].&lt;br/&gt;&lt;br/&gt;The new proposal is called Ancestor Package Relay, BIP331, and PR&amp;#39;d at&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bips/pull/1382&#34;&gt;https://github.com/bitcoin/bips/pull/1382&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The major changes to the proposal are:&lt;br/&gt;1. Scope reduction to receiver-initiated only&lt;br/&gt;2. Scope reduction to ancestor packages only&lt;br/&gt;3. Removal of block hash from package information&lt;br/&gt;&lt;br/&gt;1.  Scope reduction to receiver-initiated only&lt;br/&gt;Receiver-intiated package relay enables a node to ask for more information&lt;br/&gt;when they suspect they are missing something (i.e. in this case to resolve&lt;br/&gt;a missing parent tx). Sender-initiated package relay should, theoretically,&lt;br/&gt;save a round trip by notifying the receiver ahead of time that &amp;#34;hey, this&lt;br/&gt;is going to be a package, so make sure you download and submit these&lt;br/&gt;transactions together.&amp;#34; As with any proactive communication, there is a&lt;br/&gt;chance that the node already knows this information, so this network&lt;br/&gt;bandwidth was wasted. The logic used to decide _when_ to announce a package&lt;br/&gt;proactively determines whether it is a net increase or decrease for overall&lt;br/&gt;bandwidth usage. However, it&amp;#39;s difficult to design anything to save&lt;br/&gt;bandwidth without any idea of what its bandwidth usage actually looks like&lt;br/&gt;in practice. We&amp;#39;ll want to design the sender-initiated protocol carefully,&lt;br/&gt;and inform the design decisions using data collected from the mainnet p2p&lt;br/&gt;network. However, there is no historical transaction data to use because&lt;br/&gt;the goal is to enable currently-rejected transactions to propagate. In&lt;br/&gt;order to get this right, I propose we hold off on sender-initiated for now,&lt;br/&gt;deploy receiver-initiated package relay, observe its usage and figure out&lt;br/&gt;where we can save a round trip, and then produce a well-researched&lt;br/&gt;sender-initiated package relay proposal.&lt;br/&gt;&lt;br/&gt;2. Scope reduction to ancestor packages only&lt;br/&gt;The proposal now only includes ancestor packages (previously called&lt;br/&gt;tx-with-unconfirmed-ancestors or &amp;#34;v2&amp;#34; packages). The&lt;br/&gt;child-with-unconfirmed-parents (previously called &amp;#34;v1&amp;#34;) package has been&lt;br/&gt;removed since it is a subset of ancestor packages and sender-initiated&lt;br/&gt;relay has been removed. It may be relevant again in the future with&lt;br/&gt;sender-initiated packages. If you were reviewing the previous proposal,&lt;br/&gt;&amp;#34;pkginfo2&amp;#34; message has been renamed to &amp;#34;ancpkginfo&amp;#34; and &amp;#34;MSG_PKGINFO2&amp;#34; inv&lt;br/&gt;type to &amp;#34;MSG_ANCPKGINFO&amp;#34;.&lt;br/&gt;&lt;br/&gt;3. Removal of block hash from package information&lt;br/&gt;Most of the rationale is already on this thread. The block hash was an&lt;br/&gt;attempt to enforce topology when chainstates differ, but isn&amp;#39;t worth it. It&lt;br/&gt;does not make much sense to drop or delay transaction data requests due to&lt;br/&gt;mismatched chainstates, and the chainstate may change again between package&lt;br/&gt;information and transaction data rounds. Instead, differences in chainstate&lt;br/&gt;should be handled internally at the mempool validation level. The node&lt;br/&gt;should de-duplicate recently-confirmed transactions and make a best effort&lt;br/&gt;to validate the transactions it has already downloaded.&lt;br/&gt;&lt;br/&gt;Thanks,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;[1]&lt;br/&gt;&lt;a href=&#34;https://diyhpl.us/wiki/transcripts/bitcoin-core-dev-tech/2022-10-11-package-relay/&#34;&gt;https://diyhpl.us/wiki/transcripts/bitcoin-core-dev-tech/2022-10-11-package-relay/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On Fri, Jun 17, 2022 at 9:08 PM Antoine Riard &amp;lt;antoine.riard at gmail.com&amp;gt;&lt;br/&gt;wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks for working on that,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Always overestimating fees may sidestep this issue temporarily (while&lt;br/&gt;&amp;gt; mempool&lt;br/&gt;&amp;gt; &amp;gt; traffic is low and predictable), but this solution is not foolproof&lt;br/&gt;&amp;gt; &amp;gt; and wastes users&amp;#39; money. The feerate market can change due to sudden&lt;br/&gt;&amp;gt; &amp;gt; spikes in traffic (e.g. huge 12sat/vB dump a few days ago [9]) or&lt;br/&gt;&amp;gt; &amp;gt; sustained, high volume of Bitcoin payments (e.g.  April 2021 and&lt;br/&gt;&amp;gt; &amp;gt; December 2017).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Even if the LN implementations started to overestimate fees based on the&lt;br/&gt;&amp;gt; historical worst-case of block inclusion feerates, there is still room for&lt;br/&gt;&amp;gt; exploitation due to bip125 rule#3. Indeed, as long as the adversary is able&lt;br/&gt;&amp;gt; to stick in the mempool a higher fee package while the feerate is not&lt;br/&gt;&amp;gt; compelling enough to get it mined, your &amp;#34;honest&amp;#34; LN package should be&lt;br/&gt;&amp;gt; bounced off.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Considering Core&amp;#39;s `MAX_STANDARD_TX_WEIGHT` of 400000 WU, I think it&amp;#39;s&lt;br/&gt;&amp;gt; practical for an attacker to succeed with this pinning tactic in periods of&lt;br/&gt;&amp;gt; traffic spikes. Of course, LN implementation could overestimate fees with a&lt;br/&gt;&amp;gt; target like `MAX_STANDARD_WEIGHT` * `worst_case_block_inclusion_feerate` to&lt;br/&gt;&amp;gt; mitigate. However, assuming a value of 20sat for the latter, it would&lt;br/&gt;&amp;gt; require from any LN user a minimal channel value of 2000000 satoshis to be&lt;br/&gt;&amp;gt; theoretically secure against this type of pinning.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; So package relay is required to mitigate efficiently and realistically&lt;br/&gt;&amp;gt; against pinning attacks, while conserving the same level of &amp;#34;economic&amp;#34;&lt;br/&gt;&amp;gt; openness for Lightning. Beyond, it should be also noted that package relay&lt;br/&gt;&amp;gt; is only building block of the full set of mitigations, and there should be&lt;br/&gt;&amp;gt; a yet to-find-consensus-as-of-today other policy change such as&lt;br/&gt;&amp;gt; user-elected package limits or replace-by-feerate.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Anyway, I think it would be beneficial to document the design trade-offs&lt;br/&gt;&amp;gt; of pinning mitigations in the `Rationale` subsection, at the attention of&lt;br/&gt;&amp;gt; future L2s devs and users ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; {|&lt;br/&gt;&amp;gt; &amp;gt; |  Field Name  ||  Type  ||  Size  ||  Purpose&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |version || uint32_t || 4 || Denotes a package version supported by the&lt;br/&gt;&amp;gt; &amp;gt; node.&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |max_count || uint32_t || 4 ||Specifies the maximum number of&lt;br/&gt;&amp;gt; transactions&lt;br/&gt;&amp;gt; &amp;gt; per package this node is&lt;br/&gt;&amp;gt; &amp;gt; willing to accept.&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |max_weight || uint32_t || 4 ||Specifies the maximum total weight per&lt;br/&gt;&amp;gt; &amp;gt; package this node is willing&lt;br/&gt;&amp;gt; &amp;gt; to accept.&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |}&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It&amp;#39;s unclear to me what&amp;#39;s the purpose of `max_count` and `max_weight` in&lt;br/&gt;&amp;gt; the overall package relay flow, if they are intended to be exposed as&lt;br/&gt;&amp;gt; configurable settings to node operators. If those fields are present to&lt;br/&gt;&amp;gt; allow DoS protection increase of low-performance host, I believe it would&lt;br/&gt;&amp;gt; be better to restrain the number of consumed UTXOs or executed sigops per&lt;br/&gt;&amp;gt; package, as DoS vectors are more likely to be CPU-based, rather than&lt;br/&gt;&amp;gt; memory-based as package size already bounded at acceptance by&lt;br/&gt;&amp;gt; `MAX_PACKAGE_COUNT`.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thinking more we might introduce a `MAX_SIGOPS_PER_PACKAGR` limit, as&lt;br/&gt;&amp;gt; otherwise if we naively grant one package announcement as equal to one&lt;br/&gt;&amp;gt; transaction announcement in our tx-request logic, we might increase our DoS&lt;br/&gt;&amp;gt; surface, node ressources staying equivalent ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; {|&lt;br/&gt;&amp;gt; &amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt; &amp;gt; requested.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I&amp;#39;m not sure if we&amp;#39;ll ever allow 3-bytes of package size, that would be&lt;br/&gt;&amp;gt; ~32k of transactions.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |txns||List of wtxids||txns_length * 32|| The wtxids of each transaction&lt;br/&gt;&amp;gt; in&lt;br/&gt;&amp;gt; &amp;gt; the package.&lt;br/&gt;&amp;gt; &amp;gt; |}&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think there is a bandwidth consumption trade-off to be aware of in the&lt;br/&gt;&amp;gt; function of the package-relay usage. Let&amp;#39;s consider a single issuer&lt;br/&gt;&amp;gt; broadcasting the package to spend a shared-utxo, after the first shot the&lt;br/&gt;&amp;gt; parent component should be spread across the network mempools. At each&lt;br/&gt;&amp;gt; fee-bump, only the bumped CPFP will propagate on the network, the parent&lt;br/&gt;&amp;gt; wtxid is reannounced in `pckginfo1` though there is no need to fetch it&lt;br/&gt;&amp;gt; redundantly and waste bandwidth.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; However, I think the bandwidth saving does not hold in case of competing&lt;br/&gt;&amp;gt; transaction issuers to spend a shared-utxo. In that case, the parent might&lt;br/&gt;&amp;gt; differ at each broadcast and the list of wtxid is dissemblable at every&lt;br/&gt;&amp;gt; claim of the shared-utxo. We could save the 32 bytes * number of packages&lt;br/&gt;&amp;gt; elements by announcing a package_id, computed from the list of wtxids.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t know about the occurrence of competing broadcasts among LN&lt;br/&gt;&amp;gt; non-cooperative closes, where bandwidth could be potentially saved. I would&lt;br/&gt;&amp;gt; say it&amp;#39;s likely low because IIRC there is nothing in the LN protocol where&lt;br/&gt;&amp;gt; the counterparties signal to each other they&amp;#39;re going on-chain to introduce&lt;br/&gt;&amp;gt; a competing broadcast synchronizing event. That said, it might increase in&lt;br/&gt;&amp;gt; the future in a post-eltoo, multi-party contracting protocol world.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; So it might be interesting to document this design trade-off, if we seek&lt;br/&gt;&amp;gt; bandwidth optimizations in function of a changing landscape in the type of&lt;br/&gt;&amp;gt; transaction issuers in the future.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 3. The sender provides package information using &amp;#34;pckginfo1&amp;#34;,&lt;br/&gt;&amp;gt; &amp;gt;    including the blockhash of the sender&amp;#39;s best block, the wtxids of&lt;br/&gt;&amp;gt; &amp;gt; the transactions in the package, their total fees and total weight.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It&amp;#39;s unclear to me how the `pckinfo1` receiver should proceed if the&lt;br/&gt;&amp;gt; sender&amp;#39;s best block is not in sync with the local chain tip.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If the package isn&amp;#39;t processed further, that&amp;#39;s annoying for all the&lt;br/&gt;&amp;gt; low-performance  LN mobile clients, their chain tips might be always behind&lt;br/&gt;&amp;gt; by few blocks from the p2p network nodes. It sounds like their packages&lt;br/&gt;&amp;gt; won&amp;#39;t propagate at all.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If the package is processed further whatever the sender-receiver sync on&lt;br/&gt;&amp;gt; chain tip, what&amp;#39;s the purpose of including the blockhash ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; A child-with-unconfirmed-parents package for a transaction should be&lt;br/&gt;&amp;gt; &amp;gt; announced when it meets the peer&amp;#39;s fee filter but one or more of its&lt;br/&gt;&amp;gt; &amp;gt; parents don&amp;#39;t; a &amp;#34;inv(MSG_PCKG1)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34; should be sent&lt;br/&gt;&amp;gt; &amp;gt; for the child. Each of the parents which meet the peer&amp;#39;s fee filter&lt;br/&gt;&amp;gt; &amp;gt; should still be announced normally.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I believe we might have concerns of package-feerate downgrades attacks.&lt;br/&gt;&amp;gt; E.g, in the LN context, where your channel counterparty is aiming to jam&lt;br/&gt;&amp;gt; the propagation of the best-feerate version of the package.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Let&amp;#39;s say you have :&lt;br/&gt;&amp;gt; - Alice&amp;#39;s commitment_tx, at 1s/vB&lt;br/&gt;&amp;gt; - package A &#43; child B, at 3s/vB&lt;br/&gt;&amp;gt; - package A &#43; child C, at 10s/vB&lt;br/&gt;&amp;gt; - block inclusion feerate at 10s/vB&lt;br/&gt;&amp;gt; - Alice and Mallory are LN channel counterparties&lt;br/&gt;&amp;gt; - commitment_tx is using LN&amp;#39;s anchor outputs&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Alice&amp;#39;s LN node broadcasts A&#43;C to her mempool.&lt;br/&gt;&amp;gt; Bob&amp;#39;s feefilter is at 3s/vB.&lt;br/&gt;&amp;gt; Mallory broadcasts her child B in Alice&amp;#39;s mempool.&lt;br/&gt;&amp;gt; LN commitment does not meet Bob&amp;#39;s feefilter.&lt;br/&gt;&amp;gt; Package A&#43;child B at 3s/vB meets Bob&amp;#39;s feefilter and is announced to Bob.&lt;br/&gt;&amp;gt; Mallory broadcasts her own commitment_tx at 4s/vB in Bob&amp;#39;s mempool.&lt;br/&gt;&amp;gt; When Alice&amp;#39;s child C is relayed to Bob, it&amp;#39;s bounced off Bob&amp;#39;s mempool.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Do you think this situation is plausible ? Of course, it might be heavily&lt;br/&gt;&amp;gt; dependent on package-relay yet-not-implemented internal p2p logic.&lt;br/&gt;&amp;gt; I think it could be fixable if LN removes the counterparty&amp;#39;s&lt;br/&gt;&amp;gt; `anchor_output` on the local node&amp;#39;s version of the commitment transaction,&lt;br/&gt;&amp;gt; once package relay is deployed.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Another question, at the next fee-bump iteration, Alice rebroadcasts&lt;br/&gt;&amp;gt; A&#43;child D, at 12 s/vB. Her node has already marked Alice&amp;#39;s commitment_tx as&lt;br/&gt;&amp;gt; known in Bob&amp;#39;s `m_tx_inventory_known_filter`. So when a new higher fee&lt;br/&gt;&amp;gt; child is  discovered, should a `child-with-unconfirmed-parents` be&lt;br/&gt;&amp;gt; announced between Alice and Bob ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Anyway, I think it would be interesting to pseudo-specify the&lt;br/&gt;&amp;gt; package-assemblage algorithm (or if there is code already available) to see&lt;br/&gt;&amp;gt; if it&amp;#39;s robust against adversarial or unlucky situations ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; In fact, a package&lt;br/&gt;&amp;gt; &amp;gt; of transactions may be announced using both Erlay and package relay.&lt;br/&gt;&amp;gt; &amp;gt; After reconciliation, if the initiator would have announced a&lt;br/&gt;&amp;gt; &amp;gt; transaction by wtxid but also has package information for it, they may&lt;br/&gt;&amp;gt; &amp;gt; send &amp;#34;inv(MSG_PCKG)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34;.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Yes, I think this holds. Note, we might have to add to the reconciliation&lt;br/&gt;&amp;gt; set low-fee parents succeeding the feefilter check due to a child. When the&lt;br/&gt;&amp;gt; reconcildiff, we might have to bifucarte again on feefilter to decide to&lt;br/&gt;&amp;gt; announce missing wtixds either as `inv(MSG_PCKG)` or `inv(WTX)`.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; (IIRC, I&amp;#39;ve already made few feedbacks offline though good to get them in&lt;br/&gt;&amp;gt; the public space and think more)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Antoine&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le mar. 17 mai 2022 à 12:09, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi everybody,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I’m writing to propose a set of p2p protocol changes to enable package&lt;br/&gt;&amp;gt;&amp;gt; relay, soliciting feedback on the design and approach. Here is a link&lt;br/&gt;&amp;gt;&amp;gt; to the most up-to-date proposal:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bips/pull/1324&#34;&gt;https://github.com/bitcoin/bips/pull/1324&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If you have concept or approach feedback, *please respond on the&lt;br/&gt;&amp;gt;&amp;gt; mailing list* to allow everybody to view and participate in the&lt;br/&gt;&amp;gt;&amp;gt; discussion. If you find a typo or inaccurate wording, please feel free&lt;br/&gt;&amp;gt;&amp;gt; to leave suggestions on the PR.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I’m also working on an implementation for Bitcoin Core.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The rest of this post will include the same contents as the proposal,&lt;br/&gt;&amp;gt;&amp;gt; with a bit of reordering and additional context. If you are not 100%&lt;br/&gt;&amp;gt;&amp;gt; up-to-date on package relay and find the proposal hard to follow, I&lt;br/&gt;&amp;gt;&amp;gt; hope you find this format more informative and persuasive.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Background and Motivation==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Users may create and broadcast transactions that depend upon, i.e.&lt;br/&gt;&amp;gt;&amp;gt; spend outputs of, unconfirmed transactions. A “package” is the&lt;br/&gt;&amp;gt;&amp;gt; widely-used term for a group of transactions representable by a&lt;br/&gt;&amp;gt;&amp;gt; connected Directed Acyclic Graph (where a directed edge exists between&lt;br/&gt;&amp;gt;&amp;gt; a transaction that spends the output of another transaction).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Incentive-compatible mempool and miner policies help create a fair,&lt;br/&gt;&amp;gt;&amp;gt; fee-based market for block space. While miners maximize transaction&lt;br/&gt;&amp;gt;&amp;gt; fees in order to earn higher block rewards, non-mining users&lt;br/&gt;&amp;gt;&amp;gt; participating in transaction relay reap many benefits from employing&lt;br/&gt;&amp;gt;&amp;gt; policies that result in a mempool with the same contents, including&lt;br/&gt;&amp;gt;&amp;gt; faster compact block relay and more accurate fee estimation.&lt;br/&gt;&amp;gt;&amp;gt; Additionally, users may take advantage of mempool and miner policy to&lt;br/&gt;&amp;gt;&amp;gt; bump the priority of their transactions by attaching high-fee&lt;br/&gt;&amp;gt;&amp;gt; descendants (Child Pays for Parent or CPFP).  Only considering&lt;br/&gt;&amp;gt;&amp;gt; transactions one at a time for submission to the mempool creates a&lt;br/&gt;&amp;gt;&amp;gt; limitation in the node&amp;#39;s ability to determine which transactions have&lt;br/&gt;&amp;gt;&amp;gt; the highest feerates, since it cannot take into account descendants&lt;br/&gt;&amp;gt;&amp;gt; until all the transactions are in the mempool. Similarly, it cannot&lt;br/&gt;&amp;gt;&amp;gt; use a transaction&amp;#39;s descendants when considering which of two&lt;br/&gt;&amp;gt;&amp;gt; conflicting transactions to keep (Replace by Fee or RBF).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When a user&amp;#39;s transaction does not meet a mempool&amp;#39;s minimum feerate&lt;br/&gt;&amp;gt;&amp;gt; and they cannot create a replacement transaction directly, their&lt;br/&gt;&amp;gt;&amp;gt; transaction will simply be rejected by this mempool. They also cannot&lt;br/&gt;&amp;gt;&amp;gt; attach a descendant to pay for replacing a conflicting transaction.&lt;br/&gt;&amp;gt;&amp;gt; This limitation harms users&amp;#39; ability to fee-bump their transactions.&lt;br/&gt;&amp;gt;&amp;gt; Further, it presents a security issue in contracting protocols which&lt;br/&gt;&amp;gt;&amp;gt; rely on **presigned**, time-sensitive transactions to prevent cheating&lt;br/&gt;&amp;gt;&amp;gt; (HTLC-Timeout in LN Penalty [1] [2] [3], Unvault Cancel in Revault&lt;br/&gt;&amp;gt;&amp;gt; [4], Refund Transaction in Discreet Log Contracts [5], Updates in&lt;br/&gt;&amp;gt;&amp;gt; eltoo [6]). In other words, a key security assumption of many&lt;br/&gt;&amp;gt;&amp;gt; contracting protocols is that all parties can propagate and confirm&lt;br/&gt;&amp;gt;&amp;gt; transactions in a timely manner.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In the past few years, increasing attention [0][1][2][3][6] has been&lt;br/&gt;&amp;gt;&amp;gt; brought to **pinning attacks**, a type of censorship in which the&lt;br/&gt;&amp;gt;&amp;gt; attacker uses mempool policy restrictions to prevent a transaction&lt;br/&gt;&amp;gt;&amp;gt; from being relayed or getting mined.  TLDR: revocation transactions&lt;br/&gt;&amp;gt;&amp;gt; must meet a certain confirmation target to be effective, but their&lt;br/&gt;&amp;gt;&amp;gt; feerates are negotiated well ahead of broadcast time. If the&lt;br/&gt;&amp;gt;&amp;gt; forecasted feerate was too low and no fee-bumping options are&lt;br/&gt;&amp;gt;&amp;gt; available, attackers can steal money from their counterparties. I walk&lt;br/&gt;&amp;gt;&amp;gt; through a concrete example for stealing Lightning HTLC outputs at&lt;br/&gt;&amp;gt;&amp;gt; ~23:58 in this talk [7][8].  Note that most attacks are only possible&lt;br/&gt;&amp;gt;&amp;gt; when the market for blockspace at broadcast time  demands much higher&lt;br/&gt;&amp;gt;&amp;gt; feerates than originally anticipated at signing time. Always&lt;br/&gt;&amp;gt;&amp;gt; overestimating fees may sidestep this issue temporarily (while mempool&lt;br/&gt;&amp;gt;&amp;gt; traffic is low and predictable), but this solution is not foolproof&lt;br/&gt;&amp;gt;&amp;gt; and wastes users&amp;#39; money. The feerate market can change due to sudden&lt;br/&gt;&amp;gt;&amp;gt; spikes in traffic (e.g. huge 12sat/vB dump a few days ago [9]) or&lt;br/&gt;&amp;gt;&amp;gt; sustained, high volume of Bitcoin payments (e.g.  April 2021 and&lt;br/&gt;&amp;gt;&amp;gt; December 2017).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The best solution is to enable nodes to consider packages of&lt;br/&gt;&amp;gt;&amp;gt; transactions as a unit, e.g. one or more low-fee parent transactions&lt;br/&gt;&amp;gt;&amp;gt; with a high-fee child, instead of separately. A package-aware mempool&lt;br/&gt;&amp;gt;&amp;gt; policy can help determine if it would actually be economically&lt;br/&gt;&amp;gt;&amp;gt; rational to accept a transaction to the mempool if it doesn&amp;#39;t meet fee&lt;br/&gt;&amp;gt;&amp;gt; requirements individually. Network-wide adoption of these policies&lt;br/&gt;&amp;gt;&amp;gt; would create a more purely-feerate-based market for block space and&lt;br/&gt;&amp;gt;&amp;gt; allow contracting protocols to adjust fees (and therefore mining&lt;br/&gt;&amp;gt;&amp;gt; priority) at broadcast time.  Some support for packages has existed in&lt;br/&gt;&amp;gt;&amp;gt; Bitcoin Core for years. Since v0.13, Bitcoin Core has used ancestor&lt;br/&gt;&amp;gt;&amp;gt; packages instead of individual transactions to evaluate the incentive&lt;br/&gt;&amp;gt;&amp;gt; compatibility of transactions in the mempool [10] and select them for&lt;br/&gt;&amp;gt;&amp;gt; inclusion in blocks [11].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Package Relay, the concept of {announcing, requesting, downloading}&lt;br/&gt;&amp;gt;&amp;gt; packages between nodes on the p2p network, has also been discussed for&lt;br/&gt;&amp;gt;&amp;gt; many years. The earliest public mention I can find is from 2015 [12].&lt;br/&gt;&amp;gt;&amp;gt; The two most common use cases for package relay are fee-bumping&lt;br/&gt;&amp;gt;&amp;gt; otherwise-too-low-fee transactions and reducing the amount of orphans.&lt;br/&gt;&amp;gt;&amp;gt; It seems uncontroversial to say that everybody desires package relay&lt;br/&gt;&amp;gt;&amp;gt; conceptually, with varying degrees of urgency. Lots of work has been&lt;br/&gt;&amp;gt;&amp;gt; done by others over the past few years, from which I&amp;#39;ve taken&lt;br/&gt;&amp;gt;&amp;gt; inspiration from [13][14][15][16].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; My approach has been to split the project into two components: (1) Package&lt;br/&gt;&amp;gt;&amp;gt; Mempool Accept, which includes validation logic and mempool policy.&lt;br/&gt;&amp;gt;&amp;gt; (3) Package Relay, which includes the p2p protocol changes.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Progress so far:&lt;br/&gt;&amp;gt;&amp;gt; After discussions with various developers of contracting protocols&lt;br/&gt;&amp;gt;&amp;gt; (with heavier emphasis towards LN), it was determined that a&lt;br/&gt;&amp;gt;&amp;gt; package containing a child with all of its unconfirmed parents&lt;br/&gt;&amp;gt;&amp;gt; (child-with-unconfirmed-parents or 1-child-multi-parent package) would&lt;br/&gt;&amp;gt;&amp;gt; be sufficient for their use case, i.e. fee-bumping presigned&lt;br/&gt;&amp;gt;&amp;gt; transactions. A child-with-unconfirmed-parents package has several&lt;br/&gt;&amp;gt;&amp;gt; properties that make many things easier to reason about.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A few months ago, I proposed a set of policies for safe package&lt;br/&gt;&amp;gt;&amp;gt; validation and fee assessment for packages of this restricted&lt;br/&gt;&amp;gt;&amp;gt; topology [17]. A series of PRs implementing this proposal have&lt;br/&gt;&amp;gt;&amp;gt; been merged into Bitcoin Core [18].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Theoretically, developing a safe and incentive-compatible package&lt;br/&gt;&amp;gt;&amp;gt; mempool acceptance policy is sufficient to solve this issue. Nodes&lt;br/&gt;&amp;gt;&amp;gt; could opportunistically accept packages (e.g. by trying combinations&lt;br/&gt;&amp;gt;&amp;gt; of transactions rejected from their mempools), but this practice would&lt;br/&gt;&amp;gt;&amp;gt; likely be inefficient at best and open new Denial of Service attacks&lt;br/&gt;&amp;gt;&amp;gt; at worst. Additional p2p messages may enable nodes to request and&lt;br/&gt;&amp;gt;&amp;gt; share package validation-related information with one another in a&lt;br/&gt;&amp;gt;&amp;gt; more communication-efficient way.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Given that only package RBF remains for package mempool accept, and we&lt;br/&gt;&amp;gt;&amp;gt; can make progress on p2p and mempool in parallel, I think it’s&lt;br/&gt;&amp;gt;&amp;gt; appropriate to put forward a package relay proposal.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Proposal==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This proposal contains 2 components: a “generic” package relay&lt;br/&gt;&amp;gt;&amp;gt; protocol and an extension of it, child-with-unconfirmed-parents&lt;br/&gt;&amp;gt;&amp;gt; packages, as version 1 package relay. Another version of packages,&lt;br/&gt;&amp;gt;&amp;gt; “tx-with-unconfirmed-ancestors” can be created to extend package relay&lt;br/&gt;&amp;gt;&amp;gt; for eliminating orphans.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Generic Package Relay===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Two main ideas are introduced:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Download and validate packages of transactions together.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Provide information to help peers decide whether to request and/or how&lt;br/&gt;&amp;gt;&amp;gt; to validate transactions which are part of a package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Intended Protocol Flow====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Due to the asynchronous nature of a distributed transaction relay&lt;br/&gt;&amp;gt;&amp;gt; network, nodes may not receive all of the information needed to&lt;br/&gt;&amp;gt;&amp;gt; validate a transaction at once. For example, after a node completes&lt;br/&gt;&amp;gt;&amp;gt; Initial Block Download (IBD) and first starts participating in&lt;br/&gt;&amp;gt;&amp;gt; transaction relay with an empty mempool, it is common to receive&lt;br/&gt;&amp;gt;&amp;gt; orphans. In such scenarios where a node is aware that it is missing&lt;br/&gt;&amp;gt;&amp;gt; information, a &amp;#39;&amp;#39;receiver-initiated&amp;#39;&amp;#39; dialogue is appropriate:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Receiver requests package information.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The sender provides package information, including the wtxids of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions in the package and anything else that might be&lt;br/&gt;&amp;gt;&amp;gt; relevant (e.g. total fees and size).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    and validate the transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Sometimes, no matter what order transactions are received by a node,&lt;br/&gt;&amp;gt;&amp;gt; validating them individually is insufficient. When the sender is aware&lt;br/&gt;&amp;gt;&amp;gt; of additional information that the receiver needs to accept a package,&lt;br/&gt;&amp;gt;&amp;gt; a proactive &amp;#39;&amp;#39;sender-initiated&amp;#39;&amp;#39; dialogue should be enabled:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Sender announces they have package information pertaining to a&lt;br/&gt;&amp;gt;&amp;gt;    transaction that might otherwise be undesired on its own.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The receiver requests package information.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The sender provides package information, including the wtxids of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions in the package and anything else that might be&lt;br/&gt;&amp;gt;&amp;gt; relevant (e.g. total fees and size).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    and validate the transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Package relay is negotiated between two peers during the version&lt;br/&gt;&amp;gt;&amp;gt; handshake. Package relay requires both peers to support wtxid-based&lt;br/&gt;&amp;gt;&amp;gt; relay because package transactions are referenced by their wtxid.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====New Messages====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Three new protocol messages are added for use in any version of&lt;br/&gt;&amp;gt;&amp;gt; package relay. Additionally, each version of package relay must define&lt;br/&gt;&amp;gt;&amp;gt; its own inv type and &amp;#34;pckginfo&amp;#34; message version, referred to in this&lt;br/&gt;&amp;gt;&amp;gt; document as &amp;#34;MSG_PCKG&amp;#34; and &amp;#34;pckginfo&amp;#34; respectively. See&lt;br/&gt;&amp;gt;&amp;gt; BIP-v1-packages for a concrete example.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====sendpackages=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||  Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |version || uint32_t || 4 || Denotes a package version supported by the&lt;br/&gt;&amp;gt;&amp;gt; node.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |max_count || uint32_t || 4 ||Specifies the maximum number of&lt;br/&gt;&amp;gt;&amp;gt; transactions per package this node is&lt;br/&gt;&amp;gt;&amp;gt; willing to accept.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |max_weight || uint32_t || 4 ||Specifies the maximum total weight per&lt;br/&gt;&amp;gt;&amp;gt; package this node is willing&lt;br/&gt;&amp;gt;&amp;gt; to accept.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;sendpackages&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;sendpackages&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. During version handshake, nodes should send a &amp;#34;sendpackages&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;    message indicate they support package relay and may request&lt;br/&gt;&amp;gt;&amp;gt; packages.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The message should contain a version supported by the node. Nodes&lt;br/&gt;&amp;gt;&amp;gt;    should send a &amp;#34;sendpackages&amp;#34; message for each version they support.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The &amp;#34;sendpackages&amp;#34; message MUST be sent before sending a &amp;#34;verack&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;    message. If a &amp;#34;sendpackages&amp;#34; message is received afer &amp;#34;verack&amp;#34;, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;&amp;gt;&amp;gt;    send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;&amp;gt;&amp;gt; received by a peer after sending `fRelay==false` in their version&lt;br/&gt;&amp;gt;&amp;gt; message, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 6.. Upon receipt of a &amp;#34;sendpackages&amp;#34; message with a version that is&lt;br/&gt;&amp;gt;&amp;gt; not supported, a node must treat the peer as if it never received the&lt;br/&gt;&amp;gt;&amp;gt; message.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 7. If both peers send &amp;#34;wtxidrelay&amp;#34; and &amp;#34;sendpackages&amp;#34; with the same&lt;br/&gt;&amp;gt;&amp;gt;    version, the peers should announce, request, and send package&lt;br/&gt;&amp;gt;&amp;gt; information to each other.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====getpckgtxns=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; requested.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of wtxids||txns_length * 32|| The wtxids of each transaction&lt;br/&gt;&amp;gt;&amp;gt; in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;getpckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;getpckgtxns&amp;#34; message should be used to request all or some of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions previously announced in a &amp;#34;pckginfo&amp;#34; message,&lt;br/&gt;&amp;gt;&amp;gt; specified by witness transactiosome id.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;getpckgtxns&amp;#34; message, a node must respond with&lt;br/&gt;&amp;gt;&amp;gt;    either a &amp;#34;pckgtxns&amp;#34; containing the requested transactions or a&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;notfound&amp;#34; message indicating one or more of the transactions is&lt;br/&gt;&amp;gt;&amp;gt; unavailable. This allows the receiver to avoid downloading and storing&lt;br/&gt;&amp;gt;&amp;gt; transactions that cannot be validated immediately.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. A &amp;#34;getpckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send packages in the version handshake. If a &amp;#34;getpckgtxns&amp;#34; message&lt;br/&gt;&amp;gt;&amp;gt; is received from a peer with which package relay was not negotiated,&lt;br/&gt;&amp;gt;&amp;gt; the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====pckgtxns=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; provided.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of transactions||variable|| The transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;pckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;pckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;pckgtxns&amp;#34; message should contain the transaction data requested&lt;br/&gt;&amp;gt;&amp;gt;    using &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. A &amp;#34;pckgtxns&amp;#34; message should only be sent to a peer that requested&lt;br/&gt;&amp;gt;&amp;gt;    the package using &amp;#34;getpckgtxns&amp;#34;. If a node receives an unsolicited&lt;br/&gt;&amp;gt;&amp;gt; package, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. A &amp;#34;pckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send packages in the version handshake. If a &amp;#34;pckgtxns&amp;#34; message is&lt;br/&gt;&amp;gt;&amp;gt; received from a peer with which package relay was not negotiated, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Version 1 Packages: child-with-unconfirmed-parents===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This extends package relay for packages consisting of one transaction&lt;br/&gt;&amp;gt;&amp;gt; and all of its unconfirmed parents,by defining version 1 packages, a&lt;br/&gt;&amp;gt;&amp;gt; pckginfo1 message, and a MSG_PCKG1 inv type. It enables the use case&lt;br/&gt;&amp;gt;&amp;gt; in which a child pays for its otherwise-too-low-fee parents and their&lt;br/&gt;&amp;gt;&amp;gt; mempool conflict(s).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Intended Protocol Flow====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When relaying a package of low-fee parent(s) and high-fee child, the&lt;br/&gt;&amp;gt;&amp;gt; sender and receiver do the following:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Sender announces they have a child-with-unconfirmed-parents package&lt;br/&gt;&amp;gt;&amp;gt;    for a child that pays for otherwise-too-low-fee parent(s) using&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;inv(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The receiver requests package information using&lt;br/&gt;&amp;gt;&amp;gt;    &amp;#34;getdata(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The sender provides package information using &amp;#34;pckginfo1&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt;    including the blockhash of the sender&amp;#39;s best block, the wtxids of&lt;br/&gt;&amp;gt;&amp;gt; the transactions in the package, their total fees and total weight.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    the transactions. For example, if the receiver already has some of&lt;br/&gt;&amp;gt;&amp;gt; the transactions in their mempool, they only request the missing ones.&lt;br/&gt;&amp;gt;&amp;gt; They could also decide not to request the package at all based on the&lt;br/&gt;&amp;gt;&amp;gt; fee information provided.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. Upon receiving a &amp;#34;pckgtxns&amp;#34;, the receiver submits the transactions&lt;br/&gt;&amp;gt;&amp;gt;    together as a package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====New Messages====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A new inv type, &amp;#34;MSG_PCKG1&amp;#34;, and new protocol message, &amp;#34;PCKGINFO1&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt; are added.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====pckginfo1=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |blockhash || uint256 || 32 || The chain tip at which this package is&lt;br/&gt;&amp;gt;&amp;gt; defined.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |pckg_fee||CAmount||4|| The sum total fees paid by all transactions in&lt;br/&gt;&amp;gt;&amp;gt; the package.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |pckg_weight||int64_t||8|| The sum total weight of all transactions in&lt;br/&gt;&amp;gt;&amp;gt; the package.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; provided.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of wtxids||txns_length * 32|| The wtxids of each transaction&lt;br/&gt;&amp;gt;&amp;gt; in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;pckginfo1&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;pckginfo1&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;pckginfo1&amp;#34; message contains information about a version 1&lt;br/&gt;&amp;gt;&amp;gt;    package (defined below), referenced by the wtxid of the transaction&lt;br/&gt;&amp;gt;&amp;gt; it pertains to and the current blockhash.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;pckginfo1&amp;#34; message, the node should decide if it&lt;br/&gt;&amp;gt;&amp;gt;    wants to validate the package, request transaction data if&lt;br/&gt;&amp;gt;&amp;gt; necessary, etc.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. Upon receipt of a malformed &amp;#34;pckginfo1&amp;#34; message or package that&lt;br/&gt;&amp;gt;&amp;gt;    does not abide by the max_count, max_weight, or other rules&lt;br/&gt;&amp;gt;&amp;gt; specified by the version agreed upon in the initial negotiation, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.  If a node receives a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; message for which the &amp;#34;pckg_fee&amp;#34; or &amp;#34;pckg_weight&amp;#34; do not reflect the&lt;br/&gt;&amp;gt;&amp;gt; true total fees and weight, respectively, or the transactions in the&lt;br/&gt;&amp;gt;&amp;gt; package, the message is malformed.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. A node MUST NOT send a &amp;#34;pckginfo1&amp;#34; message that has not been&lt;br/&gt;&amp;gt;&amp;gt;    requested by the recipient. Upon receipt of an unsolicited&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;pckginfo1&amp;#34;, a node should disconnect the sender.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 6. A &amp;#34;pckginfo1&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send version 1 packages in the version handshake. If a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; message is received from a peer with which package relay was not&lt;br/&gt;&amp;gt;&amp;gt; negotiated, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====MSG_PCKG1=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. A new inv type (MSG_PCKG1 == 0x6) is added, for use in inv messages&lt;br/&gt;&amp;gt;&amp;gt;    and getdata requests pertaining to version 1 packages.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. As an inv type, it indicates that both transaction data and version&lt;br/&gt;&amp;gt;&amp;gt;    1 package information are available for the transaction. The&lt;br/&gt;&amp;gt;&amp;gt; transaction is referenced by its wtxid. As a getdata request type, it&lt;br/&gt;&amp;gt;&amp;gt; indicates that the sender wants package information for the&lt;br/&gt;&amp;gt;&amp;gt; transaction.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;getdata&amp;#34; request for &amp;#34;MSG_PCKG1&amp;#34;, the node&lt;br/&gt;&amp;gt;&amp;gt;    should respond with the version 1 package corresponding to the&lt;br/&gt;&amp;gt;&amp;gt; requested transaction and its current chain tip, or with NOTFOUND.&lt;br/&gt;&amp;gt;&amp;gt; The node should not assume that the sender is requesting the&lt;br/&gt;&amp;gt;&amp;gt; transaction data as well.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Child With Parent Packages Rules====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package sent between nodes must abide&lt;br/&gt;&amp;gt;&amp;gt; by the rules below, otherwise the package is malformed and the sender&lt;br/&gt;&amp;gt;&amp;gt; should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A version 1 or &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package can be&lt;br/&gt;&amp;gt;&amp;gt; defined for any transaction that spends unconfirmed inputs. The child&lt;br/&gt;&amp;gt;&amp;gt; can be thought of as the &amp;#34;representative&amp;#34; of the package. This package&lt;br/&gt;&amp;gt;&amp;gt; can be uniquely identified by the transaction&amp;#39;s wtxid and the current&lt;br/&gt;&amp;gt;&amp;gt; chain tip block hash.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package MUST be:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. &amp;#39;&amp;#39;Sorted topologically.&amp;#39;&amp;#39; For every transaction t in the package,&lt;br/&gt;&amp;gt;&amp;gt;    if any of t&amp;#39;s parents are present in the package, the parent must&lt;br/&gt;&amp;gt;&amp;gt; appear somewhere in the list before t. In other words, the&lt;br/&gt;&amp;gt;&amp;gt; transactions must be sorted in ascending order of the number of&lt;br/&gt;&amp;gt;&amp;gt; ancestors present in the package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. &amp;#39;&amp;#39;Only 1 child with unconfirmed parents.&amp;#39;&amp;#39; The package must consist&lt;br/&gt;&amp;gt;&amp;gt;    of one transaction and its unconfirmed parents. There must not be&lt;br/&gt;&amp;gt;&amp;gt; any other transactions in the package. Other dependency relationships&lt;br/&gt;&amp;gt;&amp;gt; may exist within the package (e.g. one parent may spend the output of&lt;br/&gt;&amp;gt;&amp;gt; another parent) provided that topological order is respected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. &amp;#39;&amp;#39;All unconfirmed parents.&amp;#39;&amp;#39; All of the child&amp;#39;s unconfirmed parents&lt;br/&gt;&amp;gt;&amp;gt;    must be present.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. &amp;#39;&amp;#39;No conflicts.&amp;#39;&amp;#39; None of the transactions in the package may&lt;br/&gt;&amp;gt;&amp;gt;    conflict with each other (i.e.  spend the same prevout).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. &amp;#39;&amp;#39;Total fees and weight.&amp;#39;&amp;#39; The &amp;#39;total_fee&amp;#39; and &amp;#39;total_weight&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;    fields must accurately represent the sum total of all transactions&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt; fees and weights as defined in BIP141, respectively.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Not all of the child&amp;#39;s parents must be present; the child transaction&lt;br/&gt;&amp;gt;&amp;gt; may also spend confirmed inputs. However, if the child has confirmed&lt;br/&gt;&amp;gt;&amp;gt; parents, they must not be in the package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; While a child-with-unconfirmed-parents package is perhaps most&lt;br/&gt;&amp;gt;&amp;gt; relevant when the child has a higher feerate than its parents, this&lt;br/&gt;&amp;gt;&amp;gt; property is not required to construct a valid package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Clarifications====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: Under what circumstances should a sender announce a&lt;br/&gt;&amp;gt;&amp;gt; child-with-unconfirmed-parents package?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package for a transaction should be&lt;br/&gt;&amp;gt;&amp;gt; announced when it meets the peer&amp;#39;s fee filter but one or more of its&lt;br/&gt;&amp;gt;&amp;gt; parents don&amp;#39;t; a &amp;#34;inv(MSG_PCKG1)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34; should be sent&lt;br/&gt;&amp;gt;&amp;gt; for the child. Each of the parents which meet the peer&amp;#39;s fee filter&lt;br/&gt;&amp;gt;&amp;gt; should still be announced normally.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: What if a new block arrives in between messages?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package is defined for a transaction&lt;br/&gt;&amp;gt;&amp;gt; based on the current chain state. As such, a new block extending the&lt;br/&gt;&amp;gt;&amp;gt; tip may decrease the number of transactions in the package (i.e. if&lt;br/&gt;&amp;gt;&amp;gt; any of the transaction&amp;#39;s parents were included in the block). In a&lt;br/&gt;&amp;gt;&amp;gt; reorg, the number of transactions in the package may decrease or&lt;br/&gt;&amp;gt;&amp;gt; increase (i.e. if any of the transaction&amp;#39;s parents were included in a&lt;br/&gt;&amp;gt;&amp;gt; block in the previous chain but not the new one).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If the new block arrives before the &amp;#34;getdata&amp;#34; or &amp;#34;pckginfo1&amp;#34;, nothing&lt;br/&gt;&amp;gt;&amp;gt; needs to change.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If the new block arrives before &amp;#34;getpckgtxns&amp;#34; or before &amp;#34;pckgtxns&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt; the receiver may need to re-request package information if the block&lt;br/&gt;&amp;gt;&amp;gt; contained a transaction in the package. If the block doesn&amp;#39;t contain&lt;br/&gt;&amp;gt;&amp;gt; any transactions in the package, whether it extends the previous tip&lt;br/&gt;&amp;gt;&amp;gt; or causes a reorg, nothing needs to change.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: Can &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages contain only one&lt;br/&gt;&amp;gt;&amp;gt; transaction?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Yes.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Further Protocol Extensions===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When introducing a new type of package, assign it a version number &amp;#34;n&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; and use an additional &amp;#34;sendpackages&amp;#34; message during version handshake&lt;br/&gt;&amp;gt;&amp;gt; to negotiate support for it. An additional package information message&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;pckginfon&amp;#34; and inv type &amp;#34;MSG_PCKGn&amp;#34; should be defined for the type of&lt;br/&gt;&amp;gt;&amp;gt; package.  However, &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; do not need to be&lt;br/&gt;&amp;gt;&amp;gt; changed.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Example proposal for tx-with-unconfirmed-ancestors package relay: [19]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Compatibility===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Older clients remain fully compatible and interoperable after this&lt;br/&gt;&amp;gt;&amp;gt; change. Clients implementing this protocol will only attempt to send&lt;br/&gt;&amp;gt;&amp;gt; and request packages if agreed upon during the version handshake.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Package Erlay===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Clients using BIP330 reconciliation-based transaction relay (Erlay)&lt;br/&gt;&amp;gt;&amp;gt; are able to use package relay without interference. In fact, a package&lt;br/&gt;&amp;gt;&amp;gt; of transactions may be announced using both Erlay and package relay.&lt;br/&gt;&amp;gt;&amp;gt; After reconciliation, if the initiator would have announced a&lt;br/&gt;&amp;gt;&amp;gt; transaction by wtxid but also has package information for it, they may&lt;br/&gt;&amp;gt;&amp;gt; send &amp;#34;inv(MSG_PCKG)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Rationale===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====P2P Message Design====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; These p2p messages are added for communication efficiency and, as&lt;br/&gt;&amp;gt;&amp;gt; such, one should measure alternative solutions based on the resources&lt;br/&gt;&amp;gt;&amp;gt; used to communicate (not necessarily trustworthy) information: We&lt;br/&gt;&amp;gt;&amp;gt; would like to minimize network bandwidth, avoid downloading a&lt;br/&gt;&amp;gt;&amp;gt; transaction more than once, avoid downloading transactions that are&lt;br/&gt;&amp;gt;&amp;gt; eventually rejected, and minimize storage allocated for&lt;br/&gt;&amp;gt;&amp;gt; not-yet-validated transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Consider these (plausible) scenarios in transaction relay:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Alice (the &amp;#34;sender&amp;#34;) is relaying transactions to Bob (the &amp;#34;receiver&amp;#34;).&lt;br/&gt;&amp;gt;&amp;gt; Alice&amp;#39;s mempool has a minimum feerate of 1sat/vB and Bob&amp;#39;s has a&lt;br/&gt;&amp;gt;&amp;gt; minimum feerate of 3sat/vB. For simplicity, all transactions are&lt;br/&gt;&amp;gt;&amp;gt; 1600Wu in virtual size and 500 bytes in serialized size. Apart from&lt;br/&gt;&amp;gt;&amp;gt; the spending relationships specified, all other inputs are from&lt;br/&gt;&amp;gt;&amp;gt; confirmed UTXOs.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Package {A, B} where A pays 0 satoshis and B pays 8000 satoshis in&lt;br/&gt;&amp;gt;&amp;gt;    fees.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. Package {C, D} where C pays 0 satoshis and D pays 1200 satoshis in&lt;br/&gt;&amp;gt;&amp;gt;    fees.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Package {E, F, G, H, J} that pays 4000, 8000, 0, 2000, and 4000&lt;br/&gt;&amp;gt;&amp;gt;    satoshis in fees, respectively.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Alternative Designs Considered====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Package Information Only:&amp;#39;&amp;#39; Just having &amp;#34;pckginfo&amp;#34; gives enough&lt;br/&gt;&amp;gt;&amp;gt; information for the receiver to accept the package. Omit the&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages. While this option is a good&lt;br/&gt;&amp;gt;&amp;gt; fallback if batched transaction download fails for some reason, it&lt;br/&gt;&amp;gt;&amp;gt; shouldn&amp;#39;t be used as the default because it &amp;#39;always&amp;#39; requires storage&lt;br/&gt;&amp;gt;&amp;gt; of unvalidated transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;No Package Information Round:&amp;#39;&amp;#39; Instead of having a package&lt;br/&gt;&amp;gt;&amp;gt; information round, just use the child&amp;#39;s wtxid to refer to the package&lt;br/&gt;&amp;gt;&amp;gt; and always send the entire package together. This would cause nodes to&lt;br/&gt;&amp;gt;&amp;gt; redownload duplicate transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I have also created a slidedeck exploring various alternative designs&lt;br/&gt;&amp;gt;&amp;gt; and some examples in which they fall flat [20]. Please feel free to&lt;br/&gt;&amp;gt;&amp;gt; suggest other alternatives.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Versioning System====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This protocol should be extensible to support multiple types of&lt;br/&gt;&amp;gt;&amp;gt; packages based on future desired use cases. Two &amp;#34;flavors&amp;#34; of&lt;br/&gt;&amp;gt;&amp;gt; versioning were considered:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. When package mempool acceptance is upgraded to support more types&lt;br/&gt;&amp;gt;&amp;gt;    of packages, increment the version number (similar to Erlay).&lt;br/&gt;&amp;gt;&amp;gt; During version handshake, peers negotiate which version of package&lt;br/&gt;&amp;gt;&amp;gt; relay they will use by each sending one &amp;#34;sendpackages&amp;#34; message.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. When introducing another type of package, assign a version number&lt;br/&gt;&amp;gt;&amp;gt;    to it and announce it as an additional supported version (similar&lt;br/&gt;&amp;gt;&amp;gt; to Compact Block Relay). During version handshake, peers send one&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;sendpackages&amp;#34; message for each version supported.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The second option was favored because it allows different parameters&lt;br/&gt;&amp;gt;&amp;gt; for different versions.  For example, it should be possible to support&lt;br/&gt;&amp;gt;&amp;gt; both &amp;#34;arbitrary topology but maximum 3-transaction&amp;#34; package as well as&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;child-with-unconfirmed-parents with default mempool ancestor limits&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; packages simultaneously.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Acknowledgements==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I hope to have made it abundantly clear that this proposal isn’t&lt;br/&gt;&amp;gt;&amp;gt; inventing the concept of package relay, and in fact builds upon years&lt;br/&gt;&amp;gt;&amp;gt; of work by many others, including Suhas Daftuar and Antoine Riard.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thank you to John Newbery and Martin Zumsande for input on the design.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thank you to Matt Corallo, Christian Decker, David Harding, Antoine&lt;br/&gt;&amp;gt;&amp;gt; Poinsot, Antoine Riard, Gregory Sanders, Chris Stewart, Bastien&lt;br/&gt;&amp;gt;&amp;gt; Teinturier, and others for input on the desired interface for&lt;br/&gt;&amp;gt;&amp;gt; contracting protocols.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Looking forward to hearing your thoughts!&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [0]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [1]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&#34;&gt;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [4]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&#34;&gt;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [5]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&#34;&gt;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [6]: &lt;a href=&#34;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&#34;&gt;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [7]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&#34;&gt;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [8]: &lt;a href=&#34;https://youtu.be/fbWSQvJjKFs?t=1438&#34;&gt;https://youtu.be/fbWSQvJjKFs?t=1438&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [9]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&#34;&gt;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7594&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7594&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7600&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7600&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [13]: &lt;a href=&#34;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&#34;&gt;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [14]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/14895&#34;&gt;https://github.com/bitcoin/bitcoin/issues/14895&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [15]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [16]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [17]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [18]: &lt;a href=&#34;https://github.com/users/glozow/projects/5/views/4?layout=board&#34;&gt;https://github.com/users/glozow/projects/5/views/4?layout=board&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [19]: &lt;a href=&#34;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&#34;&gt;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [20]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&#34;&gt;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20221101/d77fa967/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20221101/d77fa967/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:16:10Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsrmccyhsucnzx7elt25ae6yqzvxqu7ramnpszltx0gs6v8lwxxwygzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qcwvmkk</id>
    
      <title type="html">📅 Original date posted:2022-10-27 📝 Original message:Hi AJ, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsrmccyhsucnzx7elt25ae6yqzvxqu7ramnpszltx0gs6v8lwxxwygzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qcwvmkk" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsp4jpceztq86r6g4ewx99xnuu4fqwuu9sn0yzu256757avtxv49asyhgskd&#39;&gt;nevent1q…gskd&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-10-27&lt;br/&gt;📝 Original message:Hi AJ,&lt;br/&gt;&lt;br/&gt;Not going to comment on what Bitcoin Core&amp;#39;s philosophy on mempol policy is&lt;br/&gt;or should be. I want to note that I think this:&lt;br/&gt;&lt;br/&gt;&amp;gt; It&amp;#39;s also possible that this is something of a one time thing: full rbf&lt;br/&gt;&amp;gt; has been controversial for ages, but widely liked by devs, and other&lt;br/&gt;&amp;gt; attempts (eg making it available in knots) haven&amp;#39;t actually achieved&lt;br/&gt;&amp;gt; much of a result in practice. So maybe this is just a special case&lt;br/&gt;&lt;br/&gt;is true.&lt;br/&gt;&lt;br/&gt;&amp;gt; The second thing is that whatever your relay policy is, you still&lt;br/&gt;&amp;gt; need a path all the way to miners through nodes that will accept your&lt;br/&gt;&amp;gt; transaction at every step. If you&amp;#39;re making your mempool more restrictive&lt;br/&gt;&amp;gt; (eg -permitbaremultisig=0, -datacarrier=0), that&amp;#39;s easy for you (though&lt;br/&gt;&amp;gt; you&amp;#39;re making life more difficult for people who do create those sorts&lt;br/&gt;&amp;gt; of txs); but if you want a more permissive policy (package relay,&lt;br/&gt;&amp;gt; version-3-rbf, full-rbf), you might need to do some work.&lt;br/&gt;&lt;br/&gt;&amp;gt; The cutoff for that is probably something like &amp;#34;do 30% of listening&lt;br/&gt;&amp;gt; nodes have a compatible policy&amp;#34;? If they do, then you&amp;#39;ll have about a&lt;br/&gt;&amp;gt; 95% chance of having at least one of your outbound peers accept your tx,&lt;br/&gt;&amp;gt; just by random chance.&lt;br/&gt;&lt;br/&gt;Yes, in most cases, whether Bitcoin Core is restricting or loosening&lt;br/&gt;policy, the user in question is fine as long as they have a path from their&lt;br/&gt;node to a miner that will accept it. This is the case for something like&lt;br/&gt;-datacarriersize if the use case is putting stuff into OP_RETURN outputs,&lt;br/&gt;or if they&amp;#39;re LN and using CPFP carveout, v3, package relay, etc. But&lt;br/&gt;replacement is not only a question of &amp;#34;will my transaction propagate&amp;#34; but&lt;br/&gt;also, &amp;#34;will someone else&amp;#39;s transaction propagate, invalidating mine&amp;#34; or, in&lt;br/&gt;other words, &amp;#34;can I prevent someone else&amp;#39;s transaction from propagating.&amp;#34; A&lt;br/&gt;zeroconf user relies on there *not* being a path from someone else&amp;#39;s full&lt;br/&gt;RBF node to a full RBF miner. This is why I think RBF is so controversial&lt;br/&gt;in general, why -mempoolfullrbf on someone else&amp;#39;s node is considered more&lt;br/&gt;significant than another policy option, and why full RBF shouldn&amp;#39;t be&lt;br/&gt;compared with something like datacarriersize. I don&amp;#39;t think past patterns&lt;br/&gt;can be easily applied here, and I don&amp;#39;t think this necessarily shows a&lt;br/&gt;different &amp;#34;direction&amp;#34; in thinking about mempool policy in general.&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Thu, Oct 27, 2022 at 12:52 AM Anthony Towns via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi *,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; TLDR: Yes, this post is too long, and there&amp;#39;s no TLDR. If it&amp;#39;s any&lt;br/&gt;&amp;gt; consolation, it took longer to write than it does to read?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; On Tue, Jun 15, 2021 at 12:55:14PM -0400, Antoine Riard via bitcoin-dev&lt;br/&gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt; &amp;gt; Subject: Re: [bitcoin-dev] Proposal: Full-RBF in Bitcoin Core 24.0&lt;br/&gt;&amp;gt; &amp;gt; I&amp;#39;m writing to propose deprecation of opt-in RBF in favor of full-RBF&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; If there is ecosystem agreement on switching to full-RBF, but 0.24 sounds&lt;br/&gt;&amp;gt; &amp;gt; too early, let&amp;#39;s defer it to 0.25 or 0.26. I don&amp;#39;t think Core has a&lt;br/&gt;&amp;gt; &amp;gt; consistent deprecation process w.r.t to policy rules heavily relied-on by&lt;br/&gt;&amp;gt; &amp;gt; Bitcoin users, if we do so let sets a precedent satisfying as many folks&lt;br/&gt;&amp;gt; as&lt;br/&gt;&amp;gt; &amp;gt; we can.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; One precedent that seems to be being set here, which to me seems fairly&lt;br/&gt;&amp;gt; novel for bitcoin core, is that we&amp;#39;re about to start supporting and&lt;br/&gt;&amp;gt; encouraging nodes to have meaningfully different mempool policies. From&lt;br/&gt;&amp;gt; what I&amp;#39;ve seen, the baseline expectation has always been that while&lt;br/&gt;&amp;gt; certainly mempools can and will differ, policies will be largely the same:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   Firstly, there is no &amp;#34;the mempool&amp;#34;. There is no global mempool. Rather&lt;br/&gt;&amp;gt;   each node maintains its own mempool and accepts and rejects transaction&lt;br/&gt;&amp;gt;   to that mempool using their own internal policies. Most nodes have&lt;br/&gt;&amp;gt;   the same policies, but due to different start times, relay delays,&lt;br/&gt;&amp;gt;   and other factors, not every node has the same mempool, although they&lt;br/&gt;&amp;gt;   may be very similar.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   -&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://bitcoin.stackexchange.com/questions/98585/how-to-find-if-two-transactions-in-mempool-are-conflicting&#34;&gt;https://bitcoin.stackexchange.com/questions/98585/how-to-find-if-two-transactions-in-mempool-are-conflicting&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Up until now, the differences between node policies supported by different&lt;br/&gt;&amp;gt; nodes running core have been quite small, with essentially the following&lt;br/&gt;&amp;gt; options available:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -minrelaytxfee, -maxmempool - changes the lowest fee rate you&amp;#39;ll accept&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -mempoolexpiry - how long to keep txs in the mempool&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -datacarrier - reject txs creating OP_RETURN outputs&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -datacarriersize - maximum size of OP_RETURN data&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -permitbaremultisig - prevent relay of bare multisig&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -bytespersigop - changes how SIGOP accounting works for relay and&lt;br/&gt;&amp;gt;  mining prioritisation&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; as well as these, marked as &amp;#34;debug only&amp;#34; options (only shown with&lt;br/&gt;&amp;gt; -help-debug):&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -incrementalrelayfee - make it easier/harder to spam txs by only&lt;br/&gt;&amp;gt;  slightly bumping the fee; marked as a &amp;#34;debug only&amp;#34; option&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -dustrelayfee - make it easier/harder to create uneconomic utxos;&lt;br/&gt;&amp;gt;  marked as a &amp;#34;debug only&amp;#34; option&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -limit{descendant,ancestor}{count,size} - changes how large the&lt;br/&gt;&amp;gt;  transaction chains can be; marked as a &amp;#34;debug only&amp;#34; option&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; and in theory, but not available on mainnet:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -acceptnonstdtxn - relay/mine non standard transactions&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; There&amp;#39;s also the &amp;#34;prioritisetransaction&amp;#34; rpc, which can cause you to keep&lt;br/&gt;&amp;gt; a low feerate transaction in your mempool longer than you might otherwise.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think that -minrelaytxfee, -maxmempool and -mempoolexpiry are the only&lt;br/&gt;&amp;gt; ones of those options commonly set, and those only rarely result in any&lt;br/&gt;&amp;gt; differences in the txs at the top of the mempool.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; There are also quite a few parameters that aren&amp;#39;t even runtime&lt;br/&gt;&amp;gt; configurable:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  - MAX_STANDARD_TX_WEIGHT&lt;br/&gt;&amp;gt;  - MIN_STANDARD_TX_NONWITNESS_SIZE (see also #26265)&lt;br/&gt;&amp;gt;  - MAX_P2SH_SIGOPS (see also #26348)&lt;br/&gt;&amp;gt;  - MAX_STANDARD_TX_SIGOPS_COST&lt;br/&gt;&amp;gt;  - MAX_STANDARD_P2WSH_STACK_ITEMS&lt;br/&gt;&amp;gt;  - MAX_STANDARD_P2WSH_STACK_ITEM_SIZE&lt;br/&gt;&amp;gt;  - MAX_STANDARD_TAPSCRIPT_STACK_ITEM_SIZE&lt;br/&gt;&amp;gt;  - MAX_STANDARD_P2WSH_SCRIPT_SIZE&lt;br/&gt;&amp;gt;  - MAX_STANDARD_SCRIPTSIG_SIZE&lt;br/&gt;&amp;gt;  - EXTRA_DESCENDANT_TX_SIZE_LIMIT&lt;br/&gt;&amp;gt;  - MAX_REPLACEMENT_CANDIDATES&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; And other plausible options aren&amp;#39;t configurable even at compile time&lt;br/&gt;&amp;gt; -- eg, core doesn&amp;#39;t implement BIP 125&amp;#39;s inherited signalling rule so&lt;br/&gt;&amp;gt; there&amp;#39;s no way to enable it; core doesn&amp;#39;t allow opting out of BIP 125&lt;br/&gt;&amp;gt; rule 3 ratchet on absolute fee; core doesn&amp;#39;t allow CPFP carveout with&lt;br/&gt;&amp;gt; more than 1 ancestor; core doesn&amp;#39;t allow opting out of LOW_S checks&lt;br/&gt;&amp;gt; (even via -acceptnonstdtxn); etc.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; We also naturally have different mempool policies between different&lt;br/&gt;&amp;gt; releases: eg, expansions of policy, such as allowing OP_RETURN or&lt;br/&gt;&amp;gt; expanding it from 40 to 80 bytes or new soft forks where old nodes won&amp;#39;t&lt;br/&gt;&amp;gt; relay transactions that use the new; and also occassional restrictions&lt;br/&gt;&amp;gt; in policy, such as the LOW_S requirement.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; While supporting and encouraging different mempool polices might be new&lt;br/&gt;&amp;gt; for core, it&amp;#39;s not new for knots: knots changes some of these defaults&lt;br/&gt;&amp;gt; (-permitbaremultisig defaults to false, -datacarriersize is reduced to&lt;br/&gt;&amp;gt; 42), allows the use of -acceptnonstdtxn on mainnet, and introduces new&lt;br/&gt;&amp;gt; options including -spkreuse and -mempoolreplacement (giving the latter&lt;br/&gt;&amp;gt; full rbf behaviour by default). Knots also includes a `-corepolicy`&lt;br/&gt;&amp;gt; option to make it easy to get a configuration matching core&amp;#39;s defaults.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think gmaxwell&amp;#39;s take from Feb 2015 (in the context of how restrictive&lt;br/&gt;&amp;gt; policy on OP_RETURN data should be) was a reasonable description for&lt;br/&gt;&amp;gt; core&amp;#39;s approach up until now:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   There is also a matter of driving competent design rather than lazy&lt;br/&gt;&amp;gt;   first thing that works. E.g. In stealth addresses the early proposals&lt;br/&gt;&amp;gt;   use highly inefficient single ECDH point per output instead of simply&lt;br/&gt;&amp;gt;   pooling them. Network behavior is one of the few bits of friction&lt;br/&gt;&amp;gt;   driving good technical design rather than &amp;#34;move fast, break things, and&lt;br/&gt;&amp;gt;   force everyone else onto my way of doing thing rather than discussing&lt;br/&gt;&amp;gt;   the design in public&amp;#34;. No one wants to be an outright gatekeeper,&lt;br/&gt;&amp;gt;   but the network is a shared resource and it&amp;#39;s perfectly reasonable&lt;br/&gt;&amp;gt;   node behavior to be stingy about the perpetual storage impact of the&lt;br/&gt;&amp;gt;   transactions they&amp;#39;re willing to process, especially when it comes to&lt;br/&gt;&amp;gt;   neutral technical criteria like the amount of network irrelevant data&lt;br/&gt;&amp;gt;   stuffed in transactions.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   There is also a very clear pattern we&amp;#39;ve seen in the past where&lt;br/&gt;&amp;gt;   people take anything the system lets them do as strong evidence that&lt;br/&gt;&amp;gt;   they have a irrevocable right to use the system in that way, and that&lt;br/&gt;&amp;gt;   their only responsibility-- and if their usage harms the system it&amp;#39;s&lt;br/&gt;&amp;gt;   the responsibility of the system to not permit it. [...&lt;br/&gt;&amp;gt;   ...] For mitigating these risks it&amp;#39;s optimal if transactions&lt;br/&gt;&amp;gt;   seem as uniform and indistinguishable as reasonably possible.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   - &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/5286#issuecomment-72564175&#34;&gt;https://github.com/bitcoin/bitcoin/pull/5286#issuecomment-72564175&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Perhaps see also sdaftuar in Nov 2015,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   To me the most important question is, is priority something that miners&lt;br/&gt;&amp;gt;   want to use?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   If a non-negligible amount of hashpower intends to use it in their&lt;br/&gt;&amp;gt;   transaction selection, then I think it makes sense for nodes to use it&lt;br/&gt;&amp;gt;   too, because it&amp;#39;s generally helpful to have your mempool predict the&lt;br/&gt;&amp;gt;   UTXO as much as possible, and for nodes to be able to have reasonable&lt;br/&gt;&amp;gt;   fee and priority estimates (which won&amp;#39;t happen unless they track the&lt;br/&gt;&amp;gt;   priority transactions somehow -- I&amp;#39;m presuming that miners run with&lt;br/&gt;&amp;gt;   much bigger mempools than regular nodes).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   If the answer is no, then that&amp;#39;s fine and I don&amp;#39;t see a reason to push&lt;br/&gt;&amp;gt;   in this direction. I sort of assumed there was enough hashpower mining&lt;br/&gt;&amp;gt;   with priority, since last time I checked estimatepriority was still&lt;br/&gt;&amp;gt;   giving meaningful results for low-ish blockheights, but I haven&amp;#39;t done&lt;br/&gt;&amp;gt;   any kind of real analysis.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   - &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6992#issuecomment-155969455&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6992#issuecomment-155969455&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; or in June 2019,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   What this PR is proposing is to get rid of a command-line option that is&lt;br/&gt;&amp;gt;   (a) a footgun for users and (b) does not reflect what I believe to be&lt;br/&gt;&amp;gt;   the understanding most users have, which is that [X txs] are expected&lt;br/&gt;&amp;gt;   to propagate well on the network.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   ..&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   I don&amp;#39;t think this rises to the level that Luke is concerned about,&lt;br/&gt;&amp;gt;   namely a prelude to forcing a common relay policy on all nodes. In&lt;br/&gt;&amp;gt;   particular I do agree it makes sense that we offer some ways of&lt;br/&gt;&amp;gt;   customizing policy parameters (eg the mempool size, min relay fee,&lt;br/&gt;&amp;gt;   etc). Instead, I think the justification for this change is that we&lt;br/&gt;&amp;gt;   should not support behaviors we think are harmful to the ecosystem&lt;br/&gt;&amp;gt;   overall and have no legitimate use-case, and we should eliminate ways&lt;br/&gt;&amp;gt;   that users might inadvertently shoot themselves in the foot.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   - &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16171#issuecomment-500393271&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16171#issuecomment-500393271&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; (or see discussion in &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7219&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7219&lt;/a&gt;)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t mean to imply the above are saying &amp;#34;there&amp;#39;s one way to do&lt;br/&gt;&amp;gt; things and it&amp;#39;s this way&amp;#34;, or that the old way of doing things should&lt;br/&gt;&amp;gt; necessarily be the way we keep doing things. Just that previously core&lt;br/&gt;&amp;gt; has tended towards designing a single policy that works as well as it&lt;br/&gt;&amp;gt; can for everyone and the ecosystem as a whole. (I&amp;#39;m also not saying that&lt;br/&gt;&amp;gt; fullrbf can&amp;#39;t work well for everyone or the ecosystem as a whole)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; By contrast, I think the most common response to pushback against the&lt;br/&gt;&amp;gt; full rbf option has been along the lines of &amp;#34;it&amp;#39;s just an option, we&lt;br/&gt;&amp;gt; don&amp;#39;t want to force people&amp;#34;, eg:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   Blaming the default false -mempoolfullrbf option for a full RBF network&lt;br/&gt;&amp;gt;   would be holding Bitcoin Core developers responsible for the decisions&lt;br/&gt;&amp;gt;   of individual node operators and miners. I don&amp;#39;t think having the&lt;br/&gt;&amp;gt;   option (again, default false) can directly cause a full RBF network,&lt;br/&gt;&amp;gt;   and likewise, I don&amp;#39;t think removing this option removes the &amp;#34;risk&amp;#34;&lt;br/&gt;&amp;gt;   of a full RBF network.&lt;br/&gt;&amp;gt;    - glozow&lt;br/&gt;&amp;gt;      &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1274949400&#34;&gt;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1274949400&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   NACK. This is a default false option.&lt;br/&gt;&amp;gt;    - achow101&lt;br/&gt;&amp;gt;      &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1274953204&#34;&gt;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1274953204&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   Erecting artificial barriers to prevent or make it difficult for users&lt;br/&gt;&amp;gt;   to do what they want to do, is not appropriate behaviour.&lt;br/&gt;&amp;gt;    - luke-jr&lt;br/&gt;&amp;gt;      &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1290721905&#34;&gt;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1290721905&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   I&amp;#39;m in general against removing options.&lt;br/&gt;&amp;gt;    - instagibbs&lt;br/&gt;&amp;gt;      &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1292030700&#34;&gt;https://github.com/bitcoin/bitcoin/pull/26287#issuecomment-1292030700&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think this differs from what core has done in the past, in that&lt;br/&gt;&amp;gt; previously we&amp;#39;ve tried to ensure a new policy is good for everyone (or as&lt;br/&gt;&amp;gt; nearly as it can be), and then enabled it as soon as it&amp;#39;s implemented.&lt;br/&gt;&amp;gt; Any options that have been added have either been to control resource&lt;br/&gt;&amp;gt; usage in ways that don&amp;#39;t significantly effect tx propagation, to&lt;br/&gt;&amp;gt; allow people to revert to the old behaviour when the new behaviour is&lt;br/&gt;&amp;gt; controversial (eg the -mempoolreplacement=0 option from 0.12 to 0.18),&lt;br/&gt;&amp;gt; and to make it easier to test/debug the implementation.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Giving people a new relay behaviour they can opt-in to when we aren&amp;#39;t&lt;br/&gt;&amp;gt; confident enough to turn on by default doesn&amp;#39;t match the approach I&amp;#39;ve&lt;br/&gt;&amp;gt; seen core take in the past.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If this is going to be an ongoing shift in how core sees relay/mempool&lt;br/&gt;&amp;gt; policy, I think that&amp;#39;s significant and worth paying attention to.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t think it&amp;#39;s necessary to have that shift to roll out full rbf.&lt;br/&gt;&amp;gt; The other approach would be either:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  * set -mempoolfullrbf=true as the default for 24.0, and just have the&lt;br/&gt;&amp;gt;    command line param there in case people want to do a&lt;br/&gt;&amp;gt;    &amp;#34;UserRejectedMempoolPolicy&amp;#34; campaign to get everyone to opt-out&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  * revert it for now because we don&amp;#39;t think mainnet is ready for fullrbf&lt;br/&gt;&amp;gt;    yet, and introduce it as default true for 25.0 or 26.0 or 27.0 or&lt;br/&gt;&amp;gt;    to activate at some scheduled date in that timeframe (potentially&lt;br/&gt;&amp;gt;    backporting it to previous releases to help with adoption too,&lt;br/&gt;&amp;gt;    whatever). same effect as the previous option, just with a bit more&lt;br/&gt;&amp;gt;    advanced notice and time to prepare&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t think anyone&amp;#39;s proposed the first (which I interpret as &amp;#34;most of&lt;br/&gt;&amp;gt; us don&amp;#39;t think mainnet is ready for fullrbf today&amp;#34;), but the comments&lt;br/&gt;&amp;gt; above are all pushback by people arguing against (the first step of)&lt;br/&gt;&amp;gt; the second approach, and they seem to be winning the day.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It&amp;#39;s also possible that this is something of a one time thing: full rbf&lt;br/&gt;&amp;gt; has been controversial for ages, but widely liked by devs, and other&lt;br/&gt;&amp;gt; attempts (eg making it available in knots) haven&amp;#39;t actually achieved&lt;br/&gt;&amp;gt; much of a result in practice. So maybe this is just a special case and&lt;br/&gt;&amp;gt; not a precedent, and when people propose other default false options,&lt;br/&gt;&amp;gt; there will be substantially more resistance to them being merged,&lt;br/&gt;&amp;gt; despite all the talk about users having options that&amp;#39;s going on right now.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Assuming it is the change of direction it appears to be -- and all of&lt;br/&gt;&amp;gt; the above is really just justification for that assumption -- then like&lt;br/&gt;&amp;gt; I said, I think it&amp;#39;s worth seriously considering what it means for people&lt;br/&gt;&amp;gt; to choose their own relay/mempool policies and for you to expect to have&lt;br/&gt;&amp;gt; different mempool policies to many or most of your potential peers.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; One thing maybe worth noting is that is that you can still only choose&lt;br/&gt;&amp;gt; your policy from options that people write code for -- if it wasn&amp;#39;t&lt;br/&gt;&amp;gt; something you could get by running knots or compiling a rejected PR&lt;br/&gt;&amp;gt; yourself, it won&amp;#39;t magically become more possible now.  Presumably it&lt;br/&gt;&amp;gt; would mean that once a PR is written, it might get better review (rather&lt;br/&gt;&amp;gt; than being dismissed as not suitable for everyone), and there would be&lt;br/&gt;&amp;gt; less maintenance burden than if it had to be manually rebased every&lt;br/&gt;&amp;gt; release, though (or at least the maintenance burden would be shared&lt;br/&gt;&amp;gt; across everyone working on the codebase).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The second thing is that whatever your relay policy is, you still&lt;br/&gt;&amp;gt; need a path all the way to miners through nodes that will accept your&lt;br/&gt;&amp;gt; transaction at every step. If you&amp;#39;re making your mempool more restrictive&lt;br/&gt;&amp;gt; (eg -permitbaremultisig=0, -datacarrier=0), that&amp;#39;s easy for you (though&lt;br/&gt;&amp;gt; you&amp;#39;re making life more difficult for people who do create those sorts&lt;br/&gt;&amp;gt; of txs); but if you want a more permissive policy (package relay,&lt;br/&gt;&amp;gt; version-3-rbf, full-rbf), you might need to do some work.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The cutoff for that is probably something like &amp;#34;do 30% of listening&lt;br/&gt;&amp;gt; nodes have a compatible policy&amp;#34;? If they do, then you&amp;#39;ll have about a&lt;br/&gt;&amp;gt; 95% chance of having at least one of your outbound peers accept your tx,&lt;br/&gt;&amp;gt; just by random chance. If erlay allows increasing your outbound count to&lt;br/&gt;&amp;gt; 12 connections instead of 8; that might reduce down to needing just 20%&lt;br/&gt;&amp;gt; of listening nodes (~93%).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; But for cases where less than 30% (20%) of network supports your preferred&lt;br/&gt;&amp;gt; policy, you probably need to do something cleverer.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; One approach is to set a service bit and preferentially peer with other&lt;br/&gt;&amp;gt; nodes that advertise that service bit; knots does the first half of this&lt;br/&gt;&amp;gt; for fullrbf, and both halves have been proposed for core in #25600.&lt;br/&gt;&amp;gt; Preferential peering was previously done for the segwit deployment,&lt;br/&gt;&amp;gt; though in that case it was necessary not just for tx propogation but&lt;br/&gt;&amp;gt; also for ensuring block propogation, making it effectively a consensus&lt;br/&gt;&amp;gt; critical issue.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Another approach is having a separate relay network -- eg, lightning nodes&lt;br/&gt;&amp;gt; already have a gossip network, and might want to help their own ecosystem&lt;br/&gt;&amp;gt; by ensuring unilateral channel closes and justice transactions are quickly&lt;br/&gt;&amp;gt; relayed. Using their own gossip network to relay the transaction around,&lt;br/&gt;&amp;gt; and each lightning node adding it to their local bitcoind&amp;#39;s mempool and&lt;br/&gt;&amp;gt; allowing it to propogate (or not) from there as normal, would also be a&lt;br/&gt;&amp;gt; way of allowing transactions to propogate well. It does mean that miners&lt;br/&gt;&amp;gt; would either need to also participate in lightning gossip directly, or&lt;br/&gt;&amp;gt; that miners would need to connect to *many* peers to be confident of&lt;br/&gt;&amp;gt; seeing those transactions (eg, if only 2% of the network would see a&lt;br/&gt;&amp;gt; tx, you&amp;#39;d need to make 228 connections to have a 99% chance of seeing&lt;br/&gt;&amp;gt; the tx). You can&amp;#39;t currently do something like this, because all the&lt;br/&gt;&amp;gt; relay policies are also applied when adding txs to the mempool via RPC,&lt;br/&gt;&amp;gt; and there&amp;#39;s no convenient way to remove txs from the mempool.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; A case where something like that might occur is in preventing L2&lt;br/&gt;&amp;gt; transactions from pinning attacks -- so you might have a high-fee,&lt;br/&gt;&amp;gt; low-feerate transaction that&amp;#39;s been widely propogated, sitting in the&lt;br/&gt;&amp;gt; bottom of people&amp;#39;s mempools, and you want to replace it with a smaller,&lt;br/&gt;&amp;gt; higher-feerate transaction, but don&amp;#39;t want to pay a higher absolute fee,&lt;br/&gt;&amp;gt; and are thus blocked by BIP 125 rule 3. Perhaps 98% of the network is&lt;br/&gt;&amp;gt; unwilling to deviate from BIP 125 rule 3 for you; because that would&lt;br/&gt;&amp;gt; make it easy for random griefers to spam their mempool with large txs&lt;br/&gt;&amp;gt; then delete them while only paying a small fee; but your L2 peers may be&lt;br/&gt;&amp;gt; able to decode your replacement transaction and be sure that you aren&amp;#39;t&lt;br/&gt;&amp;gt; going to spam them, and thus will happily relay it.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; From a technical point-of-view, that&amp;#39;s largely fine; the downside is it&lt;br/&gt;&amp;gt; increases the centralisation pressure on mining: whether that&amp;#39;s by having&lt;br/&gt;&amp;gt; to connect to substantially more nodes, or having to parse through more&lt;br/&gt;&amp;gt; spam, you can&amp;#39;t just run your mining operation off a standard install&lt;br/&gt;&amp;gt; of bitcoin core anymore, but need to actively opt-in to find all the&lt;br/&gt;&amp;gt; weird unusual ways people are sending transactions around in order to&lt;br/&gt;&amp;gt; actually collect as much in fees as your competitors are.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; That&amp;#39;s probably moderately bad for privacy as well -- if lightning or&lt;br/&gt;&amp;gt; coinjoins need special relay rules that most nodes haven&amp;#39;t opted into,&lt;br/&gt;&amp;gt; it&amp;#39;s potentially easy to use that to find the bitcoin nodes on the&lt;br/&gt;&amp;gt; network that are participating in those protocols, and from there to&lt;br/&gt;&amp;gt; either identify the operator, or run a DoS attack to make it hard for you&lt;br/&gt;&amp;gt; to keep doing what you want. Obviously if you&amp;#39;re setting a service bit to&lt;br/&gt;&amp;gt; get better routing, you&amp;#39;ve given up that privacy already. Likewise if the&lt;br/&gt;&amp;gt; government or random vandals are opposed to bitcoin mining, and miners&lt;br/&gt;&amp;gt; have to have special configuration on their nodes that distinguish them&lt;br/&gt;&amp;gt; from regular users, then perhaps that makes it easier to find or shut&lt;br/&gt;&amp;gt; down their operations.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; There are a few efficiencies to be gained from similar mempool policies as&lt;br/&gt;&amp;gt; well: more reliable compact block reconstruction (if you&amp;#39;re not missing&lt;br/&gt;&amp;gt; any transactions, you avoid a round-trip) and presumably more efficient&lt;br/&gt;&amp;gt; set reconstruction with erlay. You&amp;#39;ll also waste less bandwidth sending&lt;br/&gt;&amp;gt; transactions that the other node is only going to reject. Both those&lt;br/&gt;&amp;gt; depend on how many transactions are going to rely on unusual mempool&lt;br/&gt;&amp;gt; policies in the first place though.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; ariard wrote:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   I know I&amp;#39;ve advocated in the past to turn RBF support by default in&lt;br/&gt;&amp;gt;   the past. Though after gathering a lot of feedbacks, this approach&lt;br/&gt;&amp;gt;   of offering the policy flexiblity to the interested users only and&lt;br/&gt;&amp;gt;   favoring a full-rbf gradual deployment sounds better to me.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   - &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/25353#issuecomment-1157137026&#34;&gt;https://github.com/bitcoin/bitcoin/pull/25353#issuecomment-1157137026&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I guess all the above leads me to think that gradual deployments of&lt;br/&gt;&amp;gt; mempool policies are likely the worse approach: even when they&amp;#39;re not&lt;br/&gt;&amp;gt; hurting anyone, it makes them hard to use during the gradual phase,&lt;br/&gt;&amp;gt; and getting around that comes with worrying compromises on privacy and&lt;br/&gt;&amp;gt; centralisation; and when they are problematic for some, the indeterminate&lt;br/&gt;&amp;gt; nature of a gradual deployment means it&amp;#39;s hard to plan for when that&lt;br/&gt;&amp;gt; risk is going to eventuate.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Theoretically, one way to recover the good parts of core deciding on&lt;br/&gt;&amp;gt; what&amp;#39;s good for the network might be for people outside of core to&lt;br/&gt;&amp;gt; recommend a mempool configuration; then core can just have an option&lt;br/&gt;&amp;gt; to make that easy, similar to &amp;#34;-std=c&#43;&#43;17&amp;#34; for a C&#43;&#43; compiler, and much&lt;br/&gt;&amp;gt; the same as knots&amp;#39; &amp;#34;-corepolicy&amp;#34; option.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Presuming anyone actually wants to take on that job, and listen to the&lt;br/&gt;&amp;gt; concerns of zeroconf businesses, lightning and coinjoin devs, miners, etc;&lt;br/&gt;&amp;gt; and can come up with something that keeps most of them happy, and that&lt;br/&gt;&amp;gt; 70% or 90% of the network ends up just following those recommendations&lt;br/&gt;&amp;gt; because it&amp;#39;s easy, it works, and it&amp;#39;s recommended by all the apps they&lt;br/&gt;&amp;gt; want to use, then that could work great:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  * miners don&amp;#39;t need to do anything special, so there&amp;#39;s no new&lt;br/&gt;&amp;gt;    mining centralisation pressure&lt;br/&gt;&amp;gt;  * miners and users don&amp;#39;t reveal what they&amp;#39;re doing with bitcoin by the way&lt;br/&gt;&amp;gt;    they configure their nodes, so there&amp;#39;s no privacy problems&lt;br/&gt;&amp;gt;  * devs can be fairly confident in how they have to design their apps&lt;br/&gt;&amp;gt;    in order to get their transactions to most hashpower&lt;br/&gt;&amp;gt;  * devs don&amp;#39;t have to add new p2p layers to make it happen&lt;br/&gt;&amp;gt;  * at least there&amp;#39;s someone to talk to when you&amp;#39;re trying to figure out&lt;br/&gt;&amp;gt;    how to make some new project possible when it&amp;#39;s inhibited by current&lt;br/&gt;&amp;gt;    relay policies and you don&amp;#39;t have to try to convince everyone to&lt;br/&gt;&amp;gt;    upgrade on your own&lt;br/&gt;&amp;gt;  * core devs just provide options, and don&amp;#39;t have to worry about being&lt;br/&gt;&amp;gt;    seen as gatekeepers&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The &amp;#34;downside&amp;#34; in that scenario is that users/dev aren&amp;#39;t making much&lt;br/&gt;&amp;gt; actual use of all the choices core is offering by making different&lt;br/&gt;&amp;gt; options available; but the upside is that that choice is at least readily&lt;br/&gt;&amp;gt; available should whoever is coming up with these policy become out of&lt;br/&gt;&amp;gt; step with what people actually want.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; One thing that might make an approach like that difficult is that core&lt;br/&gt;&amp;gt; has historically been happy to remove options that don&amp;#39;t seem useful&lt;br/&gt;&amp;gt; anymore: eg the ability to turn of BIP 125 support (#16171), and priority&lt;br/&gt;&amp;gt; transactions (#9602). Perhaps that&amp;#39;s fine if you&amp;#39;re trying to actively&lt;br/&gt;&amp;gt; craft a single mempool/relay policy that&amp;#39;s good enough for almost everyone&lt;br/&gt;&amp;gt; (after all, it makes the code simpler and more efficient, and reduces&lt;br/&gt;&amp;gt; the number of footguns); all you&amp;#39;re doing is leaving a minority of people&lt;br/&gt;&amp;gt; who want weird things to run a fork, and that&amp;#39;s going to happen anyway.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; But if people are following policy developed outside of core, core&lt;br/&gt;&amp;gt; might well disagree with them and decide &amp;#34;no that&amp;#39;s a stupid policy,&lt;br/&gt;&amp;gt; no one should do that&amp;#34; and remove some feature that others thing should&lt;br/&gt;&amp;gt; continue to be normal. Beyond the examples above, there&amp;#39;s already talk of&lt;br/&gt;&amp;gt; removing the ability to disable fullrbf support in #26305, for instance.&lt;br/&gt;&amp;gt; If that happens, then the people maintaining the policy will instead&lt;br/&gt;&amp;gt; end up maintaining an entire fork of bitcoin core, and all we&amp;#39;ve done&lt;br/&gt;&amp;gt; is transition to people running software from a different repo, and a&lt;br/&gt;&amp;gt; different set of maintainers.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If we&amp;#39;re really going to a world where core&amp;#39;s eager to add new options,&lt;br/&gt;&amp;gt; and reluctant to remove them, at least if anyone at all finds them&lt;br/&gt;&amp;gt; interesting, that&amp;#39;s presumably a non-issue, though.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; aj&lt;br/&gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20221027/1d0aaf6c/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20221027/1d0aaf6c/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:15:55Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs295u8fy9ew5jz0ym7ezcczy2eepugtqzyrx8npdhjnvlj7axg6dqzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q2furpw</id>
    
      <title type="html">📅 Original date posted:2022-09-26 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs295u8fy9ew5jz0ym7ezcczy2eepugtqzyrx8npdhjnvlj7axg6dqzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q2furpw" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsfqt2a3khg5500kle7ks2tgdsddgpmkrv7acclk6ueyx2j3ne825sgge5c8&#39;&gt;nevent1q…e5c8&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-09-26&lt;br/&gt;📝 Original message:Hi Greg, Antoine, Bastien,&lt;br/&gt;&lt;br/&gt;Thanks very much for the feedback! I interpret most of the discussion&lt;br/&gt;around limitations as ideas for future improvements rather than criticisms&lt;br/&gt;of the proposal (please correct me if I&amp;#39;m wrong). I&amp;#39;ll try to respond to as&lt;br/&gt;much as possible.&lt;br/&gt;&lt;br/&gt;Also I realize that I didn&amp;#39;t contextualize this proposal clearly enough; it&lt;br/&gt;is very tailored for LN Penalty and definitely doesn&amp;#39;t close all pinning&lt;br/&gt;attacks possible (sorry for confusing anyone). I also agree that some bits&lt;br/&gt;can be a little ugly or tack-on; I would definitely prefer a comprehensive&lt;br/&gt;RBF revamp to fix all our problems and enable other fee-bumping strategies&lt;br/&gt;such as&lt;br/&gt;sign-ANYONECANPAY-then-bring-your-own-fees-by-adding-inputs-at-broadcast. I&lt;br/&gt;was hoping to get some ideas with the &amp;#34;RBF Improvements&amp;#34; post in January,&lt;br/&gt;but it doesn&amp;#39;t seem like we&amp;#39;re much closer to a workable proposal. I think&lt;br/&gt;this is a minimally-invasive step that works for Lightning today, a small&lt;br/&gt;fix similar to CPFP carve out.&lt;br/&gt;&lt;br/&gt;&amp;gt; As you likely know from previous discussions the biggest scenario this&lt;br/&gt;does not fix in my estimation is ANYONECANPAY situations. If the parent&lt;br/&gt;transaction can be &amp;#34;inflated&amp;#34; by tacking on additional inputs, this means&lt;br/&gt;the total weight of the parent tx lowers the effective feerate of the&lt;br/&gt;package.&lt;br/&gt;&lt;br/&gt;(For more context to other readers I wrote an explanation for this in&lt;br/&gt;&amp;#34;SIGHASH_ANYONECANPAY Pinning&amp;#34; section of RBF ML post).  Yes, this&lt;br/&gt;unfortunately doesn&amp;#39;t fix any of the existing pinning attacks for single&lt;br/&gt;transaction RBF but also doesn&amp;#39;t make them worse. This boils down to adding&lt;br/&gt;an incentive compatibility rule that ensures you can&amp;#39;t replace a&lt;br/&gt;transaction with something that will confirm slower. Package RBF has an&lt;br/&gt;ancestor feerate-based rule for this (note it is quite conservative and not&lt;br/&gt;perfect).&lt;br/&gt;&lt;br/&gt;So in the scenario above with the &amp;#34;inflated&amp;#34; parent that was signed ACP,&lt;br/&gt;the replacement would be rejected because the package ancestor feerate is&lt;br/&gt;lower than the feerate of what is being replaced. But it is imperfect&lt;br/&gt;(explained below) and thus I wouldn&amp;#39;t recommend it for single transaction&lt;br/&gt;replacement. So that attack still exists for single transactions, yes.&lt;br/&gt;&lt;br/&gt;The strategy of using ACP to bring-your-own-fees has its own challenges but&lt;br/&gt;hopefully has no current use cases as you say. AFAIK LN Penalty is not&lt;br/&gt;affected by this since it doesn&amp;#39;t use ACP, though obviously I agree we&lt;br/&gt;should fix it for the future.&lt;br/&gt;&lt;br/&gt;So when I said &amp;#34;this is intended for fee-bumping presigned txns in&lt;br/&gt;contracting protocols,&amp;#34; I should have said &amp;#34;this is intended for&lt;br/&gt;fee-bumping presigned txns specifically using CPFP and anchor outputs.&amp;#34;&lt;br/&gt;Apologies for forgetting to contextualize, I&amp;#39;ve been sitting on this for&lt;br/&gt;too long.&lt;br/&gt;&lt;br/&gt;&amp;gt; The other scenario it doesn&amp;#39;t really fix is where HTLC/commitment-like&lt;br/&gt;transactions are being resolved in a batch, but due to relative time&lt;br/&gt;constraints, you may want to accelerate some and not others. Now you must&lt;br/&gt;pay higher rates to replace all of the transaction bumps. This is a&lt;br/&gt;&amp;#34;self-pin&amp;#34; and &amp;#34;get good at utxos noob&amp;#34; type problem, but it&amp;#39;s something&lt;br/&gt;that axing rule#3 in favor of a Replace-by-ancestor-feerate system would&lt;br/&gt;get us.&lt;br/&gt;&lt;br/&gt;I understand you to mean &amp;#34;if you don&amp;#39;t have enough UTXOs and you&amp;#39;re forced&lt;br/&gt;to batch-bump, you over-pay because you need to bring them all to the&lt;br/&gt;highest target feerate.&amp;#34; Isn&amp;#39;t this kind of separate, wallet-related&lt;br/&gt;problem? Contracting or not, surely every wallet needs to have enough UTXOs&lt;br/&gt;to not batch transactions that shouldn&amp;#39;t be batched... I don&amp;#39;t see how a&lt;br/&gt;replace-by-ancestor-feerate policy would make any difference for this?&lt;br/&gt;&lt;br/&gt;Also in general I&amp;#39;d like to reiterate that ancestor feerate is not a&lt;br/&gt;panacea to all our RBF incentive compatibility concerns. Like individual&lt;br/&gt;feerate, unless we run the mining algorithm, it cannot tell us exactly how&lt;br/&gt;quickly this transaction would be mined.&lt;br/&gt;&lt;br/&gt;We&amp;#39;re estimating the incentive compatibility of the original transaction(s)&lt;br/&gt;and replacement transaction(s), with the goal of not letting a transaction&lt;br/&gt;replace something that would have been more incentive compatible to mine.&lt;br/&gt;As such, we don&amp;#39;t want to overestimate how good the replacement is, and we&lt;br/&gt;don&amp;#39;t want to underestimate how good the original transactions are. This&lt;br/&gt;rule &amp;#34;The minimum between package feerate and ancestor feerate of the child&lt;br/&gt;is not lower than the individual feerates of all directly conflicting&lt;br/&gt;transactions and the ancestor feerates of all original transactions&amp;#34; is a&lt;br/&gt;conservative estimate.&lt;br/&gt;&lt;br/&gt;&amp;gt; Would kind of be nice if package RBF would detect a &amp;#34;sibling output&lt;br/&gt;spend&amp;#34; conflict, and knock it out of the mempool via the other replacement&lt;br/&gt;rules? Getting rid of the requirement to 1 block csv lock every output&lt;br/&gt;would be quite nice from a smart contracting composability point of view.&lt;br/&gt;&lt;br/&gt;Interesting, so when a transaction hits a mempool tx&amp;#39;s descendant limit, we&lt;br/&gt;consider evicting one of its descendants in favor of this transaction,&lt;br/&gt;based on the RBF rules.&lt;br/&gt;Cool idea! After chewing on this for a bit, I think this *also* just boils&lt;br/&gt;down to the fact that RBF should require replacements to be better mining&lt;br/&gt;candidates. As in, if we added this policy and it can make us evict the&lt;br/&gt;sibling and accept a transaction with a bunch of low-feerate ancestor junk,&lt;br/&gt;it would be a new pinning vector.&lt;br/&gt;&lt;br/&gt;&amp;gt; If you&amp;#39;re a miner and you receive a non-V3, second descendant of an&lt;br/&gt;unconfirmed V3 transaction, if the offered fee is in the top mempool&lt;br/&gt;backlog, I think you would have an interest to accept such a transaction.&lt;br/&gt;&lt;br/&gt;&amp;gt; So I&amp;#39;m not sure if those two rules are compatible with miners&lt;br/&gt;incentives...&lt;br/&gt;&lt;br/&gt;The same argument can be made for the 26th descendant of a mempool&lt;br/&gt;transaction; it&amp;#39;s also not entirely incentive-compatible to reject it, but&lt;br/&gt;that is not the *only* design goal in mempool policy. Of course, the&lt;br/&gt;difference here is that the 25-descendant limit rule is a sensible DoS&lt;br/&gt;protection, while this 1-descendant limit rule is more of a &amp;#34;help the&lt;br/&gt;Bitcoin ecosystem&amp;#34; policy, just like CPFP carve-out, dust limit, etc. I can&lt;br/&gt;of course understand why not everyone would be in favor of this, but I do&lt;br/&gt;think it&amp;#39;s worth it.&lt;br/&gt;&lt;br/&gt;&amp;gt; &amp;gt; 4. A V3 transaction that has an unconfirmed V3 ancestor cannot be&lt;br/&gt;&amp;gt; &amp;gt;    larger than 1000 virtual bytes.&lt;br/&gt;&lt;br/&gt;&amp;gt; If I understand correctly the 1000 vb upper bound rational, it would be&lt;br/&gt;to constraint the pinning counterparty to attach a high fee to a child due&lt;br/&gt;to the limited size, if they would like this transaction to be stuck in the&lt;br/&gt;network mempools. By doing so  this child has high odds to confirm.&lt;br/&gt;&lt;br/&gt;Yeah exactly, the &amp;#34;Rule 3 pin&amp;#34; is done by adding a child that&amp;#39;s high-fee&lt;br/&gt;(so you have to pay that much to evict it). Because they *don&amp;#39;t* want this&lt;br/&gt;tx to confirm, normally, this child would be really large. If they only&lt;br/&gt;have 1000vB for the child, they can&amp;#39;t increase the replacement cost without&lt;br/&gt;also fee-bumping the transaction to make it confirm faster.&lt;br/&gt;&lt;br/&gt;&amp;gt; As of today, I think yes you can already fingerprint LN transactions on&lt;br/&gt;the  spec-defined amount value of the anchor outputs, 330 sats. There is&lt;br/&gt;always one of them on post-anchor commitment transactions. And sadly I&lt;br/&gt;would say we&amp;#39;ll always have tricky fingerprints leaking from unilateral LN&lt;br/&gt;closures such as HTLC/PTLC timelocks...&lt;br/&gt;&lt;br/&gt;&amp;gt; I agree with you, this isn&amp;#39;t worse than today, unilateral closes will&lt;br/&gt;probably always be identifiable on-chain.&lt;br/&gt;&lt;br/&gt;Great to hear that there is no privacy worsening!&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Mon, Sep 26, 2022 at 5:02 PM Greg Sanders &amp;lt;gsanders87 at gmail.com&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Bastien,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; This may be already covered by the current package RBF logic, in that&lt;br/&gt;&amp;gt; scenario we are simply replacing [ParentTx, ChildTx1] with&lt;br/&gt;&amp;gt; [ParentTx, ChildTx2] that pays more fees, right?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; For clarification, package RBF is ParentTx*s*(plural), and&lt;br/&gt;&amp;gt; ChildTx(singular), so it might be a bit more complicated than we&amp;#39;re&lt;br/&gt;&amp;gt; thinking, and currently the V3 proposal would first de-duplicate the&lt;br/&gt;&amp;gt; ParentTx based on what is in the mempool, then look at the &amp;#34;rest&amp;#34; of the&lt;br/&gt;&amp;gt; transactions as a package, then individually. Not the same, not sure how&lt;br/&gt;&amp;gt; different. I&amp;#39;ll defer to experts.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Best,&lt;br/&gt;&amp;gt; Greg&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; On Mon, Sep 26, 2022 at 11:48 AM Bastien TEINTURIER via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thanks Gloria for this great post.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This is very valuable work for L2 contracts, and will greatly improve&lt;br/&gt;&amp;gt;&amp;gt; their security model.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; &amp;#34;Only 1 anchor output? What if I need to bump counterparty&amp;#39;s commitment&lt;br/&gt;&amp;gt;&amp;gt; tx in mempool?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; You won&amp;#39;t need to fee-bump a counterparty&amp;#39;s commitment tx using CPFP.&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; You would just package RBF it by attaching a high-feerate child to&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; your commitment tx.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Note that we can also very easily make that single anchor spendable by&lt;br/&gt;&amp;gt;&amp;gt; both participants (or even anyone), so if you see your counterparty&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt; commitment in your mempool, you can bump it without publishing your&lt;br/&gt;&amp;gt;&amp;gt; own commitment, which is quite desirable (your own commitment tx has&lt;br/&gt;&amp;gt;&amp;gt; CSV delays on your outputs, whereas your counterparty&amp;#39;s commitment tx&lt;br/&gt;&amp;gt;&amp;gt; doesn&amp;#39;t).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; &amp;#34;Is this a privacy issue, i.e. doesn&amp;#39;t it allow fingerprinting LN&lt;br/&gt;&amp;gt;&amp;gt; transactions based on nVersion?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I agree with you, this isn&amp;#39;t worse than today, unilateral closes will&lt;br/&gt;&amp;gt;&amp;gt; probably always be identifiable on-chain.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; Would kind of be nice if package RBF would detect a &amp;#34;sibling output&lt;br/&gt;&amp;gt;&amp;gt; spend&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; conflict, and knock it out of the mempool via the other replacement&lt;br/&gt;&amp;gt;&amp;gt; rules?&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; Getting rid of the requirement to 1 block csv lock every output would be&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; quite nice from a smart contracting composability point of view.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &#43;1, that would be very neat!&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This may be already covered by the current package RBF logic, in that&lt;br/&gt;&amp;gt;&amp;gt; scenario we are simply replacing [ParentTx, ChildTx1] with&lt;br/&gt;&amp;gt;&amp;gt; [ParentTx, ChildTx2] that pays more fees, right?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; 1) I do think that we should seriously consider allowing OP_TRUE to&lt;br/&gt;&amp;gt;&amp;gt; become&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; a standard script type as part of this policy update. If pinning is&lt;br/&gt;&amp;gt;&amp;gt; solved,&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; then there&amp;#39;s no reason to require all those extra bytes for &amp;#34;binding&amp;#34; an&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; anchor to a specific wallet/user. We can save quite a few bytes by&lt;br/&gt;&amp;gt;&amp;gt; having&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; the input be empty of witness data.&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; 2) If we allow for a single dust-value(0 on up) output which is&lt;br/&gt;&amp;gt;&amp;gt; immediately&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; spent by the package, anchors become even easier to to design. No value&lt;br/&gt;&amp;gt;&amp;gt; has&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; to be &amp;#34;sapped&amp;#34; from contract participants to make an anchor output.&lt;br/&gt;&amp;gt;&amp;gt; There&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; more complications for this, such as making sure the parent transaction&lt;br/&gt;&amp;gt;&amp;gt; is&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; dropped if the child spend is dropped, but maybe it&amp;#39;s worth the squeeze.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I also think both of these could be quite useful. This would probably&lt;br/&gt;&amp;gt;&amp;gt; always&lt;br/&gt;&amp;gt;&amp;gt; be used in combination with a parent transaction that pays 0 fees, so the&lt;br/&gt;&amp;gt;&amp;gt; 0-value output would always be spent in the same block.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; But this means we could end up with 0-value outputs in the utxo set, if&lt;br/&gt;&amp;gt;&amp;gt; for&lt;br/&gt;&amp;gt;&amp;gt; some reason the parent tx is CPFP-ed via another output than the 0-value&lt;br/&gt;&amp;gt;&amp;gt; one,&lt;br/&gt;&amp;gt;&amp;gt; which would be a utxo set bloat issue. But I&amp;#39;d argue that we&amp;#39;re probably&lt;br/&gt;&amp;gt;&amp;gt; already creating utxo set bloat with the 330 sat anchor outputs&lt;br/&gt;&amp;gt;&amp;gt; (especially&lt;br/&gt;&amp;gt;&amp;gt; since we use two of them, but only one is usually spent), so it would&lt;br/&gt;&amp;gt;&amp;gt; probably be *better* than what we&amp;#39;re doing today.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Le lun. 26 sept. 2022 à 03:22, Antoine Riard via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Thanks for the progress on package RBF, few early questions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 2. Any descendant of an unconfirmed V3 transaction must also be V3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 3. An unconfirmed V3 transaction cannot have more than 1 descendant.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; If you&amp;#39;re a miner and you receive a non-V3, second descendant of an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; unconfirmed V3 transaction, if the offered fee is in the top mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; backlog, I think you would have an interest to accept such a transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; So I&amp;#39;m not sure if those two rules are compatible with miners&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; incentives...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 4. A V3 transaction that has an unconfirmed V3 ancestor cannot be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt;    larger than 1000 virtual bytes.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; If I understand correctly the 1000 vb upper bound rational, it would be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; to constraint the pinning counterparty to attach a high fee to a child due&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; to the limited size, if they would like this transaction to be stuck in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; network mempools. By doing so  this child has high odds to confirm.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I still wonder if this compatible with miner incentives in period of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; empty mempools, in the sense that if you&amp;#39;ve already a V3 transaction of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; size 100Kvb offering 2 sat/vb, it&amp;#39;s more interesting than a V3 replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; candidate of size 1000 vb offering 10 sat/vb. It could be argued the former&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; should be conserved.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (That said, the hard thing with any replacement strategy we might evict&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; a parent transaction *now* to which is attached a high-feerate child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; *latter* making for a utxo considered the best ancestor set. Maybe in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; long-term miners should keep every transaction ever accepted...)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; (Lower bound) the smaller this limit, the fewer UTXOs a child may use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; to fund this fee-bump. For example, only allowing the V3 child to have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 2 inputs would require L2 protocols to manage a wallet with high-value&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; UTXOs and make batched fee-bumping impossible. However, as the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; fee-bumping child only needs to fund fees (as opposed to payments),&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; just a few UTXOs should suffice.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Reminder for L2 devs, batched fee-bumping of time-sensitive&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; confirmations of commitment transactions is unsafe, as the counterparty&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; could enter in a &amp;#34;cat-and-mouse&amp;#34; game to replace one of the batch element&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; at each block to delay confirmation of the remaining elements in the batch,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I think.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; On the other hand, I wonder if we wouldn&amp;#39;t want a higher bound. LN&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; wallets are likely to have one big UTXO in their fee-bumping reserve pool,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; as the cost of acquiring UTXO is non-null and in the optimistic case, you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; don&amp;#39;t need to do unilateral closure. Let&amp;#39;s say you close dozens of channels&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; at the same time, a UTXO pool management strategy might be to fan-out the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; first spends UTXOs in N fan-out outputs ready to feed the remaining&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; in-flight channels.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 1. The rule around unconfirmed inputs was&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; originally &amp;#34;A package may include new unconfirmed inputs, but the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; ancestor feerate of the child must be at least as high as the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; feerates of every transaction being replaced.&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Note, I think we would like this new RBF rule to also apply to single&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transaction package, e.g second-stage HTLC transactions, where a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; counterparty pins a HTLC-preimage by abusing rule 3. In that case, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; honest LN node should be able to broadcast a &amp;#34;at least as high ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; feerate&amp;#34; HTLC-timeout transaction. With `option_anchor_outputs&amp;#34; there is no&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; unconfirmed ancestor to replace, as the commitment transaction, whatever&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the party it is originating from, should already be confirmed.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;#34;Is this a privacy issue, i.e. doesn&amp;#39;t it allow fingerprinting LN&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transactions based on nVersion?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; As of today, I think yes you can already fingerprint LN transactions on&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the  spec-defined amount value of the anchor outputs, 330 sats. There is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; always one of them on post-anchor commitment transactions. And sadly I&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; would say we&amp;#39;ll always have tricky fingerprints leaking from unilateral LN&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; closures such as HTLC/PTLC timelocks...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;#34;Can a V2 transaction replace a V3 transaction and vice versa?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; IIUC, a V3 package could replace a V2 package, with the benefit of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; new package RBF rules applied. I think this would be a significant&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; advantage for LN, as for the current ~85k of opened channels, the old V2&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; states shouldn&amp;#39;t be pinning vectors. Currently, commitment transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; signal replaceability.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Le ven. 23 sept. 2022 à 11:26, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi everyone,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I&amp;#39;m writing to propose a very simple set of mempool/transaction relay&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policies intended to aid L2/contract protocols. I realized that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the previously proposed Package Mempool Accept package RBF [1]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; had a few remaining problems after digging into the RBF logic more [2].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This additional set of policies solves them without requiring a huge&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; RBF overhaul.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I&amp;#39;ve written an implementation (and docs) for Bitcoin Core:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/25038&#34;&gt;https://github.com/bitcoin/bitcoin/pull/25038&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (You may notice that this proposal incorporates feedback on the PR -&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; thanks Suhas Daftuar, Gregory Sanders, Bastien Teinturier, Anthony Towns,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and others.)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If you are interested in using package RBF/relay to bump presigned&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions, I think you may be interested in reviewing this proposal.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This should solve Rule 3 pinning and perhaps allow us&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to get rid of CPFP carve-out (yay!). I&amp;#39;m keen to hear if people find&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the 1-anchor-output, 1000vB child limit too restrictive. Also, if you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; find a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pinning attack or something that makes it unusable for you, I would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; really really like to know.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Note that transactions with nVersion=3 (&amp;#34;V3 transactions&amp;#34;) are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; currently non-standard in Bitcoin Core. That means **anything that was&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; standard before this policy change would still be standard&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; afterwards.** If you don&amp;#39;t want your transactions to be subject to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; these rules, just continue whatever you&amp;#39;re doing and don&amp;#39;t use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; nVersion=3. AFAICT this shouldn&amp;#39;t break anything, but let me know if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this would be disruptive for you?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; **New Policies:**&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This includes:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - a set of additional policy rules applying to V3 transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - modifications to package RBF rules&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; **V3 transactions:**&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Existing standardness rules apply to V3 (e.g. min/max tx weight,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; standard output types, cleanstack, etc.). The following additional&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rules apply to V3:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. A V3 transaction can be replaced, even if it does not signal BIP125&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    replaceability. (It must also meet the other RBF rules around fees,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; etc. for replacement to happen).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Any descendant of an unconfirmed V3 transaction must also be V3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Combined with Rule 1, this gives us the property of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;inherited&amp;#34; replaceability signaling when descendants of unconfirmed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are created. Additionally, checking whether a transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; signals replaceability this way does not require mempool traversal,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and does not change based on what transactions are mined. It also&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; makes subsequent rules about descendant limits much easier to check.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Note*: The descendant of a *confirmed* V3 transaction does not need to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be V3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. An unconfirmed V3 transaction cannot have more than 1 descendant.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: (Upper bound) the larger the descendant limit, the more&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions may need to be replaced. This is a problematic pinning&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attack, i.e., a malicious counterparty prevents the transaction from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; being replaced by adding many descendant transactions that aren&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee-bumping.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (Lower bound) at least 1 descendant is required to allow CPFP of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; presigned transaction. The contract protocol can create presigned&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions paying 0 fees and 1 output for attaching a CPFP at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; broadcast time (&amp;#34;anchor output&amp;#34;). Without package RBF, multiple anchor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; outputs would be required to allow each counterparty to fee-bump any&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; presigned transaction. With package RBF, since the presigned&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions can replace each other, 1 anchor output is sufficient.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. A V3 transaction that has an unconfirmed V3 ancestor cannot be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    larger than 1000 virtual bytes.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: (Upper bound) the larger the descendant size limit, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; more vbytes may need to be replaced. With default limits, if the child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is e.g. 100,000vB, that might be an additional 100,000sats (at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1sat/vbyte) or more, depending on the feerate.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (Lower bound) the smaller this limit, the fewer UTXOs a child may use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to fund this fee-bump. For example, only allowing the V3 child to have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2 inputs would require L2 protocols to manage a wallet with high-value&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; UTXOs and make batched fee-bumping impossible. However, as the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee-bumping child only needs to fund fees (as opposed to payments),&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; just a few UTXOs should suffice.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; With a limit of 1000 virtual bytes, depending on the output types, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child can have 6-15 UTXOs, which should be enough to fund a fee-bump&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; without requiring a carefully-managed UTXO pool. With 1000 virtual&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bytes as the descendant limit, the cost to replace a V3 transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; has much lower variance.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: This makes the rule very easily &amp;#34;tacked on&amp;#34; to existing&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; logic for policy and wallets. A transaction may be up to 100KvB on its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; own (`MAX_STANDARD_TX_WEIGHT`) and 101KvB with descendants&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (`DEFAULT_DESCENDANT_SIZE_LIMIT_KVB`). If an existing V3 transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool is 100KvB, its descendant can only be 1000vB, even if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the policy is 10KvB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; **Package RBF modifications:**&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. The rule around unconfirmed inputs was&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; originally &amp;#34;A package may include new unconfirmed inputs, but the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor feerate of the child must be at least as high as the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerates of every transaction being replaced.&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package may still include new unconfirmed inputs. However,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the new rule is modified to be &amp;#34;The minimum between package feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and ancestor feerate of the child is not lower than the individual&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerates of all directly conflicting transactions and the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerates of all original transactions.&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: We are attempting to ensure that the replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are not less incentive-compatible to mine. However, a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package/transaction&amp;#39;s ancestor feerate is not perfectly representative&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of its incentive compatibility; it may overestimate (some subset of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the ancestors could be included by itself if it has other high-feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendants or are themselves higher feerate than this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package/transaction). Instead, we use the minimum between the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate and ancestor feerate of the child as a more conservative value&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than what was proposed originally.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. A new rule is added, requiring that all package transactions with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool conflicts to be V3. This also means the &amp;#34;sponsoring&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child transaction must be V3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Note*: Combined with the V3 rules, this means the package must be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a child-with-parents package. Since package validation is only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attempted if the transactions do not pay sufficient fees to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepted on their own, this effectively means that only V3&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions can pay to replace their ancestors&amp;#39; conflicts, and only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; V3 transactions&amp;#39; replacements may be paid for by a descendant.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: The fee-related rules are economically rational for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor packages, but not necessarily other types of packages.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A child-with-parents package is a type of ancestor package. It&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; may be fine to allow any ancestor package, but it&amp;#39;s more difficult&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to account for all of the possibilities. For example, it gets much&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; harder to see that we&amp;#39;re applying the descendant limits correctly if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the package has a gnarly, many-generation, non-tree shape. I&amp;#39;m also&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not sure if this policy is 100% incentive-compatible if the sponsor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is not a direct descendant of the sponsee.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Please see doc/policy/version3_transactions.md and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; doc/policy/packages.md in the PR for the full set of rules.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; **Intended usage for LN:**&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Commitment transactions should be V3 and have 1 anchor output. They&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can be signed with 0 fees (or 1sat/vbyte) once package relay is deployed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; on a significant portion of the network. If the commitment tx must&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be broadcast, determine the desired feerate at broadcast time and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; spend the anchor output in a high feerate transaction. I&amp;#39;m going to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; call the broadcasted commitment tx &amp;#34;the parent&amp;#34; and the attached&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee-bumping tx &amp;#34;the child.&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - This child must be V3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - This child must be at most 1000vB. Note this restricts the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   number of inputs you can use to fund the fee bump. Depending&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; on the output types, this is around 6-15.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - One child may fund fees for multiple commitment tx (&amp;#34;batched&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   fee-bumping&amp;#34;).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - To do a second fee-bump to add more fees, replace the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   *child* with a higher-feerate tx. Do not try to attach a grandchild.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Otherwise, never try to spend from an unconfirmed V3 transaction. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendant limits for V3 transactions are very restrictive.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; **Expected Questions:**&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;Does this fix Rule 3 Pinning?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Yes. The V3 descendant limit restricts both you and your counterparty.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Assuming nodes adopted this policy, you may reasonably assume that you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only need to replace the commitment transaction &#43; up to 1000vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;Only 1 anchor output? What if I need to bump counterparty&amp;#39;s commitment&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; tx in mempool?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; You won&amp;#39;t need to fee-bump a counterparty&amp;#39;s commitment tx using CPFP.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; You would just package RBF it by attaching a high-feerate child to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; your commitment tx.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;Is this a privacy issue, i.e. doesn&amp;#39;t it allow fingerprinting LN&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions based on nVersion?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Indeed it may be unrealistic to assume V3 transactions will be in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; widespread use outside of L2. IIUC, unilateral closes are already&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; obvious LN transactions because of the HTLC inputs. For e.g.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cooperative closes and opens, I think it makes sense to continue using&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; V2. So, unless I&amp;#39;m missing something, this shouldn&amp;#39;t make it worse.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;So a V3 transaction that doesn&amp;#39;t signal BIP125 replaceability is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replaceable? Is that a backward compatibility issue?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Yes it&amp;#39;s replaceable. It&amp;#39;s not an issue AFAICT because,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; under previous policy, the V3 transaction wouldn&amp;#39;t have been&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool in the first place.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;Can a V2 transaction replace a V3 transaction and vice versa?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Yes, otherwise someone can use V3 transactions to censor V2&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions spending shared inputs. Note if the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; original V3 transaction has an unconfirmed V3 parent, this would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; violate the &amp;#34;inherited V3&amp;#34; rule and would be rejected.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks for reading! Feedback and review would be much appreciated.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [1]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220926/f053868f/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220926/f053868f/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:13:47Z</updated>
  </entry>

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

  <entry>
    <id>https://njump.me/nevent1qqs8tkpucc5966pmmd8k9c76ks0tyllsw8rut2q2cccc0jnx4l2g0aczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgr8pjr</id>
    
      <title type="html">📅 Original date posted:2022-06-07 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8tkpucc5966pmmd8k9c76ks0tyllsw8rut2q2cccc0jnx4l2g0aczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgr8pjr" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsdvdjqdrpq8xhf89p3nzvnrwf88mad6nytkvxuc7xkl3z97jx0m5c4mum5p&#39;&gt;nevent1q…um5p&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-06-07&lt;br/&gt;📝 Original message:Hi Eric, aj, all,&lt;br/&gt;&lt;br/&gt;Sorry for the delayed response. @aj I&amp;#39;m including some paraphrased points&lt;br/&gt;from our offline discussion (thanks).&lt;br/&gt;&lt;br/&gt;&amp;gt; Other idea: what if you encode the parent txs as a short hash of the&lt;br/&gt;wtxid (something like bip152 short ids? perhaps seeded per peer so&lt;br/&gt;collisions will be different per peer?) and include that in the inv&lt;br/&gt;announcement? Would that work to avoid a round trip almost all of the time,&lt;br/&gt;while still giving you enough info to save bw by deduping parents?&lt;br/&gt;&lt;br/&gt;&amp;gt; As I suggested earlier, a package is fundamentally a compact block (or&lt;br/&gt;&amp;gt; block) announcement without the header. Compact block (BIP152)&lt;br/&gt;announcement&lt;br/&gt;&amp;gt; is already well-defined and widely implemented...&lt;br/&gt;&lt;br/&gt;&amp;gt; Let us not reinvent the wheel and/or introduce accidental complexity. I&lt;br/&gt;see&lt;br/&gt;&amp;gt; no reason why packaging is not simply BIP152 without the &amp;#39;header&amp;#39; field,&lt;br/&gt;an&lt;br/&gt;&amp;gt; updated protocol version, and the following sort of changes to names&lt;br/&gt;&lt;br/&gt;Interestingly, &amp;#34;why not use BIP 152 shortids to save bandwidth?&amp;#34; is by far&lt;br/&gt;the most common suggestion I hear (including offline feedback). Here&amp;#39;s a&lt;br/&gt;full explanation:&lt;br/&gt;&lt;br/&gt;BIP 152 shortens transaction hashes (32 bytes) to shortids (6 bytes) to&lt;br/&gt;save a significant amount of network bandwidth, which is extremely&lt;br/&gt;important in block relay. However, this comes at the expense of&lt;br/&gt;computational complexity. There is no way to directly calculate a&lt;br/&gt;transaction hash from a shortid; upon receipt of a compact block, a node is&lt;br/&gt;expected to calculate the shortids of every unconfirmed transaction it&lt;br/&gt;knows about to find the matches (BIP 152: [1], Bitcoin Core: [2]). This is&lt;br/&gt;expensive but appropriate for block relay, since the block must have a&lt;br/&gt;valid Proof of Work and new blocks only come every ~10 minutes. On the&lt;br/&gt;other hand, if we require nodes to calculate shortids for every transaction&lt;br/&gt;in their mempools every time they receive a package, we are creating a DoS&lt;br/&gt;vector. Unconfirmed transactions don&amp;#39;t need PoW and, to have a live&lt;br/&gt;transaction relay network, we should expect nodes to handle transactions at&lt;br/&gt;a high-ish rate (i.e. at least 1000s of times more transactions than&lt;br/&gt;blocks). We can&amp;#39;t pre-calculate or cache shortids for mempool transactions,&lt;br/&gt;since the SipHash key depends on the block hash and a per-connection salt.&lt;br/&gt;&lt;br/&gt;Additionally, shortid calculation is not designed to prevent intentional&lt;br/&gt;individual collisions. If we were to use these shortids to deduplicate&lt;br/&gt;transactions we&amp;#39;ve supposedly already seen, we may have a censorship&lt;br/&gt;vector. Again, these tradeoffs make sense for compact block relay (see&lt;br/&gt;shortid section in BIP 152 [3]), but not package relay.&lt;br/&gt;&lt;br/&gt;TLDR: DoSy if we calculate shortids on every package and censorship vector&lt;br/&gt;if we use shortids for deduplication.&lt;br/&gt;&lt;br/&gt;&amp;gt; Given this message there is no reason&lt;br/&gt;&amp;gt; to send a (potentially bogus) fee rate with every package. It can only be&lt;br/&gt;&lt;br/&gt;&amp;gt; validated by obtaining the full set of txs, and the only recourse is&lt;br/&gt;&amp;gt; dropping (etc.) the peer, as is the case with single txs.&lt;br/&gt;&lt;br/&gt;Yeah, I agree with this. Combined with the previous discussion with aj&lt;br/&gt;(i.e. we can&amp;#39;t accurately communicate the incentive compatibility of a&lt;br/&gt;package without sending the full graph, and this whole dance is to avoid&lt;br/&gt;downloading a few low-fee transactions in uncommon edge cases), I&amp;#39;ve&lt;br/&gt;realized I should remove the fee &#43; weight information from pkginfo. Yay for&lt;br/&gt;less complexity!&lt;br/&gt;&lt;br/&gt;Also, this might be pedantic, but I said something incorrect earlier and&lt;br/&gt;would like to correct myself:&lt;br/&gt;&lt;br/&gt;&amp;gt;&amp;gt; In theory, yes, but maybe it was announced earlier (while our node was&lt;br/&gt;down?) or had dropped from our mempool or similar, either way we don&amp;#39;t have&lt;br/&gt;those txs yet.&lt;br/&gt;&lt;br/&gt;I said &amp;#34;It&amp;#39;s fine if they have Erlay, since a sender would know in advance&lt;br/&gt;that B is missing and announce it as a package.&amp;#34; But this isn&amp;#39;t true since&lt;br/&gt;we&amp;#39;re only using reconciliation in place of flooding to announce&lt;br/&gt;transactions as they arrive, not for rebroadcast, and we&amp;#39;re not doing full&lt;br/&gt;mempool set reconciliation. In any case, making sure a node receives the&lt;br/&gt;transactions announced when it was offline is not something we guarantee,&lt;br/&gt;not an intended use case for package relay, and not worsened by this.&lt;br/&gt;&lt;br/&gt;Thanks for your feedback!&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;[1]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#cmpctblock&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#cmpctblock&lt;/a&gt;&lt;br/&gt;[2]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/master/src/blockencodings.cpp#L49&#34;&gt;https://github.com/bitcoin/bitcoin/blob/master/src/blockencodings.cpp#L49&lt;/a&gt;&lt;br/&gt;[3]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#short-transaction-id-calculation&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#short-transaction-id-calculation&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On Thu, May 26, 2022 at 3:59 AM &amp;lt;eric at voskuil.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Given that packages have no header, the package requires identity in a&lt;br/&gt;&amp;gt; BIP152 scheme. For example &amp;#39;header&amp;#39; and &amp;#39;blockhash&amp;#39; fields can be replaced&lt;br/&gt;&amp;gt; with a Merkle root (e.g. &amp;#34;identity&amp;#34; field) for the package, uniquely&lt;br/&gt;&amp;gt; identifying the partially-ordered set of txs. And use of &amp;#39;getdata&amp;#39; (to&lt;br/&gt;&amp;gt; obtain a package by hash) can be eliminated (not a use case).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; e&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; -----Original Message-----&lt;br/&gt;&amp;gt; &amp;gt; From: eric at voskuil.org &amp;lt;eric at voskuil.org&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Sent: Wednesday, May 25, 2022 1:52 PM&lt;br/&gt;&amp;gt; &amp;gt; To: &amp;#39;Anthony Towns&amp;#39; &amp;lt;aj at erisian.com.au&amp;gt;; &amp;#39;Bitcoin Protocol Discussion&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt; &amp;lt;bitcoin-dev at lists.linuxfoundation.org&amp;gt;; &amp;#39;Gloria Zhao&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt; &amp;lt;gloriajzhao at gmail.com&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Subject: RE: [bitcoin-dev] Package Relay Proposal&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; From: bitcoin-dev &amp;lt;bitcoin-dev-bounces at lists.linuxfoundation.org&amp;gt; On&lt;br/&gt;&amp;gt; &amp;gt; Behalf&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Of Anthony Towns via bitcoin-dev&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Sent: Wednesday, May 25, 2022 11:56 AM&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; So the other thing is what happens if the peer announcing packages to&lt;br/&gt;&amp;gt; us&lt;br/&gt;&amp;gt; &amp;gt; is&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; dishonest?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; They announce pkg X, say X has parents A B C and the fee rate is&lt;br/&gt;&amp;gt; garbage.&lt;br/&gt;&amp;gt; &amp;gt; But&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; actually X has parent D and the fee rate is excellent. Do we request&lt;br/&gt;&amp;gt; the&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; package from another peer, or every peer, to double check? Otherwise&lt;br/&gt;&amp;gt; &amp;gt; we&amp;#39;re&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; allowing the first peer we ask about a package to censor that tx from&lt;br/&gt;&amp;gt; us?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; I think the fix for that is just to provide the fee and weight when&lt;br/&gt;&amp;gt; &amp;gt; announcing&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; the package rather than only being asked for its info? Then if one peer&lt;br/&gt;&amp;gt; &amp;gt; makes&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; it sound like a good deal you ask for the parent txids from them,&lt;br/&gt;&amp;gt; dedupe,&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; request, and verify they were honest about the parents.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Single tx broadcasts do not carry an advertised fee rate, however the&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt; feefilter&amp;#39; message (BIP133) provides this distinction. This should be&lt;br/&gt;&amp;gt; &amp;gt; interpreted as applicable to packages. Given this message there is no&lt;br/&gt;&amp;gt; reason&lt;br/&gt;&amp;gt; &amp;gt; to send a (potentially bogus) fee rate with every package. It can only be&lt;br/&gt;&amp;gt; &amp;gt; validated by obtaining the full set of txs, and the only recourse is&lt;br/&gt;&amp;gt; &amp;gt; dropping (etc.) the peer, as is the case with single txs. Relying on the&lt;br/&gt;&amp;gt; &amp;gt; existing message is simpler, more consistent, and more efficient.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;&amp;gt; Is it plausible to add the graph in?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Likewise, I think you&amp;#39;d have to have the graph info from many nodes if&lt;br/&gt;&amp;gt; &amp;gt; you&amp;#39;re&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; going to make decisions based on it and don&amp;#39;t want hostile peers to be&lt;br/&gt;&amp;gt; &amp;gt; able to&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; trick you into ignoring txs.&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Other idea: what if you encode the parent txs as a short hash of the&lt;br/&gt;&amp;gt; wtxid&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; (something like bip152 short ids? perhaps seeded per peer so collisions&lt;br/&gt;&amp;gt; &amp;gt; will&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; be different per peer?) and include that in the inv announcement? Would&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; that work to avoid a round trip almost all of the time, while still&lt;br/&gt;&amp;gt; giving&lt;br/&gt;&amp;gt; &amp;gt; you&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; enough info to save bw by deduping parents?&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; As I suggested earlier, a package is fundamentally a compact block (or&lt;br/&gt;&amp;gt; &amp;gt; block) announcement without the header. Compact block (BIP152)&lt;br/&gt;&amp;gt; &amp;gt; announcement&lt;br/&gt;&amp;gt; &amp;gt; is already well-defined and widely implemented. A node should never be&lt;br/&gt;&amp;gt; &amp;gt; required to retain an orphan, and BIP152 ensures this is not required.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Once a validated set of txs within the package has been obtained with&lt;br/&gt;&amp;gt; &amp;gt; sufficient fee, a fee-optimal node would accept the largest subgraph of&lt;br/&gt;&amp;gt; the&lt;br/&gt;&amp;gt; &amp;gt; package that conforms to fee constraints and drop any peer that provides&lt;br/&gt;&amp;gt; a&lt;br/&gt;&amp;gt; &amp;gt; package for which the full graph does not.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Let us not reinvent the wheel and/or introduce accidental complexity. I&lt;br/&gt;&amp;gt; see&lt;br/&gt;&amp;gt; &amp;gt; no reason why packaging is not simply BIP152 without the &amp;#39;header&amp;#39; field,&lt;br/&gt;&amp;gt; an&lt;br/&gt;&amp;gt; &amp;gt; updated protocol version, and the following sort of changes to names:&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; sendpkg&lt;br/&gt;&amp;gt; &amp;gt; MSG_CMPCT_PKG&lt;br/&gt;&amp;gt; &amp;gt; cmpctpkg&lt;br/&gt;&amp;gt; &amp;gt; getpkgtxn&lt;br/&gt;&amp;gt; &amp;gt; pkgtxn&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt; For a maximum 25 transactions,&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;23*24/2 = 276, seems like 36 bytes for a child-with-parents package.&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; If you&amp;#39;re doing short ids that&amp;#39;s maybe 25*4B=100B already, then the&lt;br/&gt;&amp;gt; above&lt;br/&gt;&amp;gt; &amp;gt; is&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; up to 36% overhead, I guess. Might be worth thinking more about, but&lt;br/&gt;&amp;gt; &amp;gt; maybe&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; more interesting with ancestors than just parents.&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;Also side note, since there are no size/count params,&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Size is restricted in the same manner as block and transaction&lt;br/&gt;&amp;gt; broadcasts,&lt;br/&gt;&amp;gt; &amp;gt; by consensus. If the fee rate is sufficient there would be no reason to&lt;br/&gt;&amp;gt; &amp;gt; preclude any valid size up to what can be mined in one block (packaging&lt;br/&gt;&amp;gt; &amp;gt; across blocks is not economically rational under the assumption that one&lt;br/&gt;&amp;gt; &amp;gt; miner cannot expect to mine multiple blocks in a row). Count is&lt;br/&gt;&amp;gt; incorporated&lt;br/&gt;&amp;gt; &amp;gt; into BIP152 as &amp;#39;shortids_length&amp;#39;.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt; wondering if we&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;should just have &amp;#34;version&amp;#34; in &amp;#34;sendpackages&amp;#34; be a bit field instead of&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;sending a message for each version. 32 versions should be enough&lt;br/&gt;&amp;gt; right?&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Adding versioning to individual protocols is just a reflection of the&lt;br/&gt;&amp;gt; &amp;gt; insufficiency of the initial protocol versioning design, and that of the&lt;br/&gt;&amp;gt; &amp;gt; various ad-hoc changes to it (including yet another approach in this&lt;br/&gt;&amp;gt; &amp;gt; proposal) that have been introduced to compensate for it, though I&amp;#39;ll&lt;br/&gt;&amp;gt; &amp;gt; address this in an independent post at some point.&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Best,&lt;br/&gt;&amp;gt; &amp;gt; e&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Maybe but a couple of messages per connection doesn&amp;#39;t really seem worth&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; arguing about?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Cheers,&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; aj&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; --&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Sent from my phone.&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220607/d32c46dd/attachment.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220607/d32c46dd/attachment.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:10:18Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsw2mktwkrwdfq450cl28qqdtejatyu8sskyx457j3ywu69ye4559czyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q7qjy2a</id>
    
      <title type="html">📅 Original date posted:2022-05-24 📝 Original message:Hi aj, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsw2mktwkrwdfq450cl28qqdtejatyu8sskyx457j3ywu69ye4559czyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q7qjy2a" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs802xkcnzk9w48cl06px2y53yvdezgeqe9w47upm4460f5eqjf8ts3jr5hy&#39;&gt;nevent1q…r5hy&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-05-24&lt;br/&gt;📝 Original message:Hi aj,&lt;br/&gt;&lt;br/&gt;&amp;gt; If you&amp;#39;ve got (A,B,C,X) where B spends A and X spends A,B,C where X&#43;C is&lt;br/&gt;below fee floor while A&#43;B and A&#43;B&#43;C&#43;X are above fee floor you have the&lt;br/&gt;problem though.&lt;br/&gt;&lt;br/&gt;To clarify, in this situation, I&amp;#39;m imagining something like&lt;br/&gt;A: 0 sat, 100vB&lt;br/&gt;B: 1500 sat, 100vB&lt;br/&gt;C: 0 sat, 100vB&lt;br/&gt;X: 500 sat, 100vB&lt;br/&gt;feerate floor is 3sat/vB&lt;br/&gt;&lt;br/&gt;With the algo:&lt;br/&gt;&amp;gt;  * is X alone above my fee rate? no, then forget it&lt;br/&gt;&amp;gt;  * otherwise, s := X.size, f := X.fees, R := [X]&lt;br/&gt;&amp;gt;  * for P = P1..Pn:&lt;br/&gt;&amp;gt;   * do I already have P? then skip to the next parent&lt;br/&gt;&amp;gt;   * s &#43;= P.size, f &#43;= P.fees, R &#43;= [P]&lt;br/&gt;&amp;gt;  * if f/s above my fee rate floor? if so, request all the txs in R&lt;br/&gt;&lt;br/&gt;We&amp;#39;d erroneously ask for A&#43;B&#43;C&#43;X, but really we should only take A&#43;B.&lt;br/&gt;But wouldn&amp;#39;t A&#43;B also be a package that was announced for B?&lt;br/&gt;Please lmk if you were imagining something different. I think I may be&lt;br/&gt;missing something.&lt;br/&gt;&lt;br/&gt;&amp;gt; Is it plausible to add the graph in?&lt;br/&gt;&lt;br/&gt;Fun to think about. Most basic design would be to represent {spends,&lt;br/&gt;doesn’t spend} for a previous transaction in the package as a bit. Can&lt;br/&gt;think of it as a matrix where row i, column j tells you whether Tx j&lt;br/&gt;(directly) spends Tx i.&lt;br/&gt;But of course you can omit the last row, since the child spends all of&lt;br/&gt;them. And since topological ordering is a requirement, you only need as&lt;br/&gt;many bits as there are transactions preceding this one in the package.&lt;br/&gt;If you have up to 24 parents, you need 1 &#43; 2 &#43; ... &#43; 23 bits to codify&lt;br/&gt;spending for the 2nd ... 24th parent. For a maximum 25 transactions,&lt;br/&gt;23*24/2 = 276, seems like 36 bytes for a child-with-parents package. A few&lt;br/&gt;more for tx-with-ancestors.&lt;br/&gt;Then you can split it up into sub-packages and everything. Still not sure&lt;br/&gt;if we really need to.&lt;br/&gt;&lt;br/&gt;Also side note, since there are no size/count params, wondering if we&lt;br/&gt;should just have &amp;#34;version&amp;#34; in &amp;#34;sendpackages&amp;#34; be a bit field instead of&lt;br/&gt;sending a message for each version. 32 versions should be enough right?&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, 24 May 2022 at 12:48 Anthony Towns &amp;lt;aj at erisian.com.au&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; On 23 May 2022 9:13:43 pm GMT-04:00, Gloria Zhao &amp;lt;gloriajzhao at gmail.com&amp;gt;&lt;br/&gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt; If you&amp;#39;re asking for the package for &amp;#34;D&amp;#34;, would a response telling you:&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt;   txid_D (500 sat, 100vB)&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt;   txid_A (0 sat, 100vB)&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt;   txid_B (2000 sat, 100 vB)&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt; be better, in that case? Then the receiver can maybe do the logic&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt; themselves to figure out that they already have A in their mempool&lt;br/&gt;&amp;gt; &amp;gt;&amp;gt; so it&amp;#39;s fine, or not?&lt;br/&gt;&amp;gt; &amp;gt;Right, I also considered giving the fees and sizes of each transaction in&lt;br/&gt;&amp;gt; &amp;gt;the package in “pckginfo1”. But I don’t think that information provides&lt;br/&gt;&amp;gt; &amp;gt;additional meaning unless you know the exact topology, i.e. also know if&lt;br/&gt;&amp;gt; &amp;gt;the parents have dependency relationships between them. For instance, in&lt;br/&gt;&amp;gt; &amp;gt;the {A, B, D} package there, even if you have the information listed, your&lt;br/&gt;&amp;gt; &amp;gt;decision should be different depending on whether B spends from A.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t think that&amp;#39;s true? We already know D is above our fee floor so if&lt;br/&gt;&amp;gt; B with A is also above the floor, we want them all, but also if B isn&amp;#39;t&lt;br/&gt;&amp;gt; above the floor, but all of them combined are, then we also do?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you&amp;#39;ve got (A,B,C,X) where B spends A and X spends A,B,C where X&#43;C is&lt;br/&gt;&amp;gt; below fee floor while A&#43;B and A&#43;B&#43;C&#43;X are above fee floor you have the&lt;br/&gt;&amp;gt; problem though.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Is it plausible to add the graph in?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; aj&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; --&lt;br/&gt;&amp;gt; Sent from my phone.&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220524/056c9996/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220524/056c9996/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:09:49Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs9z74k8a2w2pwng79vwh7zxulew7ufujkyuv0g93vst0cu6chp2pczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qshq8j3</id>
    
      <title type="html">📅 Original date posted:2022-05-23 📝 Original message:Hi aj, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs9z74k8a2w2pwng79vwh7zxulew7ufujkyuv0g93vst0cu6chp2pczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qshq8j3" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsqcq7tktkf4z03qeeddrf5m9d84p7sh2c2420nzmnvlv5sghfnmkqyhjjcz&#39;&gt;nevent1q…jjcz&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-05-23&lt;br/&gt;📝 Original message:Hi aj,&lt;br/&gt;&lt;br/&gt;&amp;gt; if you&amp;#39;re writing a protocol that&amp;#39;s&lt;br/&gt;&amp;gt; dependent on people seeing that a package as a whole pays a competitive&lt;br/&gt;&amp;gt; feerate, don&amp;#39;t you want to know in advance what conditions the network&lt;br/&gt;&amp;gt; is going to impose on your transactions in order to consider them as a&lt;br/&gt;&amp;gt; package?&lt;br/&gt;&lt;br/&gt;I do think unifying the size/count constraints would result in a more&lt;br/&gt;stable/easier to reason about interface for L2 devs. Then the requirement&lt;br/&gt;for propagation is just a path of nodes that support v1 package relay, and&lt;br/&gt;it’s implied their mempool policy supports it as well. Also seems like it&lt;br/&gt;could be a fingerprinting problem for nodes to give very specific&lt;br/&gt;count/size limits.&lt;br/&gt;&lt;br/&gt;&amp;gt; (… maybe core&amp;#39;s defaults should be reconsidered rather than standardised&lt;br/&gt;as-is)&lt;br/&gt;&lt;br/&gt;&amp;gt; Worst case, you could presumably do a new package relay version with&lt;br/&gt;&amp;gt; different constraints, if needed.&lt;br/&gt;&lt;br/&gt;Maybe this was my actual concern. I think the defaults are safe but it’s&lt;br/&gt;not like they’ve been proven to be optimal. This creates an obstacle to&lt;br/&gt;changing them, especially if we want to make them smaller. But I think it’s&lt;br/&gt;unlikely we’ll do that, and adding another version for new constraints&lt;br/&gt;doesn’t seem too bad.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;(Agreed with everything here, thanks for the feedback and clarifications!)&lt;br/&gt;TLDR, making these changes:&lt;br/&gt;- Count and size are implied by the version. Version 1 is specifically&lt;br/&gt;child-with-unconfirmed-parents, where the whole package is at most 25&lt;br/&gt;transactions and 101KvB.&lt;br/&gt;- Announce sendpackages based on our own state. It’s ok to send&lt;br/&gt;“sendpackages” if they sent fRelay=false.&lt;br/&gt;- At verack, require fRelay=true and wtxidrelay if they sent sendpackages,&lt;br/&gt;otherwise disconnect.&lt;br/&gt;- If we get “getpckgtxns” or “pckgtxns” without having negotiated&lt;br/&gt;“sendpackages” ahead of time, ignore, don’t disconnect. Emphasize that the&lt;br/&gt;intention is to validate all of the transactions received through&lt;br/&gt;“pckgtxns” together.&lt;br/&gt;&lt;br/&gt;&amp;gt; If you&amp;#39;re asking for the package for &amp;#34;D&amp;#34;, would a response telling you:&lt;br/&gt;&amp;gt;   txid_D (500 sat, 100vB)&lt;br/&gt;&amp;gt;   txid_A (0 sat, 100vB)&lt;br/&gt;&amp;gt;   txid_B (2000 sat, 100 vB)&lt;br/&gt;&amp;gt; be better, in that case? Then the receiver can maybe do the logic&lt;br/&gt;&amp;gt; themselves to figure out that they already have A in their mempool&lt;br/&gt;&amp;gt; so it&amp;#39;s fine, or not?&lt;br/&gt;&lt;br/&gt;Right, I also considered giving the fees and sizes of each transaction in&lt;br/&gt;the package in “pckginfo1”. But I don’t think that information provides&lt;br/&gt;additional meaning unless you know the exact topology, i.e. also know if&lt;br/&gt;the parents have dependency relationships between them. For instance, in&lt;br/&gt;the {A, B, D} package there, even if you have the information listed, your&lt;br/&gt;decision should be different depending on whether B spends from A. The only&lt;br/&gt;thing you know for sure about a child with direct parents is: if the&lt;br/&gt;aggregate feerate is too low, you won’t want the child since it depends on&lt;br/&gt;everyone else. If there’s a good-feerate transaction in there that doesn’t&lt;br/&gt;have a dependency, you’re fine as long as someone sends it to you&lt;br/&gt;individually.&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Mon, May 23, 2022 at 2:34 PM Anthony Towns via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; On Wed, May 18, 2022 at 02:40:58PM -0400, Gloria Zhao via bitcoin-dev&lt;br/&gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Does it make sense for these to be configurable, rather than implied&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; by the version?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; … would it be better to either just not do sendpackages&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; at all if you&amp;#39;re limiting ancestors in the mempool incompatibly&lt;br/&gt;&amp;gt; &amp;gt; Effectively: if you’re setting your ancestor/descendant limits lower than&lt;br/&gt;&amp;gt; &amp;gt; the default, you can’t do package relay. I wonder if this might be&lt;br/&gt;&amp;gt; &amp;gt; controversial, since it adds pressure to adhere to Bitcoin Core’s current&lt;br/&gt;&amp;gt; &amp;gt; mempool policy? I would be happy to do it this way, though - makes things&lt;br/&gt;&amp;gt; &amp;gt; easier to implement.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; How about looking at it the other way: if you&amp;#39;re writing a protocol that&amp;#39;s&lt;br/&gt;&amp;gt; dependent on people seeing that a package as a whole pays a competitive&lt;br/&gt;&amp;gt; feerate, don&amp;#39;t you want to know in advance what conditions the network&lt;br/&gt;&amp;gt; is going to impose on your transactions in order to consider them as a&lt;br/&gt;&amp;gt; package? In that case, aren&amp;#39;t the &amp;#34;depth&amp;#34; and &amp;#34;size&amp;#34; constraints things&lt;br/&gt;&amp;gt; we should specify in a standard?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; (The above&amp;#39;s not a rhetorical question; I&amp;#39;m not sure what the answer is.&lt;br/&gt;&amp;gt; And even if it&amp;#39;s &amp;#34;yes&amp;#34;, maybe core&amp;#39;s defaults should be reconsidered&lt;br/&gt;&amp;gt; rather than standardised as-is)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Worst case, you could presumably do a new package relay version with&lt;br/&gt;&amp;gt; different constraints, if needed.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt; 5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt;    send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt; received by a peer after sending `fRelay==false` in their version&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; &amp;gt; message, the sender should be disconnected.&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Seems better to just say &amp;#34;if you set fRelay=false in your version&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; message, you must not send sendpackages&amp;#34;? You already won&amp;#39;t do packages&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; with the peer if they don&amp;#39;t also announce sendpackages.&lt;br/&gt;&amp;gt; &amp;gt; I guess, theoretically, if you allow bloom filters with this peer, it’s&lt;br/&gt;&amp;gt; &amp;gt; plausible they’re saying “fRelay=false, I’ll send you a bloom filter&lt;br/&gt;&amp;gt; later,&lt;br/&gt;&amp;gt; &amp;gt; and I’ll also want to talk about packages.”&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I was just meaning &amp;#34;it&amp;#39;s okay to send VERSION fRelay=true then immediately&lt;br/&gt;&amp;gt; send WTXIDRELAY then immediately send SENDPACKAGES&amp;#34; without having to&lt;br/&gt;&amp;gt; first verify what the other guy&amp;#39;s fRelay was set to. On the other hand,&lt;br/&gt;&amp;gt; you do already have to verify the other guy&amp;#39;s version is high enough,&lt;br/&gt;&amp;gt; but it would be kind-of nice to move towards just announcing the features&lt;br/&gt;&amp;gt; you support, and not having to make it a multistep negotiation...&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Maybe: &amp;#34;You must not send sendpackages unless you also send&lt;br/&gt;&amp;gt; wtxidrelay&amp;#34; ?&lt;br/&gt;&amp;gt; &amp;gt; Do you mean if we get a verack, and the peer sent “sendpackages” but not&lt;br/&gt;&amp;gt; &amp;gt; “wtxidrelay,” we should disconnect them?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Yes.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; I have it as: we send a PCKG INV when this transaction’s feerate is above&lt;br/&gt;&amp;gt; &amp;gt; the fee filter, but one or more of its parents don’t. I don’t think using&lt;br/&gt;&amp;gt; &amp;gt; ancestor feerate is better.&lt;br/&gt;&amp;gt; &amp;gt; See this counterexample:&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt;  &lt;img src=&#34;https://raw.githubusercontent.com/glozow/bitcoin-notes/master/mempool_garden/abc_1parent_2kids.png&#34;&gt; &lt;br/&gt;&amp;gt; &amp;gt; A (0fee) has 2 kids, B (3sat/vB) and C (20sat/vB), everything’s the same&lt;br/&gt;&amp;gt; &amp;gt; vsize. Let’s say the fee filter is 3sat/vB.&lt;br/&gt;&amp;gt; &amp;gt; If we do it based on ancestor feerate, we won’t send B. But B is actually&lt;br/&gt;&amp;gt; &amp;gt; fine; C is paying for A.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; But that only works if the receiver also has C, in which case they also&lt;br/&gt;&amp;gt; have A, and you don&amp;#39;t need package relay to do anything with B? If they&lt;br/&gt;&amp;gt; didn&amp;#39;t have C already, then relaying {A,B} would be a waste of time,&lt;br/&gt;&amp;gt; because {A,B} would be rejected as only paying 1.5sat/vB or whatever..&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you switch it to being:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   A (0 sats, 200vB)&lt;br/&gt;&amp;gt;   B (2000 sats, 200vB, spends A:0)&lt;br/&gt;&amp;gt;   C (200 sats, 200vB)&lt;br/&gt;&amp;gt;   D (1000 sats, 200vB, sepnds A:1, C:0)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; then you get:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   A alone = 0s/vB&lt;br/&gt;&amp;gt;   B&#43;A = 5s/vB&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   C alone = 1s/vB&lt;br/&gt;&amp;gt;   D&#43;C&#43;A = 2s/vB&lt;br/&gt;&amp;gt;   D&#43;C = 3s/vB      (B&#43;A already at 5s/vB)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; which I think recovers your point, while also having all the details&lt;br/&gt;&amp;gt; only be dealing with direct parents.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Are &amp;#34;getpckgtxns&amp;#34; / &amp;#34;pcktxns&amp;#34; really limited to packages, or are they&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; just a general way to request a batch of transactions?&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Maybe call those messages &amp;#34;getbatchtxns&amp;#34; and &amp;#34;batchtxns&amp;#34; and allow&lt;br/&gt;&amp;gt; them to&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; be used more generally, potentially in ways unrelated to packages/cpfp?&lt;br/&gt;&amp;gt; &amp;gt; Indeed, it’s a general way to request a batch of transactions. I’ll&lt;br/&gt;&amp;gt; &amp;gt; highlight that it is “all or nothing,” i.e. if the sender is missing any&lt;br/&gt;&amp;gt; of&lt;br/&gt;&amp;gt; &amp;gt; them, they’ll just send a notfound.&lt;br/&gt;&amp;gt; &amp;gt; The idea here was to avoid downloading any transactions that can’t be&lt;br/&gt;&amp;gt; &amp;gt; validated right away.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Right; maybe I should just be calling a &amp;#34;batch of packages to be validated&lt;br/&gt;&amp;gt; together&amp;#34; a &amp;#34;tx package&amp;#34; in the first place.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Maybe it would be worth emphasising that you should be expecting to&lt;br/&gt;&amp;gt; validate all the txs you receive as a response to getpckgtxns (getpkgtxs&lt;br/&gt;&amp;gt; :) all at the same time, and immediately upon receiving them?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; The &amp;#34;only be sent if both peers agreed to do package relay&amp;#34; rule could&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; simply be dropped, I think.&lt;br/&gt;&amp;gt; &amp;gt; Wouldn’t we need some way of saying “hey I support batchtxns?” Otherwise&lt;br/&gt;&amp;gt; &amp;gt; you would have to guess by sending a request and waiting to see if it’s&lt;br/&gt;&amp;gt; &amp;gt; ignored?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Sure, perhaps I should have said leave that rule, but drop the following&lt;br/&gt;&amp;gt; &amp;#34;should be disconnected&amp;#34; rule, so that other BIPs could add in other&lt;br/&gt;&amp;gt; ways of negotiating the connection in future? *shrug*&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; Shouldn&amp;#39;t the sender only be sending package announcements when they&lt;br/&gt;&amp;gt; know&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; the recipient will be interested in the package, based on their&lt;br/&gt;&amp;gt; feefilter?&lt;br/&gt;&amp;gt; &amp;gt; I think there are cases where the sender doesn’t necessarily know.&lt;br/&gt;&amp;gt; &amp;gt; Consider this example:&lt;br/&gt;&amp;gt; &amp;gt;&lt;br/&gt;&amp;gt;  &lt;img src=&#34;https://raw.githubusercontent.com/glozow/bitcoin-notes/master/mempool_garden/rich_parent_bad_cpfp.png&#34;&gt; &lt;br/&gt;&amp;gt; &amp;gt; D (5sat/vB) has 2 parents, A (0sat/vB) and B (20sat/vB). All same size.&lt;br/&gt;&amp;gt; &amp;gt; Feefilter is 3sat/vB.&lt;br/&gt;&amp;gt; &amp;gt; If the receiver already has B, they’ll know they can just reject the&lt;br/&gt;&amp;gt; &amp;gt; package already based on the pckginfo.&lt;br/&gt;&amp;gt; &amp;gt; But the sender doesn’t really know that. The sender just knows A is below&lt;br/&gt;&amp;gt; &amp;gt; feerate and D is above. D is above the fee filter, and its ancestor&lt;br/&gt;&amp;gt; feerate&lt;br/&gt;&amp;gt; &amp;gt; is above the fee filter.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The sender would also need to know whether or not there&amp;#39;s some other&lt;br/&gt;&amp;gt; child E that pays for A sufficiently?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you&amp;#39;re asking for the package for &amp;#34;D&amp;#34;, would a response telling you:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   txid_D (500 sat, 100vB)&lt;br/&gt;&amp;gt;   txid_A (0 sat, 100vB)&lt;br/&gt;&amp;gt;   txid_B (2000 sat, 100 vB)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; be better, in that case? Then the receiver can maybe do the logic&lt;br/&gt;&amp;gt; themselves to figure out that they already have A in their mempool&lt;br/&gt;&amp;gt; so it&amp;#39;s fine, or not?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you&amp;#39;ve got a package for X, and its direct parents P1..Pn, then&lt;br/&gt;&amp;gt; I think the logic would be:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;   * is X alone above my fee rate? no, then forget it&lt;br/&gt;&amp;gt;   * otherwise, s := X.size, f := X.fees, R := [X]&lt;br/&gt;&amp;gt;   * for P = P1..Pn:&lt;br/&gt;&amp;gt;     * do I already have P? then skip to the next parent&lt;br/&gt;&amp;gt;     * s &#43;= P.size, f &#43;= P.fees, R &#43;= [P]&lt;br/&gt;&amp;gt;   * if f/s above my fee rate floor? if so, request all the txs in R&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; and you&amp;#39;d request txs if-and-only-if they&amp;#39;re a match for you mempool rate?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you have a tx with 20 in-mempool parents, then the pkginfo1 message&lt;br/&gt;&amp;gt; as proposed would be 737 bytes; including all the fee/size info would be&lt;br/&gt;&amp;gt; 957 bytes, maybe a 30% increase. Might be worth it though?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; aj&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220523/c502fd7c/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220523/c502fd7c/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:09:47Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsxjpudsgav3smntljs75tv5lpq0xuju44zc2gp2l44jteecw6uqlgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q467qkf</id>
    
      <title type="html">📅 Original date posted:2022-05-18 📝 Original message:(To ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsxjpudsgav3smntljs75tv5lpq0xuju44zc2gp2l44jteecw6uqlgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q467qkf" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsfx9n2lmf57w72klc76mjwmfprk7nts5hduduwya674gv8wjhmp5qv6m8v2&#39;&gt;nevent1q…m8v2&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-05-18&lt;br/&gt;📝 Original message:(To everyone):&lt;br/&gt;I should have made it much clearer that version 1 is only supposed to solve&lt;br/&gt;1 of the 2 use cases. I was a lot more focused on the fee-bumping use case,&lt;br/&gt;since it’s more important. Orphan-fetching was added to the motivation&lt;br/&gt;section last-minute because John Newbery mentioned to me “hey you could&lt;br/&gt;deal with orphans really easily with this.” Of course,&lt;br/&gt;child-with-unconfirmed-parents packages aren’t very useful for&lt;br/&gt;orphan-fetching since non-parent ancestors are quite common.&lt;br/&gt;&lt;br/&gt;Maybe a version 2 package for orphan-fetching could look like this:&lt;br/&gt;&lt;br/&gt;“pckginfo2” message contains a tx with all of its ancestors&lt;br/&gt;&lt;br/&gt;“MSG_PCKG2” inv type refers to a “pckginfo2” for a tx. You don’t send&lt;br/&gt;inv(MSG_PCKG2), but a node can request getdata(MSG_PCKG2) for a transaction&lt;br/&gt;they want the ancestors for, provided they sent sendpackages(version=2)&lt;br/&gt;ahead of time. It seems to me that orphan-fetching only ever needs to be&lt;br/&gt;receiver-initiated.&lt;br/&gt;&lt;br/&gt;Protocol flow would look like this:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/168891185-1630f583-de47-4937-86b1-2652cf8852f2.png&#34;&gt; &lt;br/&gt;&lt;br/&gt;We don’t have a policy for dealing with anything more than a child with its&lt;br/&gt;direct parents, but I also don’t think anybody is relying on fee-bumping&lt;br/&gt;more than 2 generations, so the validation logic here could probably just&lt;br/&gt;submit them all individually. Maybe they can request a pckginfo1 if they&lt;br/&gt;see something that’s too-low-fee, and/or use the&lt;br/&gt;child-with-unconfirmed-parents logic opportunistically.&lt;br/&gt;&lt;br/&gt;Thanks aj for the feedback! Responding:&lt;br/&gt;&lt;br/&gt;&amp;gt; The &amp;#34;PCKG&amp;#34; abbreviation threw me for a loop; isn&amp;#39;t the usual&lt;br/&gt;&amp;gt; abbreviation &amp;#34;PKG&amp;#34; ?&lt;br/&gt;&lt;br/&gt;Oh I didn&amp;#39;t know that. I could change it if people feel strongly.&lt;br/&gt;&lt;br/&gt;&amp;gt; Does it make sense for these to be configurable, rather than implied&lt;br/&gt;&amp;gt; by the version?&lt;br/&gt;&amp;gt; … would it be better to either just not do sendpackages&lt;br/&gt;&amp;gt; at all if you&amp;#39;re limiting ancestors in the mempool incompatibly&lt;br/&gt;&lt;br/&gt;Effectively: if you’re setting your ancestor/descendant limits lower than&lt;br/&gt;the default, you can’t do package relay. I wonder if this might be&lt;br/&gt;controversial, since it adds pressure to adhere to Bitcoin Core’s current&lt;br/&gt;mempool policy? I would be happy to do it this way, though - makes things&lt;br/&gt;easier to implement.&lt;br/&gt;&lt;br/&gt;&amp;gt; &amp;gt; 5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;&amp;gt; &amp;gt;    send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;&amp;gt; &amp;gt; received by a peer after sending `fRelay==false` in their version&lt;br/&gt;&amp;gt; &amp;gt; message, the sender should be disconnected.&lt;br/&gt;&lt;br/&gt;&amp;gt; Seems better to just say &amp;#34;if you set fRelay=false in your version&lt;br/&gt;&amp;gt; message, you must not send sendpackages&amp;#34;? You already won&amp;#39;t do packages&lt;br/&gt;&amp;gt; with the peer if they don&amp;#39;t also announce sendpackages.&lt;br/&gt;&lt;br/&gt;I guess, theoretically, if you allow bloom filters with this peer, it’s&lt;br/&gt;plausible they’re saying “fRelay=false, I’ll send you a bloom filter later,&lt;br/&gt;and I’ll also want to talk about packages.”&lt;br/&gt;I don’t know if that’s a use case we want to support - my gut reaction is&lt;br/&gt;no.&lt;br/&gt;&lt;br/&gt;&amp;gt; Maybe: &amp;#34;You must not send sendpackages unless you also send wtxidrelay&amp;#34; ?&lt;br/&gt;&lt;br/&gt;Do you mean if we get a verack, and the peer sent “sendpackages” but not&lt;br/&gt;“wtxidrelay,” we should disconnect them?&lt;br/&gt;&lt;br/&gt;&amp;gt; As I understand it, the two cases for the protocol flow are &amp;#34;I received&lt;br/&gt;&amp;gt; an orphan, and I&amp;#39;d like its ancestors please&amp;#34; which seems simple enough,&lt;br/&gt;&amp;gt; and &amp;#34;here&amp;#39;s a child you may be interested in, even though you possibly&lt;br/&gt;&amp;gt; weren&amp;#39;t interested in the parents of that child&amp;#34;.&lt;br/&gt;&lt;br/&gt;(Btw, please see my notes at the top of this email about separating those&lt;br/&gt;two use cases. sorry for the confusion).&lt;br/&gt;&lt;br/&gt;&amp;gt; I think the logic for the latter is: […]&lt;br/&gt;&lt;br/&gt;I have it as: we send a PCKG INV when this transaction’s feerate is above&lt;br/&gt;the fee filter, but one or more of its parents don’t. I don’t think using&lt;br/&gt;ancestor feerate is better.&lt;br/&gt;See this counterexample:&lt;br/&gt; &lt;img src=&#34;https://raw.githubusercontent.com/glozow/bitcoin-notes/master/mempool_garden/abc_1parent_2kids.png&#34;&gt; &lt;br/&gt;A (0fee) has 2 kids, B (3sat/vB) and C (20sat/vB), everything’s the same&lt;br/&gt;vsize. Let’s say the fee filter is 3sat/vB.&lt;br/&gt;If we do it based on ancestor feerate, we won’t send B. But B is actually&lt;br/&gt;fine; C is paying for A.&lt;br/&gt;&lt;br/&gt;&amp;gt; Are &amp;#34;getpckgtxns&amp;#34; / &amp;#34;pcktxns&amp;#34; really limited to packages, or are they&lt;br/&gt;&amp;gt; just a general way to request a batch of transactions?&lt;br/&gt;&lt;br/&gt;&amp;gt; Maybe call those messages &amp;#34;getbatchtxns&amp;#34; and &amp;#34;batchtxns&amp;#34; and allow them to&lt;br/&gt;&amp;gt; be used more generally, potentially in ways unrelated to packages/cpfp?&lt;br/&gt;&lt;br/&gt;Indeed, it’s a general way to request a batch of transactions. I’ll&lt;br/&gt;highlight that it is “all or nothing,” i.e. if the sender is missing any of&lt;br/&gt;them, they’ll just send a notfound.&lt;br/&gt;The idea here was to avoid downloading any transactions that can’t be&lt;br/&gt;validated right away. With packages, this makes sense, because there are&lt;br/&gt;dependency relationships. But if you’re requesting multiple unrelated&lt;br/&gt;transactions, for example, it’s unnecessary. You might end up with even&lt;br/&gt;more transaction data that’s just sitting around waiting to be validated.&lt;br/&gt;&lt;br/&gt;&amp;gt; The &amp;#34;only be sent if both peers agreed to do package relay&amp;#34; rule could&lt;br/&gt;&amp;gt; simply be dropped, I think.&lt;br/&gt;&lt;br/&gt;Wouldn’t we need some way of saying “hey I support batchtxns?” Otherwise&lt;br/&gt;you would have to guess by sending a request and waiting to see if it’s&lt;br/&gt;ignored?&lt;br/&gt;&lt;br/&gt;&amp;gt; Shouldn&amp;#39;t the sender only be sending package announcements when they know&lt;br/&gt;&amp;gt; the recipient will be interested in the package, based on their feefilter?&lt;br/&gt;&lt;br/&gt;I think there are cases where the sender doesn’t necessarily know.&lt;br/&gt;Consider this example:&lt;br/&gt; &lt;img src=&#34;https://raw.githubusercontent.com/glozow/bitcoin-notes/master/mempool_garden/rich_parent_bad_cpfp.png&#34;&gt; &lt;br/&gt;D (5sat/vB) has 2 parents, A (0sat/vB) and B (20sat/vB). All same size.&lt;br/&gt;Feefilter is 3sat/vB.&lt;br/&gt;If the receiver already has B, they’ll know they can just reject the&lt;br/&gt;package already based on the pckginfo.&lt;br/&gt;But the sender doesn’t really know that. The sender just knows A is below&lt;br/&gt;feerate and D is above. D is above the fee filter, and its ancestor feerate&lt;br/&gt;is above the fee filter.&lt;br/&gt;&lt;br/&gt;&amp;gt; CAmount in consensus/amount.h is a int64_t&lt;br/&gt;&amp;gt; The maximum block weight is 4M…&lt;br/&gt;&lt;br/&gt; Oops yes. I think we just usually use int64_t for vsizes afaik. Agree that&lt;br/&gt;it should be 8 bytes for fee, and 4 bytes is enough for vsize.&lt;br/&gt;&lt;br/&gt;&amp;gt; I guess tx relay is low priority enough that it wouldn&amp;#39;t be worth tagging&lt;br/&gt;&amp;gt; some peers as &amp;#34;high bandwidth&amp;#34; and having them immediately announce the&lt;br/&gt;&amp;gt; PCKGINFO1 message, and skip the INV/GETDATA step?&lt;br/&gt;&lt;br/&gt;I had the same idea as well, but seemed unnecessary. It would reduce the&lt;br/&gt;number of round trips, but I don’t think an extra round trip is that big of&lt;br/&gt;a deal for transaction relay. Block relay, yes of course, but I don’t think&lt;br/&gt;we care that much if it takes an extra second to send a transaction?&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, May 17, 2022 at 8:35 PM Anthony Towns &amp;lt;aj at erisian.com.au&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; On Tue, May 17, 2022 at 12:01:04PM -0400, Gloria Zhao via bitcoin-dev&lt;br/&gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt; &amp;gt; ====New Messages====&lt;br/&gt;&amp;gt; &amp;gt; Three new protocol messages are added for use in any version of&lt;br/&gt;&amp;gt; &amp;gt; package relay. Additionally, each version of package relay must define&lt;br/&gt;&amp;gt; &amp;gt; its own inv type and &amp;#34;pckginfo&amp;#34; message version, referred to in this&lt;br/&gt;&amp;gt; &amp;gt; document as &amp;#34;MSG_PCKG&amp;#34; and &amp;#34;pckginfo&amp;#34; respectively. See&lt;br/&gt;&amp;gt; &amp;gt; BIP-v1-packages for a concrete example.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The &amp;#34;PCKG&amp;#34; abbreviation threw me for a loop; isn&amp;#39;t the usual&lt;br/&gt;&amp;gt; abbreviation &amp;#34;PKG&amp;#34; ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; =====sendpackages=====&lt;br/&gt;&amp;gt; &amp;gt; |version || uint32_t || 4 || Denotes a package version supported by the&lt;br/&gt;&amp;gt; &amp;gt; node.&lt;br/&gt;&amp;gt; &amp;gt; |max_count || uint32_t || 4 ||Specifies the maximum number of&lt;br/&gt;&amp;gt; transactions&lt;br/&gt;&amp;gt; &amp;gt; per package this node is&lt;br/&gt;&amp;gt; &amp;gt; willing to accept.&lt;br/&gt;&amp;gt; &amp;gt; |max_weight || uint32_t || 4 ||Specifies the maximum total weight per&lt;br/&gt;&amp;gt; &amp;gt; package this node is willing&lt;br/&gt;&amp;gt; &amp;gt; to accept.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Does it make sense for these to be configurable, rather than implied&lt;br/&gt;&amp;gt; by the version?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I presume the idea is to cope with people specifying different values for&lt;br/&gt;&amp;gt; -limitancestorcount or -limitancestorsize, but if people are regularly&lt;br/&gt;&amp;gt; relaying packages around, it seems like it becomes hard to have those&lt;br/&gt;&amp;gt; values really be configurable while being compatible with that?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I guess I&amp;#39;m asking: would it be better to either just not do sendpackages&lt;br/&gt;&amp;gt; at all if you&amp;#39;re limiting ancestors in the mempool incompatibly; or&lt;br/&gt;&amp;gt; alternatively, would it be better to do the package relay, then reject&lt;br/&gt;&amp;gt; the particular package if it turns out too big, and log that you&amp;#39;ve&lt;br/&gt;&amp;gt; dropped it so that the node operator has some way of realising &amp;#34;whoops,&lt;br/&gt;&amp;gt; I&amp;#39;m not relaying packages properly because of how I configured my node&amp;#34;?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;&amp;gt; &amp;gt;    send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;&amp;gt; &amp;gt; received by a peer after sending `fRelay==false` in their version&lt;br/&gt;&amp;gt; &amp;gt; message, the sender should be disconnected.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Seems better to just say &amp;#34;if you set fRelay=false in your version&lt;br/&gt;&amp;gt; message, you must not send sendpackages&amp;#34;? You already won&amp;#39;t do packages&lt;br/&gt;&amp;gt; with the peer if they don&amp;#39;t also announce sendpackages.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 7. If both peers send &amp;#34;wtxidrelay&amp;#34; and &amp;#34;sendpackages&amp;#34; with the same&lt;br/&gt;&amp;gt; &amp;gt;    version, the peers should announce, request, and send package&lt;br/&gt;&amp;gt; &amp;gt; information to each other.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Maybe: &amp;#34;You must not send sendpackages unless you also send wtxidrelay&amp;#34; ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; As I understand it, the two cases for the protocol flow are &amp;#34;I received&lt;br/&gt;&amp;gt; an orphan, and I&amp;#39;d like its ancestors please&amp;#34; which seems simple enough,&lt;br/&gt;&amp;gt; and &amp;#34;here&amp;#39;s a child you may be interested in, even though you possibly&lt;br/&gt;&amp;gt; weren&amp;#39;t interested in the parents of that child&amp;#34;. I think the logic for&lt;br/&gt;&amp;gt; the latter is:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  * if tx C&amp;#39;s fee rate is less than the peer&amp;#39;s feefilter, skip it&lt;br/&gt;&amp;gt;    (will maybe treat it as a parent in some package later though)&lt;br/&gt;&amp;gt;  * if tx C&amp;#39;s ancestor fee rate is less than the peer&amp;#39;s feefilter, skip&lt;br/&gt;&amp;gt;    it?&lt;br/&gt;&amp;gt;  * look at the lowest ancestor fee rate for any of C&amp;#39;s in-mempool&lt;br/&gt;&amp;gt;    parents&lt;br/&gt;&amp;gt;  * if that is higher than the peer&amp;#39;s fee filter, send a normal INV&lt;br/&gt;&amp;gt;  * if it&amp;#39;s lower than the peer&amp;#39;s fee filter, send a PCKG INV&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Are &amp;#34;getpckgtxns&amp;#34; / &amp;#34;pcktxns&amp;#34; really limited to packages, or are they&lt;br/&gt;&amp;gt; just a general way to request a batch of transactions? Particularly in&lt;br/&gt;&amp;gt; the case of requesting the parents of an orphan tx you already have,&lt;br/&gt;&amp;gt; it seems hard for the node receiving getpckgtxns to validate that the&lt;br/&gt;&amp;gt; txs are related in some way; but also it doesn&amp;#39;t seem very necessary?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Maybe call those messages &amp;#34;getbatchtxns&amp;#34; and &amp;#34;batchtxns&amp;#34; and allow them to&lt;br/&gt;&amp;gt; be used more generally, potentially in ways unrelated to packages/cpfp?&lt;br/&gt;&amp;gt; The &amp;#34;only be sent if both peers agreed to do package relay&amp;#34; rule could&lt;br/&gt;&amp;gt; simply be dropped, I think.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 4. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt; &amp;gt;    the transactions. For example, if the receiver already has some of&lt;br/&gt;&amp;gt; &amp;gt; the transactions in their mempool, they only request the missing ones.&lt;br/&gt;&amp;gt; &amp;gt; They could also decide not to request the package at all based on the&lt;br/&gt;&amp;gt; &amp;gt; fee information provided.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Shouldn&amp;#39;t the sender only be sending package announcements when they know&lt;br/&gt;&amp;gt; the recipient will be interested in the package, based on their feefilter?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; =====pckginfo1=====&lt;br/&gt;&amp;gt; &amp;gt; {|&lt;br/&gt;&amp;gt; &amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |blockhash || uint256 || 32 || The chain tip at which this package is&lt;br/&gt;&amp;gt; &amp;gt; defined.&lt;br/&gt;&amp;gt; &amp;gt; |-&lt;br/&gt;&amp;gt; &amp;gt; |pckg_fee||CAmount||4|| The sum total fees paid by all transactions in&lt;br/&gt;&amp;gt; the&lt;br/&gt;&amp;gt; &amp;gt; package.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; CAmount in consensus/amount.h is a int64_t so shouldn&amp;#39;t this be 8&lt;br/&gt;&amp;gt; bytes? If you limit a package to 101kvB, an int32_t is enough to cover&lt;br/&gt;&amp;gt; any package with a fee rate of about 212 BTC/block or lower, though.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; |pckg_weight||int64_t||8|| The sum total weight of all transactions in&lt;br/&gt;&amp;gt; the&lt;br/&gt;&amp;gt; &amp;gt; package.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The maximum block weight is 4M, and the default -limitancestorsize&lt;br/&gt;&amp;gt; presumably implies a max package weight of 404k; seems odd to provide&lt;br/&gt;&amp;gt; a uint64_t rather than an int32_t here, which easily allows either of&lt;br/&gt;&amp;gt; those values?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 2. &amp;#39;&amp;#39;Only 1 child with unconfirmed parents.&amp;#39;&amp;#39; The package must consist&lt;br/&gt;&amp;gt; &amp;gt;    of one transaction and its unconfirmed parents. There must not be&lt;br/&gt;&amp;gt; &amp;gt; any other transactions in the package. Other dependency relationships&lt;br/&gt;&amp;gt; &amp;gt; may exist within the package (e.g. one parent may spend the output of&lt;br/&gt;&amp;gt; &amp;gt; another parent) provided that topological order is respected.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think this means that some of the parents could also have unconfirmed&lt;br/&gt;&amp;gt; parents, but they won&amp;#39;t be included in the package, and must be requested&lt;br/&gt;&amp;gt; via the recipient-initiated approach?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 5. &amp;#39;&amp;#39;Total fees and weight.&amp;#39;&amp;#39; The &amp;#39;total_fee&amp;#39; and &amp;#39;total_weight&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt;    fields must accurately represent the sum total of all transactions&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt;    fees and weights as defined in BIP141, respectively.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Presumably this excludes any unconfirmed grandparents and earlier&lt;br/&gt;&amp;gt; ancestors since they aren&amp;#39;t part of the package, in this approach? Doesn&amp;#39;t&lt;br/&gt;&amp;gt; that make this both harder to calculate (assuming we already have&lt;br/&gt;&amp;gt; ancestor summaries) and less useful, in the case where those ancestors&lt;br/&gt;&amp;gt; have a lower fee rate?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;#39;&amp;#39;Q: Can &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages contain only one&lt;br/&gt;&amp;gt; &amp;gt; transaction?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt; &amp;gt; Yes.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; This would be normal if you&amp;#39;re requesting a single missing parent for&lt;br/&gt;&amp;gt; an orphan you&amp;#39;ve received, I think?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I&amp;#39;m slightly surprised the process is:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  -&amp;gt;  INV PCKG1 C&lt;br/&gt;&amp;gt;   &amp;lt;- GETDATA PCKG1 C&lt;br/&gt;&amp;gt;  -&amp;gt;  PCKGINFO1 blockhash A B C fee weight&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; rather than announcing the package fee info in the first message.&lt;br/&gt;&amp;gt; But if the sender is already applying the feefilter to the package before&lt;br/&gt;&amp;gt; announcing it, it probably doesn&amp;#39;t matter, and means you&amp;#39;re only getting&lt;br/&gt;&amp;gt; a 32B INV from every peer, rather than a 32*(n&#43;2) PCKGINFO1 message from&lt;br/&gt;&amp;gt; every peer.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I guess tx relay is low priority enough that it wouldn&amp;#39;t be worth tagging&lt;br/&gt;&amp;gt; some peers as &amp;#34;high bandwidth&amp;#34; and having them immediately announce the&lt;br/&gt;&amp;gt; PCKGINFO1 message, and skip the INV/GETDATA step?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; aj&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220518/f022b65c/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220518/f022b65c/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:09:46Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsw52qe3crec0arc0amjt0xlzu0r7dhx5ktns3wycrnxmguclswrqgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgfucr8</id>
    
      <title type="html">📅 Original date posted:2022-05-17 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsw52qe3crec0arc0amjt0xlzu0r7dhx5ktns3wycrnxmguclswrqgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgfucr8" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqst4y3m2w9evfct4l52nmv4y9ywwfu5s0kkefwc6nd3t399v8usvhqu7lq88&#39;&gt;nevent1q…lq88&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-05-17&lt;br/&gt;📝 Original message:Hi Greg,&lt;br/&gt;&lt;br/&gt;Thanks for reading!&lt;br/&gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package sent between nodes must abide by&lt;br/&gt;the rules below, otherwise the package is malformed and the sender should&lt;br/&gt;be disconnected.&lt;br/&gt;&lt;br/&gt;&amp;gt;&amp;gt; However, if the child has confirmed parents, they must not be in the&lt;br/&gt;package.&lt;br/&gt;&lt;br/&gt;&amp;gt; If my naive understanding is correct, this means things like otherwise&lt;br/&gt;common situations such as a new block will result in disconnects, say when&lt;br/&gt;&amp;gt; the sender doesn&amp;#39;t hear about a new block which makes the relay package&lt;br/&gt;superfluous/irrelevant. Similar would be disconnection&lt;br/&gt;&amp;gt; when confirmed gets turned into unconfirmed, but those situations are&lt;br/&gt;extremely uncommon. The other rules are entirely under the control&lt;br/&gt;&amp;gt; of the sender, which leads me to wonder if it&amp;#39;s appropriate.&lt;br/&gt;&lt;br/&gt;This is why the &amp;#34;pckginfo1&amp;#34; message includes the blockhash at which the&lt;br/&gt;package was defined.&lt;br/&gt;Also please see Clarifications - &amp;#34;Q: What if a new block arrives in between&lt;br/&gt;messages?&amp;#39;&amp;#39; section in the v1-packages portion. It covers both cases, i.e.&lt;br/&gt;a transaction going from unconfirmed-&amp;gt;confirmed and confirmed-&amp;gt;unconfirmed&lt;br/&gt;in a reorg.&lt;br/&gt;&lt;br/&gt;In case anybody is wondering &amp;#34;why don&amp;#39;t we just allow confirmed parents?&amp;#34;:&lt;br/&gt;Since we validate based on the UTXO set, when we see a recently-confirmed&lt;br/&gt;transaction, it just looks like it spends nonexistent inputs. In these&lt;br/&gt;cases, we don&amp;#39;t really know if the input was recently spent in a block or&lt;br/&gt;just never existed, unless we plan on looking up transactions in past&lt;br/&gt;blocks. We do some guesswork when we deal with new blocks in normal&lt;br/&gt;transaction relay (e.g. we requested the tx before a block arrived):&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/d5d40d59f8d12cf53c5ad1ce9710f3f108cec386/src/validation.cpp#L780-L784&#34;&gt;https://github.com/bitcoin/bitcoin/blob/d5d40d59f8d12cf53c5ad1ce9710f3f108cec386/src/validation.cpp#L780-L784&lt;/a&gt;&lt;br/&gt;I believe it&amp;#39;s cleaner to just explicitly say which blockhash you&amp;#39;re on to&lt;br/&gt;avoid confusion.&lt;br/&gt;&lt;br/&gt;Thanks,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, May 17, 2022 at 1:56 PM Greg Sanders &amp;lt;gsanders87 at gmail.com&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks for working on this important proposal!&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Still a lot to digest, but I just had on area of comment/question:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; A child-with-unconfirmed-parents package sent between nodes must abide by&lt;br/&gt;&amp;gt; the rules below, otherwise the package is malformed and the sender should&lt;br/&gt;&amp;gt; be disconnected.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; However, if the child has confirmed parents, they must not be in the&lt;br/&gt;&amp;gt; package.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If my naive understanding is correct, this means things like otherwise&lt;br/&gt;&amp;gt; common situations such as a new block will result in disconnects, say when&lt;br/&gt;&amp;gt; the sender doesn&amp;#39;t hear about a new block which makes the relay package&lt;br/&gt;&amp;gt; superfluous/irrelevant. Similar would be disconnection&lt;br/&gt;&amp;gt; when confirmed gets turned into unconfirmed, but those situations are&lt;br/&gt;&amp;gt; extremely uncommon. The other rules are entirely under the control&lt;br/&gt;&amp;gt; of the sender, which leads me to wonder if it&amp;#39;s appropriate.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; Greg&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; On Tue, May 17, 2022 at 12:09 PM Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi everybody,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I’m writing to propose a set of p2p protocol changes to enable package&lt;br/&gt;&amp;gt;&amp;gt; relay, soliciting feedback on the design and approach. Here is a link&lt;br/&gt;&amp;gt;&amp;gt; to the most up-to-date proposal:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bips/pull/1324&#34;&gt;https://github.com/bitcoin/bips/pull/1324&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If you have concept or approach feedback, *please respond on the&lt;br/&gt;&amp;gt;&amp;gt; mailing list* to allow everybody to view and participate in the&lt;br/&gt;&amp;gt;&amp;gt; discussion. If you find a typo or inaccurate wording, please feel free&lt;br/&gt;&amp;gt;&amp;gt; to leave suggestions on the PR.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I’m also working on an implementation for Bitcoin Core.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The rest of this post will include the same contents as the proposal,&lt;br/&gt;&amp;gt;&amp;gt; with a bit of reordering and additional context. If you are not 100%&lt;br/&gt;&amp;gt;&amp;gt; up-to-date on package relay and find the proposal hard to follow, I&lt;br/&gt;&amp;gt;&amp;gt; hope you find this format more informative and persuasive.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Background and Motivation==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Users may create and broadcast transactions that depend upon, i.e.&lt;br/&gt;&amp;gt;&amp;gt; spend outputs of, unconfirmed transactions. A “package” is the&lt;br/&gt;&amp;gt;&amp;gt; widely-used term for a group of transactions representable by a&lt;br/&gt;&amp;gt;&amp;gt; connected Directed Acyclic Graph (where a directed edge exists between&lt;br/&gt;&amp;gt;&amp;gt; a transaction that spends the output of another transaction).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Incentive-compatible mempool and miner policies help create a fair,&lt;br/&gt;&amp;gt;&amp;gt; fee-based market for block space. While miners maximize transaction&lt;br/&gt;&amp;gt;&amp;gt; fees in order to earn higher block rewards, non-mining users&lt;br/&gt;&amp;gt;&amp;gt; participating in transaction relay reap many benefits from employing&lt;br/&gt;&amp;gt;&amp;gt; policies that result in a mempool with the same contents, including&lt;br/&gt;&amp;gt;&amp;gt; faster compact block relay and more accurate fee estimation.&lt;br/&gt;&amp;gt;&amp;gt; Additionally, users may take advantage of mempool and miner policy to&lt;br/&gt;&amp;gt;&amp;gt; bump the priority of their transactions by attaching high-fee&lt;br/&gt;&amp;gt;&amp;gt; descendants (Child Pays for Parent or CPFP).  Only considering&lt;br/&gt;&amp;gt;&amp;gt; transactions one at a time for submission to the mempool creates a&lt;br/&gt;&amp;gt;&amp;gt; limitation in the node&amp;#39;s ability to determine which transactions have&lt;br/&gt;&amp;gt;&amp;gt; the highest feerates, since it cannot take into account descendants&lt;br/&gt;&amp;gt;&amp;gt; until all the transactions are in the mempool. Similarly, it cannot&lt;br/&gt;&amp;gt;&amp;gt; use a transaction&amp;#39;s descendants when considering which of two&lt;br/&gt;&amp;gt;&amp;gt; conflicting transactions to keep (Replace by Fee or RBF).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When a user&amp;#39;s transaction does not meet a mempool&amp;#39;s minimum feerate&lt;br/&gt;&amp;gt;&amp;gt; and they cannot create a replacement transaction directly, their&lt;br/&gt;&amp;gt;&amp;gt; transaction will simply be rejected by this mempool. They also cannot&lt;br/&gt;&amp;gt;&amp;gt; attach a descendant to pay for replacing a conflicting transaction.&lt;br/&gt;&amp;gt;&amp;gt; This limitation harms users&amp;#39; ability to fee-bump their transactions.&lt;br/&gt;&amp;gt;&amp;gt; Further, it presents a security issue in contracting protocols which&lt;br/&gt;&amp;gt;&amp;gt; rely on **presigned**, time-sensitive transactions to prevent cheating&lt;br/&gt;&amp;gt;&amp;gt; (HTLC-Timeout in LN Penalty [1] [2] [3], Unvault Cancel in Revault&lt;br/&gt;&amp;gt;&amp;gt; [4], Refund Transaction in Discreet Log Contracts [5], Updates in&lt;br/&gt;&amp;gt;&amp;gt; eltoo [6]). In other words, a key security assumption of many&lt;br/&gt;&amp;gt;&amp;gt; contracting protocols is that all parties can propagate and confirm&lt;br/&gt;&amp;gt;&amp;gt; transactions in a timely manner.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In the past few years, increasing attention [0][1][2][3][6] has been&lt;br/&gt;&amp;gt;&amp;gt; brought to **pinning attacks**, a type of censorship in which the&lt;br/&gt;&amp;gt;&amp;gt; attacker uses mempool policy restrictions to prevent a transaction&lt;br/&gt;&amp;gt;&amp;gt; from being relayed or getting mined.  TLDR: revocation transactions&lt;br/&gt;&amp;gt;&amp;gt; must meet a certain confirmation target to be effective, but their&lt;br/&gt;&amp;gt;&amp;gt; feerates are negotiated well ahead of broadcast time. If the&lt;br/&gt;&amp;gt;&amp;gt; forecasted feerate was too low and no fee-bumping options are&lt;br/&gt;&amp;gt;&amp;gt; available, attackers can steal money from their counterparties. I walk&lt;br/&gt;&amp;gt;&amp;gt; through a concrete example for stealing Lightning HTLC outputs at&lt;br/&gt;&amp;gt;&amp;gt; ~23:58 in this talk [7][8].  Note that most attacks are only possible&lt;br/&gt;&amp;gt;&amp;gt; when the market for blockspace at broadcast time  demands much higher&lt;br/&gt;&amp;gt;&amp;gt; feerates than originally anticipated at signing time. Always&lt;br/&gt;&amp;gt;&amp;gt; overestimating fees may sidestep this issue temporarily (while mempool&lt;br/&gt;&amp;gt;&amp;gt; traffic is low and predictable), but this solution is not foolproof&lt;br/&gt;&amp;gt;&amp;gt; and wastes users&amp;#39; money. The feerate market can change due to sudden&lt;br/&gt;&amp;gt;&amp;gt; spikes in traffic (e.g. huge 12sat/vB dump a few days ago [9]) or&lt;br/&gt;&amp;gt;&amp;gt; sustained, high volume of Bitcoin payments (e.g.  April 2021 and&lt;br/&gt;&amp;gt;&amp;gt; December 2017).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The best solution is to enable nodes to consider packages of&lt;br/&gt;&amp;gt;&amp;gt; transactions as a unit, e.g. one or more low-fee parent transactions&lt;br/&gt;&amp;gt;&amp;gt; with a high-fee child, instead of separately. A package-aware mempool&lt;br/&gt;&amp;gt;&amp;gt; policy can help determine if it would actually be economically&lt;br/&gt;&amp;gt;&amp;gt; rational to accept a transaction to the mempool if it doesn&amp;#39;t meet fee&lt;br/&gt;&amp;gt;&amp;gt; requirements individually. Network-wide adoption of these policies&lt;br/&gt;&amp;gt;&amp;gt; would create a more purely-feerate-based market for block space and&lt;br/&gt;&amp;gt;&amp;gt; allow contracting protocols to adjust fees (and therefore mining&lt;br/&gt;&amp;gt;&amp;gt; priority) at broadcast time.  Some support for packages has existed in&lt;br/&gt;&amp;gt;&amp;gt; Bitcoin Core for years. Since v0.13, Bitcoin Core has used ancestor&lt;br/&gt;&amp;gt;&amp;gt; packages instead of individual transactions to evaluate the incentive&lt;br/&gt;&amp;gt;&amp;gt; compatibility of transactions in the mempool [10] and select them for&lt;br/&gt;&amp;gt;&amp;gt; inclusion in blocks [11].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Package Relay, the concept of {announcing, requesting, downloading}&lt;br/&gt;&amp;gt;&amp;gt; packages between nodes on the p2p network, has also been discussed for&lt;br/&gt;&amp;gt;&amp;gt; many years. The earliest public mention I can find is from 2015 [12].&lt;br/&gt;&amp;gt;&amp;gt; The two most common use cases for package relay are fee-bumping&lt;br/&gt;&amp;gt;&amp;gt; otherwise-too-low-fee transactions and reducing the amount of orphans.&lt;br/&gt;&amp;gt;&amp;gt; It seems uncontroversial to say that everybody desires package relay&lt;br/&gt;&amp;gt;&amp;gt; conceptually, with varying degrees of urgency. Lots of work has been&lt;br/&gt;&amp;gt;&amp;gt; done by others over the past few years, from which I&amp;#39;ve taken&lt;br/&gt;&amp;gt;&amp;gt; inspiration from [13][14][15][16].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; My approach has been to split the project into two components: (1) Package&lt;br/&gt;&amp;gt;&amp;gt; Mempool Accept, which includes validation logic and mempool policy.&lt;br/&gt;&amp;gt;&amp;gt; (3) Package Relay, which includes the p2p protocol changes.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Progress so far:&lt;br/&gt;&amp;gt;&amp;gt; After discussions with various developers of contracting protocols&lt;br/&gt;&amp;gt;&amp;gt; (with heavier emphasis towards LN), it was determined that a&lt;br/&gt;&amp;gt;&amp;gt; package containing a child with all of its unconfirmed parents&lt;br/&gt;&amp;gt;&amp;gt; (child-with-unconfirmed-parents or 1-child-multi-parent package) would&lt;br/&gt;&amp;gt;&amp;gt; be sufficient for their use case, i.e. fee-bumping presigned&lt;br/&gt;&amp;gt;&amp;gt; transactions. A child-with-unconfirmed-parents package has several&lt;br/&gt;&amp;gt;&amp;gt; properties that make many things easier to reason about.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A few months ago, I proposed a set of policies for safe package&lt;br/&gt;&amp;gt;&amp;gt; validation and fee assessment for packages of this restricted&lt;br/&gt;&amp;gt;&amp;gt; topology [17]. A series of PRs implementing this proposal have&lt;br/&gt;&amp;gt;&amp;gt; been merged into Bitcoin Core [18].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Theoretically, developing a safe and incentive-compatible package&lt;br/&gt;&amp;gt;&amp;gt; mempool acceptance policy is sufficient to solve this issue. Nodes&lt;br/&gt;&amp;gt;&amp;gt; could opportunistically accept packages (e.g. by trying combinations&lt;br/&gt;&amp;gt;&amp;gt; of transactions rejected from their mempools), but this practice would&lt;br/&gt;&amp;gt;&amp;gt; likely be inefficient at best and open new Denial of Service attacks&lt;br/&gt;&amp;gt;&amp;gt; at worst. Additional p2p messages may enable nodes to request and&lt;br/&gt;&amp;gt;&amp;gt; share package validation-related information with one another in a&lt;br/&gt;&amp;gt;&amp;gt; more communication-efficient way.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Given that only package RBF remains for package mempool accept, and we&lt;br/&gt;&amp;gt;&amp;gt; can make progress on p2p and mempool in parallel, I think it’s&lt;br/&gt;&amp;gt;&amp;gt; appropriate to put forward a package relay proposal.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Proposal==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This proposal contains 2 components: a “generic” package relay&lt;br/&gt;&amp;gt;&amp;gt; protocol and an extension of it, child-with-unconfirmed-parents&lt;br/&gt;&amp;gt;&amp;gt; packages, as version 1 package relay. Another version of packages,&lt;br/&gt;&amp;gt;&amp;gt; “tx-with-unconfirmed-ancestors” can be created to extend package relay&lt;br/&gt;&amp;gt;&amp;gt; for eliminating orphans.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Generic Package Relay===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Two main ideas are introduced:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Download and validate packages of transactions together.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Provide information to help peers decide whether to request and/or how&lt;br/&gt;&amp;gt;&amp;gt; to validate transactions which are part of a package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Intended Protocol Flow====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Due to the asynchronous nature of a distributed transaction relay&lt;br/&gt;&amp;gt;&amp;gt; network, nodes may not receive all of the information needed to&lt;br/&gt;&amp;gt;&amp;gt; validate a transaction at once. For example, after a node completes&lt;br/&gt;&amp;gt;&amp;gt; Initial Block Download (IBD) and first starts participating in&lt;br/&gt;&amp;gt;&amp;gt; transaction relay with an empty mempool, it is common to receive&lt;br/&gt;&amp;gt;&amp;gt; orphans. In such scenarios where a node is aware that it is missing&lt;br/&gt;&amp;gt;&amp;gt; information, a &amp;#39;&amp;#39;receiver-initiated&amp;#39;&amp;#39; dialogue is appropriate:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Receiver requests package information.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The sender provides package information, including the wtxids of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions in the package and anything else that might be&lt;br/&gt;&amp;gt;&amp;gt; relevant (e.g. total fees and size).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    and validate the transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Sometimes, no matter what order transactions are received by a node,&lt;br/&gt;&amp;gt;&amp;gt; validating them individually is insufficient. When the sender is aware&lt;br/&gt;&amp;gt;&amp;gt; of additional information that the receiver needs to accept a package,&lt;br/&gt;&amp;gt;&amp;gt; a proactive &amp;#39;&amp;#39;sender-initiated&amp;#39;&amp;#39; dialogue should be enabled:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Sender announces they have package information pertaining to a&lt;br/&gt;&amp;gt;&amp;gt;    transaction that might otherwise be undesired on its own.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The receiver requests package information.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The sender provides package information, including the wtxids of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions in the package and anything else that might be&lt;br/&gt;&amp;gt;&amp;gt; relevant (e.g. total fees and size).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    and validate the transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Package relay is negotiated between two peers during the version&lt;br/&gt;&amp;gt;&amp;gt; handshake. Package relay requires both peers to support wtxid-based&lt;br/&gt;&amp;gt;&amp;gt; relay because package transactions are referenced by their wtxid.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====New Messages====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Three new protocol messages are added for use in any version of&lt;br/&gt;&amp;gt;&amp;gt; package relay. Additionally, each version of package relay must define&lt;br/&gt;&amp;gt;&amp;gt; its own inv type and &amp;#34;pckginfo&amp;#34; message version, referred to in this&lt;br/&gt;&amp;gt;&amp;gt; document as &amp;#34;MSG_PCKG&amp;#34; and &amp;#34;pckginfo&amp;#34; respectively. See&lt;br/&gt;&amp;gt;&amp;gt; BIP-v1-packages for a concrete example.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====sendpackages=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||  Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |version || uint32_t || 4 || Denotes a package version supported by the&lt;br/&gt;&amp;gt;&amp;gt; node.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |max_count || uint32_t || 4 ||Specifies the maximum number of&lt;br/&gt;&amp;gt;&amp;gt; transactions per package this node is&lt;br/&gt;&amp;gt;&amp;gt; willing to accept.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |max_weight || uint32_t || 4 ||Specifies the maximum total weight per&lt;br/&gt;&amp;gt;&amp;gt; package this node is willing&lt;br/&gt;&amp;gt;&amp;gt; to accept.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;sendpackages&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;sendpackages&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. During version handshake, nodes should send a &amp;#34;sendpackages&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;    message indicate they support package relay and may request&lt;br/&gt;&amp;gt;&amp;gt; packages.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The message should contain a version supported by the node. Nodes&lt;br/&gt;&amp;gt;&amp;gt;    should send a &amp;#34;sendpackages&amp;#34; message for each version they support.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The &amp;#34;sendpackages&amp;#34; message MUST be sent before sending a &amp;#34;verack&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;    message. If a &amp;#34;sendpackages&amp;#34; message is received afer &amp;#34;verack&amp;#34;, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;&amp;gt;&amp;gt;    send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;&amp;gt;&amp;gt; received by a peer after sending `fRelay==false` in their version&lt;br/&gt;&amp;gt;&amp;gt; message, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 6.. Upon receipt of a &amp;#34;sendpackages&amp;#34; message with a version that is&lt;br/&gt;&amp;gt;&amp;gt; not supported, a node must treat the peer as if it never received the&lt;br/&gt;&amp;gt;&amp;gt; message.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 7. If both peers send &amp;#34;wtxidrelay&amp;#34; and &amp;#34;sendpackages&amp;#34; with the same&lt;br/&gt;&amp;gt;&amp;gt;    version, the peers should announce, request, and send package&lt;br/&gt;&amp;gt;&amp;gt; information to each other.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====getpckgtxns=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; requested.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of wtxids||txns_length * 32|| The wtxids of each transaction&lt;br/&gt;&amp;gt;&amp;gt; in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;getpckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;getpckgtxns&amp;#34; message should be used to request all or some of&lt;br/&gt;&amp;gt;&amp;gt;    the transactions previously announced in a &amp;#34;pckginfo&amp;#34; message,&lt;br/&gt;&amp;gt;&amp;gt; specified by witness transactiosome id.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;getpckgtxns&amp;#34; message, a node must respond with&lt;br/&gt;&amp;gt;&amp;gt;    either a &amp;#34;pckgtxns&amp;#34; containing the requested transactions or a&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;notfound&amp;#34; message indicating one or more of the transactions is&lt;br/&gt;&amp;gt;&amp;gt; unavailable. This allows the receiver to avoid downloading and storing&lt;br/&gt;&amp;gt;&amp;gt; transactions that cannot be validated immediately.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. A &amp;#34;getpckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send packages in the version handshake. If a &amp;#34;getpckgtxns&amp;#34; message&lt;br/&gt;&amp;gt;&amp;gt; is received from a peer with which package relay was not negotiated,&lt;br/&gt;&amp;gt;&amp;gt; the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====pckgtxns=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; provided.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of transactions||variable|| The transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;pckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;pckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;pckgtxns&amp;#34; message should contain the transaction data requested&lt;br/&gt;&amp;gt;&amp;gt;    using &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. A &amp;#34;pckgtxns&amp;#34; message should only be sent to a peer that requested&lt;br/&gt;&amp;gt;&amp;gt;    the package using &amp;#34;getpckgtxns&amp;#34;. If a node receives an unsolicited&lt;br/&gt;&amp;gt;&amp;gt; package, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. A &amp;#34;pckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send packages in the version handshake. If a &amp;#34;pckgtxns&amp;#34; message is&lt;br/&gt;&amp;gt;&amp;gt; received from a peer with which package relay was not negotiated, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Version 1 Packages: child-with-unconfirmed-parents===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This extends package relay for packages consisting of one transaction&lt;br/&gt;&amp;gt;&amp;gt; and all of its unconfirmed parents,by defining version 1 packages, a&lt;br/&gt;&amp;gt;&amp;gt; pckginfo1 message, and a MSG_PCKG1 inv type. It enables the use case&lt;br/&gt;&amp;gt;&amp;gt; in which a child pays for its otherwise-too-low-fee parents and their&lt;br/&gt;&amp;gt;&amp;gt; mempool conflict(s).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Intended Protocol Flow====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When relaying a package of low-fee parent(s) and high-fee child, the&lt;br/&gt;&amp;gt;&amp;gt; sender and receiver do the following:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Sender announces they have a child-with-unconfirmed-parents package&lt;br/&gt;&amp;gt;&amp;gt;    for a child that pays for otherwise-too-low-fee parent(s) using&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;inv(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. The receiver requests package information using&lt;br/&gt;&amp;gt;&amp;gt;    &amp;#34;getdata(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. The sender provides package information using &amp;#34;pckginfo1&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt;    including the blockhash of the sender&amp;#39;s best block, the wtxids of&lt;br/&gt;&amp;gt;&amp;gt; the transactions in the package, their total fees and total weight.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. The reciever uses the package information to decide how to request&lt;br/&gt;&amp;gt;&amp;gt;    the transactions. For example, if the receiver already has some of&lt;br/&gt;&amp;gt;&amp;gt; the transactions in their mempool, they only request the missing ones.&lt;br/&gt;&amp;gt;&amp;gt; They could also decide not to request the package at all based on the&lt;br/&gt;&amp;gt;&amp;gt; fee information provided.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. Upon receiving a &amp;#34;pckgtxns&amp;#34;, the receiver submits the transactions&lt;br/&gt;&amp;gt;&amp;gt;    together as a package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====New Messages====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A new inv type, &amp;#34;MSG_PCKG1&amp;#34;, and new protocol message, &amp;#34;PCKGINFO1&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt; are added.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====pckginfo1=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; {|&lt;br/&gt;&amp;gt;&amp;gt; |  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |blockhash || uint256 || 32 || The chain tip at which this package is&lt;br/&gt;&amp;gt;&amp;gt; defined.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |pckg_fee||CAmount||4|| The sum total fees paid by all transactions in&lt;br/&gt;&amp;gt;&amp;gt; the package.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |pckg_weight||int64_t||8|| The sum total weight of all transactions in&lt;br/&gt;&amp;gt;&amp;gt; the package.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;&amp;gt;&amp;gt; provided.&lt;br/&gt;&amp;gt;&amp;gt; |-&lt;br/&gt;&amp;gt;&amp;gt; |txns||List of wtxids||txns_length * 32|| The wtxids of each transaction&lt;br/&gt;&amp;gt;&amp;gt; in the package.&lt;br/&gt;&amp;gt;&amp;gt; |}&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The &amp;#34;pckginfo1&amp;#34; message has the structure defined above, with&lt;br/&gt;&amp;gt;&amp;gt;    pchCommand == &amp;#34;pckginfo1&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. A &amp;#34;pckginfo1&amp;#34; message contains information about a version 1&lt;br/&gt;&amp;gt;&amp;gt;    package (defined below), referenced by the wtxid of the transaction&lt;br/&gt;&amp;gt;&amp;gt; it pertains to and the current blockhash.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;pckginfo1&amp;#34; message, the node should decide if it&lt;br/&gt;&amp;gt;&amp;gt;    wants to validate the package, request transaction data if&lt;br/&gt;&amp;gt;&amp;gt; necessary, etc.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. Upon receipt of a malformed &amp;#34;pckginfo1&amp;#34; message or package that&lt;br/&gt;&amp;gt;&amp;gt;    does not abide by the max_count, max_weight, or other rules&lt;br/&gt;&amp;gt;&amp;gt; specified by the version agreed upon in the initial negotiation, the&lt;br/&gt;&amp;gt;&amp;gt; sender should be disconnected.  If a node receives a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; message for which the &amp;#34;pckg_fee&amp;#34; or &amp;#34;pckg_weight&amp;#34; do not reflect the&lt;br/&gt;&amp;gt;&amp;gt; true total fees and weight, respectively, or the transactions in the&lt;br/&gt;&amp;gt;&amp;gt; package, the message is malformed.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. A node MUST NOT send a &amp;#34;pckginfo1&amp;#34; message that has not been&lt;br/&gt;&amp;gt;&amp;gt;    requested by the recipient. Upon receipt of an unsolicited&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;pckginfo1&amp;#34;, a node should disconnect the sender.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 6. A &amp;#34;pckginfo1&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;&amp;gt;&amp;gt;    send version 1 packages in the version handshake. If a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; message is received from a peer with which package relay was not&lt;br/&gt;&amp;gt;&amp;gt; negotiated, the sender should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; =====MSG_PCKG1=====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. A new inv type (MSG_PCKG1 == 0x6) is added, for use in inv messages&lt;br/&gt;&amp;gt;&amp;gt;    and getdata requests pertaining to version 1 packages.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. As an inv type, it indicates that both transaction data and version&lt;br/&gt;&amp;gt;&amp;gt;    1 package information are available for the transaction. The&lt;br/&gt;&amp;gt;&amp;gt; transaction is referenced by its wtxid. As a getdata request type, it&lt;br/&gt;&amp;gt;&amp;gt; indicates that the sender wants package information for the&lt;br/&gt;&amp;gt;&amp;gt; transaction.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Upon receipt of a &amp;#34;getdata&amp;#34; request for &amp;#34;MSG_PCKG1&amp;#34;, the node&lt;br/&gt;&amp;gt;&amp;gt;    should respond with the version 1 package corresponding to the&lt;br/&gt;&amp;gt;&amp;gt; requested transaction and its current chain tip, or with NOTFOUND.&lt;br/&gt;&amp;gt;&amp;gt; The node should not assume that the sender is requesting the&lt;br/&gt;&amp;gt;&amp;gt; transaction data as well.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Child With Parent Packages Rules====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package sent between nodes must abide&lt;br/&gt;&amp;gt;&amp;gt; by the rules below, otherwise the package is malformed and the sender&lt;br/&gt;&amp;gt;&amp;gt; should be disconnected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A version 1 or &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package can be&lt;br/&gt;&amp;gt;&amp;gt; defined for any transaction that spends unconfirmed inputs. The child&lt;br/&gt;&amp;gt;&amp;gt; can be thought of as the &amp;#34;representative&amp;#34; of the package. This package&lt;br/&gt;&amp;gt;&amp;gt; can be uniquely identified by the transaction&amp;#39;s wtxid and the current&lt;br/&gt;&amp;gt;&amp;gt; chain tip block hash.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package MUST be:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. &amp;#39;&amp;#39;Sorted topologically.&amp;#39;&amp;#39; For every transaction t in the package,&lt;br/&gt;&amp;gt;&amp;gt;    if any of t&amp;#39;s parents are present in the package, the parent must&lt;br/&gt;&amp;gt;&amp;gt; appear somewhere in the list before t. In other words, the&lt;br/&gt;&amp;gt;&amp;gt; transactions must be sorted in ascending order of the number of&lt;br/&gt;&amp;gt;&amp;gt; ancestors present in the package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. &amp;#39;&amp;#39;Only 1 child with unconfirmed parents.&amp;#39;&amp;#39; The package must consist&lt;br/&gt;&amp;gt;&amp;gt;    of one transaction and its unconfirmed parents. There must not be&lt;br/&gt;&amp;gt;&amp;gt; any other transactions in the package. Other dependency relationships&lt;br/&gt;&amp;gt;&amp;gt; may exist within the package (e.g. one parent may spend the output of&lt;br/&gt;&amp;gt;&amp;gt; another parent) provided that topological order is respected.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. &amp;#39;&amp;#39;All unconfirmed parents.&amp;#39;&amp;#39; All of the child&amp;#39;s unconfirmed parents&lt;br/&gt;&amp;gt;&amp;gt;    must be present.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. &amp;#39;&amp;#39;No conflicts.&amp;#39;&amp;#39; None of the transactions in the package may&lt;br/&gt;&amp;gt;&amp;gt;    conflict with each other (i.e.  spend the same prevout).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 5. &amp;#39;&amp;#39;Total fees and weight.&amp;#39;&amp;#39; The &amp;#39;total_fee&amp;#39; and &amp;#39;total_weight&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;    fields must accurately represent the sum total of all transactions&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt; fees and weights as defined in BIP141, respectively.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Not all of the child&amp;#39;s parents must be present; the child transaction&lt;br/&gt;&amp;gt;&amp;gt; may also spend confirmed inputs. However, if the child has confirmed&lt;br/&gt;&amp;gt;&amp;gt; parents, they must not be in the package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; While a child-with-unconfirmed-parents package is perhaps most&lt;br/&gt;&amp;gt;&amp;gt; relevant when the child has a higher feerate than its parents, this&lt;br/&gt;&amp;gt;&amp;gt; property is not required to construct a valid package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Clarifications====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: Under what circumstances should a sender announce a&lt;br/&gt;&amp;gt;&amp;gt; child-with-unconfirmed-parents package?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package for a transaction should be&lt;br/&gt;&amp;gt;&amp;gt; announced when it meets the peer&amp;#39;s fee filter but one or more of its&lt;br/&gt;&amp;gt;&amp;gt; parents don&amp;#39;t; a &amp;#34;inv(MSG_PCKG1)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34; should be sent&lt;br/&gt;&amp;gt;&amp;gt; for the child. Each of the parents which meet the peer&amp;#39;s fee filter&lt;br/&gt;&amp;gt;&amp;gt; should still be announced normally.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: What if a new block arrives in between messages?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A child-with-unconfirmed-parents package is defined for a transaction&lt;br/&gt;&amp;gt;&amp;gt; based on the current chain state. As such, a new block extending the&lt;br/&gt;&amp;gt;&amp;gt; tip may decrease the number of transactions in the package (i.e. if&lt;br/&gt;&amp;gt;&amp;gt; any of the transaction&amp;#39;s parents were included in the block). In a&lt;br/&gt;&amp;gt;&amp;gt; reorg, the number of transactions in the package may decrease or&lt;br/&gt;&amp;gt;&amp;gt; increase (i.e. if any of the transaction&amp;#39;s parents were included in a&lt;br/&gt;&amp;gt;&amp;gt; block in the previous chain but not the new one).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If the new block arrives before the &amp;#34;getdata&amp;#34; or &amp;#34;pckginfo1&amp;#34;, nothing&lt;br/&gt;&amp;gt;&amp;gt; needs to change.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If the new block arrives before &amp;#34;getpckgtxns&amp;#34; or before &amp;#34;pckgtxns&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt; the receiver may need to re-request package information if the block&lt;br/&gt;&amp;gt;&amp;gt; contained a transaction in the package. If the block doesn&amp;#39;t contain&lt;br/&gt;&amp;gt;&amp;gt; any transactions in the package, whether it extends the previous tip&lt;br/&gt;&amp;gt;&amp;gt; or causes a reorg, nothing needs to change.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Q: Can &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages contain only one&lt;br/&gt;&amp;gt;&amp;gt; transaction?&amp;#39;&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Yes.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Further Protocol Extensions===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; When introducing a new type of package, assign it a version number &amp;#34;n&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; and use an additional &amp;#34;sendpackages&amp;#34; message during version handshake&lt;br/&gt;&amp;gt;&amp;gt; to negotiate support for it. An additional package information message&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;pckginfon&amp;#34; and inv type &amp;#34;MSG_PCKGn&amp;#34; should be defined for the type of&lt;br/&gt;&amp;gt;&amp;gt; package.  However, &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; do not need to be&lt;br/&gt;&amp;gt;&amp;gt; changed.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Example proposal for tx-with-unconfirmed-ancestors package relay: [19]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Compatibility===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Older clients remain fully compatible and interoperable after this&lt;br/&gt;&amp;gt;&amp;gt; change. Clients implementing this protocol will only attempt to send&lt;br/&gt;&amp;gt;&amp;gt; and request packages if agreed upon during the version handshake.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Package Erlay===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Clients using BIP330 reconciliation-based transaction relay (Erlay)&lt;br/&gt;&amp;gt;&amp;gt; are able to use package relay without interference. In fact, a package&lt;br/&gt;&amp;gt;&amp;gt; of transactions may be announced using both Erlay and package relay.&lt;br/&gt;&amp;gt;&amp;gt; After reconciliation, if the initiator would have announced a&lt;br/&gt;&amp;gt;&amp;gt; transaction by wtxid but also has package information for it, they may&lt;br/&gt;&amp;gt;&amp;gt; send &amp;#34;inv(MSG_PCKG)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ===Rationale===&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====P2P Message Design====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; These p2p messages are added for communication efficiency and, as&lt;br/&gt;&amp;gt;&amp;gt; such, one should measure alternative solutions based on the resources&lt;br/&gt;&amp;gt;&amp;gt; used to communicate (not necessarily trustworthy) information: We&lt;br/&gt;&amp;gt;&amp;gt; would like to minimize network bandwidth, avoid downloading a&lt;br/&gt;&amp;gt;&amp;gt; transaction more than once, avoid downloading transactions that are&lt;br/&gt;&amp;gt;&amp;gt; eventually rejected, and minimize storage allocated for&lt;br/&gt;&amp;gt;&amp;gt; not-yet-validated transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Consider these (plausible) scenarios in transaction relay:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Alice (the &amp;#34;sender&amp;#34;) is relaying transactions to Bob (the &amp;#34;receiver&amp;#34;).&lt;br/&gt;&amp;gt;&amp;gt; Alice&amp;#39;s mempool has a minimum feerate of 1sat/vB and Bob&amp;#39;s has a&lt;br/&gt;&amp;gt;&amp;gt; minimum feerate of 3sat/vB. For simplicity, all transactions are&lt;br/&gt;&amp;gt;&amp;gt; 1600Wu in virtual size and 500 bytes in serialized size. Apart from&lt;br/&gt;&amp;gt;&amp;gt; the spending relationships specified, all other inputs are from&lt;br/&gt;&amp;gt;&amp;gt; confirmed UTXOs.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Package {A, B} where A pays 0 satoshis and B pays 8000 satoshis in&lt;br/&gt;&amp;gt;&amp;gt;    fees.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. Package {C, D} where C pays 0 satoshis and D pays 1200 satoshis in&lt;br/&gt;&amp;gt;&amp;gt;    fees.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. Package {E, F, G, H, J} that pays 4000, 8000, 0, 2000, and 4000&lt;br/&gt;&amp;gt;&amp;gt;    satoshis in fees, respectively.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Alternative Designs Considered====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;Package Information Only:&amp;#39;&amp;#39; Just having &amp;#34;pckginfo&amp;#34; gives enough&lt;br/&gt;&amp;gt;&amp;gt; information for the receiver to accept the package. Omit the&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages. While this option is a good&lt;br/&gt;&amp;gt;&amp;gt; fallback if batched transaction download fails for some reason, it&lt;br/&gt;&amp;gt;&amp;gt; shouldn&amp;#39;t be used as the default because it &amp;#39;always&amp;#39; requires storage&lt;br/&gt;&amp;gt;&amp;gt; of unvalidated transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;&amp;#39;No Package Information Round:&amp;#39;&amp;#39; Instead of having a package&lt;br/&gt;&amp;gt;&amp;gt; information round, just use the child&amp;#39;s wtxid to refer to the package&lt;br/&gt;&amp;gt;&amp;gt; and always send the entire package together. This would cause nodes to&lt;br/&gt;&amp;gt;&amp;gt; redownload duplicate transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I have also created a slidedeck exploring various alternative designs&lt;br/&gt;&amp;gt;&amp;gt; and some examples in which they fall flat [20]. Please feel free to&lt;br/&gt;&amp;gt;&amp;gt; suggest other alternatives.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ====Versioning System====&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This protocol should be extensible to support multiple types of&lt;br/&gt;&amp;gt;&amp;gt; packages based on future desired use cases. Two &amp;#34;flavors&amp;#34; of&lt;br/&gt;&amp;gt;&amp;gt; versioning were considered:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. When package mempool acceptance is upgraded to support more types&lt;br/&gt;&amp;gt;&amp;gt;    of packages, increment the version number (similar to Erlay).&lt;br/&gt;&amp;gt;&amp;gt; During version handshake, peers negotiate which version of package&lt;br/&gt;&amp;gt;&amp;gt; relay they will use by each sending one &amp;#34;sendpackages&amp;#34; message.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. When introducing another type of package, assign a version number&lt;br/&gt;&amp;gt;&amp;gt;    to it and announce it as an additional supported version (similar&lt;br/&gt;&amp;gt;&amp;gt; to Compact Block Relay). During version handshake, peers send one&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;sendpackages&amp;#34; message for each version supported.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The second option was favored because it allows different parameters&lt;br/&gt;&amp;gt;&amp;gt; for different versions.  For example, it should be possible to support&lt;br/&gt;&amp;gt;&amp;gt; both &amp;#34;arbitrary topology but maximum 3-transaction&amp;#34; package as well as&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;child-with-unconfirmed-parents with default mempool ancestor limits&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; packages simultaneously.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ==Acknowledgements==&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I hope to have made it abundantly clear that this proposal isn’t&lt;br/&gt;&amp;gt;&amp;gt; inventing the concept of package relay, and in fact builds upon years&lt;br/&gt;&amp;gt;&amp;gt; of work by many others, including Suhas Daftuar and Antoine Riard.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thank you to John Newbery and Martin Zumsande for input on the design.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thank you to Matt Corallo, Christian Decker, David Harding, Antoine&lt;br/&gt;&amp;gt;&amp;gt; Poinsot, Antoine Riard, Gregory Sanders, Chris Stewart, Bastien&lt;br/&gt;&amp;gt;&amp;gt; Teinturier, and others for input on the desired interface for&lt;br/&gt;&amp;gt;&amp;gt; contracting protocols.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Looking forward to hearing your thoughts!&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [0]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [1]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&#34;&gt;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [4]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&#34;&gt;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [5]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&#34;&gt;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [6]: &lt;a href=&#34;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&#34;&gt;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [7]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&#34;&gt;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [8]: &lt;a href=&#34;https://youtu.be/fbWSQvJjKFs?t=1438&#34;&gt;https://youtu.be/fbWSQvJjKFs?t=1438&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [9]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&#34;&gt;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7594&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7594&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7600&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7600&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [13]: &lt;a href=&#34;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&#34;&gt;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [14]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/14895&#34;&gt;https://github.com/bitcoin/bitcoin/issues/14895&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [15]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [16]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [17]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [18]: &lt;a href=&#34;https://github.com/users/glozow/projects/5/views/4?layout=board&#34;&gt;https://github.com/users/glozow/projects/5/views/4?layout=board&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [19]: &lt;a href=&#34;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&#34;&gt;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [20]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&#34;&gt;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220517/321c2029/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220517/321c2029/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:09:43Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqstqgc7r0h7jx506chjhgfslad2gazrx2fwe63vc6jeejl78h3alkszyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2quwnrjv</id>
    
      <title type="html">📅 Original date posted:2022-05-17 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqstqgc7r0h7jx506chjhgfslad2gazrx2fwe63vc6jeejl78h3alkszyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2quwnrjv" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqszla6hnxvz00nwfefh53z24kq9vtqsq8jw24fhdgj3luhw00sfctg6k0ve3&#39;&gt;nevent1q…0ve3&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-05-17&lt;br/&gt;📝 Original message:Hi everybody,&lt;br/&gt;&lt;br/&gt;I’m writing to propose a set of p2p protocol changes to enable package&lt;br/&gt;relay, soliciting feedback on the design and approach. Here is a link&lt;br/&gt;to the most up-to-date proposal:&lt;br/&gt;&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bips/pull/1324&#34;&gt;https://github.com/bitcoin/bips/pull/1324&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;If you have concept or approach feedback, *please respond on the&lt;br/&gt;mailing list* to allow everybody to view and participate in the&lt;br/&gt;discussion. If you find a typo or inaccurate wording, please feel free&lt;br/&gt;to leave suggestions on the PR.&lt;br/&gt;&lt;br/&gt;I’m also working on an implementation for Bitcoin Core.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;The rest of this post will include the same contents as the proposal,&lt;br/&gt;with a bit of reordering and additional context. If you are not 100%&lt;br/&gt;up-to-date on package relay and find the proposal hard to follow, I&lt;br/&gt;hope you find this format more informative and persuasive.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;==Background and Motivation==&lt;br/&gt;&lt;br/&gt;Users may create and broadcast transactions that depend upon, i.e.&lt;br/&gt;spend outputs of, unconfirmed transactions. A “package” is the&lt;br/&gt;widely-used term for a group of transactions representable by a&lt;br/&gt;connected Directed Acyclic Graph (where a directed edge exists between&lt;br/&gt;a transaction that spends the output of another transaction).&lt;br/&gt;&lt;br/&gt;Incentive-compatible mempool and miner policies help create a fair,&lt;br/&gt;fee-based market for block space. While miners maximize transaction&lt;br/&gt;fees in order to earn higher block rewards, non-mining users&lt;br/&gt;participating in transaction relay reap many benefits from employing&lt;br/&gt;policies that result in a mempool with the same contents, including&lt;br/&gt;faster compact block relay and more accurate fee estimation.&lt;br/&gt;Additionally, users may take advantage of mempool and miner policy to&lt;br/&gt;bump the priority of their transactions by attaching high-fee&lt;br/&gt;descendants (Child Pays for Parent or CPFP).  Only considering&lt;br/&gt;transactions one at a time for submission to the mempool creates a&lt;br/&gt;limitation in the node&amp;#39;s ability to determine which transactions have&lt;br/&gt;the highest feerates, since it cannot take into account descendants&lt;br/&gt;until all the transactions are in the mempool. Similarly, it cannot&lt;br/&gt;use a transaction&amp;#39;s descendants when considering which of two&lt;br/&gt;conflicting transactions to keep (Replace by Fee or RBF).&lt;br/&gt;&lt;br/&gt;When a user&amp;#39;s transaction does not meet a mempool&amp;#39;s minimum feerate&lt;br/&gt;and they cannot create a replacement transaction directly, their&lt;br/&gt;transaction will simply be rejected by this mempool. They also cannot&lt;br/&gt;attach a descendant to pay for replacing a conflicting transaction.&lt;br/&gt;This limitation harms users&amp;#39; ability to fee-bump their transactions.&lt;br/&gt;Further, it presents a security issue in contracting protocols which&lt;br/&gt;rely on **presigned**, time-sensitive transactions to prevent cheating&lt;br/&gt;(HTLC-Timeout in LN Penalty [1] [2] [3], Unvault Cancel in Revault&lt;br/&gt;[4], Refund Transaction in Discreet Log Contracts [5], Updates in&lt;br/&gt;eltoo [6]). In other words, a key security assumption of many&lt;br/&gt;contracting protocols is that all parties can propagate and confirm&lt;br/&gt;transactions in a timely manner.&lt;br/&gt;&lt;br/&gt;In the past few years, increasing attention [0][1][2][3][6] has been&lt;br/&gt;brought to **pinning attacks**, a type of censorship in which the&lt;br/&gt;attacker uses mempool policy restrictions to prevent a transaction&lt;br/&gt;from being relayed or getting mined.  TLDR: revocation transactions&lt;br/&gt;must meet a certain confirmation target to be effective, but their&lt;br/&gt;feerates are negotiated well ahead of broadcast time. If the&lt;br/&gt;forecasted feerate was too low and no fee-bumping options are&lt;br/&gt;available, attackers can steal money from their counterparties. I walk&lt;br/&gt;through a concrete example for stealing Lightning HTLC outputs at&lt;br/&gt;~23:58 in this talk [7][8].  Note that most attacks are only possible&lt;br/&gt;when the market for blockspace at broadcast time  demands much higher&lt;br/&gt;feerates than originally anticipated at signing time. Always&lt;br/&gt;overestimating fees may sidestep this issue temporarily (while mempool&lt;br/&gt;traffic is low and predictable), but this solution is not foolproof&lt;br/&gt;and wastes users&amp;#39; money. The feerate market can change due to sudden&lt;br/&gt;spikes in traffic (e.g. huge 12sat/vB dump a few days ago [9]) or&lt;br/&gt;sustained, high volume of Bitcoin payments (e.g.  April 2021 and&lt;br/&gt;December 2017).&lt;br/&gt;&lt;br/&gt;The best solution is to enable nodes to consider packages of&lt;br/&gt;transactions as a unit, e.g. one or more low-fee parent transactions&lt;br/&gt;with a high-fee child, instead of separately. A package-aware mempool&lt;br/&gt;policy can help determine if it would actually be economically&lt;br/&gt;rational to accept a transaction to the mempool if it doesn&amp;#39;t meet fee&lt;br/&gt;requirements individually. Network-wide adoption of these policies&lt;br/&gt;would create a more purely-feerate-based market for block space and&lt;br/&gt;allow contracting protocols to adjust fees (and therefore mining&lt;br/&gt;priority) at broadcast time.  Some support for packages has existed in&lt;br/&gt;Bitcoin Core for years. Since v0.13, Bitcoin Core has used ancestor&lt;br/&gt;packages instead of individual transactions to evaluate the incentive&lt;br/&gt;compatibility of transactions in the mempool [10] and select them for&lt;br/&gt;inclusion in blocks [11].&lt;br/&gt;&lt;br/&gt;Package Relay, the concept of {announcing, requesting, downloading}&lt;br/&gt;packages between nodes on the p2p network, has also been discussed for&lt;br/&gt;many years. The earliest public mention I can find is from 2015 [12].&lt;br/&gt;The two most common use cases for package relay are fee-bumping&lt;br/&gt;otherwise-too-low-fee transactions and reducing the amount of orphans.&lt;br/&gt;It seems uncontroversial to say that everybody desires package relay&lt;br/&gt;conceptually, with varying degrees of urgency. Lots of work has been&lt;br/&gt;done by others over the past few years, from which I&amp;#39;ve taken&lt;br/&gt;inspiration from [13][14][15][16].&lt;br/&gt;&lt;br/&gt;My approach has been to split the project into two components: (1) Package&lt;br/&gt;Mempool Accept, which includes validation logic and mempool policy.&lt;br/&gt;(3) Package Relay, which includes the p2p protocol changes.&lt;br/&gt;&lt;br/&gt;Progress so far:&lt;br/&gt;After discussions with various developers of contracting protocols&lt;br/&gt;(with heavier emphasis towards LN), it was determined that a&lt;br/&gt;package containing a child with all of its unconfirmed parents&lt;br/&gt;(child-with-unconfirmed-parents or 1-child-multi-parent package) would&lt;br/&gt;be sufficient for their use case, i.e. fee-bumping presigned&lt;br/&gt;transactions. A child-with-unconfirmed-parents package has several&lt;br/&gt;properties that make many things easier to reason about.&lt;br/&gt;&lt;br/&gt;A few months ago, I proposed a set of policies for safe package&lt;br/&gt;validation and fee assessment for packages of this restricted&lt;br/&gt;topology [17]. A series of PRs implementing this proposal have&lt;br/&gt;been merged into Bitcoin Core [18].&lt;br/&gt;&lt;br/&gt;Theoretically, developing a safe and incentive-compatible package&lt;br/&gt;mempool acceptance policy is sufficient to solve this issue. Nodes&lt;br/&gt;could opportunistically accept packages (e.g. by trying combinations&lt;br/&gt;of transactions rejected from their mempools), but this practice would&lt;br/&gt;likely be inefficient at best and open new Denial of Service attacks&lt;br/&gt;at worst. Additional p2p messages may enable nodes to request and&lt;br/&gt;share package validation-related information with one another in a&lt;br/&gt;more communication-efficient way.&lt;br/&gt;&lt;br/&gt;Given that only package RBF remains for package mempool accept, and we&lt;br/&gt;can make progress on p2p and mempool in parallel, I think it’s&lt;br/&gt;appropriate to put forward a package relay proposal.&lt;br/&gt;&lt;br/&gt;==Proposal==&lt;br/&gt;&lt;br/&gt;This proposal contains 2 components: a “generic” package relay&lt;br/&gt;protocol and an extension of it, child-with-unconfirmed-parents&lt;br/&gt;packages, as version 1 package relay. Another version of packages,&lt;br/&gt;“tx-with-unconfirmed-ancestors” can be created to extend package relay&lt;br/&gt;for eliminating orphans.&lt;br/&gt;&lt;br/&gt;===Generic Package Relay===&lt;br/&gt;&lt;br/&gt;Two main ideas are introduced:&lt;br/&gt;&lt;br/&gt;Download and validate packages of transactions together.&lt;br/&gt;&lt;br/&gt;Provide information to help peers decide whether to request and/or how&lt;br/&gt;to validate transactions which are part of a package.&lt;br/&gt;&lt;br/&gt;====Intended Protocol Flow====&lt;br/&gt;&lt;br/&gt;Due to the asynchronous nature of a distributed transaction relay&lt;br/&gt;network, nodes may not receive all of the information needed to&lt;br/&gt;validate a transaction at once. For example, after a node completes&lt;br/&gt;Initial Block Download (IBD) and first starts participating in&lt;br/&gt;transaction relay with an empty mempool, it is common to receive&lt;br/&gt;orphans. In such scenarios where a node is aware that it is missing&lt;br/&gt;information, a &amp;#39;&amp;#39;receiver-initiated&amp;#39;&amp;#39; dialogue is appropriate:&lt;br/&gt;&lt;br/&gt;1. Receiver requests package information.&lt;br/&gt;&lt;br/&gt;2. The sender provides package information, including the wtxids of&lt;br/&gt;   the transactions in the package and anything else that might be&lt;br/&gt;relevant (e.g. total fees and size).&lt;br/&gt;&lt;br/&gt;3. The reciever uses the package information to decide how to request&lt;br/&gt;   and validate the transactions.&lt;br/&gt;&lt;br/&gt;Sometimes, no matter what order transactions are received by a node,&lt;br/&gt;validating them individually is insufficient. When the sender is aware&lt;br/&gt;of additional information that the receiver needs to accept a package,&lt;br/&gt;a proactive &amp;#39;&amp;#39;sender-initiated&amp;#39;&amp;#39; dialogue should be enabled:&lt;br/&gt;&lt;br/&gt;1. Sender announces they have package information pertaining to a&lt;br/&gt;   transaction that might otherwise be undesired on its own.&lt;br/&gt;&lt;br/&gt;2. The receiver requests package information.&lt;br/&gt;&lt;br/&gt;3. The sender provides package information, including the wtxids of&lt;br/&gt;   the transactions in the package and anything else that might be&lt;br/&gt;relevant (e.g. total fees and size).&lt;br/&gt;&lt;br/&gt;4. The reciever uses the package information to decide how to request&lt;br/&gt;   and validate the transactions.&lt;br/&gt;&lt;br/&gt;Package relay is negotiated between two peers during the version&lt;br/&gt;handshake. Package relay requires both peers to support wtxid-based&lt;br/&gt;relay because package transactions are referenced by their wtxid.&lt;br/&gt;&lt;br/&gt;====New Messages====&lt;br/&gt;&lt;br/&gt;Three new protocol messages are added for use in any version of&lt;br/&gt;package relay. Additionally, each version of package relay must define&lt;br/&gt;its own inv type and &amp;#34;pckginfo&amp;#34; message version, referred to in this&lt;br/&gt;document as &amp;#34;MSG_PCKG&amp;#34; and &amp;#34;pckginfo&amp;#34; respectively. See&lt;br/&gt;BIP-v1-packages for a concrete example.&lt;br/&gt;&lt;br/&gt;=====sendpackages=====&lt;br/&gt;&lt;br/&gt;{|&lt;br/&gt;|  Field Name  ||  Type  ||  Size  ||  Purpose&lt;br/&gt;|-&lt;br/&gt;|version || uint32_t || 4 || Denotes a package version supported by the&lt;br/&gt;node.&lt;br/&gt;|-&lt;br/&gt;|max_count || uint32_t || 4 ||Specifies the maximum number of transactions&lt;br/&gt;per package this node is&lt;br/&gt;willing to accept.&lt;br/&gt;|-&lt;br/&gt;|max_weight || uint32_t || 4 ||Specifies the maximum total weight per&lt;br/&gt;package this node is willing&lt;br/&gt;to accept.&lt;br/&gt;|-&lt;br/&gt;|}&lt;br/&gt;&lt;br/&gt;1. The &amp;#34;sendpackages&amp;#34; message has the structure defined above, with&lt;br/&gt;   pchCommand == &amp;#34;sendpackages&amp;#34;.&lt;br/&gt;&lt;br/&gt;2. During version handshake, nodes should send a &amp;#34;sendpackages&amp;#34;&lt;br/&gt;   message indicate they support package relay and may request&lt;br/&gt;packages.&lt;br/&gt;&lt;br/&gt;3. The message should contain a version supported by the node. Nodes&lt;br/&gt;   should send a &amp;#34;sendpackages&amp;#34; message for each version they support.&lt;br/&gt;&lt;br/&gt;4. The &amp;#34;sendpackages&amp;#34; message MUST be sent before sending a &amp;#34;verack&amp;#34;&lt;br/&gt;   message. If a &amp;#34;sendpackages&amp;#34; message is received afer &amp;#34;verack&amp;#34;, the&lt;br/&gt;sender should be disconnected.&lt;br/&gt;&lt;br/&gt;5. If &amp;#39;fRelay==false&amp;#39; in a peer&amp;#39;s version message, the node must not&lt;br/&gt;   send &amp;#34;sendpackages&amp;#34; to them. If a &amp;#34;sendpackages&amp;#34; message is&lt;br/&gt;received by a peer after sending `fRelay==false` in their version&lt;br/&gt;message, the sender should be disconnected.&lt;br/&gt;&lt;br/&gt;6.. Upon receipt of a &amp;#34;sendpackages&amp;#34; message with a version that is&lt;br/&gt;not supported, a node must treat the peer as if it never received the&lt;br/&gt;message.&lt;br/&gt;&lt;br/&gt;7. If both peers send &amp;#34;wtxidrelay&amp;#34; and &amp;#34;sendpackages&amp;#34; with the same&lt;br/&gt;   version, the peers should announce, request, and send package&lt;br/&gt;information to each other.&lt;br/&gt;&lt;br/&gt;=====getpckgtxns=====&lt;br/&gt;&lt;br/&gt;{|&lt;br/&gt;|  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;|-&lt;br/&gt;|txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;requested.&lt;br/&gt;|-&lt;br/&gt;|txns||List of wtxids||txns_length * 32|| The wtxids of each transaction in&lt;br/&gt;the package.&lt;br/&gt;|}&lt;br/&gt;&lt;br/&gt;1. The &amp;#34;getpckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;   pchCommand == &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&lt;br/&gt;2. A &amp;#34;getpckgtxns&amp;#34; message should be used to request all or some of&lt;br/&gt;   the transactions previously announced in a &amp;#34;pckginfo&amp;#34; message,&lt;br/&gt;specified by witness transactiosome id.&lt;br/&gt;&lt;br/&gt;3. Upon receipt of a &amp;#34;getpckgtxns&amp;#34; message, a node must respond with&lt;br/&gt;   either a &amp;#34;pckgtxns&amp;#34; containing the requested transactions or a&lt;br/&gt;&amp;#34;notfound&amp;#34; message indicating one or more of the transactions is&lt;br/&gt;unavailable. This allows the receiver to avoid downloading and storing&lt;br/&gt;transactions that cannot be validated immediately.&lt;br/&gt;&lt;br/&gt;4. A &amp;#34;getpckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;   send packages in the version handshake. If a &amp;#34;getpckgtxns&amp;#34; message&lt;br/&gt;is received from a peer with which package relay was not negotiated,&lt;br/&gt;the sender should be disconnected.&lt;br/&gt;&lt;br/&gt;=====pckgtxns=====&lt;br/&gt;&lt;br/&gt;{|&lt;br/&gt;|  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;|-&lt;br/&gt;|txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;provided.&lt;br/&gt;|-&lt;br/&gt;|txns||List of transactions||variable|| The transactions in the package.&lt;br/&gt;|}&lt;br/&gt;&lt;br/&gt;1. The &amp;#34;pckgtxns&amp;#34; message has the structure defined above, with&lt;br/&gt;   pchCommand == &amp;#34;pckgtxns&amp;#34;.&lt;br/&gt;&lt;br/&gt;2. A &amp;#34;pckgtxns&amp;#34; message should contain the transaction data requested&lt;br/&gt;   using &amp;#34;getpckgtxns&amp;#34;.&lt;br/&gt;&lt;br/&gt;3. A &amp;#34;pckgtxns&amp;#34; message should only be sent to a peer that requested&lt;br/&gt;   the package using &amp;#34;getpckgtxns&amp;#34;. If a node receives an unsolicited&lt;br/&gt;package, the sender should be disconnected.&lt;br/&gt;&lt;br/&gt;4. A &amp;#34;pckgtxns&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;   send packages in the version handshake. If a &amp;#34;pckgtxns&amp;#34; message is&lt;br/&gt;received from a peer with which package relay was not negotiated, the&lt;br/&gt;sender should be disconnected.&lt;br/&gt;&lt;br/&gt;===Version 1 Packages: child-with-unconfirmed-parents===&lt;br/&gt;&lt;br/&gt;This extends package relay for packages consisting of one transaction&lt;br/&gt;and all of its unconfirmed parents,by defining version 1 packages, a&lt;br/&gt;pckginfo1 message, and a MSG_PCKG1 inv type. It enables the use case&lt;br/&gt;in which a child pays for its otherwise-too-low-fee parents and their&lt;br/&gt;mempool conflict(s).&lt;br/&gt;&lt;br/&gt;====Intended Protocol Flow====&lt;br/&gt;&lt;br/&gt;When relaying a package of low-fee parent(s) and high-fee child, the&lt;br/&gt;sender and receiver do the following:&lt;br/&gt;&lt;br/&gt;1. Sender announces they have a child-with-unconfirmed-parents package&lt;br/&gt;   for a child that pays for otherwise-too-low-fee parent(s) using&lt;br/&gt;&amp;#34;inv(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&lt;br/&gt;2. The receiver requests package information using&lt;br/&gt;   &amp;#34;getdata(MSG_PCKG1)&amp;#34;.&lt;br/&gt;&lt;br/&gt;3. The sender provides package information using &amp;#34;pckginfo1&amp;#34;,&lt;br/&gt;   including the blockhash of the sender&amp;#39;s best block, the wtxids of&lt;br/&gt;the transactions in the package, their total fees and total weight.&lt;br/&gt;&lt;br/&gt;4. The reciever uses the package information to decide how to request&lt;br/&gt;   the transactions. For example, if the receiver already has some of&lt;br/&gt;the transactions in their mempool, they only request the missing ones.&lt;br/&gt;They could also decide not to request the package at all based on the&lt;br/&gt;fee information provided.&lt;br/&gt;&lt;br/&gt;5. Upon receiving a &amp;#34;pckgtxns&amp;#34;, the receiver submits the transactions&lt;br/&gt;   together as a package.&lt;br/&gt;&lt;br/&gt;====New Messages====&lt;br/&gt;&lt;br/&gt;A new inv type, &amp;#34;MSG_PCKG1&amp;#34;, and new protocol message, &amp;#34;PCKGINFO1&amp;#34;,&lt;br/&gt;are added.&lt;br/&gt;&lt;br/&gt;=====pckginfo1=====&lt;br/&gt;&lt;br/&gt;{|&lt;br/&gt;|  Field Name  ||  Type  ||  Size  ||   Purpose&lt;br/&gt;|-&lt;br/&gt;|blockhash || uint256 || 32 || The chain tip at which this package is&lt;br/&gt;defined.&lt;br/&gt;|-&lt;br/&gt;|pckg_fee||CAmount||4|| The sum total fees paid by all transactions in the&lt;br/&gt;package.&lt;br/&gt;|-&lt;br/&gt;|pckg_weight||int64_t||8|| The sum total weight of all transactions in the&lt;br/&gt;package.&lt;br/&gt;|-&lt;br/&gt;|txns_length||CompactSize||1 or 3 bytes|| The number of transactions&lt;br/&gt;provided.&lt;br/&gt;|-&lt;br/&gt;|txns||List of wtxids||txns_length * 32|| The wtxids of each transaction in&lt;br/&gt;the package.&lt;br/&gt;|}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;1. The &amp;#34;pckginfo1&amp;#34; message has the structure defined above, with&lt;br/&gt;   pchCommand == &amp;#34;pckginfo1&amp;#34;.&lt;br/&gt;&lt;br/&gt;2. A &amp;#34;pckginfo1&amp;#34; message contains information about a version 1&lt;br/&gt;   package (defined below), referenced by the wtxid of the transaction&lt;br/&gt;it pertains to and the current blockhash.&lt;br/&gt;&lt;br/&gt;3. Upon receipt of a &amp;#34;pckginfo1&amp;#34; message, the node should decide if it&lt;br/&gt;   wants to validate the package, request transaction data if&lt;br/&gt;necessary, etc.&lt;br/&gt;&lt;br/&gt;4. Upon receipt of a malformed &amp;#34;pckginfo1&amp;#34; message or package that&lt;br/&gt;   does not abide by the max_count, max_weight, or other rules&lt;br/&gt;specified by the version agreed upon in the initial negotiation, the&lt;br/&gt;sender should be disconnected.  If a node receives a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;message for which the &amp;#34;pckg_fee&amp;#34; or &amp;#34;pckg_weight&amp;#34; do not reflect the&lt;br/&gt;true total fees and weight, respectively, or the transactions in the&lt;br/&gt;package, the message is malformed.&lt;br/&gt;&lt;br/&gt;5. A node MUST NOT send a &amp;#34;pckginfo1&amp;#34; message that has not been&lt;br/&gt;   requested by the recipient. Upon receipt of an unsolicited&lt;br/&gt;&amp;#34;pckginfo1&amp;#34;, a node should disconnect the sender.&lt;br/&gt;&lt;br/&gt;6. A &amp;#34;pckginfo1&amp;#34; message should only be sent if both peers agreed to&lt;br/&gt;   send version 1 packages in the version handshake. If a &amp;#34;pckginfo1&amp;#34;&lt;br/&gt;message is received from a peer with which package relay was not&lt;br/&gt;negotiated, the sender should be disconnected.&lt;br/&gt;&lt;br/&gt;=====MSG_PCKG1=====&lt;br/&gt;&lt;br/&gt;1. A new inv type (MSG_PCKG1 == 0x6) is added, for use in inv messages&lt;br/&gt;   and getdata requests pertaining to version 1 packages.&lt;br/&gt;&lt;br/&gt;2. As an inv type, it indicates that both transaction data and version&lt;br/&gt;   1 package information are available for the transaction. The&lt;br/&gt;transaction is referenced by its wtxid. As a getdata request type, it&lt;br/&gt;indicates that the sender wants package information for the&lt;br/&gt;transaction.&lt;br/&gt;&lt;br/&gt;3. Upon receipt of a &amp;#34;getdata&amp;#34; request for &amp;#34;MSG_PCKG1&amp;#34;, the node&lt;br/&gt;   should respond with the version 1 package corresponding to the&lt;br/&gt;requested transaction and its current chain tip, or with NOTFOUND.&lt;br/&gt;The node should not assume that the sender is requesting the&lt;br/&gt;transaction data as well.&lt;br/&gt;&lt;br/&gt;====Child With Parent Packages Rules====&lt;br/&gt;&lt;br/&gt;A child-with-unconfirmed-parents package sent between nodes must abide&lt;br/&gt;by the rules below, otherwise the package is malformed and the sender&lt;br/&gt;should be disconnected.&lt;br/&gt;&lt;br/&gt;A version 1 or &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package can be&lt;br/&gt;defined for any transaction that spends unconfirmed inputs. The child&lt;br/&gt;can be thought of as the &amp;#34;representative&amp;#34; of the package. This package&lt;br/&gt;can be uniquely identified by the transaction&amp;#39;s wtxid and the current&lt;br/&gt;chain tip block hash.&lt;br/&gt;&lt;br/&gt;A &amp;#39;&amp;#39;child-with-unconfirmed-parents&amp;#39;&amp;#39; package MUST be:&lt;br/&gt;&lt;br/&gt;1. &amp;#39;&amp;#39;Sorted topologically.&amp;#39;&amp;#39; For every transaction t in the package,&lt;br/&gt;   if any of t&amp;#39;s parents are present in the package, the parent must&lt;br/&gt;appear somewhere in the list before t. In other words, the&lt;br/&gt;transactions must be sorted in ascending order of the number of&lt;br/&gt;ancestors present in the package.&lt;br/&gt;&lt;br/&gt;2. &amp;#39;&amp;#39;Only 1 child with unconfirmed parents.&amp;#39;&amp;#39; The package must consist&lt;br/&gt;   of one transaction and its unconfirmed parents. There must not be&lt;br/&gt;any other transactions in the package. Other dependency relationships&lt;br/&gt;may exist within the package (e.g. one parent may spend the output of&lt;br/&gt;another parent) provided that topological order is respected.&lt;br/&gt;&lt;br/&gt;3. &amp;#39;&amp;#39;All unconfirmed parents.&amp;#39;&amp;#39; All of the child&amp;#39;s unconfirmed parents&lt;br/&gt;   must be present.&lt;br/&gt;&lt;br/&gt;4. &amp;#39;&amp;#39;No conflicts.&amp;#39;&amp;#39; None of the transactions in the package may&lt;br/&gt;   conflict with each other (i.e.  spend the same prevout).&lt;br/&gt;&lt;br/&gt;5. &amp;#39;&amp;#39;Total fees and weight.&amp;#39;&amp;#39; The &amp;#39;total_fee&amp;#39; and &amp;#39;total_weight&amp;#39;&lt;br/&gt;   fields must accurately represent the sum total of all transactions&amp;#39;&lt;br/&gt;fees and weights as defined in BIP141, respectively.&lt;br/&gt;&lt;br/&gt;Not all of the child&amp;#39;s parents must be present; the child transaction&lt;br/&gt;may also spend confirmed inputs. However, if the child has confirmed&lt;br/&gt;parents, they must not be in the package.&lt;br/&gt;&lt;br/&gt;While a child-with-unconfirmed-parents package is perhaps most&lt;br/&gt;relevant when the child has a higher feerate than its parents, this&lt;br/&gt;property is not required to construct a valid package.&lt;br/&gt;&lt;br/&gt;====Clarifications====&lt;br/&gt;&lt;br/&gt;&amp;#39;&amp;#39;Q: Under what circumstances should a sender announce a&lt;br/&gt;child-with-unconfirmed-parents package?&amp;#39;&amp;#39;&lt;br/&gt;&lt;br/&gt;A child-with-unconfirmed-parents package for a transaction should be&lt;br/&gt;announced when it meets the peer&amp;#39;s fee filter but one or more of its&lt;br/&gt;parents don&amp;#39;t; a &amp;#34;inv(MSG_PCKG1)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34; should be sent&lt;br/&gt;for the child. Each of the parents which meet the peer&amp;#39;s fee filter&lt;br/&gt;should still be announced normally.&lt;br/&gt;&lt;br/&gt;&amp;#39;&amp;#39;Q: What if a new block arrives in between messages?&amp;#39;&amp;#39;&lt;br/&gt;&lt;br/&gt;A child-with-unconfirmed-parents package is defined for a transaction&lt;br/&gt;based on the current chain state. As such, a new block extending the&lt;br/&gt;tip may decrease the number of transactions in the package (i.e. if&lt;br/&gt;any of the transaction&amp;#39;s parents were included in the block). In a&lt;br/&gt;reorg, the number of transactions in the package may decrease or&lt;br/&gt;increase (i.e. if any of the transaction&amp;#39;s parents were included in a&lt;br/&gt;block in the previous chain but not the new one).&lt;br/&gt;&lt;br/&gt;If the new block arrives before the &amp;#34;getdata&amp;#34; or &amp;#34;pckginfo1&amp;#34;, nothing&lt;br/&gt;needs to change.&lt;br/&gt;&lt;br/&gt;If the new block arrives before &amp;#34;getpckgtxns&amp;#34; or before &amp;#34;pckgtxns&amp;#34;,&lt;br/&gt;the receiver may need to re-request package information if the block&lt;br/&gt;contained a transaction in the package. If the block doesn&amp;#39;t contain&lt;br/&gt;any transactions in the package, whether it extends the previous tip&lt;br/&gt;or causes a reorg, nothing needs to change.&lt;br/&gt;&lt;br/&gt;&amp;#39;&amp;#39;Q: Can &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages contain only one&lt;br/&gt;transaction?&amp;#39;&amp;#39;&lt;br/&gt;&lt;br/&gt;Yes.&lt;br/&gt;&lt;br/&gt;===Further Protocol Extensions===&lt;br/&gt;&lt;br/&gt;When introducing a new type of package, assign it a version number &amp;#34;n&amp;#34;&lt;br/&gt;and use an additional &amp;#34;sendpackages&amp;#34; message during version handshake&lt;br/&gt;to negotiate support for it. An additional package information message&lt;br/&gt;&amp;#34;pckginfon&amp;#34; and inv type &amp;#34;MSG_PCKGn&amp;#34; should be defined for the type of&lt;br/&gt;package.  However, &amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; do not need to be&lt;br/&gt;changed.&lt;br/&gt;&lt;br/&gt;Example proposal for tx-with-unconfirmed-ancestors package relay: [19]&lt;br/&gt;&lt;br/&gt;===Compatibility===&lt;br/&gt;&lt;br/&gt;Older clients remain fully compatible and interoperable after this&lt;br/&gt;change. Clients implementing this protocol will only attempt to send&lt;br/&gt;and request packages if agreed upon during the version handshake.&lt;br/&gt;&lt;br/&gt;===Package Erlay===&lt;br/&gt;&lt;br/&gt;Clients using BIP330 reconciliation-based transaction relay (Erlay)&lt;br/&gt;are able to use package relay without interference. In fact, a package&lt;br/&gt;of transactions may be announced using both Erlay and package relay.&lt;br/&gt;After reconciliation, if the initiator would have announced a&lt;br/&gt;transaction by wtxid but also has package information for it, they may&lt;br/&gt;send &amp;#34;inv(MSG_PCKG)&amp;#34; instead of &amp;#34;inv(WTX)&amp;#34;.&lt;br/&gt;&lt;br/&gt;===Rationale===&lt;br/&gt;&lt;br/&gt;====P2P Message Design====&lt;br/&gt;&lt;br/&gt;These p2p messages are added for communication efficiency and, as&lt;br/&gt;such, one should measure alternative solutions based on the resources&lt;br/&gt;used to communicate (not necessarily trustworthy) information: We&lt;br/&gt;would like to minimize network bandwidth, avoid downloading a&lt;br/&gt;transaction more than once, avoid downloading transactions that are&lt;br/&gt;eventually rejected, and minimize storage allocated for&lt;br/&gt;not-yet-validated transactions.&lt;br/&gt;&lt;br/&gt;Consider these (plausible) scenarios in transaction relay:&lt;br/&gt;&lt;br/&gt;Alice (the &amp;#34;sender&amp;#34;) is relaying transactions to Bob (the &amp;#34;receiver&amp;#34;).&lt;br/&gt;Alice&amp;#39;s mempool has a minimum feerate of 1sat/vB and Bob&amp;#39;s has a&lt;br/&gt;minimum feerate of 3sat/vB. For simplicity, all transactions are&lt;br/&gt;1600Wu in virtual size and 500 bytes in serialized size. Apart from&lt;br/&gt;the spending relationships specified, all other inputs are from&lt;br/&gt;confirmed UTXOs.&lt;br/&gt;&lt;br/&gt;1. Package {A, B} where A pays 0 satoshis and B pays 8000 satoshis in&lt;br/&gt;   fees.&lt;br/&gt;&lt;br/&gt;2. Package {C, D} where C pays 0 satoshis and D pays 1200 satoshis in&lt;br/&gt;   fees.&lt;br/&gt;&lt;br/&gt;3. Package {E, F, G, H, J} that pays 4000, 8000, 0, 2000, and 4000&lt;br/&gt;   satoshis in fees, respectively.&lt;br/&gt;&lt;br/&gt;====Alternative Designs Considered====&lt;br/&gt;&lt;br/&gt;&amp;#39;&amp;#39;Package Information Only:&amp;#39;&amp;#39; Just having &amp;#34;pckginfo&amp;#34; gives enough&lt;br/&gt;information for the receiver to accept the package. Omit the&lt;br/&gt;&amp;#34;getpckgtxns&amp;#34; and &amp;#34;pckgtxns&amp;#34; messages. While this option is a good&lt;br/&gt;fallback if batched transaction download fails for some reason, it&lt;br/&gt;shouldn&amp;#39;t be used as the default because it &amp;#39;always&amp;#39; requires storage&lt;br/&gt;of unvalidated transactions.&lt;br/&gt;&lt;br/&gt;&amp;#39;&amp;#39;No Package Information Round:&amp;#39;&amp;#39; Instead of having a package&lt;br/&gt;information round, just use the child&amp;#39;s wtxid to refer to the package&lt;br/&gt;and always send the entire package together. This would cause nodes to&lt;br/&gt;redownload duplicate transactions.&lt;br/&gt;&lt;br/&gt;I have also created a slidedeck exploring various alternative designs&lt;br/&gt;and some examples in which they fall flat [20]. Please feel free to&lt;br/&gt;suggest other alternatives.&lt;br/&gt;&lt;br/&gt;====Versioning System====&lt;br/&gt;&lt;br/&gt;This protocol should be extensible to support multiple types of&lt;br/&gt;packages based on future desired use cases. Two &amp;#34;flavors&amp;#34; of&lt;br/&gt;versioning were considered:&lt;br/&gt;&lt;br/&gt;1. When package mempool acceptance is upgraded to support more types&lt;br/&gt;   of packages, increment the version number (similar to Erlay).&lt;br/&gt;During version handshake, peers negotiate which version of package&lt;br/&gt;relay they will use by each sending one &amp;#34;sendpackages&amp;#34; message.&lt;br/&gt;&lt;br/&gt;2. When introducing another type of package, assign a version number&lt;br/&gt;   to it and announce it as an additional supported version (similar&lt;br/&gt;to Compact Block Relay). During version handshake, peers send one&lt;br/&gt;&amp;#34;sendpackages&amp;#34; message for each version supported.&lt;br/&gt;&lt;br/&gt;The second option was favored because it allows different parameters&lt;br/&gt;for different versions.  For example, it should be possible to support&lt;br/&gt;both &amp;#34;arbitrary topology but maximum 3-transaction&amp;#34; package as well as&lt;br/&gt;&amp;#34;child-with-unconfirmed-parents with default mempool ancestor limits&amp;#34;&lt;br/&gt;packages simultaneously.&lt;br/&gt;&lt;br/&gt;==Acknowledgements==&lt;br/&gt;&lt;br/&gt;I hope to have made it abundantly clear that this proposal isn’t&lt;br/&gt;inventing the concept of package relay, and in fact builds upon years&lt;br/&gt;of work by many others, including Suhas Daftuar and Antoine Riard.&lt;br/&gt;&lt;br/&gt;Thank you to John Newbery and Martin Zumsande for input on the design.&lt;br/&gt;&lt;br/&gt;Thank you to Matt Corallo, Christian Decker, David Harding, Antoine&lt;br/&gt;Poinsot, Antoine Riard, Gregory Sanders, Chris Stewart, Bastien&lt;br/&gt;Teinturier, and others for input on the desired interface for&lt;br/&gt;contracting protocols.&lt;br/&gt;&lt;br/&gt;Looking forward to hearing your thoughts!&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;[0]:&lt;br/&gt;&lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&lt;/a&gt;&lt;br/&gt;[1]:&lt;br/&gt;&lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-April/002639.html&lt;/a&gt;&lt;br/&gt;[2]:&lt;br/&gt;&lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-June/002758.html&lt;/a&gt;&lt;br/&gt;[3]: &lt;a href=&#34;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&#34;&gt;https://github.com/t-bast/lightning-docs/blob/master/pinning-attacks.md&lt;/a&gt;&lt;br/&gt;[4]:&lt;br/&gt;&lt;a href=&#34;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&#34;&gt;https://github.com/revault/practical-revault/blob/master/transactions.md#cancel_tx&lt;/a&gt;&lt;br/&gt;[5]:&lt;br/&gt;&lt;a href=&#34;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&#34;&gt;https://github.com/discreetlogcontracts/dlcspecs/blob/master/Transactions.md#refund-transaction&lt;/a&gt;&lt;br/&gt;[6]: &lt;a href=&#34;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&#34;&gt;https://gist.github.com/instagibbs/60264606e181451e977e439a49f69fe1&lt;/a&gt;&lt;br/&gt;[7]:&lt;br/&gt;&lt;a href=&#34;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&#34;&gt;https://btctranscripts.com/adopting-bitcoin/2021/2021-11-16-gloria-zhao-transaction-relay-policy/#lightning-attacks&lt;/a&gt;&lt;br/&gt;[8]: &lt;a href=&#34;https://youtu.be/fbWSQvJjKFs?t=1438&#34;&gt;https://youtu.be/fbWSQvJjKFs?t=1438&lt;/a&gt;&lt;br/&gt;[9]:&lt;br/&gt;&lt;a href=&#34;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&#34;&gt;https://www.reddit.com/r/Bitcoin/comments/unew4e/looks_like_70_mvb_of_transactions_just_got_dumped/&lt;/a&gt;&lt;br/&gt;[10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7594&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7594&lt;/a&gt;&lt;br/&gt;[11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/7600&#34;&gt;https://github.com/bitcoin/bitcoin/pull/7600&lt;/a&gt;&lt;br/&gt;[12]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6455#issuecomment-122716820&lt;/a&gt;&lt;br/&gt;[13]: &lt;a href=&#34;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&#34;&gt;https://gist.github.com/sdaftuar/8756699bfcad4d3806ba9f3396d4e66a&lt;/a&gt;&lt;br/&gt;[14]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/14895&#34;&gt;https://github.com/bitcoin/bitcoin/issues/14895&lt;/a&gt;&lt;br/&gt;[15]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;[16]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;[17]:&lt;br/&gt;&lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;[18]: &lt;a href=&#34;https://github.com/users/glozow/projects/5/views/4?layout=board&#34;&gt;https://github.com/users/glozow/projects/5/views/4?layout=board&lt;/a&gt;&lt;br/&gt;[19]: &lt;a href=&#34;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&#34;&gt;https://gist.github.com/glozow/9b321cd3ef6505135c763112033ff2a7&lt;/a&gt;&lt;br/&gt;[20]:&lt;br/&gt;&lt;a href=&#34;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&#34;&gt;https://docs.google.com/presentation/d/1B__KlZO1VzxJGx-0DYChlWawaEmGJ9EGApEzrHqZpQc/edit?usp=sharing&lt;/a&gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220517/f2e7c128/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220517/f2e7c128/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:09:41Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsp40k6qx0nu88kmp60x6yxdtk8mgk57zkfnxw3clmnxkr6jmg4nuczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qg56msj</id>
    
      <title type="html">📅 Original date posted:2022-03-14 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsp40k6qx0nu88kmp60x6yxdtk8mgk57zkfnxw3clmnxkr6jmg4nuczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qg56msj" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsy8ww470zm3d4tyzn5ys9dc75rkt4rp80fr33ulpucpzjct3rym6gurzgjr&#39;&gt;nevent1q…zgjr&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-03-14&lt;br/&gt;📝 Original message:Hi Billy,&lt;br/&gt;&lt;br/&gt;&amp;gt; We should expect miners will be using a more complex, more optimal way of&lt;br/&gt;determining what blocks they&amp;#39;re working on [...] we should instead run with&lt;br/&gt;the assumption that miners keep all potentially relevant transactions in&lt;br/&gt;their mempools, including potentially many conflicting transctions, in&lt;br/&gt;order to create the most profitable blocks. And therefore we shouldn&amp;#39;t put&lt;br/&gt;the constraint on normal non-mining full nodes to do that same more-complex&lt;br/&gt;mempool behavior or add any complexity for the purpose of denying&lt;br/&gt;transaction replacements.&lt;br/&gt;&lt;br/&gt;&amp;gt; I think a lot of the complexity in these ideas is because of the attempt&lt;br/&gt;to match relay rules with miner&lt;br/&gt;inclusion rules.&lt;br/&gt;&lt;br/&gt;I think the assumption that miners are using a completely different&lt;br/&gt;implementation of mempool and block template building is false. IIUC, most&lt;br/&gt;miners use Bitcoin Core and perhaps configure their node differently (e.g.&lt;br/&gt;larger mempool and different minfeerates), but also use `getblocktemplate`&lt;br/&gt;which means the same ancestor package-based mining algorithm.&lt;br/&gt;&lt;br/&gt;Of course, I&amp;#39;m not a miner, so if anybody is a miner or has seen miners&amp;#39;&lt;br/&gt;setups, please correct me if I&amp;#39;m wrong.&lt;br/&gt;&lt;br/&gt;In either case, we would want our mining algorithm to result in block&lt;br/&gt;templates that are as close as possible to perfectly incentive compatibile.&lt;br/&gt;&lt;br/&gt;Fundamentally, I believe default mempool policy (which perhaps naturally&lt;br/&gt;creates a network-wide transaction relay policy) should be as close to the&lt;br/&gt;mining code as possible. Imagine node A only keeps 1 block&amp;#39;s worth of&lt;br/&gt;transactions, and node B keeps a (default) 300MB mempool. The contents of&lt;br/&gt;node A&amp;#39;s mempool should be as close as possible to a block template&lt;br/&gt;generated from node B&amp;#39;s mempool. Otherwise, node A&amp;#39;s mempool is not very&lt;br/&gt;useful - their fee estimation is flawed and compact block relay won&amp;#39;t do&lt;br/&gt;them much good if they need to re-request a lot of block transactions.&lt;br/&gt;Next, imagine that node B is a miner. It would be very suboptimal if the&lt;br/&gt;mining code was ancestor package-based (i.e. supports CPFP), but the&lt;br/&gt;mempool policy only cared about individual feerate, and evicted low-fee&lt;br/&gt;parents despite their high-fee children. It&amp;#39;s easy to see why this would be&lt;br/&gt;suboptimal.&lt;br/&gt;Attempting to match mempool policy with the mining algorithm is also&lt;br/&gt;arguably the point of package relay. Our mining code uses ancestor packages&lt;br/&gt;which is good, but we only submit transactions one at a time to the&lt;br/&gt;mempool, so a transaction&amp;#39;s high-fee children can&amp;#39;t be considered until&lt;br/&gt;they are all already in the mempool. Package relay allows us to start&lt;br/&gt;thinking about ancestor packages immediately when evaluating transactions&lt;br/&gt;for submission to the mempool.&lt;br/&gt;&lt;br/&gt;The attempt to match policy with miner inclusion rules is deliberate and&lt;br/&gt;necessary.&lt;br/&gt;&lt;br/&gt;&amp;gt; I want to echo James O&amp;#39;Beirne&amp;#39;s opinion on this that this may be the&lt;br/&gt;wrong path to go down (a path of more complexity without much gain). He&lt;br/&gt;said: &amp;#34;Special consideration for &amp;#34;what should be in the next block&amp;#34; and/or&lt;br/&gt;the caching of block templates seems like an imposing dependency, dragging&lt;br/&gt;in a bunch of state and infrastructure to a question that should be solely&lt;br/&gt;limited to mempool feerate aggregates and the feerate of the particular txn&lt;br/&gt;package a wallet is concerned with.&amp;#34;&lt;br/&gt;&lt;br/&gt;It seems that I under-explained the purpose of building/caching block&lt;br/&gt;templates in my original post, since both you and James have the same&lt;br/&gt;misunderstanding. Since RBF&amp;#39;s introduction, we have improved to an ancestor&lt;br/&gt;package-based mining algorithm. This supports CPFP (incentive compatible)&lt;br/&gt;and it is now common to see more complex &amp;#34;families&amp;#34; of transactions as&lt;br/&gt;users fee-bump transactions (market is working, yay). On the other hand, we&lt;br/&gt;no longer have an accurate way of determining a transaction&amp;#39;s &amp;#34;mining&lt;br/&gt;score,&amp;#34; i.e., the feerate of this transaction&amp;#39;s ancestor package when it is&lt;br/&gt;included in a block template using our current mining algorithm.&lt;br/&gt;&lt;br/&gt;This limitation is a big blocker in proposing new fee/feerate RBF rules.&lt;br/&gt;For example, if we say &amp;#34;the transaction needs a better feerate,&amp;#34; this is&lt;br/&gt;obviously flawed, since the original transactions may have very&lt;br/&gt;high-feerate children, and the replacement transaction may have low feerate&lt;br/&gt;parents. So what we really want is &amp;#34;the transaction needs to be more&lt;br/&gt;incentive compatible to mine based on our mining algorithm,&amp;#34; but we have no&lt;br/&gt;way of getting that information right now.&lt;br/&gt;&lt;br/&gt;In my original post, I [described 4 heuristics to get transaction&amp;#39;s &amp;#34;mining&lt;br/&gt;score&amp;#34;][1] using the current data cached in the mempool (e.g. max ancestor&lt;br/&gt;feerate of descendant set), as well as why they don&amp;#39;t work. As such, the&lt;br/&gt;best way to calculate a transaction&amp;#39;s mining score AFAICT is to grab all of&lt;br/&gt;the related transactions and build a mini &amp;#34;block template&amp;#34; with them. The&lt;br/&gt;[implementation][2] I sent last week also cuts out some of the fluff, so&lt;br/&gt;the pseudocode looks like this:&lt;br/&gt;&lt;br/&gt;// Get ALL connected entries (ancestors, descendants, siblings, cousins,&lt;br/&gt;coparents, etc.)&lt;br/&gt;vector&amp;lt;TxMempoolEntry&amp;gt; cluster = mempool.GetAllTransactionsRelatedTo(txid);&lt;br/&gt;sort(cluster, ancestorfeerate);&lt;br/&gt;&lt;br/&gt;// For deducting ancestors when they are included separately&lt;br/&gt;vector&amp;lt;ModifiedTxMempoolEntry&amp;gt; modified_entries;&lt;br/&gt;&lt;br/&gt;while (!cluster.empty() and !modified_entries.empty()) {&lt;br/&gt;    iter = BetterAncestorFeerateOf(cluster, modified_entries);&lt;br/&gt;    best_ancestor_package = GetAncestorSet(iter);&lt;br/&gt;    mining_score = Feerate(best_ancestor_package);&lt;br/&gt;    for (entry : best_ancestor_package) {&lt;br/&gt;       mining_scores[entry] = mining_score;&lt;br/&gt;       for (descendant : GetAllDescendants(entry) {&lt;br/&gt;           modified_entries[descendant].DeductAncestorFromAccounting(entry);&lt;br/&gt;       }&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;Perhaps somebody will come up with a better way to do this, but this is my&lt;br/&gt;solution, and I hope I&amp;#39;ve now sufficiently described why I&amp;#39;ve made an&lt;br/&gt;effort to think about this. It&amp;#39;s not because I want to make things more&lt;br/&gt;fancy or complicated, but because we currently have no way of accurately&lt;br/&gt;determining a transaction&amp;#39;s mining score. The reason I proposed a&lt;br/&gt;persistent block template is so we can efficiently query the mining score&lt;br/&gt;of all transactions in the mempool.&lt;br/&gt;&lt;br/&gt;&amp;gt; However, I do think that these DOS concerns are quite overblown. I wrote&lt;br/&gt;up a comment on your rbf-improvements.md&lt;br/&gt;&amp;lt;&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#gistcomment-4093100&amp;gt&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#gistcomment-4093100&amp;gt&lt;/a&gt;;&lt;br/&gt;detailing&lt;br/&gt;my thought process on that. The summary is that as long as the fee-rate&lt;br/&gt;relay rule is maintained, any &amp;#34;spam&amp;#34; is actually paid for, either by the&lt;br/&gt;&amp;#34;first&amp;#34; transaction in the spam chain, or by the &amp;#34;spam&amp;#34; itself.&lt;br/&gt;&lt;br/&gt;The DoS concern is not overblown. I recommend you re-read the [current RBF&lt;br/&gt;policy][3]; Rule 3 and 4 *are* the feerate relay rules. Removing Rule 3&lt;br/&gt;means allowing recycled fees, so new transactions are not necessarily&lt;br/&gt;&amp;#34;paying&amp;#34; anything.&lt;br/&gt;&lt;br/&gt;[1]:&lt;br/&gt;&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#mining-score-of-a-mempool-transaction&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#mining-score-of-a-mempool-transaction&lt;/a&gt;&lt;br/&gt;[2]: &lt;a href=&#34;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&#34;&gt;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&lt;/a&gt;&lt;br/&gt;[3]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&#34;&gt;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Sat, Mar 12, 2022 at 8:18 AM Billy Tetrud &amp;lt;billy.tetrud at gmail.com&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; In reading through more of the discussion, it seems the idea I presented&lt;br/&gt;&amp;gt; above might basically be a reformulation of t-bast&amp;#39;s rate-limiting idea&lt;br/&gt;&amp;gt; presented in this comment&lt;br/&gt;&amp;gt; &amp;lt;&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4081349#gistcomment-4081349&amp;gt&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4081349#gistcomment-4081349&amp;gt&lt;/a&gt;;.&lt;br/&gt;&amp;gt; Perhaps he could comment on whether that characterization is accurate.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; On Fri, Mar 11, 2022 at 10:22 AM Billy Tetrud &amp;lt;billy.tetrud at gmail.com&amp;gt;&lt;br/&gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt;  1. Transaction relay rate limiting&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I have a similar concern as yours, that this could prevent higher&lt;br/&gt;&amp;gt;&amp;gt; fee-rate transactions from being broadcast.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; 2. Staggered broadcast of replacement transactions: within some time&lt;br/&gt;&amp;gt;&amp;gt; interval, maybe accept multiple replacements for the same prevout, but only&lt;br/&gt;&amp;gt;&amp;gt; relay the original transaction.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; By this do you mean basically having a batching window where, on&lt;br/&gt;&amp;gt;&amp;gt; receiving a replacement transaction, a node will wait for a period of time,&lt;br/&gt;&amp;gt;&amp;gt; potentially receiving many replacements for the same transaction (or many&lt;br/&gt;&amp;gt;&amp;gt; separate conflicting transactions), and only broadcasting the &amp;#34;best&amp;#34; one(s)&lt;br/&gt;&amp;gt;&amp;gt; at the end of that time window?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Its an interesting idea, but it would produce a problem. Every hop that&lt;br/&gt;&amp;gt;&amp;gt; replacement transaction takes would be delayed by this staggered window. If&lt;br/&gt;&amp;gt;&amp;gt; the window were 3 minutes and transactions generally take 20 hops to get to&lt;br/&gt;&amp;gt;&amp;gt; the majority of miners, a &amp;#34;best-case average&amp;#34; delay might be 3.75 minutes&lt;br/&gt;&amp;gt;&amp;gt; (noting that among your 8 nodes, its quite likely one of them would have a&lt;br/&gt;&amp;gt;&amp;gt; window ending much sooner than 3 minutes). Some (maybe 3% of) nodes would&lt;br/&gt;&amp;gt;&amp;gt; experience delays of more than 20 minutes. That kind of delay isn&amp;#39;t great.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; However it made me think of another idea: a transaction replacement&lt;br/&gt;&amp;gt;&amp;gt; broadcast cooldown. What if nodes kept track of the time they broadcasted&lt;br/&gt;&amp;gt;&amp;gt; the last replacement for a package and had a relay cooldown after the last&lt;br/&gt;&amp;gt;&amp;gt; replacement was broadcasted? A node receiving a replacement would relay the&lt;br/&gt;&amp;gt;&amp;gt; replacement immediately if the package its replacing was broadcasted more&lt;br/&gt;&amp;gt;&amp;gt; than X seconds ago, and otherwise it would wait until the time when that&lt;br/&gt;&amp;gt;&amp;gt; package was broadcasted at least X seconds ago to broadcast it. Any&lt;br/&gt;&amp;gt;&amp;gt; replacements it receives during that waiting period would replace as&lt;br/&gt;&amp;gt;&amp;gt; normal, meaning the unrebroadcasted replacement would never be&lt;br/&gt;&amp;gt;&amp;gt; broadcasted, and only the highest value replacement would be broadcasted at&lt;br/&gt;&amp;gt;&amp;gt; the end of the cooldown.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This wouldn&amp;#39;t prevent a higher-fee-rate transaction from being&lt;br/&gt;&amp;gt;&amp;gt; broadcasted (like rate limiting could), but would still be effective at&lt;br/&gt;&amp;gt;&amp;gt; limiting unnecessary data transmission. Another benefit is that in the&lt;br/&gt;&amp;gt;&amp;gt; non-adversarial case, replacement transactions wouldn&amp;#39;t be subject to any&lt;br/&gt;&amp;gt;&amp;gt; delay at all (while in the staggered broadcast idea, most replacements&lt;br/&gt;&amp;gt;&amp;gt; would experience some delay). And in the adversarial case, where a&lt;br/&gt;&amp;gt;&amp;gt; malicious actor broadcasts a low-as-possible-value replacement just before&lt;br/&gt;&amp;gt;&amp;gt; yours, the worst case delay is just whatever the cooldown period is. I&lt;br/&gt;&amp;gt;&amp;gt; would imagine that maybe 1 minute would be a reasonable worst-case delay.&lt;br/&gt;&amp;gt;&amp;gt; This would limit spam for a transaction that makes it into a block to ~10x&lt;br/&gt;&amp;gt;&amp;gt; (9 to 1). I don&amp;#39;t see much of a downside to doing this beyond just the&lt;br/&gt;&amp;gt;&amp;gt; slight additional complexity of relay rules (and considering it could save&lt;br/&gt;&amp;gt;&amp;gt; substantial additional code complexity, even that is a benefit).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; All a node would need to do is keep a timestamp on each transaction they&lt;br/&gt;&amp;gt;&amp;gt; receive for when it was broadcasted and check it when a replacement comes&lt;br/&gt;&amp;gt;&amp;gt; in. If now-broadcastDate &amp;lt; cooldown, set a timer for cooldown -&lt;br/&gt;&amp;gt;&amp;gt; (now-broadcastDate) to broadcast it. If another replacement comes in, clear&lt;br/&gt;&amp;gt;&amp;gt; that timer and repeat using the original broadcast date (since the&lt;br/&gt;&amp;gt;&amp;gt; unbroadcast transaction doesn&amp;#39;t have a broadcast date yet).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I think it might also be useful to note that eliminating &amp;#34;extra data&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; caused by careless or malicious actors (spam or whatever you want to call&lt;br/&gt;&amp;gt;&amp;gt; it) should not be the goal. It is impossible to prevent all spam. What we&lt;br/&gt;&amp;gt;&amp;gt; should be aiming for is more specific: we should attempt to design a system&lt;br/&gt;&amp;gt;&amp;gt; where spam is manageable. Eg if our goal is to ensure that a bitcoin node&lt;br/&gt;&amp;gt;&amp;gt; uses no more than 10% of the bandwidth of a &amp;#34;normal&amp;#34; user, if current&lt;br/&gt;&amp;gt;&amp;gt; non-spam traffic only requires 1% of a &amp;#34;normal&amp;#34; users&amp;#39;s bandwidth, then the&lt;br/&gt;&amp;gt;&amp;gt; network can bear a 9 to 1 ratio of spam. When a node spins up, there is a&lt;br/&gt;&amp;gt;&amp;gt; lot more data to download and process. So we know that all full nodes can&lt;br/&gt;&amp;gt;&amp;gt; handle at least as much traffic as they handle during IBD. What&amp;#39;s the&lt;br/&gt;&amp;gt;&amp;gt; difference between those amounts? I&amp;#39;m not sure, but I would guess that IBD&lt;br/&gt;&amp;gt;&amp;gt; is at least a couple times more demanding than a fully synced node. So I&lt;br/&gt;&amp;gt;&amp;gt; might suggest that as long as spam can be kept below a ratio of maybe 2 to&lt;br/&gt;&amp;gt;&amp;gt; 1, we should consider the design acceptable (and therefore more complexity&lt;br/&gt;&amp;gt;&amp;gt; unnecessary).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The 1 minute broadcast cooldown I mentioned before wouldn&amp;#39;t be quite&lt;br/&gt;&amp;gt;&amp;gt; sufficient to achieve that ratio. But a 3.33 minute cooldown would be.&lt;br/&gt;&amp;gt;&amp;gt; Whether this is &amp;#34;too much&amp;#34; is something that would have to be discussed, I&lt;br/&gt;&amp;gt;&amp;gt; suspect a worst-case adversarial 3.33 minute delay would not be &amp;#34;too much&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt; Doing this could basically eliminate any risk of actual service denial via&lt;br/&gt;&amp;gt;&amp;gt; replacement transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; However, I do think that these DOS concerns are quite overblown. I wrote&lt;br/&gt;&amp;gt;&amp;gt; up a comment on your rbf-improvements.md&lt;br/&gt;&amp;gt;&amp;gt; &amp;lt;&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#gistcomment-4093100&amp;gt&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4093100#gistcomment-4093100&amp;gt&lt;/a&gt;; detailing&lt;br/&gt;&amp;gt;&amp;gt; my thought process on that. The summary is that as long as the fee-rate&lt;br/&gt;&amp;gt;&amp;gt; relay rule is maintained, any &amp;#34;spam&amp;#34; is actually paid for, either by the&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;first&amp;#34; transaction in the spam chain, or by the &amp;#34;spam&amp;#34; itself. Even&lt;br/&gt;&amp;gt;&amp;gt; without something like a minimum RBF relay delay limiting how much spam&lt;br/&gt;&amp;gt;&amp;gt; could be created, the economics of the fee-rate rule already sufficiently&lt;br/&gt;&amp;gt;&amp;gt; mitigate the issue of spam.&lt;br/&gt;&amp;gt;&amp;gt; On Wed, Mar 9, 2022 at 9:37 AM Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Hi RBF friends,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Posting a summary of RBF discussions at coredev (mostly on transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; relay rate-limiting), user-elected descendant limit as a short term&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; solution to unblock package RBF, and mining score, all open for feedback:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; One big concept discussed was baking DoS protection into the p2p level&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; rather than policy level. TLDR: The fees are not paid to the node operator,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; but to the miner. While we can use fees to reason about the cost of an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; attack, if we&amp;#39;re ultimately interested in preventing resource exhaustion,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; maybe we want to &amp;#34;stop the bleeding&amp;#34; when it happens and bound the amount&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; of resources used in general. There were two main ideas:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; 1. Transaction relay rate limiting (i.e. the one you proposed above or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; some variation) with a feerate-based priority queue&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; 2. Staggered broadcast of replacement transactions: within some time&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; interval, maybe accept multiple replacements for the same prevout, but only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; relay the original transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Looking to solicit feedback on these ideas and the concept in general.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Is it a good idea (separate from RBF) to add rate-limiting in transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; relay? And is it the right direction to think about RBF DoS protection this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; way?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; A lingering concern that I have about this idea is it would then be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; possible to impact the propagation of another person’s transaction, i.e.,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; an attacker can censor somebody’s transaction from ever being announced by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; a node if they send enough transactions to fill up the rate limit.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Obviously this would be expensive since they&amp;#39;re spending a lot on fees, but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I imagine it could be profitable in some situations to spend a few thousand&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; dollars to prevent anyone from hearing about a transaction for a few hours.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; This might be a non-issue in practice if the rate limit is generous and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; traffic isn’t horrendous, but is this a problem?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; And if we don&amp;#39;t require an increase in (i.e. addition of &amp;#34;new&amp;#34;) absolute&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; fees, users are essentially allowed to “recycle” fees. In the scenario&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; where we prioritize relay based on feerate, users could potentially be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; placed higher in the queue, ahead of other users’ transactions, multiple&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; times, without ever adding more fees to the transaction. Again, maybe this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; isn’t a huge deal in practice if we set the parameters right, but it seems…&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; not great, in principle.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; ---------&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; It&amp;#39;s probably also a good idea to point out that there&amp;#39;s been some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; discussion happening on the gist containing my original post on this thread&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&lt;/a&gt;).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Suhas and Matt [proposed][0] adding a policy rule allowing users to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; specify descendant limits on their transactions. For example, some nth bit&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; of nSequence with nVersion 3 means &amp;#34;this transaction won&amp;#39;t have more than X&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; vbytes of descendants&amp;#34; where X = max(1000, vsizeof(tx)) or something. It&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; solves the pinning problem with package RBF where the attacker&amp;#39;s package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; contains a very large and high-fee descendant.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; We could add this policy and deploy it with package RBF/package relay so&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; that LN can use it by setting the user-elected descendant limit flag on&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; commitment transactions. (Otherwise package RBF is blocked until we find a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; more comprehensive solution to the pinning attack).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; It&amp;#39;s simple to [implement][1] as a mempool policy, but adds some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; complexity for wallets that use it, since it limits their use of UTXOs from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transactions with this bit set.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; ---------&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Also, coming back to the idea of &amp;#34;we can&amp;#39;t just use {individual,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; ancestor} feerate,&amp;#34; I&amp;#39;m interested in soliciting feedback on adding a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; “mining score” calculator. I&amp;#39;ve implemented one [here][2] which takes the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transaction in question, grabs all of the connected mempool transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (including siblings, coparents, etc., as they wouldn’t be in the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; nor descendant sets), and builds a “block template” using our current&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; mining algorithm. The mining score of a transaction is the ancestor feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; at which it is included.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; This would be helpful for something like ancestor-aware funding and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; fee-bumping in the wallet: [3], [4]. I think if we did the rate-limited&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; priority queue for transaction relay, we&amp;#39;d want to use something like this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; as the priority value. And for RBF, we probably want to require that a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; replacement have a higher mining score than the original transactions. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; could be computationally expensive to do all the time; it could be good to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; cache it but that could make mempool bookkeeping more complicated. Also, if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; we end up trying to switch to a candidate set-based algorithm for mining,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; we&amp;#39;d of course need a new calculator.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [0]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4058140#gistcomment-4058140&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4058140#gistcomment-4058140&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [1]: &lt;a href=&#34;https://github.com/glozow/bitcoin/tree/2022-02-user-desclimit&#34;&gt;https://github.com/glozow/bitcoin/tree/2022-02-user-desclimit&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [2] &lt;a href=&#34;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&#34;&gt;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [3]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/9645&#34;&gt;https://github.com/bitcoin/bitcoin/issues/9645&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/15553&#34;&gt;https://github.com/bitcoin/bitcoin/issues/15553&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; On Tue, Feb 8, 2022 at 4:58 AM Anthony Towns &amp;lt;aj at erisian.com.au&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On Mon, Feb 07, 2022 at 11:16:26AM &#43;0000, Gloria Zhao wrote:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; @aj:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; I wonder sometimes if it could be sufficient to just have a relay&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; limit and prioritise by ancestor feerate though. Maybe something&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; like:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; - instead of adding txs to each peers setInventoryTxToSend&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; immediately,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   set a mempool flag &amp;#34;relayed=false&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; - on a time delay, add the top N (by fee rate) &amp;#34;relayed=false&amp;#34; txs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   each peer&amp;#39;s setInventoryTxToSend and mark them as &amp;#34;relayed=true&amp;#34;;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   calculate how much kB those txs were, and do this again after&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   SIZE/RATELIMIT seconds&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; - don&amp;#39;t include &amp;#34;relayed=false&amp;#34; txs when building blocks?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The &amp;#34;?&amp;#34; was me not being sure that point is a good suggestion...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Miners might reasonably decide to have no rate limit, and always relay,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and never exclude txs -- but the question then becomes is whether they&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; hear about the tx at all, so rate limiting behaviour could still be a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; potential problem for whoever made the tx.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; Wow cool! I think outbound tx relay size-based rate-limiting and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; prioritizing tx relay by feerate are great ideas for preventing&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; spammers&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; from wasting bandwidth network-wide. I agree, this would slow the low&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; feerate spam down, preventing a huge network-wide bandwidth spike.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; And it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; would allow high feerate transactions to propagate as they should,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; regardless of how busy traffic is. Combined with inbound tx request&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; rate-limiting, might this be sufficient to prevent DoS regardless of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; fee-based replacement policies?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I think you only want to do outbound rate limits, ie, how often you send&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; INV, GETDATA and TX messages? Once you receive any of those, I think&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; you have to immediately process / ignore it, you can&amp;#39;t really sensibly&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; defer it (beyond the existing queues we have that just build up while&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; we&amp;#39;re busy processing other things first)?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; One point that I&amp;#39;m not 100% clear on: is it ok to prioritize the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; transactions by ancestor feerate in this scheme? As I described in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; original post, this can be quite different from the actual feerate we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; consider a transaction in a block for. The transaction could have a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; high&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; feerate sibling bumping its ancestor.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; For example, A (1sat/vB) has 2 children: B (49sat/vB) and C&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (5sat/vB). If&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; we just received C, it would be incorrect to give it a priority equal&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; its ancestor feerate (3sat/vB) because if we constructed a block&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; template&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; now, B would bump A, and C&amp;#39;s new ancestor feerate is 5sat/vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; Then, if we imagine that top N is &amp;gt;5sat/vB, we&amp;#39;re not relaying C. If&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; also exclude C when building blocks, we&amp;#39;re missing out on good fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I think you&amp;#39;re right that this would be ugly. It&amp;#39;s something of a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; special case:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  a) you really care about C getting into the next block; but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  b) you&amp;#39;re trusting B not being replaced by a higher fee tx that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     doesn&amp;#39;t have A as a parent; and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  c) there&amp;#39;s a lot of txs bidding the floor of the next block up to a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     level in-between the ancestor fee rate of 3sat/vB and the tx fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     rate of 5sat/vB&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Without (a), maybe you don&amp;#39;t care about it getting to a miner quickly.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If your trust in (b) was misplaced, then your tx&amp;#39;s effective fee rate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; will drop and (because of (c)), you&amp;#39;ll lose anyway. And if the spam ends&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; up outside of (c)&amp;#39;s range, either the rate limiting won&amp;#39;t take effect&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (spam&amp;#39;s too cheap) and you&amp;#39;ll be fine, or you&amp;#39;ll miss out on the block&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; anyway (spam&amp;#39;s paying more than your tx rate) and you never had any hope&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of making it in.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Note that we already rate limit via INVENTORY_BROADCAST_MAX /&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *_INVENTORY_BROADCAST_INTERVAL; which gets to something like 10,500 txs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; per 10 minutes for outbound connections. This would be a weight based&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rate limit instead-of/in-addition-to that, I guess.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; As far as a non-ugly approach goes, I think you&amp;#39;d have to be smarter&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; about&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; tracking the &amp;#34;effective fee rate&amp;#34; than the ancestor fee rate manages;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; maybe that&amp;#39;s something that could fall out of Murch and Clara&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; candidate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; set blockbuilding ideas [0] ?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Perhaps that same work would also make it possible to come up with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a better answer to &amp;#34;do I care that this replacement would invalidate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; these descendents?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [0] &lt;a href=&#34;https://github.com/Xekyo/blockbuilding&#34;&gt;https://github.com/Xekyo/blockbuilding&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt; - keep high-feerate evicted txs around for a while in case they get&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   mined by someone else to improve compact block relay, a la the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; &amp;gt;   orphan pool?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; Replaced transactions are already added to vExtraTxnForCompact :D&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I guess I was thinking that it&amp;#39;s just a 100 tx LRU cache, which might&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not be good enough?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Maybe it would be more on point to have a rate limit apply only to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement transactions?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; For wallets, AJ&amp;#39;s &amp;#34;All you need is for there to be *a* path that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; follows&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; the new relay rules and gets from your node/wallet to perhaps 10% of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; hashpower&amp;#34; makes sense to me (which would be the former).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Perhaps a corollarly of that is that it&amp;#39;s *better* to have the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; acceptance rule only consider economic incentives, and have the spam&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; prevention only be about &amp;#34;shall I tell my peers about this?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If you don&amp;#39;t have that split; then the anti-spam rules can prevent you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; from getting the tx in the mempool at all; whereas if you do have the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; split, then even if the bitcoind anti-spam rules are blocking you at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; every turn, you can still send your tx to miners by some other route,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and then they can add it to their mempool directly without any hassle.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; aj&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220314/a6e228e5/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220314/a6e228e5/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:05:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqspvl74jnkk5e8su2f739s645pe5y5d7xrrakxtq2amq3edpvndtjgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qqlxulk</id>
    
      <title type="html">📅 Original date posted:2022-03-09 📝 Original message:Hi RBF ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqspvl74jnkk5e8su2f739s645pe5y5d7xrrakxtq2amq3edpvndtjgzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qqlxulk" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsvn8jxq38upjqsmex5nkwqtfr5wmtdk3tlfzgmkue9kvttnhuef0qr9rlfc&#39;&gt;nevent1q…rlfc&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-03-09&lt;br/&gt;📝 Original message:Hi RBF friends,&lt;br/&gt;&lt;br/&gt;Posting a summary of RBF discussions at coredev (mostly on transaction&lt;br/&gt;relay rate-limiting), user-elected descendant limit as a short term&lt;br/&gt;solution to unblock package RBF, and mining score, all open for feedback:&lt;br/&gt;&lt;br/&gt;One big concept discussed was baking DoS protection into the p2p level&lt;br/&gt;rather than policy level. TLDR: The fees are not paid to the node operator,&lt;br/&gt;but to the miner. While we can use fees to reason about the cost of an&lt;br/&gt;attack, if we&amp;#39;re ultimately interested in preventing resource exhaustion,&lt;br/&gt;maybe we want to &amp;#34;stop the bleeding&amp;#34; when it happens and bound the amount&lt;br/&gt;of resources used in general. There were two main ideas:&lt;br/&gt;&lt;br/&gt;1. Transaction relay rate limiting (i.e. the one you proposed above or some&lt;br/&gt;variation) with a feerate-based priority queue&lt;br/&gt;2. Staggered broadcast of replacement transactions: within some time&lt;br/&gt;interval, maybe accept multiple replacements for the same prevout, but only&lt;br/&gt;relay the original transaction.&lt;br/&gt;&lt;br/&gt;Looking to solicit feedback on these ideas and the concept in general. Is&lt;br/&gt;it a good idea (separate from RBF) to add rate-limiting in transaction&lt;br/&gt;relay? And is it the right direction to think about RBF DoS protection this&lt;br/&gt;way?&lt;br/&gt;&lt;br/&gt;A lingering concern that I have about this idea is it would then be&lt;br/&gt;possible to impact the propagation of another person’s transaction, i.e.,&lt;br/&gt;an attacker can censor somebody’s transaction from ever being announced by&lt;br/&gt;a node if they send enough transactions to fill up the rate limit.&lt;br/&gt;Obviously this would be expensive since they&amp;#39;re spending a lot on fees, but&lt;br/&gt;I imagine it could be profitable in some situations to spend a few thousand&lt;br/&gt;dollars to prevent anyone from hearing about a transaction for a few hours.&lt;br/&gt;This might be a non-issue in practice if the rate limit is generous and&lt;br/&gt;traffic isn’t horrendous, but is this a problem?&lt;br/&gt;&lt;br/&gt;And if we don&amp;#39;t require an increase in (i.e. addition of &amp;#34;new&amp;#34;) absolute&lt;br/&gt;fees, users are essentially allowed to “recycle” fees. In the scenario&lt;br/&gt;where we prioritize relay based on feerate, users could potentially be&lt;br/&gt;placed higher in the queue, ahead of other users’ transactions, multiple&lt;br/&gt;times, without ever adding more fees to the transaction. Again, maybe this&lt;br/&gt;isn’t a huge deal in practice if we set the parameters right, but it seems…&lt;br/&gt;not great, in principle.&lt;br/&gt;&lt;br/&gt;---------&lt;br/&gt;&lt;br/&gt;It&amp;#39;s probably also a good idea to point out that there&amp;#39;s been some&lt;br/&gt;discussion happening on the gist containing my original post on this thread&lt;br/&gt;(&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&lt;/a&gt;).&lt;br/&gt;&lt;br/&gt;Suhas and Matt [proposed][0] adding a policy rule allowing users to specify&lt;br/&gt;descendant limits on their transactions. For example, some nth bit of&lt;br/&gt;nSequence with nVersion 3 means &amp;#34;this transaction won&amp;#39;t have more than X&lt;br/&gt;vbytes of descendants&amp;#34; where X = max(1000, vsizeof(tx)) or something. It&lt;br/&gt;solves the pinning problem with package RBF where the attacker&amp;#39;s package&lt;br/&gt;contains a very large and high-fee descendant.&lt;br/&gt;&lt;br/&gt;We could add this policy and deploy it with package RBF/package relay so&lt;br/&gt;that LN can use it by setting the user-elected descendant limit flag on&lt;br/&gt;commitment transactions. (Otherwise package RBF is blocked until we find a&lt;br/&gt;more comprehensive solution to the pinning attack).&lt;br/&gt;&lt;br/&gt;It&amp;#39;s simple to [implement][1] as a mempool policy, but adds some complexity&lt;br/&gt;for wallets that use it, since it limits their use of UTXOs from&lt;br/&gt;transactions with this bit set.&lt;br/&gt;&lt;br/&gt;---------&lt;br/&gt;&lt;br/&gt;Also, coming back to the idea of &amp;#34;we can&amp;#39;t just use {individual, ancestor}&lt;br/&gt;feerate,&amp;#34; I&amp;#39;m interested in soliciting feedback on adding a “mining score”&lt;br/&gt;calculator. I&amp;#39;ve implemented one [here][2] which takes the transaction in&lt;br/&gt;question, grabs all of the connected mempool transactions (including&lt;br/&gt;siblings, coparents, etc., as they wouldn’t be in the ancestor nor&lt;br/&gt;descendant sets), and builds a “block template” using our current mining&lt;br/&gt;algorithm. The mining score of a transaction is the ancestor feerate at&lt;br/&gt;which it is included.&lt;br/&gt;&lt;br/&gt;This would be helpful for something like ancestor-aware funding and&lt;br/&gt;fee-bumping in the wallet: [3], [4]. I think if we did the rate-limited&lt;br/&gt;priority queue for transaction relay, we&amp;#39;d want to use something like this&lt;br/&gt;as the priority value. And for RBF, we probably want to require that a&lt;br/&gt;replacement have a higher mining score than the original transactions. This&lt;br/&gt;could be computationally expensive to do all the time; it could be good to&lt;br/&gt;cache it but that could make mempool bookkeeping more complicated. Also, if&lt;br/&gt;we end up trying to switch to a candidate set-based algorithm for mining,&lt;br/&gt;we&amp;#39;d of course need a new calculator.&lt;br/&gt;&lt;br/&gt;[0]:&lt;br/&gt;&lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4058140#gistcomment-4058140&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff?permalink_comment_id=4058140#gistcomment-4058140&lt;/a&gt;&lt;br/&gt;[1]: &lt;a href=&#34;https://github.com/glozow/bitcoin/tree/2022-02-user-desclimit&#34;&gt;https://github.com/glozow/bitcoin/tree/2022-02-user-desclimit&lt;/a&gt;&lt;br/&gt;[2] &lt;a href=&#34;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&#34;&gt;https://github.com/glozow/bitcoin/tree/2022-02-mining-score&lt;/a&gt;&lt;br/&gt;[3]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/9645&#34;&gt;https://github.com/bitcoin/bitcoin/issues/9645&lt;/a&gt;&lt;br/&gt;[4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/issues/15553&#34;&gt;https://github.com/bitcoin/bitcoin/issues/15553&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, Feb 8, 2022 at 4:58 AM Anthony Towns &amp;lt;aj at erisian.com.au&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; On Mon, Feb 07, 2022 at 11:16:26AM &#43;0000, Gloria Zhao wrote:&lt;br/&gt;&amp;gt; &amp;gt; @aj:&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; I wonder sometimes if it could be sufficient to just have a relay rate&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; limit and prioritise by ancestor feerate though. Maybe something like:&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; - instead of adding txs to each peers setInventoryTxToSend immediately,&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   set a mempool flag &amp;#34;relayed=false&amp;#34;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; - on a time delay, add the top N (by fee rate) &amp;#34;relayed=false&amp;#34; txs to&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   each peer&amp;#39;s setInventoryTxToSend and mark them as &amp;#34;relayed=true&amp;#34;;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   calculate how much kB those txs were, and do this again after&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   SIZE/RATELIMIT seconds&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; - don&amp;#39;t include &amp;#34;relayed=false&amp;#34; txs when building blocks?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The &amp;#34;?&amp;#34; was me not being sure that point is a good suggestion...&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Miners might reasonably decide to have no rate limit, and always relay,&lt;br/&gt;&amp;gt; and never exclude txs -- but the question then becomes is whether they&lt;br/&gt;&amp;gt; hear about the tx at all, so rate limiting behaviour could still be a&lt;br/&gt;&amp;gt; potential problem for whoever made the tx.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; Wow cool! I think outbound tx relay size-based rate-limiting and&lt;br/&gt;&amp;gt; &amp;gt; prioritizing tx relay by feerate are great ideas for preventing spammers&lt;br/&gt;&amp;gt; &amp;gt; from wasting bandwidth network-wide. I agree, this would slow the low&lt;br/&gt;&amp;gt; &amp;gt; feerate spam down, preventing a huge network-wide bandwidth spike. And it&lt;br/&gt;&amp;gt; &amp;gt; would allow high feerate transactions to propagate as they should,&lt;br/&gt;&amp;gt; &amp;gt; regardless of how busy traffic is. Combined with inbound tx request&lt;br/&gt;&amp;gt; &amp;gt; rate-limiting, might this be sufficient to prevent DoS regardless of the&lt;br/&gt;&amp;gt; &amp;gt; fee-based replacement policies?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think you only want to do outbound rate limits, ie, how often you send&lt;br/&gt;&amp;gt; INV, GETDATA and TX messages? Once you receive any of those, I think&lt;br/&gt;&amp;gt; you have to immediately process / ignore it, you can&amp;#39;t really sensibly&lt;br/&gt;&amp;gt; defer it (beyond the existing queues we have that just build up while&lt;br/&gt;&amp;gt; we&amp;#39;re busy processing other things first)?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; One point that I&amp;#39;m not 100% clear on: is it ok to prioritize the&lt;br/&gt;&amp;gt; &amp;gt; transactions by ancestor feerate in this scheme? As I described in the&lt;br/&gt;&amp;gt; &amp;gt; original post, this can be quite different from the actual feerate we&lt;br/&gt;&amp;gt; would&lt;br/&gt;&amp;gt; &amp;gt; consider a transaction in a block for. The transaction could have a high&lt;br/&gt;&amp;gt; &amp;gt; feerate sibling bumping its ancestor.&lt;br/&gt;&amp;gt; &amp;gt; For example, A (1sat/vB) has 2 children: B (49sat/vB) and C (5sat/vB). If&lt;br/&gt;&amp;gt; &amp;gt; we just received C, it would be incorrect to give it a priority equal to&lt;br/&gt;&amp;gt; &amp;gt; its ancestor feerate (3sat/vB) because if we constructed a block template&lt;br/&gt;&amp;gt; &amp;gt; now, B would bump A, and C&amp;#39;s new ancestor feerate is 5sat/vB.&lt;br/&gt;&amp;gt; &amp;gt; Then, if we imagine that top N is &amp;gt;5sat/vB, we&amp;#39;re not relaying C. If we&lt;br/&gt;&amp;gt; &amp;gt; also exclude C when building blocks, we&amp;#39;re missing out on good fees.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think you&amp;#39;re right that this would be ugly. It&amp;#39;s something of a&lt;br/&gt;&amp;gt; special case:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  a) you really care about C getting into the next block; but&lt;br/&gt;&amp;gt;  b) you&amp;#39;re trusting B not being replaced by a higher fee tx that&lt;br/&gt;&amp;gt;     doesn&amp;#39;t have A as a parent; and&lt;br/&gt;&amp;gt;  c) there&amp;#39;s a lot of txs bidding the floor of the next block up to a&lt;br/&gt;&amp;gt;     level in-between the ancestor fee rate of 3sat/vB and the tx fee&lt;br/&gt;&amp;gt;     rate of 5sat/vB&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Without (a), maybe you don&amp;#39;t care about it getting to a miner quickly.&lt;br/&gt;&amp;gt; If your trust in (b) was misplaced, then your tx&amp;#39;s effective fee rate&lt;br/&gt;&amp;gt; will drop and (because of (c)), you&amp;#39;ll lose anyway. And if the spam ends&lt;br/&gt;&amp;gt; up outside of (c)&amp;#39;s range, either the rate limiting won&amp;#39;t take effect&lt;br/&gt;&amp;gt; (spam&amp;#39;s too cheap) and you&amp;#39;ll be fine, or you&amp;#39;ll miss out on the block&lt;br/&gt;&amp;gt; anyway (spam&amp;#39;s paying more than your tx rate) and you never had any hope&lt;br/&gt;&amp;gt; of making it in.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Note that we already rate limit via INVENTORY_BROADCAST_MAX /&lt;br/&gt;&amp;gt; *_INVENTORY_BROADCAST_INTERVAL; which gets to something like 10,500 txs&lt;br/&gt;&amp;gt; per 10 minutes for outbound connections. This would be a weight based&lt;br/&gt;&amp;gt; rate limit instead-of/in-addition-to that, I guess.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; As far as a non-ugly approach goes, I think you&amp;#39;d have to be smarter about&lt;br/&gt;&amp;gt; tracking the &amp;#34;effective fee rate&amp;#34; than the ancestor fee rate manages;&lt;br/&gt;&amp;gt; maybe that&amp;#39;s something that could fall out of Murch and Clara&amp;#39;s candidate&lt;br/&gt;&amp;gt; set blockbuilding ideas [0] ?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Perhaps that same work would also make it possible to come up with&lt;br/&gt;&amp;gt; a better answer to &amp;#34;do I care that this replacement would invalidate&lt;br/&gt;&amp;gt; these descendents?&amp;#34;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; [0] &lt;a href=&#34;https://github.com/Xekyo/blockbuilding&#34;&gt;https://github.com/Xekyo/blockbuilding&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt; - keep high-feerate evicted txs around for a while in case they get&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   mined by someone else to improve compact block relay, a la the&lt;br/&gt;&amp;gt; &amp;gt; &amp;gt;   orphan pool?&lt;br/&gt;&amp;gt; &amp;gt; Replaced transactions are already added to vExtraTxnForCompact :D&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I guess I was thinking that it&amp;#39;s just a 100 tx LRU cache, which might&lt;br/&gt;&amp;gt; not be good enough?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Maybe it would be more on point to have a rate limit apply only to&lt;br/&gt;&amp;gt; replacement transactions?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; For wallets, AJ&amp;#39;s &amp;#34;All you need is for there to be *a* path that follows&lt;br/&gt;&amp;gt; &amp;gt; the new relay rules and gets from your node/wallet to perhaps 10% of&lt;br/&gt;&amp;gt; &amp;gt; hashpower&amp;#34; makes sense to me (which would be the former).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Perhaps a corollarly of that is that it&amp;#39;s *better* to have the mempool&lt;br/&gt;&amp;gt; acceptance rule only consider economic incentives, and have the spam&lt;br/&gt;&amp;gt; prevention only be about &amp;#34;shall I tell my peers about this?&amp;#34;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If you don&amp;#39;t have that split; then the anti-spam rules can prevent you&lt;br/&gt;&amp;gt; from getting the tx in the mempool at all; whereas if you do have the&lt;br/&gt;&amp;gt; split, then even if the bitcoind anti-spam rules are blocking you at&lt;br/&gt;&amp;gt; every turn, you can still send your tx to miners by some other route,&lt;br/&gt;&amp;gt; and then they can add it to their mempool directly without any hassle.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; aj&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220309/097a4111/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220309/097a4111/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:05:53Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2xcwnfvj2jkhs0e7pucvpkh76skuxs5d9sd5jxykgn2cq9vazcngzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qtvpcfz</id>
    
      <title type="html">📅 Original date posted:2022-02-07 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2xcwnfvj2jkhs0e7pucvpkh76skuxs5d9sd5jxykgn2cq9vazcngzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qtvpcfz" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsdc8hfz7lmwr8j4pp7844q2n8p3d8kqx38jcmsf3us53qz7e8hfhqvjefap&#39;&gt;nevent1q…efap&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-02-07&lt;br/&gt;📝 Original message:Hi everyone,&lt;br/&gt;&lt;br/&gt;Thanks for giving your attention to the post! I haven&amp;#39;t had time to write&lt;br/&gt;responses to everything, but sending my thoughts about what has been most&lt;br/&gt;noteworthy to me:&lt;br/&gt;&lt;br/&gt;@jeremy:&lt;br/&gt;&amp;gt; A final point is that a verifiable delay function could be used over,&lt;br/&gt;e.g., each of the N COutpoints individually to rate-limit transaction&lt;br/&gt;replacement. The VDF period can be made shorter / eliminated depending on&lt;br/&gt;the feerate increase.&lt;br/&gt;&lt;br/&gt;Thanks for the suggestion! In general, I don&amp;#39;t think rate limiting by&lt;br/&gt;outpoint/prevout is a safe option, as it is particularly dangerous for L2&lt;br/&gt;applications with shared prevouts. For example, the prevout that LN channel&lt;br/&gt;counterparties conflict on is the output from their shared funding tx. Any&lt;br/&gt;kind of limit on spending this prevout can be monopolized by a spammy&lt;br/&gt;attacker. For example, if you only allow 1 per minute, the attacker will&lt;br/&gt;just race to take up that slot every minute to prevent the honest party&amp;#39;s&lt;br/&gt;transaction from being accepted.&lt;br/&gt;This is similar to the pinning attack based on monopolizing the&lt;br/&gt;transaction&amp;#39;s descendant limit, except we can&amp;#39;t carve out an exemption&lt;br/&gt;because we wouldn&amp;#39;t know whose replacement we&amp;#39;re looking at.&lt;br/&gt;&lt;br/&gt;@tbast:&lt;br/&gt;&amp;gt; The way I understand it, limiting the impact on descendant transactions&lt;br/&gt;is only important for DoS protection, not for incentive compatibility.&lt;br/&gt;&lt;br/&gt;&amp;gt; I believe it&amp;#39;s completely ok to require increasing both the fees and&lt;br/&gt;feerate if we don&amp;#39;t take descendants into account, because you control your&lt;br/&gt;ancestor set - whereas the descendant set may be completely out of your&lt;br/&gt;control.&lt;br/&gt;&lt;br/&gt;Ignoring descendants of direct conflicts would certainly make our lives&lt;br/&gt;much easier! Unfortunately, I don&amp;#39;t think we can do this since they can be&lt;br/&gt;fee bumps, i.e., in AJ&amp;#39;s example. Considering descendants is important for&lt;br/&gt;both incentive compatibility and DoS.&lt;br/&gt;If the replacement transaction has a higher feerate than its direct&lt;br/&gt;conflict, but the direct conflict also has high feerate descendants, we&lt;br/&gt;might end up with lower fees and/or feerates by accepting the replacement.&lt;br/&gt;&lt;br/&gt;@aj:&lt;br/&gt;&amp;gt; I wonder sometimes if it could be sufficient to just have a relay rate&lt;br/&gt;limit and prioritise by ancestor feerate though. Maybe something like:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; - instead of adding txs to each peers setInventoryTxToSend immediately,&lt;br/&gt;&amp;gt;   set a mempool flag &amp;#34;relayed=false&amp;#34;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; - on a time delay, add the top N (by fee rate) &amp;#34;relayed=false&amp;#34; txs to&lt;br/&gt;&amp;gt;   each peer&amp;#39;s setInventoryTxToSend and mark them as &amp;#34;relayed=true&amp;#34;;&lt;br/&gt;&amp;gt;   calculate how much kB those txs were, and do this again after&lt;br/&gt;&amp;gt;   SIZE/RATELIMIT seconds&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; - don&amp;#39;t include &amp;#34;relayed=false&amp;#34; txs when building blocks?&lt;br/&gt;&lt;br/&gt;Wow cool! I think outbound tx relay size-based rate-limiting and&lt;br/&gt;prioritizing tx relay by feerate are great ideas for preventing spammers&lt;br/&gt;from wasting bandwidth network-wide. I agree, this would slow the low&lt;br/&gt;feerate spam down, preventing a huge network-wide bandwidth spike. And it&lt;br/&gt;would allow high feerate transactions to propagate as they should,&lt;br/&gt;regardless of how busy traffic is. Combined with inbound tx request&lt;br/&gt;rate-limiting, might this be sufficient to prevent DoS regardless of the&lt;br/&gt;fee-based replacement policies?&lt;br/&gt;&lt;br/&gt;One point that I&amp;#39;m not 100% clear on: is it ok to prioritize the&lt;br/&gt;transactions by ancestor feerate in this scheme? As I described in the&lt;br/&gt;original post, this can be quite different from the actual feerate we would&lt;br/&gt;consider a transaction in a block for. The transaction could have a high&lt;br/&gt;feerate sibling bumping its ancestor.&lt;br/&gt;For example, A (1sat/vB) has 2 children: B (49sat/vB) and C (5sat/vB). If&lt;br/&gt;we just received C, it would be incorrect to give it a priority equal to&lt;br/&gt;its ancestor feerate (3sat/vB) because if we constructed a block template&lt;br/&gt;now, B would bump A, and C&amp;#39;s new ancestor feerate is 5sat/vB.&lt;br/&gt;Then, if we imagine that top N is &amp;gt;5sat/vB, we&amp;#39;re not relaying C. If we&lt;br/&gt;also exclude C when building blocks, we&amp;#39;re missing out on good fees.&lt;br/&gt;&lt;br/&gt;&amp;gt; - keep high-feerate evicted txs around for a while in case they get&lt;br/&gt;&amp;gt;   mined by someone else to improve compact block relay, a la the&lt;br/&gt;&amp;gt;   orphan pool?&lt;br/&gt;&lt;br/&gt;Replaced transactions are already added to vExtraTxnForCompact :D&lt;br/&gt;&lt;br/&gt;@ariard&lt;br/&gt;&amp;gt; Deployment of Taproot opens interesting possibilities in the&lt;br/&gt;vaults/payment channels design space, where the tapscripts can commit to&lt;br/&gt;different set of timelocks/quorum of keys. Even if the pre-signed states&lt;br/&gt;stay symmetric, whoever is the publisher, the feerate cost to spend can&lt;br/&gt;fluctuate.&lt;br/&gt;&lt;br/&gt;Indeed, perhaps with taproot we may legitimately have&lt;br/&gt;same-txid-different-witness transactions as a normal thing rather than rare&lt;br/&gt;edge case. But as with everything enabled by taproot, I wouldn&amp;#39;t count our&lt;br/&gt;tapscript eggs until a concrete use case hatches and/or an application&lt;br/&gt;actually implements it.&lt;br/&gt;&lt;br/&gt;&amp;gt; How this new replacement rule would behave if you have a parent in the&lt;br/&gt;&amp;#34;replace-by-feerate&amp;#34; half but the child is in the &amp;#34;replace-by-fee&amp;#34; one ?&lt;br/&gt;&lt;br/&gt;Thanks for considering my suggestion! This particular scenario is not&lt;br/&gt;possible, since a child cannot be considered for the next block without its&lt;br/&gt;parent. But if the original transactions are found both in and outside the&lt;br/&gt;next block, I think it would be fine to just require both are met.&lt;br/&gt;&lt;br/&gt;&amp;gt; Overall, I think there is the deployment issue to warn of. Moving to a&lt;br/&gt;new set of RBF rules implies for a lot of Bitcoin applications to rewrite&lt;br/&gt;their RBF logics.&lt;br/&gt;&lt;br/&gt;I agree that transitioning as painlessly as possible would be a huge&lt;br/&gt;priority in any kind of upgrade to mempool policy. I&amp;#39;m very interested in&lt;br/&gt;hearing wallet devs&amp;#39; feedback on this.&lt;br/&gt;I&amp;#39;m also not actually clear on what backwards compatibility in this&lt;br/&gt;scenario would look like. I imagine it to mean we run both sets of RBF&lt;br/&gt;rules and accept the replacement if it passes either one. Or do we only&lt;br/&gt;accept the replacement if it passes both?&lt;br/&gt;For wallets, AJ&amp;#39;s &amp;#34;All you need is for there to be *a* path that follows&lt;br/&gt;the new relay rules and gets from your node/wallet to perhaps 10% of&lt;br/&gt;hashpower&amp;#34; makes sense to me (which would be the former). For merchants who&lt;br/&gt;care more about making sure the original transaction isn&amp;#39;t replaceable,&lt;br/&gt;would they prefer that either policy is sufficient to prevent a replacement&lt;br/&gt;(more in line with the latter)? Or is that covered by signaling / am I&lt;br/&gt;overthinking this?&lt;br/&gt;&lt;br/&gt;Thanks,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Mon, Feb 7, 2022 at 10:24 AM Bastien TEINTURIER via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Good morning,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; The tricky question is what happens when X arrives on its own and it&lt;br/&gt;&amp;gt; &amp;gt; might be that no one ever sends a replacement for B,C,D)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It feels ok to me, but this is definitely arguable.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It covers the fact that B,C,D could have been fake transactions whose&lt;br/&gt;&amp;gt; sole purpose was to do a pinning attack: in that case the attacker would&lt;br/&gt;&amp;gt; have found a way to ensure these transactions don&amp;#39;t confirm anyway (or&lt;br/&gt;&amp;gt; pay minimal/negligible fees).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If these transactions were legitimate, I believe that their owners would&lt;br/&gt;&amp;gt; remake them at some point (because these transactions reflect a business&lt;br/&gt;&amp;gt; relationship that needed to happen, so it should very likely still&lt;br/&gt;&amp;gt; happen). It&amp;#39;s probably hard to verify because the new corresponding&lt;br/&gt;&amp;gt; transactions may have nothing in common with the first, but I think the&lt;br/&gt;&amp;gt; simplifications it offers for wallets is worth it (which is just my&lt;br/&gt;&amp;gt; opinion and needs more scrutiny/feedback).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; But if your backlog&amp;#39;s feerate does drop off, *and* that matters, then&lt;br/&gt;&amp;gt; &amp;gt; I don&amp;#39;t think you can ignore the impact of the descendent transactions&lt;br/&gt;&amp;gt; &amp;gt; that you might not get a replacement for.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; That is because you&amp;#39;re only taking into account the current backlog, and&lt;br/&gt;&amp;gt; not taking into account the fact that new items will be added to it soon&lt;br/&gt;&amp;gt; to replace the evicted descendants. But I agree that this is a bet: we&lt;br/&gt;&amp;gt; can&amp;#39;t predict the future and guarantee these replacements will come.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It is really a trade-off, ignoring descendents provides a much simpler&lt;br/&gt;&amp;gt; contract that doesn&amp;#39;t vary from one mempool to another, but when your&lt;br/&gt;&amp;gt; backlog isn&amp;#39;t full enough, you may lose some future profits if&lt;br/&gt;&amp;gt; transactions don&amp;#39;t come in later.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; I think &amp;#34;Y% higher&amp;#34; rather than just &amp;#34;higher&amp;#34; is only useful for&lt;br/&gt;&amp;gt; &amp;gt; rate-limiting, not incentive compatibility. (Though maybe it helps&lt;br/&gt;&amp;gt; &amp;gt; stabilise a greedy algorithm in some cases?)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; That&amp;#39;s true. I claimed these policies only address incentives, but using&lt;br/&gt;&amp;gt; a percentage increase addresses rate-limiting a bit as well (I couldn&amp;#39;t&lt;br/&gt;&amp;gt; resist trying to do at least something for it!). I find it a very easy&lt;br/&gt;&amp;gt; mechanism to implement, while choosing an absolute value is hard (it&amp;#39;s&lt;br/&gt;&amp;gt; always easier to think in relatives than absolutes).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; This is why I think it is important to understand the rationales for&lt;br/&gt;&amp;gt; introducing the rules in the first place&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I completely agree. As you mentioned, we are still in brainstorming&lt;br/&gt;&amp;gt; phase, once (if?) we start to converge on what could be better policies,&lt;br/&gt;&amp;gt; we do need to clearly explain each policy&amp;#39;s expected goal. That will let&lt;br/&gt;&amp;gt; future Bastien writing code in 2030 clearly highlight why the 2022 rules&lt;br/&gt;&amp;gt; don&amp;#39;t make sense anymore!&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le sam. 5 févr. 2022 à 14:22, Michael Folkson &amp;lt;&lt;br/&gt;&amp;gt; michaelfolkson at protonmail.com&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thanks for this Bastien (and Gloria for initially posting about this).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I sympathetically skimmed the eclair PR (&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/ACINQ/eclair/pull/2113&#34;&gt;https://github.com/ACINQ/eclair/pull/2113&lt;/a&gt;) dealing with replaceable&lt;br/&gt;&amp;gt;&amp;gt; transactions fee bumping.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; There will continue to be a (hopefully) friendly tug of war on this&lt;br/&gt;&amp;gt;&amp;gt; probably for the rest of Bitcoin&amp;#39;s existence. I am sure people like Luke,&lt;br/&gt;&amp;gt;&amp;gt; Prayank etc will (rightfully) continue to raise that Lightning and other&lt;br/&gt;&amp;gt;&amp;gt; second layer protocols shouldn&amp;#39;t demand that policy rules be changed if&lt;br/&gt;&amp;gt;&amp;gt; there is a reason (e.g. DoS vector) for those rules on the base network.&lt;br/&gt;&amp;gt;&amp;gt; But if there are rules that have no upside, introduce unnecessary&lt;br/&gt;&amp;gt;&amp;gt; complexity for no reason and make Lightning implementers like Bastien&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt; life miserable attempting to deal with them I really hope we can make&lt;br/&gt;&amp;gt;&amp;gt; progress on removing or simplifying them.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This is why I think it is important to understand the rationales for&lt;br/&gt;&amp;gt;&amp;gt; introducing the rules in the first place (and why it is safe to remove them&lt;br/&gt;&amp;gt;&amp;gt; if indeed it is) and being as rigorous as possible on the rationales for&lt;br/&gt;&amp;gt;&amp;gt; introducing additional rules. It sounds like from Gloria&amp;#39;s initial post we&lt;br/&gt;&amp;gt;&amp;gt; are still at a brainstorming phase (which is fine) but knowing what we know&lt;br/&gt;&amp;gt;&amp;gt; today I really hope we can learn from the mistakes of the original BIP 125,&lt;br/&gt;&amp;gt;&amp;gt; namely the Core implementation not matching the BIP and the sparse&lt;br/&gt;&amp;gt;&amp;gt; rationales for the rules. As Bastien says this is not criticizing the&lt;br/&gt;&amp;gt;&amp;gt; original BIP 125 authors, 7 years is a long time especially in Bitcoin&lt;br/&gt;&amp;gt;&amp;gt; world and they probably weren&amp;#39;t thinking about Bastien sitting down to&lt;br/&gt;&amp;gt;&amp;gt; write an eclair PR in late 2021 (and reviewers of that PR) when they wrote&lt;br/&gt;&amp;gt;&amp;gt; the BIP in 2015.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; --&lt;br/&gt;&amp;gt;&amp;gt; Michael Folkson&lt;br/&gt;&amp;gt;&amp;gt; Email: michaelfolkson at protonmail.com&lt;br/&gt;&amp;gt;&amp;gt; Keybase: michaelfolkson&lt;br/&gt;&amp;gt;&amp;gt; PGP: 43ED C999 9F85 1D40 EAF4 9835 92D6 0159 214C FEE3&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ------- Original Message -------&lt;br/&gt;&amp;gt;&amp;gt; On Monday, January 31st, 2022 at 3:57 PM, Bastien TEINTURIER via&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev &amp;lt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Many thanks for raising awareness on these issues and constantly pushing&lt;br/&gt;&amp;gt;&amp;gt; towards finding a better model. This work will highly improve the&lt;br/&gt;&amp;gt;&amp;gt; security of any multi-party contract trying to build on top of bitcoin&lt;br/&gt;&amp;gt;&amp;gt; (because most multi-party contracts will need to have timeout conditions&lt;br/&gt;&amp;gt;&amp;gt; and participants will need to make some transactions confirm before a&lt;br/&gt;&amp;gt;&amp;gt; timeout happens - otherwise they may lose funds).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; For starters, let me quickly explain why the current rules are hard to&lt;br/&gt;&amp;gt;&amp;gt; work with in the context of lightning (but I believe most L2 protocols&lt;br/&gt;&amp;gt;&amp;gt; will have the same issues). Feel free to skip this part if you are&lt;br/&gt;&amp;gt;&amp;gt; already convinced.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## Motivation&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The biggest pain point is BIP 125 rule 2.&lt;br/&gt;&amp;gt;&amp;gt; If I need to increase the fees of a time-sensitive transaction because&lt;br/&gt;&amp;gt;&amp;gt; the feerate has been rising since I broadcast it, I may need to also pay&lt;br/&gt;&amp;gt;&amp;gt; high fees just to produce a confirmed utxo that I can use. I&amp;#39;m actually&lt;br/&gt;&amp;gt;&amp;gt; paying a high fee twice instead of once (and needlessly using on-chain&lt;br/&gt;&amp;gt;&amp;gt; space, our scarcest asset, because we could have avoided that additional&lt;br/&gt;&amp;gt;&amp;gt; transaction!).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; It also has some annoying &amp;#34;non-determinism&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt; Imagine that my transaction has been evicted from my mempool because its&lt;br/&gt;&amp;gt;&amp;gt; feerate was too low. I could think &amp;#34;Great, that means I don&amp;#39;t have to&lt;br/&gt;&amp;gt;&amp;gt; apply BIP 125 restrictions, I can just fund this transaction as if it&lt;br/&gt;&amp;gt;&amp;gt; were a new one!&amp;#34;. But actually I do, because my transaction could still&lt;br/&gt;&amp;gt;&amp;gt; be in miner&amp;#39;s mempools and I have no way of knowing it...this means that&lt;br/&gt;&amp;gt;&amp;gt; whenever I have broadcast a transaction, I must assume that I will&lt;br/&gt;&amp;gt;&amp;gt; always need to abide by whatever replacement rules the network applies.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Fortunately, as far as I understand it, this rule only exists because of&lt;br/&gt;&amp;gt;&amp;gt; a previous implementation detail of bitcoin core, so there&amp;#39;s simply no&lt;br/&gt;&amp;gt;&amp;gt; good reason to keep it.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The second biggest pain point is rule 3. It prevents me from efficiently&lt;br/&gt;&amp;gt;&amp;gt; using my capital while it&amp;#39;s unconfirmed. Whenever I&amp;#39;m using a big utxo&lt;br/&gt;&amp;gt;&amp;gt; to fund a transaction, I will get a big change output, and it would&lt;br/&gt;&amp;gt;&amp;gt; really be a waste to be unable to use that change output to fund other&lt;br/&gt;&amp;gt;&amp;gt; transactions. In order to be capital-efficient, I will end up creating&lt;br/&gt;&amp;gt;&amp;gt; descendant trees for my time-sensitive transactions. But as Gloria&lt;br/&gt;&amp;gt;&amp;gt; explained, replacing all my children will cost me an absurdly large&lt;br/&gt;&amp;gt;&amp;gt; amount of fees. So what I&amp;#39;m actually planning to do instead is to RBF&lt;br/&gt;&amp;gt;&amp;gt; one of the descendants high enough to get the whole tree confirmed.&lt;br/&gt;&amp;gt;&amp;gt; But if those descendants&amp;#39; timeouts were far in the future, that&amp;#39;s a&lt;br/&gt;&amp;gt;&amp;gt; waste, I paid a lot more fees for them than I should have. I&amp;#39;d like to&lt;br/&gt;&amp;gt;&amp;gt; just replace my transaction and republish the invalidated children&lt;br/&gt;&amp;gt;&amp;gt; independently.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Rule 4 doesn&amp;#39;t hurt as much as the two previous ones, I don&amp;#39;t have too&lt;br/&gt;&amp;gt;&amp;gt; much to say about it.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; To be fair to the BIP 125 authors, all of these scenarios were very hard&lt;br/&gt;&amp;gt;&amp;gt; to forecast at the time this BIP was created. We needed years to build&lt;br/&gt;&amp;gt;&amp;gt; on those rules to get a better understanding of their limitations and if&lt;br/&gt;&amp;gt;&amp;gt; the rationale behind them made sense in the long term.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## Proposals&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I believe that now is a good time to re-think those, and I really like&lt;br/&gt;&amp;gt;&amp;gt; Gloria&amp;#39;s categorization of the design constraints.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I&amp;#39;d like to propose a different way of looking at descendants that makes&lt;br/&gt;&amp;gt;&amp;gt; it easier to design the new rules. The way I understand it, limiting the&lt;br/&gt;&amp;gt;&amp;gt; impact on descendant transactions is only important for DoS protection,&lt;br/&gt;&amp;gt;&amp;gt; not for incentive compatibility. I would argue that after evictions,&lt;br/&gt;&amp;gt;&amp;gt; descendant transactions will be submitted again (because they represent&lt;br/&gt;&amp;gt;&amp;gt; transactions that people actually want to make), so evicting them does&lt;br/&gt;&amp;gt;&amp;gt; not have a negative impact on mining incentives (in a world where blocks&lt;br/&gt;&amp;gt;&amp;gt; are full most of the time).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I&amp;#39;m curious to hear other people&amp;#39;s thoughts on that. If it makes sense,&lt;br/&gt;&amp;gt;&amp;gt; I would propose the following very simple rules:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. The transaction&amp;#39;s ancestor absolute fees must be X% higher than the&lt;br/&gt;&amp;gt;&amp;gt; previous transaction&amp;#39;s ancestor fees&lt;br/&gt;&amp;gt;&amp;gt; 2. The transaction&amp;#39;s ancestor feerate must be Y% higher than the&lt;br/&gt;&amp;gt;&amp;gt; previous transaction&amp;#39;s ancestor feerate&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I believe it&amp;#39;s completely ok to require increasing both the fees and&lt;br/&gt;&amp;gt;&amp;gt; feerate if we don&amp;#39;t take descendants into account, because you control&lt;br/&gt;&amp;gt;&amp;gt; your ancestor set - whereas the descendant set may be completely out of&lt;br/&gt;&amp;gt;&amp;gt; your control.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This is very easy to use by wallets, because the ancestor set is easy to&lt;br/&gt;&amp;gt;&amp;gt; obtain. And an important point is that the ancestor set is the same in&lt;br/&gt;&amp;gt;&amp;gt; every mempool, whereas the descendant set is not (your mempool may have&lt;br/&gt;&amp;gt;&amp;gt; rejected the last descendants, while other people&amp;#39;s mempools may still&lt;br/&gt;&amp;gt;&amp;gt; contain them).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Because of that reason, I&amp;#39;d like to avoid having a rule that relies on&lt;br/&gt;&amp;gt;&amp;gt; some size of the replaced descendant set: it may be valid in your&lt;br/&gt;&amp;gt;&amp;gt; mempool but invalid in someone else&amp;#39;s, which makes it exploitable for&lt;br/&gt;&amp;gt;&amp;gt; pinning attacks.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I believe these rules are incentive compatible (again, if you accept&lt;br/&gt;&amp;gt;&amp;gt; the fact that the descendants will be re-submitted and mined as well,&lt;br/&gt;&amp;gt;&amp;gt; so their fees aren&amp;#39;t lost).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Can we choose X and Y so that these two rules are also DoS-resistant?&lt;br/&gt;&amp;gt;&amp;gt; Unfortunately I&amp;#39;m not sure, so maybe we&amp;#39;ll need to add a third rule to&lt;br/&gt;&amp;gt;&amp;gt; address that. But before we do, can someone detail what it costs for a&lt;br/&gt;&amp;gt;&amp;gt; node to evict a descendant tree? Given that bitcoin core doesn&amp;#39;t allow&lt;br/&gt;&amp;gt;&amp;gt; chains of more than 25 transactions, the maximum number of transactions&lt;br/&gt;&amp;gt;&amp;gt; being replaced will be bounded by 25 * N (where N is the number of&lt;br/&gt;&amp;gt;&amp;gt; outputs of the transaction being replaced). If it&amp;#39;s just O(n) pruning of&lt;br/&gt;&amp;gt;&amp;gt; a graph, maybe that&amp;#39;s ok? Or maybe we make X or Y depend on the number&lt;br/&gt;&amp;gt;&amp;gt; of outputs of the transaction being replaced (this would need very&lt;br/&gt;&amp;gt;&amp;gt; careful thoughts)?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If you made it this far, thanks for reading!&lt;br/&gt;&amp;gt;&amp;gt; A couple of comments on the previous messages:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; Currently, if we see a transaction&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; that has the same txid as one in the mempool, we reject it as a&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; duplicate, even if the feerate is much higher. It&amp;#39;s unclear to me if&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; we have a very strong reason to change this, but noting it as a&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; limitation of our current replacement policy.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I don&amp;#39;t see a strong reason from an L2 protocol&amp;#39;s point of view yet, but&lt;br/&gt;&amp;gt;&amp;gt; there are many unkown unknowns. But from a miner incentive&amp;#39;s point of&lt;br/&gt;&amp;gt;&amp;gt; view, we should keep the transaction with the higher feerate, shouldn&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt; we? In that case it&amp;#39;s also a more efficient use of on-chain space, which&lt;br/&gt;&amp;gt;&amp;gt; is a win, right?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; We might have a more-or-less long transition period during which we&lt;br/&gt;&amp;gt;&amp;gt; support both...&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Yes, this is a long term thing.&lt;br/&gt;&amp;gt;&amp;gt; Even if bitcoin core releases a new version with updated RBF rules, as a&lt;br/&gt;&amp;gt;&amp;gt; wallet you&amp;#39;ll need to keep using the old rules for a long time if you&lt;br/&gt;&amp;gt;&amp;gt; want to be safe.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; But it&amp;#39;s all the more reason to try to ship this as soon as possible,&lt;br/&gt;&amp;gt;&amp;gt; this way maybe our grand-children will be able to benefit from it ;)&lt;br/&gt;&amp;gt;&amp;gt; (just kidding on the timespan obviously).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Le lun. 31 janv. 2022 à 00:11, Antoine Riard via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Thanks for this RBF sum up. Few thoughts and more context comments if it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; can help other readers.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; For starters, the absolute fee pinning attack is especially&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; problematic if we apply the same rules (i.e. Rule #3 and #4) in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; Package RBF. Imagine that Alice (honest) and Bob (adversary) share a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; LN channel. The mempool is rather full, so their pre-negotiated&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; commitment transactions&amp;#39; feerates would not be considered high&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; priority by miners. Bob broadcasts his commitment transaction and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; attaches a very large child (100KvB with 100,000sat in fees) to his&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; anchor output. Alice broadcasts her commitment transaction with a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; fee-bumping child (200vB with 50,000sat fees which is a generous&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 250sat/vB), but this does not meet the absolute fee requirement. She&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; would need to add another 50,000sat to replace Bob&amp;#39;s commitment&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Solving LN pinning attacks, what we&amp;#39;re aiming for is enabling a fair&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; feerate bid between the counterparties, thus either forcing the adversary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; to overbid or to disengage from the confirmation competition. If the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; replace-by-feerate rule is adopted, there shouldn&amp;#39;t be an incentive for Bob&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; pick up the first option. Though if he does, that&amp;#39;s a winning outcome&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; for Alice, as one of the commitment transactions confirms and her&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; time-sensitive second-stage HTLC can be subsequently confirmed.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; It&amp;#39;s unclear to me if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; we have a very strong reason to change this, but noting it as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; limitation of our current replacement policy. See [#24007][12].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Deployment of Taproot opens interesting possibilities in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; vaults/payment channels design space, where the tapscripts can commit to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; different set of timelocks/quorum of keys. Even if the pre-signed states&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; stay symmetric, whoever is the publisher, the feerate cost to spend can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; fluctuate.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; While this isn&amp;#39;t completely broken, and the user interface is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; secondary to the safety of the mempool policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I think with L2s transaction broadcast backend, the stability and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; clarity of the RBF user interface is primary. What we could be worried&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; about is a too-much complex interface easing the way for an attacker to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; trigger your L2 node to issue policy-invalid chain of transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Especially, when we consider that an attacker might have leverage on chain&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; of transactions composition (&amp;#34;force broadcast of commitment A then&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; commitment B, knowing they will share a CPFP&amp;#34;) or even transactions size&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (&amp;#34;overload commitment A with HTLCs&amp;#34;).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; * If the original transaction is in the top {0.75MvB, 1MvB} of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; mempool, apply the current rules (absolute fees must increase and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; pay for the replacement transaction&amp;#39;s new bandwidth). Otherwise, use a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; feerate-only rule.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; How this new replacement rule would behave if you have a parent in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;replace-by-feerate&amp;#34; half but the child is in the &amp;#34;replace-by-fee&amp;#34; one ?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; If we allow the replacement of the parent based on the feerate, we might&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; decrease the top block absolute fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; If we block the replacement of the parent based on the feerate because&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the replacement absolute fees aren&amp;#39;t above the replaced package, we still&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; preclude a pinning vector. The child might be low-feerate junk and even&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; attached to a low ancestor-score branch.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; If I&amp;#39;m correct on this limitation, maybe we could turn off the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;replace-by-fee&amp;#34; behavior as soon as the mempool is fulfilled with a few&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; blocks ?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; * Rate-limit how many replacements we allow per prevout.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Depending on how it is implemented, though I would be concerned it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; introduces a new pinning vector in the context of shared-utxo. If it&amp;#39;s a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; hardcoded constant, it could be exhausted by an adversary starting at the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; lowest acceptable feerate then slowly increasing while still not reaching&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the top of the mempool. Same if it&amp;#39;s time-based or block-based, no&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; guarantee the replacement slot is honestly used by your counterparty.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Further, an above-the-average replacement frequency might just be the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; reflection of your confirmation strategy reacting to block schedule or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; mempools historical data. As long as the feerate penalty is paid, I lean to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; allow replacement.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (One solution could be to associate per-user &amp;#34;tag&amp;#34; to the LN&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transactions, where each &amp;#34;tag&amp;#34; would have its own replacement slots, but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; privacy?)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; * Rate-limit transaction validation in general, per peer.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I think we could improve on the Core&amp;#39;s new transaction requester logic.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Maybe we could bind the peer announced flow based on the feerate score&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; (modulo validation time) of the previously validated transactions from that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; peer ? That said, while related to RBF, it sounds to me that enhancing&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Core&amp;#39;s rate-limiting transaction strategy is a whole discussion in itself&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [0]. Especially ensuring it&amp;#39;s tolerant to the specific requirements of LN &amp;amp;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; consorts.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; What should they be? We can do some arithmetic to see what happens if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; you start with the biggest/lowest feerate transaction and do a bunch&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; of replacements. Maybe we end up with values that are high enough to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; prevent abuse and make sense for applications/users that do RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; That&amp;#39;s a good question.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; One observation is that the attacker can always renew the set of DoSy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; utxos to pursue the attack. So maybe we could pick up constants scaled on&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the block size ? That way an attacker would have to burn fees, thus&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; deterring them from launching an attack. Even if the attackers are miners,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; they have to renounce their income to acquire new DoSy utxos. If a low-fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; period, we could scale up the constants ?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Overall, I think there is the deployment issue to warn of. Moving to a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; new set of RBF rules implies for a lot of Bitcoin applications to rewrite&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; their RBF logics. We might have a more-or-less long transition period&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; during which we support both...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Antoine&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; [0] &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21224&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21224&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Le jeu. 27 janv. 2022 à 09:10, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi everyone,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This post discusses limitations of current Bitcoin Core RBF policy and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attempts to start a conversation about how we can improve it,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; summarizing some ideas that have been discussed. Please reply if you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; have any new input on issues to be solved and ideas for improvement!&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Just in case I&amp;#39;ve screwed up the text wrapping again, another copy can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; found here:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Background&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Please feel free to skip this section if you are already familiar&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Nodes may receive *conflicting* unconfirmed transactions, aka&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;double spends&amp;#34; of the same inputs. Instead of always keeping the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; first transaction, since v0.12, Bitcoin Core mempool policy has&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; included a set of Replace-by-Fee (RBF) criteria that allows the second&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction to replace the first one and any descendants it may have.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Bitcoin Core RBF policy was previously documented as BIP 125.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The current RBF policy is documented [here][1]. In summary:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. The directly conflicting transactions all signal replaceability&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; explicitly.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. The replacement transaction only includes an unconfirmed input if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that input was included in one of the directly conflicting&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. The replacement transaction pays an absolute fee of at least the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; sum paid by the original transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. The additional fees pays for the replacement transaction&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bandwidth at or above the rate set by the node&amp;#39;s *incremental relay&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate*.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 5. The sum of all directly conflicting transactions&amp;#39; descendant counts&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (number of transactions inclusive of itself and its descendants)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; does not exceed 100.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We can split these rules into 3 categories/goals:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - **Allow Opting Out**: Some applications/businesses are unable to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; handle transactions that are replaceable (e.g. merchants that use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; zero-confirmation transactions). We (try to) help these businesses by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; honoring BIP125 signaling; we won&amp;#39;t replace transactions that have not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; opted in.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - **Incentive Compatibility**: Ensure that our RBF policy would not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accept replacement transactions which would decrease fee profits&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of a miner. In general, if our mempool policy deviates from what is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; economically rational, it&amp;#39;s likely that the transactions in our&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool will not match the ones in miners&amp;#39; mempools, making our&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee estimation, compact block relay, and other mempool-dependent&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; functions unreliable. Incentive-incompatible policy may also&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; encourage transaction submission through routes other than the p2p&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; network, harming censorship-resistance and privacy of Bitcoin payments.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - **DoS Protection**: Limit two types of DoS attacks on the node&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool: (1) the number of times a transaction can be replaced and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (2) the volume of transactions that can be evicted during a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Even more abstract: our goal is to make a replacement policy that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; results in a useful interface for users and safe policy for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; node operators.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Motivation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There are a number of known problems with the current RBF policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Many of these shortcomings exist due to mempool limitations at the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time RBF was implemented or result from new types of Bitcoin usage;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; they are not criticisms of the original design.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Pinning Attacks&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The most pressing concern is that attackers may take advantage of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limitations in RBF policy to prevent other users&amp;#39; transactions from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; being mined or getting accepted as a replacement.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### SIGHASH_ANYONECANPAY Pinning&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125#2 can be bypassed by creating intermediary transactions to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replaced together. Anyone can simply split a 1-input 1-output&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction off from the replacement transaction, then broadcast the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction as is. This can always be done, and quite cheaply. More&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; details in [this comment][2].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In general, if a transaction is signed with SIGHASH\_ANYONECANPAY,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; anybody can just attach a low feerate parent to this transaction and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; lower its ancestor feerate. Even if you require SIGHASH\_ALL which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; prevents an attacker from changing any outputs, the input can be a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; very low amount (e.g. just above the dust limit) from a low-fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor and still bring down the ancestor feerate of the transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; TLDR: if your transaction is signed with SIGHASH\_ANYONECANPAY and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; signals replaceability, regardless of the feerate you broadcast at, an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attacker can lower its mining priority by adding an ancestor.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Absolute Fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The restriction of requiring replacement transactions to increase the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; absolute fee of the mempool has been described as &amp;#34;bonkers.&amp;#34; If the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; original transaction has a very large descendant that pays a large&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; amount of fees, even if it has a low feerate, the replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction must now pay those fees in order to meet Rule #3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There are a number of reasons why, in order to enable Package RBF, we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cannot use the same criteria.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; For starters, the absolute fee pinning attack is especially&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; problematic if we apply the same rules (i.e. Rule #3 and #4) in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Package RBF. Imagine that Alice (honest) and Bob (adversary) share a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; LN channel. The mempool is rather full, so their pre-negotiated&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; commitment transactions&amp;#39; feerates would not be considered high&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; priority by miners. Bob broadcasts his commitment transaction and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attaches a very large child (100KvB with 100,000sat in fees) to his&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; anchor output. Alice broadcasts her commitment transaction with a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee-bumping child (200vB with 50,000sat fees which is a generous&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 250sat/vB), but this does not meet the absolute fee requirement. She&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would need to add another 50,000sat to replace Bob&amp;#39;s commitment&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Disallowing new unconfirmed inputs (Rule #2) in Package RBF would be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; broken for packages containing transactions already in the mempool,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; explained [here][7].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Note: I originally [proposed][6] Package RBF using the same Rule #3&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and #4 before I realized how significant this pinning attack is. I&amp;#39;m&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; retracting that proposal, and a new set of Package RBF rules would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; follow from whatever the new individual RBF rules end up being.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Same Txid Different Witness&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Two transactions with the same non-witness data but different&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; witnesses have the same txid but different wtxid, and the same fee but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not necessarily the same feerate. Currently, if we see a transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that has the same txid as one in the mempool, we reject it as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; duplicate, even if the feerate is much higher. It&amp;#39;s unclear to me if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; we have a very strong reason to change this, but noting it as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limitation of our current replacement policy. See [#24007][12].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### User Interface&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Using Unconfirmed UTXOs to Fund Replacements&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The restriction of only allowing confirmed UTXOs for funding a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee-bump (Rule #2) can hurt users trying to fee-bump their&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions and complicate wallet implementations. If the original&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&amp;#39;s output value isn&amp;#39;t sufficient to fund a fee-bump and/or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; all of the user&amp;#39;s other UTXOs are unconfirmed, they might not be able&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to fund a replacement transaction. Wallet developers also need to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; treat self-owned unconfirmed UTXOs as unusable for fee-bumping, which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; adds complexity to wallet logic. For example, see BDK issues [#144][4]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and [#414][5].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Interface Not Suitable for Coin Selection&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Currently, a user cannot simply create a replacement transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; targeting a specific feerate or meeting a minimum fee amount and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; expect to meet the RBF criteria. The fee amount depends on the size of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the replacement transaction, and feerate is almost irrelevant.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Bitcoin Core&amp;#39;s `bumpfee` doesn&amp;#39;t use the RBF rules when funding the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement. It [estimates][13] a feerate which is &amp;#34;wallet incremental&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relay fee&amp;#34; (a conservative overestimation of the node&amp;#39;s incremental&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relay fee) higher than the original transaction, selects coins for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that feerate, and hopes that it meets the RBF rules. It never fails&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Rule #3 and #4 because it uses all original inputs and refuses to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bump a transaction with mempool descendants.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This is suboptimal, but is designed to work with the coin selection&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; engine: select a feerate first, and then add fees to cover it.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Following the exact RBF rules would require working the other way&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; around: based on how much fees we&amp;#39;ve added to the transaction and its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; current size, calculate the feerate to see if we meet Rule #4.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; While this isn&amp;#39;t completely broken, and the user interface is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; secondary to the safety of the mempool policy, we can do much better.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A much more user-friendly interface would depend *only* on the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee and size of the original transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Updates to Mempool and Mining&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Since RBF was first implemented, a number of improvements have been&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; made to mempool and mining logic. For example, we now use ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerates in mining (allowing CPFP), and keep track of ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; packages in the mempool.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Ideas for Improvements&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Goals&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; To summarize, these seem to be desired changes, in order of priority:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. Remove Rule #3. The replacement should not be *required* to pay&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; higher absolute fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Make it impossible for a replacement transaction to have a lower&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mining score than the original transaction(s). This would eliminate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the `SIGHASH\_ANYONECANPAY` pinning attack.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. Remove Rule #2. Adding new unconfirmed inputs should be allowed.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. Create a more helpful interface that helps wallet fund replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions that aim for a feerate and fee.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### A Different Model for Fees&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; For incentive compatibility, I believe there are different&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; formulations we should consider. Most importantly, if we want to get&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rid of the absolute fee rule, we can no longer think of it as &amp;#34;the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction needs to pay for its own bandwidth,&amp;#34; since we won&amp;#39;t always&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be getting additional fees. That means we need a new method of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rate-limiting replacements that doesn&amp;#39;t require additional fees every&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; While it makes sense to think about monetary costs when launching a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; specific type of attack, given that the fees are paid to the miner and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not to the mempool operators, maybe it doesn&amp;#39;t make much sense to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; think about &amp;#34;paying for bandwidth&amp;#34;. Maybe we should implement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction validation rate-limiting differently, e.g. building it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; into the P2P layer instead of the mempool policy layer.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Recently, Suhas gave a [formulation][8] for incentive compatibility&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that made sense to me: &amp;#34;are the fees expected to be paid in the next&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (N?) blocks higher or lower if we process this transaction?&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I started by thinking about this where N=1 or `1 &#43; p`.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here, a rational miner is looking at what fees they would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; collect in the next block, and then some proportion `p` of the rest of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the blocks based on their hashrate. We&amp;#39;re assuming `p` isn&amp;#39;t *so high*&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that they would be okay with lower absolute fees in the next 1 block.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We&amp;#39;re also assuming `p` isn&amp;#39;t *so low* that the miner doesn&amp;#39;t care&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; about what&amp;#39;s left of the mempool after this block.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A tweak to this formulation is &amp;#34;if we process this transaction, would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the fees in the next 1 block higher or lower, and is the feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; density of the rest of the mempool higher or lower?&amp;#34; This is pretty&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; similar, where N=1, but we consider the rest of the mempool by feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rather than fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Mining Score of a Mempool Transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We are often interested in finding out what&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the &amp;#34;mining score&amp;#34; of a transaction in the mempool is. That is, when&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the transaction is considered in block template building, what is the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate it is considered at?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Obviously, it&amp;#39;s not the transaction&amp;#39;s individual feerate. Bitcoin Core&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [mining code sorts][14] transactions by their ancestor feerate and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; includes them packages at a time, keeping track of how this affects the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package feerates of remaining transactions in the mempool.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *ancestor feerate*: Ancestor feerate is easily accessible information,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; but it&amp;#39;s not accurate either, because it doesn&amp;#39;t take into account the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fact that subsets of a transaction&amp;#39;s ancestor set can be included&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; without it. For example, ancestors may have high feerates on their own&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; or we may have [high feerate siblings][8].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; TLDR: *Looking at the current ancestor feerate of a transaction is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; insufficient to tell us what feerate it will be considered at when&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; building a block template in the future.*&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *min(individual feerate, ancestor feerate)*: Another&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; heuristic that is simple to calculate based on current mempool tooling&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is to use the [minimum of a transaction&amp;#39;s individual score and its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor score][10] as a conservative measure. But this can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; overestimate as well (see the example below).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *min ancestor feerate(tx &#43; possible ancestor subsets)* We can also&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; take the minimum of every possible ancestor subset, but this can be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; computationally expensive since there can be lots and lots of ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; subsets.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *max ancestor feerate(tx &#43; possible descendant subsets)*: Another idea&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is to use the [maximum ancestor score of the transaction &#43; each of its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendants][9]. This doesn&amp;#39;t work either; it has the same blindspot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of ancestor subsets being mined on their own.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Mining Score Example&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here&amp;#39;s an example illustrating why mining score is tricky to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; efficiently calculate for mempool transactions:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Let&amp;#39;s say you have same-size transactions A (21sat/vB), B (1sat/vB),&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; C(9sat/vB), D(5sat/vB).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The layout is: grandparent A, parent B, and two children C and D.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ```&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ^&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; B&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ^ ^&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; C D&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ```&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A miner using ancestor packages to build block templates will first&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; include A with a mining score of 21. Next, the miner will include B and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; C with a mining score of 6. This leaves D, with a mining score of 5.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Note: in this case, mining by ancestor feerate results in the most&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rational decisions, but [a candidate set-based approach][10] which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; makes ancestor feerate much less relevant could&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be more advantageous in other situations.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Here is a chart showing the &amp;#34;true&amp;#34; mining score alongside the values&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; calculating using imperfect heuristics described above. All of them&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can overestimate or underestimate.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ```&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A B C D&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mining score | 21 | 6 | 6 | 5 |&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor feerate | 21 | 11 | 10.3 | 9 |&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; min(individual, ancestor) | 21 | 1 | 9 | 5 |&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; min(tx &#43; ancestor subsets) | 21 | 1 | 5 | 3 |&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; max(tx &#43; descendants subsets) | 21 | 9 | 9 | 5 |&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ```&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Possibly the best solution for finding the &amp;#34;mining score&amp;#34; of a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction is to build a block template, see what feerate each&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package is included at. Perhaps at some cutoff, remaining mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions can be estimated using some heuristic that leans&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; {overestimating, underestimating} depending on the situation.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Mining score seems to be relevant in multiple places: Murch and I&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; recently [found][3] that it would be very important in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;ancestor-aware&amp;#34; funding of transactions (the wallet doesn&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incorporate ancestor fees when using unconfirmed transactions in coin&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; selection, which is a bug we want to fix).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In general, it would be nice to know the exact mining priority of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; one&amp;#39;s unconfirmed transaction is. I can think of a few block/mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; explorers who might want to display this information for users.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### RBF Improvement Proposals&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; After speaking to quite a few people, here are some suggestions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for improvements that I have heard:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * The ancestor score of the replacement must be {5, 10, N}% higher&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than that of every original transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * The ancestor score of the replacement must be 1sat/vB higher than&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that of every original transaction.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * If the original transaction is in the top {0.75MvB, 1MvB} of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool, apply the current rules (absolute fees must increase and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pay for the replacement transaction&amp;#39;s new bandwidth). Otherwise, use a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate-only rule.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * If fees don&amp;#39;t increase, the size of the replacement transaction must&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; decrease by at least N%.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Rate-limit how many replacements we allow per prevout.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Rate-limit transaction validation in general, per peer.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Perhaps some others on the mailing list can chime in to throw other&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ideas into the ring and/or combine some of these rules into a sensible&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Replace by Feerate Only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I don&amp;#39;t think there&amp;#39;s going to be a single-line feerate-based&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rule that can incorporate everything we need.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On one hand, a feerate-only approach helps eliminate the issues&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; associated with Rule #3. On the other hand, I believe the main concern&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with a feerate-only approach is how to rate limit replacements. We&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; don&amp;#39;t want to enable an attack such as:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. Attacker broadcasts large, low-feerate transaction, and attaches a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; chain of descendants.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. The attacker replaces the transaction with a smaller but higher&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate transaction, attaching a new chain of descendants.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. Repeat 1000 times.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Fees in Next Block and Feerate for the Rest of the Mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Perhaps we can look at replacements like this:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. Calculate the directly conflicting transactions and, with their&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendants, the original transactions. Check signaling. Limit the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; total volume (e.g. can&amp;#39;t be more than 100 total or 1MvB or something).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Find which original transactions would be in the next ~1 block. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement must pay at least this amount &#43; X% in absolute fees. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; guarantees that the fees of the next block doesn&amp;#39;t decrease.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. Find which transactions would be left in the mempool after that ~1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; block. The replacement&amp;#39;s feerate must be Y% higher than the maximum&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mining score of these transactions. This guarantees that you now have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only *better* candidates in your after-this-block mempool than you did&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; before, even if the size and fees the transactions decrease.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. Now you have two numbers: a minimum absolute fee amount and a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimum feerate. Check to see if the replacement(s) meet these&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimums. Also, a wallet would be able to ask the node &amp;#34;What fee and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate would I need to put on a transaction replacing this?&amp;#34; and use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this information to fund a replacement transaction, without needing to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; guess or overshoot.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Obviously, there are some magic numbers missing here. X and Y are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; TBD constants to ensure we have some kind of rate limiting for the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; number of replacements allowed using some set of fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; What should they be? We can do some arithmetic to see what happens if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; you start with the biggest/lowest feerate transaction and do a bunch&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of replacements. Maybe we end up with values that are high enough to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; prevent abuse and make sense for applications/users that do RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Mempool Changes Need for Implementation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; As described in the mining score section above,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; we may want additional tooling to more accurately assess&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the economic gain of replacing transactions in our mempool.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A few options have been discussed:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Calculate block templates on the fly when we need to consider a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement. However, since replacements are [quite common][11]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and the information might be useful for other things as well,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it may be worth it to cache a block template.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Keep a persistent block template so that we know what transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; we would put in the next block. We need to remember the feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; at which each transaction was included in the template, because an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor package may be included in the same block template in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; multiple subsets. Transactions included earlier alter the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate of the remaining transactions in the package. We also need&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to keep track of the new feerates of transactions left over.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Divide the mempool into two layers, &amp;#34;high feerate&amp;#34; and &amp;#34;low&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate.&amp;#34; The high feerate layer contains ~1 block of packages with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the highest ancestor feerates, and the low feerate layer contains&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; everything else. At the edge of a block, we have a Knapsacky problem&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; where the next highest ancestor feerate package might not fit, so we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would probably want the high feerate layer ~2MvB or something to avoid&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; underestimating the fees.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Acknowledgements&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thank you to everyone whose RBF-related suggestions, grievances,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; criticisms and ideas were incorporated in this document:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Andrew Chow, Matt Corallo, Suhas Daftuar, Christian Decker,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Mark Erhardt, Lloyd Fournier, Lisa Neigut, John Newbery,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Antoine Poinsot, Antoine Riard, Larry Ruane,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; S3RK and Bastien Teinturier.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks for reading!&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [1]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&#34;&gt;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/23121#issuecomment-929475999&#34;&gt;https://github.com/bitcoin/bitcoin/pull/23121#issuecomment-929475999&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/Xekyo/bitcoin/commit/d754b0242ec69d42c570418aebf9c1335af0b8ea&#34;&gt;https://github.com/Xekyo/bitcoin/commit/d754b0242ec69d42c570418aebf9c1335af0b8ea&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [4]: &lt;a href=&#34;https://github.com/bitcoindevkit/bdk/issues/144&#34;&gt;https://github.com/bitcoindevkit/bdk/issues/144&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [5]: &lt;a href=&#34;https://github.com/bitcoindevkit/bdk/issues/414&#34;&gt;https://github.com/bitcoindevkit/bdk/issues/414&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [6]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [7]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#new-unconfirmed-inputs-rule-2&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#new-unconfirmed-inputs-rule-2&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [8]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/23121#discussion_r777131366&#34;&gt;https://github.com/bitcoin/bitcoin/pull/23121#discussion_r777131366&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [9]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290#issuecomment-865887922&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290#issuecomment-865887922&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [10]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/Xekyo/5cb413fe9f26dbce57abfd344ebbfaf2#file-candidate-set-based-block-building-md&#34;&gt;https://gist.github.com/Xekyo/5cb413fe9f26dbce57abfd344ebbfaf2#file-candidate-set-based-block-building-md&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [11]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22539#issuecomment-885763670&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22539#issuecomment-885763670&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/24007&#34;&gt;https://github.com/bitcoin/bitcoin/pull/24007&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [13]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/1a369f006fd0bec373b95001ed84b480e852f191/src/wallet/feebumper.cpp#L114&#34;&gt;https://github.com/bitcoin/bitcoin/blob/1a369f006fd0bec373b95001ed84b480e852f191/src/wallet/feebumper.cpp#L114&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [14]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/cf5bb048e80d4cde8828787b266b7f5f2e3b6d7b/src/node/miner.cpp#L310-L320&#34;&gt;https://github.com/bitcoin/bitcoin/blob/cf5bb048e80d4cde8828787b266b7f5f2e3b6d7b/src/node/miner.cpp#L310-L320&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220207/34141dc7/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220207/34141dc7/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:03:15Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsq09uuj24tt47yt8ldq0gga57vuatpmd9xkzjujpr2335qmy0cg2qzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q4mrdaq</id>
    
      <title type="html">📅 Original date posted:2022-01-27 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsq09uuj24tt47yt8ldq0gga57vuatpmd9xkzjujpr2335qmy0cg2qzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q4mrdaq" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsdemuq9cce3pvhjeshku7fpk4vzrfke66zl2fx27u95zekyjpj92q6twr3n&#39;&gt;nevent1q…wr3n&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2022-01-27&lt;br/&gt;📝 Original message:Hi everyone,&lt;br/&gt;&lt;br/&gt;This post discusses limitations of current Bitcoin Core RBF policy and&lt;br/&gt;attempts to start a conversation about how we can improve it,&lt;br/&gt;summarizing some ideas that have been discussed. Please reply if you&lt;br/&gt;have any new input on issues to be solved and ideas for improvement!&lt;br/&gt;&lt;br/&gt;Just in case I&amp;#39;ve screwed up the text wrapping again, another copy can be&lt;br/&gt;found here: &lt;a href=&#34;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&#34;&gt;https://gist.github.com/glozow/25d9662c52453bd08b4b4b1d3783b9ff&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;## Background&lt;br/&gt;&lt;br/&gt;Please feel free to skip this section if you are already familiar&lt;br/&gt;with RBF.&lt;br/&gt;&lt;br/&gt;Nodes may receive *conflicting* unconfirmed transactions, aka&lt;br/&gt;&amp;#34;double spends&amp;#34; of the same inputs. Instead of always keeping the&lt;br/&gt;first transaction, since v0.12, Bitcoin Core mempool policy has&lt;br/&gt;included a set of Replace-by-Fee (RBF) criteria that allows the second&lt;br/&gt;transaction to replace the first one and any descendants it may have.&lt;br/&gt;&lt;br/&gt;Bitcoin Core RBF policy was previously documented as BIP 125.&lt;br/&gt;The current RBF policy is documented [here][1]. In summary:&lt;br/&gt;&lt;br/&gt;1. The directly conflicting transactions all signal replaceability&lt;br/&gt;   explicitly.&lt;br/&gt;&lt;br/&gt;2. The replacement transaction only includes an unconfirmed input if&lt;br/&gt;   that input was included in one of the directly conflicting&lt;br/&gt;transactions.&lt;br/&gt;&lt;br/&gt;3. The replacement transaction pays an absolute fee of at least the&lt;br/&gt;   sum paid by the original transactions.&lt;br/&gt;&lt;br/&gt;4. The additional fees pays for the replacement transaction&amp;#39;s&lt;br/&gt;   bandwidth at or above the rate set by the node&amp;#39;s *incremental relay&lt;br/&gt;feerate*.&lt;br/&gt;&lt;br/&gt;5. The sum of all directly conflicting transactions&amp;#39; descendant counts&lt;br/&gt;   (number of transactions inclusive of itself and its descendants)&lt;br/&gt;does not exceed 100.&lt;br/&gt;&lt;br/&gt;We can split these rules into 3 categories/goals:&lt;br/&gt;&lt;br/&gt;- **Allow Opting Out**: Some applications/businesses are unable to&lt;br/&gt;  handle transactions that are replaceable (e.g. merchants that use&lt;br/&gt;zero-confirmation transactions). We (try to) help these businesses by&lt;br/&gt;honoring BIP125 signaling; we won&amp;#39;t replace transactions that have not&lt;br/&gt;opted in.&lt;br/&gt;&lt;br/&gt;- **Incentive Compatibility**: Ensure that our RBF policy would not&lt;br/&gt;  accept replacement transactions which would decrease fee profits&lt;br/&gt;  of a miner. In general, if our mempool policy deviates from what is&lt;br/&gt;economically rational, it&amp;#39;s likely that the transactions in our&lt;br/&gt;mempool will not match the ones in miners&amp;#39; mempools, making our&lt;br/&gt;fee estimation, compact block relay, and other mempool-dependent&lt;br/&gt;functions unreliable. Incentive-incompatible policy may also&lt;br/&gt;encourage transaction submission through routes other than the p2p&lt;br/&gt;network, harming censorship-resistance and privacy of Bitcoin payments.&lt;br/&gt;&lt;br/&gt;- **DoS Protection**: Limit two types of DoS attacks on the node&amp;#39;s&lt;br/&gt;  mempool: (1) the number of times a transaction can be replaced and&lt;br/&gt;(2) the volume of transactions that can be evicted during a&lt;br/&gt;replacement.&lt;br/&gt;&lt;br/&gt;Even more abstract: our goal is to make a replacement policy that&lt;br/&gt;results in a useful interface for users and safe policy for&lt;br/&gt;node operators.&lt;br/&gt;&lt;br/&gt;## Motivation&lt;br/&gt;&lt;br/&gt;There are a number of known problems with the current RBF policy.&lt;br/&gt;Many of these shortcomings exist due to mempool limitations at the&lt;br/&gt;time RBF was implemented or result from new types of Bitcoin usage;&lt;br/&gt;they are not criticisms of the original design.&lt;br/&gt;&lt;br/&gt;### Pinning Attacks&lt;br/&gt;&lt;br/&gt;The most pressing concern is that attackers may take advantage of&lt;br/&gt;limitations in RBF policy to prevent other users&amp;#39; transactions from&lt;br/&gt;being mined or getting accepted as a replacement.&lt;br/&gt;&lt;br/&gt;#### SIGHASH_ANYONECANPAY Pinning&lt;br/&gt;&lt;br/&gt;BIP125#2 can be bypassed by creating intermediary transactions to be&lt;br/&gt;replaced together. Anyone can simply split a 1-input 1-output&lt;br/&gt;transaction off from the replacement transaction, then broadcast the&lt;br/&gt;transaction as is. This can always be done, and quite cheaply. More&lt;br/&gt;details in [this comment][2].&lt;br/&gt;&lt;br/&gt;In general, if a transaction is signed with SIGHASH\_ANYONECANPAY,&lt;br/&gt;anybody can just attach a low feerate parent to this transaction and&lt;br/&gt;lower its ancestor feerate.  Even if you require SIGHASH\_ALL which&lt;br/&gt;prevents an attacker from changing any outputs, the input can be a&lt;br/&gt;very low amount (e.g. just above the dust limit) from a low-fee&lt;br/&gt;ancestor and still bring down the ancestor feerate of the transaction.&lt;br/&gt;&lt;br/&gt;TLDR: if your transaction is signed with SIGHASH\_ANYONECANPAY and&lt;br/&gt;signals replaceability, regardless of the feerate you broadcast at, an&lt;br/&gt;attacker can lower its mining priority by adding an ancestor.&lt;br/&gt;&lt;br/&gt;#### Absolute Fee&lt;br/&gt;&lt;br/&gt;The restriction of requiring replacement transactions to increase the&lt;br/&gt;absolute fee of the mempool has been described as &amp;#34;bonkers.&amp;#34; If the&lt;br/&gt;original transaction has a very large descendant that pays a large&lt;br/&gt;amount of fees, even if it has a low feerate, the replacement&lt;br/&gt;transaction must now pay those fees in order to meet Rule #3.&lt;br/&gt;&lt;br/&gt;#### Package RBF&lt;br/&gt;&lt;br/&gt;There are a number of reasons why, in order to enable Package RBF, we&lt;br/&gt;cannot use the same criteria.&lt;br/&gt;&lt;br/&gt;For starters, the absolute fee pinning attack is especially&lt;br/&gt;problematic if we apply the same rules (i.e. Rule #3 and #4) in&lt;br/&gt;Package RBF. Imagine that Alice (honest) and Bob (adversary) share a&lt;br/&gt;LN channel. The mempool is rather full, so their pre-negotiated&lt;br/&gt;commitment transactions&amp;#39; feerates would not be considered high&lt;br/&gt;priority by miners.  Bob broadcasts his commitment transaction and&lt;br/&gt;attaches a very large child (100KvB with 100,000sat in fees) to his&lt;br/&gt;anchor output. Alice broadcasts her commitment transaction with a&lt;br/&gt;fee-bumping child (200vB with 50,000sat fees which is a generous&lt;br/&gt;250sat/vB), but this does not meet the absolute fee requirement. She&lt;br/&gt;would need to add another 50,000sat to replace Bob&amp;#39;s commitment&lt;br/&gt;transaction.&lt;br/&gt;&lt;br/&gt;Disallowing new unconfirmed inputs (Rule #2) in Package RBF would be&lt;br/&gt;broken for packages containing transactions already in the mempool,&lt;br/&gt;explained [here][7].&lt;br/&gt;&lt;br/&gt;Note: I originally [proposed][6] Package RBF using the same Rule #3&lt;br/&gt;and #4 before I realized how significant this pinning attack is. I&amp;#39;m&lt;br/&gt;retracting that proposal, and a new set of Package RBF rules would&lt;br/&gt;follow from whatever the new individual RBF rules end up being.&lt;br/&gt;&lt;br/&gt;#### Same Txid Different Witness&lt;br/&gt;&lt;br/&gt;Two transactions with the same non-witness data but different&lt;br/&gt;witnesses have the same txid but different wtxid, and the same fee but&lt;br/&gt;not necessarily the same feerate. Currently, if we see a transaction&lt;br/&gt;that has the same txid as one in the mempool, we reject it as a&lt;br/&gt;duplicate, even if the feerate is much higher. It&amp;#39;s unclear to me if&lt;br/&gt;we have a very strong reason to change this, but noting it as a&lt;br/&gt;limitation of our current replacement policy. See [#24007][12].&lt;br/&gt;&lt;br/&gt;### User Interface&lt;br/&gt;&lt;br/&gt;#### Using Unconfirmed UTXOs to Fund Replacements&lt;br/&gt;&lt;br/&gt;The restriction of only allowing confirmed UTXOs for funding a&lt;br/&gt;fee-bump (Rule #2) can hurt users trying to fee-bump their&lt;br/&gt;transactions and complicate wallet implementations. If the original&lt;br/&gt;transaction&amp;#39;s output value isn&amp;#39;t sufficient to fund a fee-bump and/or&lt;br/&gt;all of the user&amp;#39;s other UTXOs are unconfirmed, they might not be able&lt;br/&gt;to fund a replacement transaction. Wallet developers also need to&lt;br/&gt;treat self-owned unconfirmed UTXOs as unusable for fee-bumping, which&lt;br/&gt;adds complexity to wallet logic. For example, see BDK issues [#144][4]&lt;br/&gt;and [#414][5].&lt;br/&gt;&lt;br/&gt;#### Interface Not Suitable for Coin Selection&lt;br/&gt;&lt;br/&gt;Currently, a user cannot simply create a replacement transaction&lt;br/&gt;targeting a specific feerate or meeting a minimum fee amount and&lt;br/&gt;expect to meet the RBF criteria. The fee amount depends on the size of&lt;br/&gt;the replacement transaction, and feerate is almost irrelevant.&lt;br/&gt;&lt;br/&gt;Bitcoin Core&amp;#39;s `bumpfee` doesn&amp;#39;t use the RBF rules when funding the&lt;br/&gt;replacement. It [estimates][13] a feerate which is &amp;#34;wallet incremental&lt;br/&gt;relay fee&amp;#34; (a conservative overestimation of the node&amp;#39;s incremental&lt;br/&gt;relay fee) higher than the original transaction, selects coins for&lt;br/&gt;that feerate, and hopes that it meets the RBF rules. It never fails&lt;br/&gt;Rule #3 and #4 because it uses all original inputs and refuses to&lt;br/&gt;bump a transaction with mempool descendants.&lt;br/&gt;&lt;br/&gt;This is suboptimal, but is designed to work with the coin selection&lt;br/&gt;engine: select a feerate first, and then add fees to cover it.&lt;br/&gt;Following the exact RBF rules would require working the other way&lt;br/&gt;around: based on how much fees we&amp;#39;ve added to the transaction and its&lt;br/&gt;current size, calculate the feerate to see if we meet Rule #4.&lt;br/&gt;&lt;br/&gt;While this isn&amp;#39;t completely broken, and the user interface is&lt;br/&gt;secondary to the safety of the mempool policy, we can do much better.&lt;br/&gt;A much more user-friendly interface would depend *only* on the&lt;br/&gt;fee and size of the original transactions.&lt;br/&gt;&lt;br/&gt;### Updates to Mempool and Mining&lt;br/&gt;&lt;br/&gt;Since RBF was first implemented, a number of improvements have been&lt;br/&gt;made to mempool and mining logic. For example, we now use ancestor&lt;br/&gt;feerates in mining (allowing CPFP), and keep track of ancestor&lt;br/&gt;packages in the mempool.&lt;br/&gt;&lt;br/&gt;## Ideas for Improvements&lt;br/&gt;&lt;br/&gt;### Goals&lt;br/&gt;&lt;br/&gt;To summarize, these seem to be desired changes, in order of priority:&lt;br/&gt;&lt;br/&gt;1. Remove Rule #3. The replacement should not be *required* to pay&lt;br/&gt;higher absolute fees.&lt;br/&gt;&lt;br/&gt;2. Make it impossible for a replacement transaction to have a lower&lt;br/&gt;mining score than the original transaction(s). This would eliminate&lt;br/&gt;the `SIGHASH\_ANYONECANPAY` pinning attack.&lt;br/&gt;&lt;br/&gt;3. Remove Rule #2. Adding new unconfirmed inputs should be allowed.&lt;br/&gt;&lt;br/&gt;4. Create a more helpful interface that helps wallet fund replacement&lt;br/&gt;transactions that aim for a feerate and fee.&lt;br/&gt;&lt;br/&gt;### A Different Model for Fees&lt;br/&gt;&lt;br/&gt;For incentive compatibility, I believe there are different&lt;br/&gt;formulations we should consider.  Most importantly, if we want to get&lt;br/&gt;rid of the absolute fee rule, we can no longer think of it as &amp;#34;the&lt;br/&gt;transaction needs to pay for its own bandwidth,&amp;#34; since we won&amp;#39;t always&lt;br/&gt;be getting additional fees. That means we need a new method of&lt;br/&gt;rate-limiting replacements that doesn&amp;#39;t require additional fees every&lt;br/&gt;time.&lt;br/&gt;&lt;br/&gt;While it makes sense to think about monetary costs when launching a&lt;br/&gt;specific type of attack, given that the fees are paid to the miner and&lt;br/&gt;not to the mempool operators, maybe it doesn&amp;#39;t make much sense to&lt;br/&gt;think about &amp;#34;paying for bandwidth&amp;#34;. Maybe we should implement&lt;br/&gt;transaction validation rate-limiting differently, e.g. building it&lt;br/&gt;into the P2P layer instead of the mempool policy layer.&lt;br/&gt;&lt;br/&gt;Recently, Suhas gave a [formulation][8] for incentive compatibility&lt;br/&gt;that made sense to me: &amp;#34;are the fees expected to be paid in the next&lt;br/&gt;(N?) blocks higher or lower if we process this transaction?&amp;#34;&lt;br/&gt;&lt;br/&gt;I started by thinking about this where N=1 or `1 &#43; p`.&lt;br/&gt;Here, a rational miner is looking at what fees they would&lt;br/&gt;collect in the next block, and then some proportion `p` of the rest of&lt;br/&gt;the blocks based on their hashrate. We&amp;#39;re assuming `p` isn&amp;#39;t *so high*&lt;br/&gt;that they would be okay with lower absolute fees in the next 1 block.&lt;br/&gt;We&amp;#39;re also assuming `p` isn&amp;#39;t *so low* that the miner doesn&amp;#39;t care&lt;br/&gt;about what&amp;#39;s left of the mempool after this block.&lt;br/&gt;&lt;br/&gt;A tweak to this formulation is &amp;#34;if we process this transaction, would&lt;br/&gt;the fees in the next 1 block higher or lower, and is the feerate&lt;br/&gt;density of the rest of the mempool higher or lower?&amp;#34; This is pretty&lt;br/&gt;similar, where N=1, but we consider the rest of the mempool by feerate&lt;br/&gt;rather than fees.&lt;br/&gt;&lt;br/&gt;### Mining Score of a Mempool Transaction&lt;br/&gt;&lt;br/&gt;We are often interested in finding out what&lt;br/&gt;the &amp;#34;mining score&amp;#34; of a transaction in the mempool is. That is, when&lt;br/&gt;the transaction is considered in block template building, what is the&lt;br/&gt;feerate it is considered at?&lt;br/&gt;&lt;br/&gt;Obviously, it&amp;#39;s not the transaction&amp;#39;s individual feerate. Bitcoin Core&lt;br/&gt;[mining code sorts][14] transactions by their ancestor feerate and&lt;br/&gt;includes them packages at a time, keeping track of how this affects the&lt;br/&gt;package feerates of remaining transactions in the mempool.&lt;br/&gt;&lt;br/&gt;*ancestor feerate*: Ancestor feerate is easily accessible information,&lt;br/&gt;but it&amp;#39;s not accurate either, because it doesn&amp;#39;t take into account the&lt;br/&gt;fact that subsets of a transaction&amp;#39;s ancestor set can be included&lt;br/&gt;without it. For example, ancestors may have high feerates on their own&lt;br/&gt;or we may have [high feerate siblings][8].&lt;br/&gt;&lt;br/&gt;TLDR: *Looking at the current ancestor feerate of a transaction is&lt;br/&gt;insufficient to tell us what feerate it will be considered at when&lt;br/&gt;building a block template in the future.*&lt;br/&gt;&lt;br/&gt;*min(individual feerate, ancestor feerate)*: Another&lt;br/&gt;heuristic that is simple to calculate based on current mempool tooling&lt;br/&gt;is to use the [minimum of a transaction&amp;#39;s individual score and its&lt;br/&gt;ancestor score][10] as a conservative measure.  But this can&lt;br/&gt;overestimate as well (see the example below).&lt;br/&gt;&lt;br/&gt;*min ancestor feerate(tx &#43; possible ancestor subsets)* We can also&lt;br/&gt;take the minimum of every possible ancestor subset, but this can be&lt;br/&gt;computationally expensive since there can be lots and lots of ancestor&lt;br/&gt;subsets.&lt;br/&gt;&lt;br/&gt;*max ancestor feerate(tx &#43; possible descendant subsets)*: Another idea&lt;br/&gt;is to use the [maximum ancestor score of the transaction &#43; each of its&lt;br/&gt;descendants][9]. This doesn&amp;#39;t work either; it has the same blindspot&lt;br/&gt;of ancestor subsets being mined on their own.&lt;br/&gt;&lt;br/&gt;#### Mining Score Example&lt;br/&gt;&lt;br/&gt;Here&amp;#39;s an example illustrating why mining score is tricky to&lt;br/&gt;efficiently calculate for mempool transactions:&lt;br/&gt;&lt;br/&gt;Let&amp;#39;s say you have same-size transactions A (21sat/vB), B (1sat/vB),&lt;br/&gt;C(9sat/vB), D(5sat/vB).&lt;br/&gt;The layout is: grandparent A, parent B, and two children C and D.&lt;br/&gt;&lt;br/&gt;```&lt;br/&gt;    A&lt;br/&gt;    ^&lt;br/&gt;    B&lt;br/&gt;   ^ ^&lt;br/&gt;   C D&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;A miner using ancestor packages to build block templates will first&lt;br/&gt;include A with a mining score of 21. Next, the miner will include B and&lt;br/&gt;C with a mining score of 6. This leaves D, with a mining score of 5.&lt;br/&gt;&lt;br/&gt;Note: in this case, mining by ancestor feerate results in the most&lt;br/&gt;rational decisions, but [a candidate set-based approach][10] which&lt;br/&gt;makes ancestor feerate much less relevant could&lt;br/&gt;be more advantageous in other situations.&lt;br/&gt;&lt;br/&gt;Here is a chart showing the &amp;#34;true&amp;#34; mining score alongside the values&lt;br/&gt;calculating using imperfect heuristics described above. All of them&lt;br/&gt;can overestimate or underestimate.&lt;br/&gt;&lt;br/&gt;```&lt;br/&gt;   A     B       C     D&lt;br/&gt;mining score |   21   |   6   |   6   |   5   |&lt;br/&gt;ancestor feerate   |   21   |  11   | 10.3  |   9   |&lt;br/&gt;min(individual, ancestor) |   21   |   1   |   9   |   5   |&lt;br/&gt;min(tx &#43; ancestor subsets)      |   21   |   1   |   5   |   3   |&lt;br/&gt;max(tx &#43; descendants subsets) |   21   |   9   |   9   |   5   |&lt;br/&gt;&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;Possibly the best solution for finding the &amp;#34;mining score&amp;#34; of a&lt;br/&gt;transaction is to build a block template, see what feerate each&lt;br/&gt;package is included at. Perhaps at some cutoff, remaining mempool&lt;br/&gt;transactions can be estimated using some heuristic that leans&lt;br/&gt;{overestimating, underestimating} depending on the situation.&lt;br/&gt;&lt;br/&gt;Mining score seems to be relevant in multiple places: Murch and I&lt;br/&gt;recently [found][3] that it would be very important in&lt;br/&gt;&amp;#34;ancestor-aware&amp;#34; funding of transactions (the wallet doesn&amp;#39;t&lt;br/&gt;incorporate ancestor fees when using unconfirmed transactions in coin&lt;br/&gt;selection, which is a bug we want to fix).&lt;br/&gt;&lt;br/&gt;In general, it would be nice to know the exact mining priority of&lt;br/&gt;one&amp;#39;s unconfirmed transaction is.  I can think of a few block/mempool&lt;br/&gt;explorers who might want to display this information for users.&lt;br/&gt;&lt;br/&gt;### RBF Improvement Proposals&lt;br/&gt;&lt;br/&gt;After speaking to quite a few people, here are some suggestions&lt;br/&gt;for improvements that I have heard:&lt;br/&gt;&lt;br/&gt;* The ancestor score of the replacement must be {5, 10, N}% higher&lt;br/&gt;  than that of every original transaction.&lt;br/&gt;&lt;br/&gt;* The ancestor score of the replacement must be 1sat/vB higher than&lt;br/&gt;  that of every original transaction.&lt;br/&gt;&lt;br/&gt;* If the original transaction is in the top {0.75MvB, 1MvB} of the&lt;br/&gt;  mempool, apply the current rules (absolute fees must increase and&lt;br/&gt;pay for the replacement transaction&amp;#39;s new bandwidth). Otherwise, use a&lt;br/&gt;feerate-only rule.&lt;br/&gt;&lt;br/&gt;* If fees don&amp;#39;t increase, the size of the replacement transaction must&lt;br/&gt;  decrease by at least N%.&lt;br/&gt;&lt;br/&gt;* Rate-limit how many replacements we allow per prevout.&lt;br/&gt;&lt;br/&gt;* Rate-limit transaction validation in general, per peer.&lt;br/&gt;&lt;br/&gt;Perhaps some others on the mailing list can chime in to throw other&lt;br/&gt;ideas into the ring and/or combine some of these rules into a sensible&lt;br/&gt;policy.&lt;br/&gt;&lt;br/&gt;#### Replace by Feerate Only&lt;br/&gt;&lt;br/&gt;I don&amp;#39;t think there&amp;#39;s going to be a single-line feerate-based&lt;br/&gt;rule that can incorporate everything we need.&lt;br/&gt;On one hand, a feerate-only approach helps eliminate the issues&lt;br/&gt;associated with Rule #3. On the other hand, I believe the main concern&lt;br/&gt;with a feerate-only approach is how to rate limit replacements. We&lt;br/&gt;don&amp;#39;t want to enable an attack such as:&lt;br/&gt;&lt;br/&gt;1. Attacker broadcasts large, low-feerate transaction, and attaches a&lt;br/&gt;chain of descendants.&lt;br/&gt;&lt;br/&gt;2. The attacker replaces the transaction with a smaller but higher&lt;br/&gt;feerate transaction, attaching a new chain of descendants.&lt;br/&gt;&lt;br/&gt;3. Repeat 1000 times.&lt;br/&gt;&lt;br/&gt;#### Fees in Next Block and Feerate for the Rest of the Mempool&lt;br/&gt;&lt;br/&gt;Perhaps we can look at replacements like this:&lt;br/&gt;&lt;br/&gt;1. Calculate the directly conflicting transactions and, with their&lt;br/&gt;descendants, the original transactions. Check signaling. Limit the&lt;br/&gt;total volume (e.g. can&amp;#39;t be more than 100 total or 1MvB or something).&lt;br/&gt;&lt;br/&gt;2. Find which original transactions would be in the next ~1 block. The&lt;br/&gt;replacement must pay at least this amount &#43; X% in absolute fees. This&lt;br/&gt;guarantees that the fees of the next block doesn&amp;#39;t decrease.&lt;br/&gt;&lt;br/&gt;3. Find which transactions would be left in the mempool after that ~1&lt;br/&gt;block. The replacement&amp;#39;s feerate must be Y% higher than the maximum&lt;br/&gt;mining score of these transactions. This guarantees that you now have&lt;br/&gt;only *better* candidates in your after-this-block mempool than you did&lt;br/&gt;before, even if the size and fees the transactions decrease.&lt;br/&gt;&lt;br/&gt;4. Now you have two numbers: a minimum absolute fee amount and a&lt;br/&gt;minimum feerate. Check to see if the replacement(s) meet these&lt;br/&gt;minimums. Also, a wallet would be able to ask the node &amp;#34;What fee and&lt;br/&gt;feerate would I need to put on a transaction replacing this?&amp;#34; and use&lt;br/&gt;this information to fund a replacement transaction, without needing to&lt;br/&gt;guess or overshoot.&lt;br/&gt;&lt;br/&gt;Obviously, there are some magic numbers missing here. X and Y are&lt;br/&gt;TBD constants to ensure we have some kind of rate limiting for the&lt;br/&gt;number of replacements allowed using some set of fees.&lt;br/&gt;&lt;br/&gt;What should they be? We can do some arithmetic to see what happens if&lt;br/&gt;you start with the biggest/lowest feerate transaction and do a bunch&lt;br/&gt;of replacements. Maybe we end up with values that are high enough to&lt;br/&gt;prevent abuse and make sense for applications/users that do RBF.&lt;br/&gt;&lt;br/&gt;### Mempool Changes Need for Implementation&lt;br/&gt;&lt;br/&gt;As described in the mining score section above,&lt;br/&gt;we may want additional tooling to more accurately assess&lt;br/&gt;the economic gain of replacing transactions in our mempool.&lt;br/&gt;&lt;br/&gt;A few options have been discussed:&lt;br/&gt;&lt;br/&gt;* Calculate block templates on the fly when we need to consider a&lt;br/&gt;  replacement. However, since replacements are [quite common][11]&lt;br/&gt;  and the information might be useful for other things as well,&lt;br/&gt;  it may be worth it to cache a block template.&lt;br/&gt;&lt;br/&gt;* Keep a persistent block template so that we know what transactions&lt;br/&gt;  we would put in the next block. We need to remember the feerate&lt;br/&gt;at which each transaction was included in the template, because an&lt;br/&gt;ancestor package may be included in the same block template in&lt;br/&gt;multiple subsets. Transactions included earlier alter the ancestor&lt;br/&gt;feerate of the remaining transactions in the package. We also need&lt;br/&gt;to keep track of the new feerates of transactions left over.&lt;br/&gt;&lt;br/&gt;* Divide the mempool into two layers, &amp;#34;high feerate&amp;#34; and &amp;#34;low&lt;br/&gt;  feerate.&amp;#34; The high feerate layer contains ~1 block of packages with&lt;br/&gt;the highest ancestor feerates, and the low feerate layer contains&lt;br/&gt;everything else. At the edge of a block, we have a Knapsacky problem&lt;br/&gt;where the next highest ancestor feerate package might not fit, so we&lt;br/&gt;would probably want the high feerate layer ~2MvB or something to avoid&lt;br/&gt;underestimating the fees.&lt;br/&gt;&lt;br/&gt;## Acknowledgements&lt;br/&gt;&lt;br/&gt;Thank you to everyone whose RBF-related suggestions, grievances,&lt;br/&gt;criticisms and ideas were incorporated in this document:&lt;br/&gt;Andrew Chow, Matt Corallo, Suhas Daftuar, Christian Decker,&lt;br/&gt;Mark Erhardt, Lloyd Fournier, Lisa Neigut, John Newbery,&lt;br/&gt;Antoine Poinsot, Antoine Riard, Larry Ruane,&lt;br/&gt;S3RK and Bastien Teinturier.&lt;br/&gt;&lt;br/&gt;Thanks for reading!&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;[1]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&#34;&gt;https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md&lt;/a&gt;&lt;br/&gt;[2]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/23121#issuecomment-929475999&#34;&gt;https://github.com/bitcoin/bitcoin/pull/23121#issuecomment-929475999&lt;/a&gt;&lt;br/&gt;[3]:&lt;br/&gt;&lt;a href=&#34;https://github.com/Xekyo/bitcoin/commit/d754b0242ec69d42c570418aebf9c1335af0b8ea&#34;&gt;https://github.com/Xekyo/bitcoin/commit/d754b0242ec69d42c570418aebf9c1335af0b8ea&lt;/a&gt;&lt;br/&gt;[4]: &lt;a href=&#34;https://github.com/bitcoindevkit/bdk/issues/144&#34;&gt;https://github.com/bitcoindevkit/bdk/issues/144&lt;/a&gt;&lt;br/&gt;[5]: &lt;a href=&#34;https://github.com/bitcoindevkit/bdk/issues/414&#34;&gt;https://github.com/bitcoindevkit/bdk/issues/414&lt;/a&gt;&lt;br/&gt;[6]:&lt;br/&gt;&lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&lt;/a&gt;&lt;br/&gt;[7]:&lt;br/&gt;&lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#new-unconfirmed-inputs-rule-2&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#new-unconfirmed-inputs-rule-2&lt;/a&gt;&lt;br/&gt;[8]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/23121#discussion_r777131366&#34;&gt;https://github.com/bitcoin/bitcoin/pull/23121#discussion_r777131366&lt;/a&gt;&lt;br/&gt;[9]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290#issuecomment-865887922&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290#issuecomment-865887922&lt;/a&gt;&lt;br/&gt;[10]:&lt;br/&gt;&lt;a href=&#34;https://gist.github.com/Xekyo/5cb413fe9f26dbce57abfd344ebbfaf2#file-candidate-set-based-block-building-md&#34;&gt;https://gist.github.com/Xekyo/5cb413fe9f26dbce57abfd344ebbfaf2#file-candidate-set-based-block-building-md&lt;/a&gt;&lt;br/&gt;[11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22539#issuecomment-885763670&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22539#issuecomment-885763670&lt;/a&gt;&lt;br/&gt;[12]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/24007&#34;&gt;https://github.com/bitcoin/bitcoin/pull/24007&lt;/a&gt;&lt;br/&gt;[13]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/1a369f006fd0bec373b95001ed84b480e852f191/src/wallet/feebumper.cpp#L114&#34;&gt;https://github.com/bitcoin/bitcoin/blob/1a369f006fd0bec373b95001ed84b480e852f191/src/wallet/feebumper.cpp#L114&lt;/a&gt;&lt;br/&gt;[14]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/cf5bb048e80d4cde8828787b266b7f5f2e3b6d7b/src/node/miner.cpp#L310-L320&#34;&gt;https://github.com/bitcoin/bitcoin/blob/cf5bb048e80d4cde8828787b266b7f5f2e3b6d7b/src/node/miner.cpp#L310-L320&lt;/a&gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220127/ec8ff818/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220127/ec8ff818/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:03:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsq0hn67rakm9vpthjxlr4x09jfqfvv9z933fu8rfesrenusfs3lrqzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q2x2w0l</id>
    
      <title type="html">📅 Original date posted:2021-12-07 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsq0hn67rakm9vpthjxlr4x09jfqfvv9z933fu8rfesrenusfs3lrqzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q2x2w0l" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsr9fc7kt0hznylpe2mwtzel9p4hv7c9q03nraqvh46n97tn7pr8lqz9dcvm&#39;&gt;nevent1q…dcvm&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-12-07&lt;br/&gt;📝 Original message:Hi Darosior and Ariard,&lt;br/&gt;&lt;br/&gt;Thank you for your work looking into fee-bumping so thoroughly, and for&lt;br/&gt;sharing your results. I agree about fee-bumping&amp;#39;s importance in contract&lt;br/&gt;security and feel that it&amp;#39;s often under-prioritized. In general, what&lt;br/&gt;you&amp;#39;ve described in this post, to me, is strong motivation for some of the&lt;br/&gt;proposed changes to RBF we&amp;#39;ve been discussing. Mostly, I have some&lt;br/&gt;questions.&lt;br/&gt;&lt;br/&gt;&amp;gt; The part of Revault we are interested in for this study is the delegation&lt;br/&gt;process, and more&lt;br/&gt;&amp;gt; specifically the application of spending policies by network monitors&lt;br/&gt;(watchtowers).&lt;br/&gt;&lt;br/&gt;I&amp;#39;d like to better understand how fee-bumping would be used, i.e. how the&lt;br/&gt;watchtower model works:&lt;br/&gt;- Do all of the vault parties both deposit to the vault and a refill/fee to&lt;br/&gt;the watchtower, is there a reward the watchtower collects for a successful&lt;br/&gt;Cancel, or something else? (Apologies if there&amp;#39;s a thorough explanation&lt;br/&gt;somewhere that I haven&amp;#39;t already seen).&lt;br/&gt;- Do we expect watchtowers tracking multiple vaults to be batching multiple&lt;br/&gt;Cancel transaction fee-bumps?&lt;br/&gt;- Do we expect vault users to be using multiple watchtowers for a better&lt;br/&gt;trust model? If so, and we&amp;#39;re expecting batched fee-bumps, won&amp;#39;t those&lt;br/&gt;conflict?&lt;br/&gt;&lt;br/&gt;&amp;gt; For Revault we can afford to introduce malleability in the Cancel&lt;br/&gt;transaction since there is no&lt;br/&gt;&amp;gt; second-stage transaction depending on its txid. Therefore it is&lt;br/&gt;pre-signed with ANYONECANPAY. We&lt;br/&gt;&amp;gt; can&amp;#39;t use ANYONECANPAY|SINGLE since it would open a pinning vector [3].&lt;br/&gt;Note how we can&amp;#39;t leverage&lt;br/&gt;&amp;gt; the carve out rule, and neither can any other more-than-two-parties&lt;br/&gt;contract.&lt;br/&gt;&lt;br/&gt;We&amp;#39;ve already talked about this offline, but I&amp;#39;d like to point out here&lt;br/&gt;that even transactions signed with ANYONECANPAY|ALL can be pinned by RBF&lt;br/&gt;unless we add an ancestor score rule. [0], [1] (numbers are inaccurate,&lt;br/&gt;Cancel Tx feerates wouldn&amp;#39;t be that low, but just to illustrate what the&lt;br/&gt;attack would look like)&lt;br/&gt;&lt;br/&gt;[0]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/135104603-9e775062-5c8d-4d55-9bc9-6e9db92cfe6d.png&#34;&gt; &lt;br/&gt;[1]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/145044333-2f85da4a-af71-44a1-bc21-30c388713a0d.png&#34;&gt; &lt;br/&gt;&lt;br/&gt;&amp;gt; can&amp;#39;t use ANYONECANPAY|SINGLE since it would open a pinning vector [3].&lt;br/&gt;Note how we can&amp;#39;t leverage&lt;br/&gt;&amp;gt; the carve out rule, and neither can any other more-than-two-parties&lt;br/&gt;contract.&lt;br/&gt;&lt;br/&gt;Well stated about CPFP carve out. I suppose the generalization is that&lt;br/&gt;allowing n extra ancestorcount=2 descendants to a transaction means it can&lt;br/&gt;help contracts with &amp;lt;=n&#43;1 parties (more accurately, outputs)? I wonder if&lt;br/&gt;it&amp;#39;s possible to devise a different approach for limiting&lt;br/&gt;ancestors/descendants, e.g. by height/width/branching factor of the family&lt;br/&gt;instead of count... :shrug:&lt;br/&gt;&lt;br/&gt;&amp;gt; You could keep a single large UTxO and peel it as you need to sponsor&lt;br/&gt;transactions. But this means&lt;br/&gt;&amp;gt; that you need to create a coin of a specific value according to your need&lt;br/&gt;at the current feerate&lt;br/&gt;&amp;gt; estimation, hope to have it confirmed in a few blocks (at least for now!&lt;br/&gt;[5]), and hope that the&lt;br/&gt;&amp;gt; value won&amp;#39;t be obsolete by the time it confirmed.&lt;br/&gt;&lt;br/&gt;IIUC, a Cancel transaction can be generalized as a 1-in-1-out where the&lt;br/&gt;input is presigned with counterparties, SIGHASH_ANYONECANPAY. The fan-out&lt;br/&gt;UTXO pool approach is a clever solution. I also think this smells like a&lt;br/&gt;case where improving lower-level RBF rules is more appropriate than&lt;br/&gt;requiring applications to write workarounds and generate extra&lt;br/&gt;transactions. Seeing that the BIP125#2 (no new unconfirmed inputs)&lt;br/&gt;restriction really hurts in this case, if that rule were removed, would you&lt;br/&gt;be able to simply keep the 1 big UTXO per vault and cut out the exact&lt;br/&gt;nValue you need to fee-bump Cancel transactions? Would that feel less like&lt;br/&gt;&amp;#34;burning&amp;#34; for the sake of fee-bumping?&lt;br/&gt;&lt;br/&gt;&amp;gt; First of all, when to fee-bump? At fixed time intervals? At each block&lt;br/&gt;connection? It sounds like,&lt;br/&gt;&amp;gt; given a large enough timelock, you could try to greed by &amp;#34;trying your&lt;br/&gt;luck&amp;#34; at a lower feerate and&lt;br/&gt;&amp;gt; only re-bumping every N blocks. You would then start aggressively bumping&lt;br/&gt;at every block after M&lt;br/&gt;&amp;gt; blocks have passed.&lt;br/&gt;&lt;br/&gt;I&amp;#39;m wondering if you also considered other questions like:&lt;br/&gt;- Should a fee-bumping strategy be dependent upon the rate of incoming&lt;br/&gt;transactions? To me, it seems like the two components are (1) what&amp;#39;s in the&lt;br/&gt;mempool and (2) what&amp;#39;s going to trickle into the mempool between now and&lt;br/&gt;the target block. The first component is best-effort keeping&lt;br/&gt;incentive-compatible mempool; historical data and crystal ball look like&lt;br/&gt;the only options for incorporating the 2nd component.&lt;br/&gt;- Should the fee-bumping strategy depend on how close you are to your&lt;br/&gt;timelock expiry? (though this seems like a potential privacy leak, and the&lt;br/&gt;game theory could get weird as you mentioned).&lt;br/&gt;- As long as you have a good fee estimator (i.e. given a current mempool,&lt;br/&gt;can get an accurate feerate given a % probability of getting into target&lt;br/&gt;block n), is there any reason to devise a fee-bumping strategy beyond&lt;br/&gt;picking a time interval?&lt;br/&gt;&lt;br/&gt;It would be interesting to see stats on the spread of feerates in blocks&lt;br/&gt;during periods of fee fluctuation.&lt;br/&gt;&lt;br/&gt;&amp;gt; &amp;gt; In the event that you notice a consequent portion of the block is&lt;br/&gt;filled with transactions paying&lt;br/&gt;&amp;gt; &amp;gt; less than your own, you might want to start panicking and bump your&lt;br/&gt;transaction fees by a certain&lt;br/&gt;&amp;gt; &amp;gt; percentage with no consideration for your fee estimator. You might skew&lt;br/&gt;miners incentives in doing&lt;br/&gt;&amp;gt; &amp;gt; so: if you increase the fees by a factor of N, any miner with a&lt;br/&gt;fraction larger than 1/N of the&lt;br/&gt;&amp;gt; &amp;gt; network hashrate now has an incentive to censor your transaction at&lt;br/&gt;first to get you to panic.&lt;br/&gt;&lt;br/&gt;&amp;gt; Yes I think miner-harvesting attacks should be weighed carefully in the&lt;br/&gt;design of offchain contracts fee-bumping strategies, at least in the future&lt;br/&gt;when the mining reward exhausts further.&lt;br/&gt;&lt;br/&gt;Miner-harvesting (such cool naming!) is interesting, but I want to clarify&lt;br/&gt;the value of N - I don&amp;#39;t think it&amp;#39;s the factor by which you increase the&lt;br/&gt;fees on just your transaction.&lt;br/&gt;&lt;br/&gt;To codify: your transaction pays a fee of `f1` right now and might pay a&lt;br/&gt;fee of `f2` in a later block that the miner expects to mine with 1/N&lt;br/&gt;probability. The economically rational miner isn&amp;#39;t incentivized if simply&lt;br/&gt;`f2 = N * f1` unless their mempool is otherwise empty.&lt;br/&gt;By omitting your transaction in this block, the miner can include another&lt;br/&gt;transaction/package paying `g1` fees instead, so they lose `f1-g1` in fees&lt;br/&gt;right now. In the future block, they have the choice between collecting&lt;br/&gt;`f2` or `g2` (from another transaction/package) in fees, so their gain is&lt;br/&gt;`max(f2-g2, 0)`.&lt;br/&gt;So the equation is more like: a miner with 1/N of the hashrate, employing&lt;br/&gt;this censorship strategy, gains only if `max(f2-g2, 0) &amp;gt; N * (f1-g1)`. More&lt;br/&gt;broadly, the miner only profits if `f2` is significantly higher than `g2`&lt;br/&gt;and `f1` is about the same feerate as everything else in your mempool: it&lt;br/&gt;seems like they&amp;#39;re betting on how much you _overshoot_, not how much you&lt;br/&gt;bump.&lt;br/&gt;&lt;br/&gt;In general, I agree it would really suck to inadvertently create a game&lt;br/&gt;where miners can drive feerates up by triggering desperation-driven&lt;br/&gt;fee-bumping procedures. I guess this is a reason to avoid&lt;br/&gt;increasingly-aggressive feebumping, or strategies where we predictably&lt;br/&gt;overshoot.&lt;br/&gt;&lt;br/&gt;Slightly related question: in contracts, generally, the timelock deadline&lt;br/&gt;is revealed in the script, so the miner knows how &amp;#34;desperate&amp;#34; we are right?&lt;br/&gt;Is that a problem? For Revault, if your Cancel transaction is a keypath&lt;br/&gt;spend (I think I remember reading that somewhere?) and you don&amp;#39;t reveal the&lt;br/&gt;script, they don&amp;#39;t see your timelock deadline yes?&lt;br/&gt;&lt;br/&gt;Again, thanks for the digging and sharing. :)&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, Nov 30, 2021 at 3:27 PM darosior via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi Antoine,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks for your comment. I believe for Lightning it&amp;#39;s simpler with regard&lt;br/&gt;&amp;gt; to the management of the UTxO pool, but harder with regard to choosing&lt;br/&gt;&amp;gt; a threat model.&lt;br/&gt;&amp;gt; Responses inline.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; For any opened channel, ensure the confirmation of a Commitment&lt;br/&gt;&amp;gt; transaction and the children HTLC-Success/HTLC-Timeout transactions. Note,&lt;br/&gt;&amp;gt; in the Lightning security game you have to consider (at least) 4 types of&lt;br/&gt;&amp;gt; players moves and incentives : your node, your channel counterparties, the&lt;br/&gt;&amp;gt; miners, the crowd of bitcoin users. The number of the last type of players&lt;br/&gt;&amp;gt; is unknown from your node, however it should not be forgotten you&amp;#39;re in&lt;br/&gt;&amp;gt; competition for block space, therefore their block demands bids should be&lt;br/&gt;&amp;gt; anticipated and reacted to in consequence. With that remark in mind,&lt;br/&gt;&amp;gt; implications for your LN fee-bumping strategy will be raised afterwards.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; For a LN service provider, on-chain overpayments are bearing on your&lt;br/&gt;&amp;gt; operational costs, thus downgrading your economic competitiveness. For the&lt;br/&gt;&amp;gt; average LN user, overpayment might price out outside a LN non-custodial&lt;br/&gt;&amp;gt; deployment, as you don&amp;#39;t have the minimal security budget to be on your own.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I think this problem statement can be easily generalised to any offchain&lt;br/&gt;&amp;gt; contract. And your points stand for all of them.&lt;br/&gt;&amp;gt; &amp;#34;For any opened contract, ensure at any point the confirmation of a (set&lt;br/&gt;&amp;gt; of) transaction(s) in a given number of blocks&amp;#34;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Same issue with Lightning, we can be pinned today on the basis of&lt;br/&gt;&amp;gt; replace-by-fee rule 3. We can be also blinded by network mempool&lt;br/&gt;&amp;gt; partitions, a pinning counterparty can segregate all the full-nodes  in as&lt;br/&gt;&amp;gt; many subsets by broadcasting a revoked Commitment transaction different for&lt;br/&gt;&amp;gt; each. For Revault, I think you can also do unlimited partitions by mutating&lt;br/&gt;&amp;gt; the ANYONECANPAY-input of the Cancel.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Well you can already do unlimited partitions by adding different inputs to&lt;br/&gt;&amp;gt; it. You could malleate the witness, but since we are using Miniscript i&amp;#39;m&lt;br/&gt;&amp;gt; confident you would only be able in a marginal way.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; That said, if you have a distributed towers deployment, spread across the&lt;br/&gt;&amp;gt; p2p network topology, and they can&amp;#39;t be clustered together through&lt;br/&gt;&amp;gt; cross-layers or intra-layer heuristics, you should be able to reliably&lt;br/&gt;&amp;gt; observe such partitions. I think such distributed monitors are deployed by&lt;br/&gt;&amp;gt; few L1 merchants accepting 0-conf to detect naive double-spend.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; We should aim to more than 0-conf (in)security level..&lt;br/&gt;&amp;gt; It seems to me the only policy-level mitigation for RBF pinning around the&lt;br/&gt;&amp;gt; &amp;#34;don&amp;#39;t decrease the abolute fees of a less-than-a-block mempool&amp;#34; would be&lt;br/&gt;&amp;gt; to drop the requirement on increasing absolute fees if the mempool is &amp;#34;full&lt;br/&gt;&amp;gt; enough&amp;#34; (and the feerate increases exponentially, of course).&lt;br/&gt;&amp;gt; Another approach could be by introducing new consensus rules as proposed&lt;br/&gt;&amp;gt; by Jeremy last year [0]. If we go in the realm of new consensus rules, then&lt;br/&gt;&amp;gt; i think that simply committing to a maximum tx size would fix pinning by&lt;br/&gt;&amp;gt; RBF rule 3. Could be in the annex, or in the unused sequence bits (although&lt;br/&gt;&amp;gt; they currently are by Lightning, meh). You could also check in the output&lt;br/&gt;&amp;gt; script that the input commits to this.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; [0]&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-September/018168.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-September/018168.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Have we already discussed a fee-bumping &amp;#34;shared cache&amp;#34;, a CPFP variation ?&lt;br/&gt;&amp;gt; Strawman idea: Alice and Bob commit collateral inputs to a separate UTXO&lt;br/&gt;&amp;gt; from the main &amp;#34;offchain contract&amp;#34; one. This UTXO is locked by a multi-sig.&lt;br/&gt;&amp;gt; For any Commitment transaction pre-signed, also counter-sign a CPFP with&lt;br/&gt;&amp;gt; top mempool feerate included, spending a Commitment anchor output and the&lt;br/&gt;&amp;gt; shared-cache UTXO. If the fees spike,  you can re-sign a high-feerate CPFP,&lt;br/&gt;&amp;gt; assuming interactivity. As the CPFP is counter-signed by everyone, the&lt;br/&gt;&amp;gt; outputs can be CSV-1 encumbered to prevent pinnings. If the share-cache is&lt;br/&gt;&amp;gt; feeded at parity, there shouldn&amp;#39;t be an incentive to waste or maliciously&lt;br/&gt;&amp;gt; inflate the feerate. I think this solution can be easily generalized to&lt;br/&gt;&amp;gt; more than 2 counterparties by using a multi-signature scheme. Big issue, if&lt;br/&gt;&amp;gt; the feerate is short due to fee spikes and you need to re-sign a&lt;br/&gt;&amp;gt; higher-feerate CPFP, you&amp;#39;re trusting your counterparty to interact, though&lt;br/&gt;&amp;gt; arguably not worse than the current update fee mechanism.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; It really looks just like `update_fee`. Except maybe with the property&lt;br/&gt;&amp;gt; that you have the channel liquidity not depend on the onchain feerate.&lt;br/&gt;&amp;gt; In any case, for Lightning i think it&amp;#39;s a bad idea to re-introduce trust&lt;br/&gt;&amp;gt; on this side post anchor outputs. For Revault it&amp;#39;s clearly out of the&lt;br/&gt;&amp;gt; question to introduce trust in your counterparties (why would you bother&lt;br/&gt;&amp;gt; having a fee-bumping mechanism in the first place then?). Probably the same&lt;br/&gt;&amp;gt; holds for all offchain contracts.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; For Lightning, it&amp;#39;d mean keeping an equivalent amount of funds as the&lt;br/&gt;&amp;gt; sum of all your&lt;br/&gt;&amp;gt; channels balances sitting there unallocated &amp;#34;just in case&amp;#34;. This is not&lt;br/&gt;&amp;gt; reasonable.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Agree, game-theory wise, you would like to keep a full fee-bumping&lt;br/&gt;&amp;gt; reserve, ready to burn as much in fees as the contested HTLC value, as it&amp;#39;s&lt;br/&gt;&amp;gt; the maximum gain of your counterparty. Though perfect equilibrium is hard&lt;br/&gt;&amp;gt; to achieve because your malicious counterparty might have an edge pushing&lt;br/&gt;&amp;gt; you to broadcast your Commitment first by witholding HTLC resolution.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Fractional fee-bumping reserves are much more realistic to expect in the&lt;br/&gt;&amp;gt; LN network. Lower fee-bumping reserve, higher liquidity deployed, in theory&lt;br/&gt;&amp;gt; higher routing fees. By observing historical feerates, average offchain&lt;br/&gt;&amp;gt; balances at risk and routing fees expected gains, you should be able to&lt;br/&gt;&amp;gt; discover an equilibrium where higher levels of reserve aren&amp;#39;t worth the&lt;br/&gt;&amp;gt; opportunity cost. I guess this  equilibrium could be your LN fee-bumping&lt;br/&gt;&amp;gt; reserve max feerate.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Note, I think the LN approach is a bit different from what suits a custody&lt;br/&gt;&amp;gt; protocol like Revault,  as you compute a direct return of the frozen&lt;br/&gt;&amp;gt; fee-bumping liquidity. With Revault, if you have numerous bitcoins&lt;br/&gt;&amp;gt; protected, it&amp;#39;s might be more interesting to adopt a &amp;#34;buy the mempool,&lt;br/&gt;&amp;gt; stupid&amp;#34; strategy than risking fund safety for few percentages of interest&lt;br/&gt;&amp;gt; returns.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; True for routing nodes. For wallets (if receiving funds), it&amp;#39;s not about&lt;br/&gt;&amp;gt; an investment: just users expectations to being able to transact without&lt;br/&gt;&amp;gt; risking to lose their funds (ie being able to enforce their contract&lt;br/&gt;&amp;gt; onchain). Although wallets they are much less at risk.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; This is where the &amp;#34;anticipate the crowd of bitcoin users move&amp;#34; point can&lt;br/&gt;&amp;gt; be laid out. As the crowd of bitcoin users&amp;#39; fee-bumping reserves are&lt;br/&gt;&amp;gt; ultimately unknown from your node knowledge, you should be ready to be a&lt;br/&gt;&amp;gt; bit more conservative than the vanilla fee-bumping strategies shipped by&lt;br/&gt;&amp;gt; default. In case of massive mempool congestion, your additional&lt;br/&gt;&amp;gt; conservatism might get your time-sensitive transactions and game on the&lt;br/&gt;&amp;gt; crowd of bitcoin users. First Problem: if all offchain bitcoin software&lt;br/&gt;&amp;gt; adopt that strategy we might inflate the worst-case feerate rate at the&lt;br/&gt;&amp;gt; benefit of the miners, without holistically improving block throughput.&lt;br/&gt;&amp;gt; Second problem : your class of offchain bitcoin softwares might have&lt;br/&gt;&amp;gt; ridiculous fee-bumping reserve compared&lt;br/&gt;&amp;gt; to other classes of offchain bitcoin softwares (Revault &amp;gt; Lightning) and&lt;br/&gt;&amp;gt; just be priced out bydesign in case of mempool congestion. Third problem :&lt;br/&gt;&amp;gt; as the number of offchain bitcoin applications should go up with time, your&lt;br/&gt;&amp;gt; fee-bumping reserve levels based from historical data might be always late&lt;br/&gt;&amp;gt; by one &amp;#34;bank-run&amp;#34; scenario.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Black swan event 2.0? Just rule n°3 is inherent to any kind of fee&lt;br/&gt;&amp;gt; estimation.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; For Lightning, if you&amp;#39;re short in fee-bumping reserves you might still do&lt;br/&gt;&amp;gt; preemptive channel closures, either cooperatively or unilaterally and get&lt;br/&gt;&amp;gt; back the off-chain liquidity to protect the more economically interesting&lt;br/&gt;&amp;gt; channels. Though again, that kind of automatic behavior might be compelling&lt;br/&gt;&amp;gt; at the individual node-level, but make the mempol congestion worse&lt;br/&gt;&amp;gt; holistically.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Yeah so we are back to the &amp;#34;fractional reserve&amp;#34; model: you can only&lt;br/&gt;&amp;gt; enforce X% of the offchain contracts your participate in.. Actually it&amp;#39;s&lt;br/&gt;&amp;gt; even an added assumption: that you still have operating contracts, with&lt;br/&gt;&amp;gt; honest counterparties.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; In case of massive mempool congestion, you might try to front-run the&lt;br/&gt;&amp;gt; crowd of bitcoin users relying on block connections for fee-bumping, and&lt;br/&gt;&amp;gt; thus start your fee-bumping as soon as you observe feerate groups&lt;br/&gt;&amp;gt; fluctuations in your local mempool(s).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I don&amp;#39;t think any kind of mempool-based estimate generalizes well, since&lt;br/&gt;&amp;gt; at any point the expected time before the next block is 10 minutes (and a&lt;br/&gt;&amp;gt; lot can happen in 10min).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Also you might proceed your fee-bumping ticks on a local clock instead of&lt;br/&gt;&amp;gt; block connections in case of time-dilation or deeper eclipse attacks of&lt;br/&gt;&amp;gt; your local node. Your view of the chain might be compromised but not your&lt;br/&gt;&amp;gt; ability to broadcast transactions thanks to emergency channels (in the&lt;br/&gt;&amp;gt; non-LN sense...though in fact quid of txn wrapped in onions ?) of&lt;br/&gt;&amp;gt; communication.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Oh, yeah, i didn&amp;#39;t explicit &amp;#34;not getting eclipsed&amp;#34; (or more generally&lt;br/&gt;&amp;gt; &amp;#34;data availability&amp;#34;) as an assumption since it&amp;#39;s generally one made by&lt;br/&gt;&amp;gt; participants of any offchain contract. In this case you can&amp;#39;t even have&lt;br/&gt;&amp;gt; decent fee estimation, so you are screwed anyways.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Yes, stay open the question on how you enforce this block insurance&lt;br/&gt;&amp;gt; market. Reputation, which might be to avoid due to the latent&lt;br/&gt;&amp;gt; centralization effect, might be hard to stack and audit reliably for an&lt;br/&gt;&amp;gt; emergency mechanism running, hopefully, once in a halvening period. Maybe&lt;br/&gt;&amp;gt; maybe some cryptographic or economically based mechanism on slashing or&lt;br/&gt;&amp;gt; swaps could be found...&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Unfortunately, given current mining centralisation, pools are in a very&lt;br/&gt;&amp;gt; good position to offer pretty decent SLAs around that. With a block space&lt;br/&gt;&amp;gt; insurance, you of course don&amp;#39;t need all these convoluted fee-bumping hacks.&lt;br/&gt;&amp;gt; I&amp;#39;m very concerned that large stakeholders of the &amp;#34;offchain contracts&lt;br/&gt;&amp;gt; ecosystem&amp;#34; would just go this (easier) way and further increase mining&lt;br/&gt;&amp;gt; centralisation pressure.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I agree that a cryptography-based scheme around this type of insurance&lt;br/&gt;&amp;gt; services would be the best way out.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Antoine&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le lun. 29 nov. 2021 à 09:34, darosior via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi everyone,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Fee-bumping is paramount to the security of many protocols building on&lt;br/&gt;&amp;gt;&amp;gt; Bitcoin, as they require the&lt;br/&gt;&amp;gt;&amp;gt; confirmation of a transaction (which might be presigned) before the&lt;br/&gt;&amp;gt;&amp;gt; expiration of a timelock at any&lt;br/&gt;&amp;gt;&amp;gt; point after the establishment of the contract.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The part of Revault using presigned transactions (the delegation from a&lt;br/&gt;&amp;gt;&amp;gt; large to a smaller multisig)&lt;br/&gt;&amp;gt;&amp;gt; is no exception. We have been working on how to approach this for a while&lt;br/&gt;&amp;gt;&amp;gt; now and i&amp;#39;d like to share&lt;br/&gt;&amp;gt;&amp;gt; what we have in order to open a discussion on this problem so central to&lt;br/&gt;&amp;gt;&amp;gt; what seem to be The Right&lt;br/&gt;&amp;gt;&amp;gt; Way [0] to build on Bitcoin but which has yet to be discussed in details&lt;br/&gt;&amp;gt;&amp;gt; (at least publicly).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I&amp;#39;ll discuss what we came up with for Revault (at least for what will be&lt;br/&gt;&amp;gt;&amp;gt; its first iteration) but my&lt;br/&gt;&amp;gt;&amp;gt; intent with posting to the mailing list is more to frame the questions to&lt;br/&gt;&amp;gt;&amp;gt; this problem we are all&lt;br/&gt;&amp;gt;&amp;gt; going to face rather than present the results of our study tailored to&lt;br/&gt;&amp;gt;&amp;gt; the Revault usecase.&lt;br/&gt;&amp;gt;&amp;gt; The discussion is still pretty Revault-centric (as it&amp;#39;s the case study)&lt;br/&gt;&amp;gt;&amp;gt; but hopefully this can help&lt;br/&gt;&amp;gt;&amp;gt; future protocol designers and/or start a discussion around what&lt;br/&gt;&amp;gt;&amp;gt; everyone&amp;#39;s doing for existing ones.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 1. Reminder about Revault&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The part of Revault we are interested in for this study is the delegation&lt;br/&gt;&amp;gt;&amp;gt; process, and more&lt;br/&gt;&amp;gt;&amp;gt; specifically the application of spending policies by network monitors&lt;br/&gt;&amp;gt;&amp;gt; (watchtowers).&lt;br/&gt;&amp;gt;&amp;gt; Coins are received on a large multisig. Participants of this large&lt;br/&gt;&amp;gt;&amp;gt; multisig create 2 [1]&lt;br/&gt;&amp;gt;&amp;gt; transactions. The Unvault, spending a deposit UTxO, creates an output&lt;br/&gt;&amp;gt;&amp;gt; paying either to the small&lt;br/&gt;&amp;gt;&amp;gt; multisig after a timelock or to the large multisig immediately. The&lt;br/&gt;&amp;gt;&amp;gt; Cancel, spending the Unvault&lt;br/&gt;&amp;gt;&amp;gt; output through the non-timelocked path, creates a new deposit UTxO.&lt;br/&gt;&amp;gt;&amp;gt; Participants regularly exchange the Cancel transaction signatures for&lt;br/&gt;&amp;gt;&amp;gt; each deposit, sharing the&lt;br/&gt;&amp;gt;&amp;gt; signatures with the watchtowers they operate. They then optionally [2]&lt;br/&gt;&amp;gt;&amp;gt; sign the Unvault transaction&lt;br/&gt;&amp;gt;&amp;gt; and share the signatures with the small multisig participants who can in&lt;br/&gt;&amp;gt;&amp;gt; turn use them to proceed&lt;br/&gt;&amp;gt;&amp;gt; with a spending. Watchtowers can enforce spending policies (say, can&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt; Unvault outside of business&lt;br/&gt;&amp;gt;&amp;gt; hours) by having the Cancel transaction be confirmed before the&lt;br/&gt;&amp;gt;&amp;gt; expiration of the timelock.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 2. Problem statement&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; For any delegated vault, ensure the confirmation of a Cancel transaction&lt;br/&gt;&amp;gt;&amp;gt; in a configured number of&lt;br/&gt;&amp;gt;&amp;gt; blocks at any point. In so doing, minimize the overpayments and the UTxO&lt;br/&gt;&amp;gt;&amp;gt; set footprint. Overpayments&lt;br/&gt;&amp;gt;&amp;gt; increase the burden on the watchtower operator by increasing the required&lt;br/&gt;&amp;gt;&amp;gt; frequency of refills of the&lt;br/&gt;&amp;gt;&amp;gt; fee-bumping wallet, which is already the worst user experience. You are&lt;br/&gt;&amp;gt;&amp;gt; likely to manage a number of&lt;br/&gt;&amp;gt;&amp;gt; UTxOs with your number of vaults, which comes at a cost for you as well&lt;br/&gt;&amp;gt;&amp;gt; as everyone running a full&lt;br/&gt;&amp;gt;&amp;gt; node.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Note that this assumes miners are economically rationale, are&lt;br/&gt;&amp;gt;&amp;gt; incentivized by *public* fees and that&lt;br/&gt;&amp;gt;&amp;gt; you have a way to propagate your fee-bumped transaction to them. We also&lt;br/&gt;&amp;gt;&amp;gt; don&amp;#39;t consider the block&lt;br/&gt;&amp;gt;&amp;gt; space bounds.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In the previous paragraph and the following text, &amp;#34;vault&amp;#34; can generally&lt;br/&gt;&amp;gt;&amp;gt; be replaced with &amp;#34;offchain&lt;br/&gt;&amp;gt;&amp;gt; contract&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 3. With presigned transactions&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; As you all know, the first difficulty is to get to be able to&lt;br/&gt;&amp;gt;&amp;gt; unilaterally enforce your contract&lt;br/&gt;&amp;gt;&amp;gt; onchain. That is, any participant must be able to unilaterally bump the&lt;br/&gt;&amp;gt;&amp;gt; fees of a transaction even&lt;br/&gt;&amp;gt;&amp;gt; if it was co-signed by other participants.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; For Revault we can afford to introduce malleability in the Cancel&lt;br/&gt;&amp;gt;&amp;gt; transaction since there is no&lt;br/&gt;&amp;gt;&amp;gt; second-stage transaction depending on its txid. Therefore it is&lt;br/&gt;&amp;gt;&amp;gt; pre-signed with ANYONECANPAY. We&lt;br/&gt;&amp;gt;&amp;gt; can&amp;#39;t use ANYONECANPAY|SINGLE since it would open a pinning vector [3].&lt;br/&gt;&amp;gt;&amp;gt; Note how we can&amp;#39;t leverage&lt;br/&gt;&amp;gt;&amp;gt; the carve out rule, and neither can any other more-than-two-parties&lt;br/&gt;&amp;gt;&amp;gt; contract.&lt;br/&gt;&amp;gt;&amp;gt; This has a significant implication for the rest, as we are entirely&lt;br/&gt;&amp;gt;&amp;gt; burning fee-bumping UTxOs.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This opens up a pinning vector, or at least a significant nuisance: any&lt;br/&gt;&amp;gt;&amp;gt; other party can largely&lt;br/&gt;&amp;gt;&amp;gt; increase the absolute fee without increasing the feerate, leveraging the&lt;br/&gt;&amp;gt;&amp;gt; RBF rules to prevent you&lt;br/&gt;&amp;gt;&amp;gt; from replacing it without paying an insane fee. And you might not see it&lt;br/&gt;&amp;gt;&amp;gt; in your own mempool and&lt;br/&gt;&amp;gt;&amp;gt; could only suppose it&amp;#39;s happening by receiving non-full blocks or with&lt;br/&gt;&amp;gt;&amp;gt; transactions paying a lower&lt;br/&gt;&amp;gt;&amp;gt; feerate.&lt;br/&gt;&amp;gt;&amp;gt; Unfortunately i know of no other primitive that can be used by&lt;br/&gt;&amp;gt;&amp;gt; multi-party (i mean, &amp;gt;2) presigned&lt;br/&gt;&amp;gt;&amp;gt; transactions protocols for fee-bumping that aren&amp;#39;t (more) vulnerable to&lt;br/&gt;&amp;gt;&amp;gt; pinning.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 4. We are still betting on future feerate&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The problem is still missing one more constraint. &amp;#34;Ensuring confirmation&lt;br/&gt;&amp;gt;&amp;gt; at any time&amp;#34; involves ensuring&lt;br/&gt;&amp;gt;&amp;gt; confirmation at *any* feerate, which you *cannot* do. So what&amp;#39;s the&lt;br/&gt;&amp;gt;&amp;gt; limit? In theory you should be ready&lt;br/&gt;&amp;gt;&amp;gt; to burn as much in fees as the value of the funds you want to get out of&lt;br/&gt;&amp;gt;&amp;gt; the contract. So... For us&lt;br/&gt;&amp;gt;&amp;gt; it&amp;#39;d mean keeping for each vault an equivalent amount of funds sitting&lt;br/&gt;&amp;gt;&amp;gt; there on the watchtower&amp;#39;s hot&lt;br/&gt;&amp;gt;&amp;gt; wallet. For Lightning, it&amp;#39;d mean keeping an equivalent amount of funds as&lt;br/&gt;&amp;gt;&amp;gt; the sum of all your&lt;br/&gt;&amp;gt;&amp;gt; channels balances sitting there unallocated &amp;#34;just in case&amp;#34;. This is not&lt;br/&gt;&amp;gt;&amp;gt; reasonable.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; So you need to keep a maximum feerate, above which you won&amp;#39;t be able to&lt;br/&gt;&amp;gt;&amp;gt; ensure the enforcement of&lt;br/&gt;&amp;gt;&amp;gt; all your contracts onchain at the same time. We call that the &amp;#34;reserve&lt;br/&gt;&amp;gt;&amp;gt; feerate&amp;#34; and you can have&lt;br/&gt;&amp;gt;&amp;gt; different strategies for choosing it, for instance:&lt;br/&gt;&amp;gt;&amp;gt; - The 85th percentile over the last year of transactions feerates&lt;br/&gt;&amp;gt;&amp;gt; - The maximum historical feerate&lt;br/&gt;&amp;gt;&amp;gt; - The maximum historical feerate adjusted in dollars (makes more sense&lt;br/&gt;&amp;gt;&amp;gt; but introduces a (set of?)&lt;br/&gt;&amp;gt;&amp;gt;   trusted oracle(s) in a security-critical component)&lt;br/&gt;&amp;gt;&amp;gt; - Picking a random high feerate (why not? It&amp;#39;s an arbitrary assumption&lt;br/&gt;&amp;gt;&amp;gt; anyways)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Therefore, even if we don&amp;#39;t have to bet on the broadcast-time feerate&lt;br/&gt;&amp;gt;&amp;gt; market at signing time anymore&lt;br/&gt;&amp;gt;&amp;gt; (since we can unilaterally bump), we still need some kind of prediction&lt;br/&gt;&amp;gt;&amp;gt; in preparation of making&lt;br/&gt;&amp;gt;&amp;gt; funds available to bump the fees at broadcast time.&lt;br/&gt;&amp;gt;&amp;gt; Apart from judging that 500sat/vb is probably more reasonable than&lt;br/&gt;&amp;gt;&amp;gt; 10sat/vbyte, this unfortunately&lt;br/&gt;&amp;gt;&amp;gt; sounds pretty much crystal-ball-driven.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; We currently use the maximum of the 95th percentiles over 90-days windows&lt;br/&gt;&amp;gt;&amp;gt; over historical block chain&lt;br/&gt;&amp;gt;&amp;gt; feerates. [4]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 5. How much funds does my watchtower need?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; That&amp;#39;s what we call the &amp;#34;reserve&amp;#34;. Depending on your reserve feerate&lt;br/&gt;&amp;gt;&amp;gt; strategy it might vary over&lt;br/&gt;&amp;gt;&amp;gt; time. This is easier to reason about with a per-contract reserve. For&lt;br/&gt;&amp;gt;&amp;gt; Revault it&amp;#39;s pretty&lt;br/&gt;&amp;gt;&amp;gt; straightforward since the Cancel transaction size is static:&lt;br/&gt;&amp;gt;&amp;gt; `reserve_feerate * cancel_size`. For&lt;br/&gt;&amp;gt;&amp;gt; other protocols with dynamic transaction sizes (or even packages of&lt;br/&gt;&amp;gt;&amp;gt; transactions) it&amp;#39;s less so. For&lt;br/&gt;&amp;gt;&amp;gt; your Lightning channel you would probably take the maximum size of your&lt;br/&gt;&amp;gt;&amp;gt; commitment transaction&lt;br/&gt;&amp;gt;&amp;gt; according to your HTLC exposure settings &#43; the size of as many&lt;br/&gt;&amp;gt;&amp;gt; `htlc_success` transaction?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Then you either have your software or your user guesstimate how many&lt;br/&gt;&amp;gt;&amp;gt; offchain contracts the&lt;br/&gt;&amp;gt;&amp;gt; watchtower will have to watch, time that by the per-contract reserve and&lt;br/&gt;&amp;gt;&amp;gt; refill this amount (plus&lt;br/&gt;&amp;gt;&amp;gt; some slack in practice). Once again, a UX tradeoff (not even mentioning&lt;br/&gt;&amp;gt;&amp;gt; the guesstimation UX):&lt;br/&gt;&amp;gt;&amp;gt; overestimating leads to too many unallocated funds sitting on a hot&lt;br/&gt;&amp;gt;&amp;gt; wallet, underestimating means&lt;br/&gt;&amp;gt;&amp;gt; (at best) inability to participate in new contracts or being &amp;#34;at risk&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; (not being able to enforce&lt;br/&gt;&amp;gt;&amp;gt; all your contracts onchain at your reserve feerate) before a new refill.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; For vaults you likely have large-value UTxOs and small transactions (the&lt;br/&gt;&amp;gt;&amp;gt; Cancel is one-in one-out in&lt;br/&gt;&amp;gt;&amp;gt; Revault). For some other applications with large transactions and&lt;br/&gt;&amp;gt;&amp;gt; lower-value UTxOs on average it&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt; likely that only part of the offchain contracts might be enforceable at a&lt;br/&gt;&amp;gt;&amp;gt; reasonable feerate. Is it&lt;br/&gt;&amp;gt;&amp;gt; reasonable?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 6. UTxO pool layout&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Now that you somehow managed to settle on a refill amount, how are you&lt;br/&gt;&amp;gt;&amp;gt; going to use these funds?&lt;br/&gt;&amp;gt;&amp;gt; Also, you&amp;#39;ll need to manage your pool across time (consolidating small&lt;br/&gt;&amp;gt;&amp;gt; coins, and probably fanning&lt;br/&gt;&amp;gt;&amp;gt; out large ones).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; You could keep a single large UTxO and peel it as you need to sponsor&lt;br/&gt;&amp;gt;&amp;gt; transactions. But this means&lt;br/&gt;&amp;gt;&amp;gt; that you need to create a coin of a specific value according to your need&lt;br/&gt;&amp;gt;&amp;gt; at the current feerate&lt;br/&gt;&amp;gt;&amp;gt; estimation, hope to have it confirmed in a few blocks (at least for now!&lt;br/&gt;&amp;gt;&amp;gt; [5]), and hope that the&lt;br/&gt;&amp;gt;&amp;gt; value won&amp;#39;t be obsolete by the time it confirmed. Also, you&amp;#39;d have to do&lt;br/&gt;&amp;gt;&amp;gt; that for any number of&lt;br/&gt;&amp;gt;&amp;gt; Cancel, chaining feebump coin creation transactions off the change of the&lt;br/&gt;&amp;gt;&amp;gt; previous ones or replacing&lt;br/&gt;&amp;gt;&amp;gt; them with more outputs. Both seem to become really un-manageable (and&lt;br/&gt;&amp;gt;&amp;gt; expensive) in many edge-cases,&lt;br/&gt;&amp;gt;&amp;gt; shortening the time you have to confirm the actual Cancel transaction and&lt;br/&gt;&amp;gt;&amp;gt; creating uncertainty about&lt;br/&gt;&amp;gt;&amp;gt; the reserve (how much is my just-in-time fanout going to cost me in fees&lt;br/&gt;&amp;gt;&amp;gt; that i need to refill in&lt;br/&gt;&amp;gt;&amp;gt; advance on my watchtower wallet?).&lt;br/&gt;&amp;gt;&amp;gt; This is less of a concern for protocols using CPFP to sponsor&lt;br/&gt;&amp;gt;&amp;gt; transactions, but they rely on a&lt;br/&gt;&amp;gt;&amp;gt; policy rule specific to 2-parties contracts.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Therefore for Revault we fan-out the coins per-vault in advance. We do so&lt;br/&gt;&amp;gt;&amp;gt; at refill time so the&lt;br/&gt;&amp;gt;&amp;gt; refiller can give an excess to pay for the fees of the fanout transaction&lt;br/&gt;&amp;gt;&amp;gt; (which is reasonable since&lt;br/&gt;&amp;gt;&amp;gt; it will occur just after the refilling transaction confirms). When the&lt;br/&gt;&amp;gt;&amp;gt; watchtower is asked to watch&lt;br/&gt;&amp;gt;&amp;gt; for a new delegated vault it will allocate coins from the pool of&lt;br/&gt;&amp;gt;&amp;gt; fanned-out UTxOs to it (failing&lt;br/&gt;&amp;gt;&amp;gt; that, it would refuse the delegation).&lt;br/&gt;&amp;gt;&amp;gt; What is a good distribution of UTxOs amounts per vault? We want to&lt;br/&gt;&amp;gt;&amp;gt; minimize the number of coins,&lt;br/&gt;&amp;gt;&amp;gt; still have coins small enough to not overpay (remember, we can&amp;#39;t have&lt;br/&gt;&amp;gt;&amp;gt; change) and be able to bump a&lt;br/&gt;&amp;gt;&amp;gt; Cancel up to the reserve feerate using these coins. The two latter&lt;br/&gt;&amp;gt;&amp;gt; constraints are directly in&lt;br/&gt;&amp;gt;&amp;gt; contradiction as the minimal value of a coin usable at the reserve&lt;br/&gt;&amp;gt;&amp;gt; feerate (paying for its own input&lt;br/&gt;&amp;gt;&amp;gt; fee &#43; bumping the feerate by, say, 5sat/vb) is already pretty high.&lt;br/&gt;&amp;gt;&amp;gt; Therefore we decided to go with&lt;br/&gt;&amp;gt;&amp;gt; two distributions per vault. The &amp;#34;reserve distribution&amp;#34; alone ensures&lt;br/&gt;&amp;gt;&amp;gt; that we can bump up to the&lt;br/&gt;&amp;gt;&amp;gt; reserve feerate and is usable for high feerates. The &amp;#34;bonus distribution&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt; is not, but contains&lt;br/&gt;&amp;gt;&amp;gt; smaller coins useful to prevent overpayments during low and medium fee&lt;br/&gt;&amp;gt;&amp;gt; periods (which is most of the&lt;br/&gt;&amp;gt;&amp;gt; time).&lt;br/&gt;&amp;gt;&amp;gt; Both distributions are based on a basic geometric suite [6]. Each value&lt;br/&gt;&amp;gt;&amp;gt; is half the previous one.&lt;br/&gt;&amp;gt;&amp;gt; This exponentially decreases the value, limiting the number of coins. But&lt;br/&gt;&amp;gt;&amp;gt; this also allows for&lt;br/&gt;&amp;gt;&amp;gt; pretty small coins to exist and each coin&amp;#39;s value is equal to the sum of&lt;br/&gt;&amp;gt;&amp;gt; the smaller coins,&lt;br/&gt;&amp;gt;&amp;gt; or smaller by at most the value of the smallest coin. Therefore bounding&lt;br/&gt;&amp;gt;&amp;gt; the maximum overpayment to&lt;br/&gt;&amp;gt;&amp;gt; the smallest coin&amp;#39;s value [7].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; For the management of the UTxO pool across time we merged the&lt;br/&gt;&amp;gt;&amp;gt; consolidation with the fanout. When&lt;br/&gt;&amp;gt;&amp;gt; fanning out a refilled UTxO, we scan the pool for coins that need to be&lt;br/&gt;&amp;gt;&amp;gt; consolidated according to a&lt;br/&gt;&amp;gt;&amp;gt; heuristic. An instance of a heuristic is &amp;#34;the coin isn&amp;#39;t allocated and&lt;br/&gt;&amp;gt;&amp;gt; would not have been able to&lt;br/&gt;&amp;gt;&amp;gt; increase the fee at the median feerate over the past 90 days of blocks&amp;#34;.&lt;br/&gt;&amp;gt;&amp;gt; We had this assumption that feerate would tend to go up with time and&lt;br/&gt;&amp;gt;&amp;gt; therefore discarded having to&lt;br/&gt;&amp;gt;&amp;gt; split some UTxOs from the pool. We however overlooked that a large&lt;br/&gt;&amp;gt;&amp;gt; increase in the exchange price of&lt;br/&gt;&amp;gt;&amp;gt; BTC as we&amp;#39;ve seen during the past year could invalidate this assumption&lt;br/&gt;&amp;gt;&amp;gt; and that should arguably be&lt;br/&gt;&amp;gt;&amp;gt; reconsidered.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 7. Bumping and re-bumping&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; First of all, when to fee-bump? At fixed time intervals? At each block&lt;br/&gt;&amp;gt;&amp;gt; connection? It sounds like,&lt;br/&gt;&amp;gt;&amp;gt; given a large enough timelock, you could try to greed by &amp;#34;trying your&lt;br/&gt;&amp;gt;&amp;gt; luck&amp;#34; at a lower feerate and&lt;br/&gt;&amp;gt;&amp;gt; only re-bumping every N blocks. You would then start aggressively bumping&lt;br/&gt;&amp;gt;&amp;gt; at every block after M&lt;br/&gt;&amp;gt;&amp;gt; blocks have passed. But that&amp;#39;s actually a bet (in disguised?) that the&lt;br/&gt;&amp;gt;&amp;gt; next block feerate in M blocks&lt;br/&gt;&amp;gt;&amp;gt; will be lower than the current one. In the absence of any predictive&lt;br/&gt;&amp;gt;&amp;gt; model it is more reasonable to&lt;br/&gt;&amp;gt;&amp;gt; just start being aggressive immediately.&lt;br/&gt;&amp;gt;&amp;gt; You probably want to base your estimates on `estimatesmartfee` and as a&lt;br/&gt;&amp;gt;&amp;gt; consequence you would re-bump&lt;br/&gt;&amp;gt;&amp;gt; (if needed )after each block connection, when your estimates get updated&lt;br/&gt;&amp;gt;&amp;gt; and you notice your&lt;br/&gt;&amp;gt;&amp;gt; transaction was not included in the block.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In the event that you notice a consequent portion of the block is filled&lt;br/&gt;&amp;gt;&amp;gt; with transactions paying&lt;br/&gt;&amp;gt;&amp;gt; less than your own, you might want to start panicking and bump your&lt;br/&gt;&amp;gt;&amp;gt; transaction fees by a certain&lt;br/&gt;&amp;gt;&amp;gt; percentage with no consideration for your fee estimator. You might skew&lt;br/&gt;&amp;gt;&amp;gt; miners incentives in doing&lt;br/&gt;&amp;gt;&amp;gt; so: if you increase the fees by a factor of N, any miner with a fraction&lt;br/&gt;&amp;gt;&amp;gt; larger than 1/N of the&lt;br/&gt;&amp;gt;&amp;gt; network hashrate now has an incentive to censor your transaction at first&lt;br/&gt;&amp;gt;&amp;gt; to get you to panic. Also&lt;br/&gt;&amp;gt;&amp;gt; note this can happen if you want to pay the absolute fees for the&lt;br/&gt;&amp;gt;&amp;gt; &amp;#39;pinning&amp;#39; attack mentioned in&lt;br/&gt;&amp;gt;&amp;gt; section #2, and that might actually incentivize miners to perform it&lt;br/&gt;&amp;gt;&amp;gt; themselves..&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The gist is that the most effective way to bump and rebump (RBF the&lt;br/&gt;&amp;gt;&amp;gt; Cancel tx) seems to just be to&lt;br/&gt;&amp;gt;&amp;gt; consider the `estimatesmartfee 2 CONSERVATIVE` feerate at every block&lt;br/&gt;&amp;gt;&amp;gt; your tx isn&amp;#39;t included in, and&lt;br/&gt;&amp;gt;&amp;gt; to RBF it if the feerate is higher.&lt;br/&gt;&amp;gt;&amp;gt; In addition, we fallback to a block chain based estimation when estimates&lt;br/&gt;&amp;gt;&amp;gt; aren&amp;#39;t available (eg if&lt;br/&gt;&amp;gt;&amp;gt; the user stopped their WT for say a hour and we come back up): we use the&lt;br/&gt;&amp;gt;&amp;gt; 85th percentile over the&lt;br/&gt;&amp;gt;&amp;gt; feerates in the last 6 blocks. Sure, miners can try to have an influence&lt;br/&gt;&amp;gt;&amp;gt; on that by stuffing their&lt;br/&gt;&amp;gt;&amp;gt; blocks with large fee self-paying transactions, but they would need to:&lt;br/&gt;&amp;gt;&amp;gt; 1. Be sure to catch a significant portion of the 6 blocks (at least 2,&lt;br/&gt;&amp;gt;&amp;gt; actually)&lt;br/&gt;&amp;gt;&amp;gt; 2. Give up on 25% of the highest fee-paying transactions (assuming they&lt;br/&gt;&amp;gt;&amp;gt; got the 6 blocks, it&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;    proportionally larger and incertain as they get less of them)&lt;br/&gt;&amp;gt;&amp;gt; 3. Hope that our estimator will fail and we need to fall back to the&lt;br/&gt;&amp;gt;&amp;gt; chain-based estimation&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 8. Our study&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; We essentially replayed the historical data with different deployment&lt;br/&gt;&amp;gt;&amp;gt; configurations (number of&lt;br/&gt;&amp;gt;&amp;gt; participants and timelock) and probability of an event occurring (event&lt;br/&gt;&amp;gt;&amp;gt; being say an Unvault, an&lt;br/&gt;&amp;gt;&amp;gt; invalid Unvault, a new delegation, ..). We then observed different&lt;br/&gt;&amp;gt;&amp;gt; metrics such as the time at risk&lt;br/&gt;&amp;gt;&amp;gt; (when we can&amp;#39;t enforce all our contracts at the reserve feerate at the&lt;br/&gt;&amp;gt;&amp;gt; same time), or the&lt;br/&gt;&amp;gt;&amp;gt; operational cost.&lt;br/&gt;&amp;gt;&amp;gt; We got the historical fee estimates data from Statoshi [9], Txstats [10]&lt;br/&gt;&amp;gt;&amp;gt; and the historical chain&lt;br/&gt;&amp;gt;&amp;gt; data from Riccardo Casatta&amp;#39;s `blocks_iterator` [11]. Thanks!&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The (research-quality..) code can be found at&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/revault/research&#34;&gt;https://github.com/revault/research&lt;/a&gt; under the section&lt;br/&gt;&amp;gt;&amp;gt; &amp;#34;Fee bumping&amp;#34;. Again it&amp;#39;s very Revault specific, but at least the data&lt;br/&gt;&amp;gt;&amp;gt; can probably be reused for&lt;br/&gt;&amp;gt;&amp;gt; studying other protocols.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## 9. Insurances&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Of course, given it&amp;#39;s all hacks and workarounds and there is no good&lt;br/&gt;&amp;gt;&amp;gt; answer to &amp;#34;what is a reasonable&lt;br/&gt;&amp;gt;&amp;gt; feerate up to which we need to make contracts enforceable onchain?&amp;#34;,&lt;br/&gt;&amp;gt;&amp;gt; there is definitely room for an&lt;br/&gt;&amp;gt;&amp;gt; insurance market. But this enters the realm of opinions. Although i do&lt;br/&gt;&amp;gt;&amp;gt; have some (having discussed&lt;br/&gt;&amp;gt;&amp;gt; this topic for the past years with different people), i would like to&lt;br/&gt;&amp;gt;&amp;gt; keep this post focused on the&lt;br/&gt;&amp;gt;&amp;gt; technical aspects of this problem.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [0] As far as i can tell, having offchain contracts be enforceable&lt;br/&gt;&amp;gt;&amp;gt; onchain by confirming a&lt;br/&gt;&amp;gt;&amp;gt; transaction before the expiration of a timelock is a widely agreed-upon&lt;br/&gt;&amp;gt;&amp;gt; approach. And i don&amp;#39;t think&lt;br/&gt;&amp;gt;&amp;gt; we can opt for any other fundamentally different one, as you want to know&lt;br/&gt;&amp;gt;&amp;gt; you can claim back your&lt;br/&gt;&amp;gt;&amp;gt; coins from a contract after a deadline before taking part in it.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [1] The Real Revault (tm) involves more transactions, but for the sake of&lt;br/&gt;&amp;gt;&amp;gt; conciseness i only&lt;br/&gt;&amp;gt;&amp;gt; detailed a minimum instance of the problem.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [2] Only presigning part of the Unvault transactions allows to only&lt;br/&gt;&amp;gt;&amp;gt; delegate part of the coins,&lt;br/&gt;&amp;gt;&amp;gt; which can be abstracted as &amp;#34;delegate x% of your stash&amp;#34; in the user&lt;br/&gt;&amp;gt;&amp;gt; interface.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [3]&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-May/017835.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-May/017835.html&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [4]&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/revault/research/blob/1df953813708287c32a15e771ba74957ec44f354/feebumping/model/statemachine.py#L323-L329&#34;&gt;https://github.com/revault/research/blob/1df953813708287c32a15e771ba74957ec44f354/feebumping/model/statemachine.py#L323-L329&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [5] &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/23121&#34;&gt;https://github.com/bitcoin/bitcoin/pull/23121&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [6]&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/revault/research/blob/1df953813708287c32a15e771ba74957ec44f354/feebumping/model/statemachine.py#L494-L507&#34;&gt;https://github.com/revault/research/blob/1df953813708287c32a15e771ba74957ec44f354/feebumping/model/statemachine.py#L494-L507&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [7] Of course this assumes a combinatorial coin selection, but i believe&lt;br/&gt;&amp;gt;&amp;gt; it&amp;#39;s ok given we limit the&lt;br/&gt;&amp;gt;&amp;gt; number of coins beforehand.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [8] Although there is the argument to outbid a censorship, anyone&lt;br/&gt;&amp;gt;&amp;gt; censoring you isn&amp;#39;t necessarily a&lt;br/&gt;&amp;gt;&amp;gt; miner.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [9] &lt;a href=&#34;https://www.statoshi.info/&#34;&gt;https://www.statoshi.info/&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [10] &lt;a href=&#34;https://www.statoshi.info/&#34;&gt;https://www.statoshi.info/&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [11] &lt;a href=&#34;https://github.com/RCasatta/blocks_iterator&#34;&gt;https://github.com/RCasatta/blocks_iterator&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20211207/79ed7638/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20211207/79ed7638/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:00:54Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsge5k27z24qev9gmsx79txqk7t67vrefrl0aryejs7z2lrax9qnuczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q5y7jea</id>
    
      <title type="html">📅 Original date posted:2021-10-26 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsge5k27z24qev9gmsx79txqk7t67vrefrl0aryejs7z2lrax9qnuczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q5y7jea" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqswm6qqrsxpvvcgtrxuc77utvptq74czna3ve8smlhn4sffykk5cjgelyz8p&#39;&gt;nevent1q…yz8p&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-10-26&lt;br/&gt;📝 Original message:Hi Lisa,&lt;br/&gt;&lt;br/&gt;Some background for people who are not familiar with mempool:&lt;br/&gt;&lt;br/&gt;The mempool is a cache of unconfirmed transactions, designed in a way&lt;br/&gt;to help miners efficiently pick the highest feerate packages to&lt;br/&gt;include in new blocks. It stores more than a block&amp;#39;s worth of&lt;br/&gt;transactions because transaction volume fluctuates and any rational&lt;br/&gt;miner would try to maximize the fees in their blocks; in a reorg, we&lt;br/&gt;also don&amp;#39;t want to completely forget what transactions were in the&lt;br/&gt;now-stale tip.&lt;br/&gt;&lt;br/&gt;In Bitcoin Core, full nodes keep a mempool by default. The additional&lt;br/&gt;requirements for keeping a mempool are minimal (300MB storage, can be&lt;br/&gt;configured to be lower) because anyone, anywhere in the world, should&lt;br/&gt;be able to run a node and broadcast a Bitcoin payment without special&lt;br/&gt;connectivity to some specific set of people or expensive/inaccessible&lt;br/&gt;hardware. Perhaps connecting directly to miners can be a solution for&lt;br/&gt;some people, but I don&amp;#39;t think it&amp;#39;s healthy for the network.&lt;br/&gt;&lt;br/&gt;Some benefits of keeping a mempool as a non-mining node include:&lt;br/&gt;- Fee estimation based on your node&amp;#39;s knowledge of unconfirmed&lt;br/&gt;transactions &#43; historical data.&lt;br/&gt;- Dramatically increased block validation (and thus propagation)&lt;br/&gt;speed, since you cache signature and script results of transactions&lt;br/&gt;before they are confirmed.&lt;br/&gt;- Reduced block relay bandwidth usage (Bitcoin Core nodes use BIP152&lt;br/&gt;compact block relay), as you don&amp;#39;t need to re-request the block&lt;br/&gt;transactions you already have in your mempool.&lt;br/&gt;- Wallet ability to send/receive transactions that spend unconfirmed outputs.&lt;br/&gt;&lt;br/&gt;&amp;gt; I had the realization that the mempool is obsolete and should be eliminated.&lt;br/&gt;&lt;br/&gt;I assume you mean that the mempool should still exist but be turned&lt;br/&gt;off for non-mining nodes. A block template producer needs to keep&lt;br/&gt;unconfirmed transactions somewhere.&lt;br/&gt;On Bitcoin Core today, you can use the -blocksonly config option to&lt;br/&gt;ignore incoming transactions (effectively switching off your mempool),&lt;br/&gt;but there are strong reasons not to do this:&lt;br/&gt;- It is trivial for your peers to detect that all transactions&lt;br/&gt;broadcasted by your node = from your wallet. Linking your node to your&lt;br/&gt;transactions is a very bad privacy leak.&lt;br/&gt;- You must query someone else for what feerate to put on your transaction.&lt;br/&gt;- You can&amp;#39;t use BIP152 compact block relay, so your network bandwidth&lt;br/&gt;usage spikes at every block. You also can&amp;#39;t cache validation results,&lt;br/&gt;so your block validation speed slows down.&lt;br/&gt;&lt;br/&gt;&amp;gt; Removing the mempool would greatly reduce the bandwidth requirement for running a node...&lt;br/&gt;&lt;br/&gt;If you&amp;#39;re having problems with your individual node&amp;#39;s bandwidth usage,&lt;br/&gt;you can also decrease the number of connections you make or turn off&lt;br/&gt;incoming connections. There are efforts to reduce transaction relay&lt;br/&gt;bandwidth usage network-wide [1].&lt;br/&gt;&lt;br/&gt;&amp;gt; Removing the mempool would... keep intentionality of transactions private until confirmed/irrevocable...&lt;br/&gt;&lt;br/&gt;I&amp;#39;m confused - what is the purpose of keeping a transaction private&lt;br/&gt;until it confirms? Don&amp;#39;t miners still see your transaction? A&lt;br/&gt;confirmed transaction is not irrevocable; reorgs happen.&lt;br/&gt;&lt;br/&gt;&amp;gt; Removing the mempool would... naturally resolve all current issues inherent in package relay and rbf rules.&lt;br/&gt;&lt;br/&gt;Removing the mempool does not help with this. How does a miner decide&lt;br/&gt;whether a conflicting transaction is an economically-advantageous&lt;br/&gt;replacement or a DoS attack? How do you submit your CPFP if the parent&lt;br/&gt;is below the mempool minimum feerate? Do they already have a different&lt;br/&gt;relay/mempool implementation handling all of these problems but don&amp;#39;t&lt;br/&gt;aren&amp;#39;t sharing it with the rest of the community?&lt;br/&gt;&lt;br/&gt;&amp;gt; Initial feerate estimation would need to be based on published blocks, not pending transactions (as this information would no longer be available), or from direct interactions with block producers.&lt;br/&gt;&lt;br/&gt;There are many reasons why using only published blocks for fee&lt;br/&gt;estimates is a flawed design, including:&lt;br/&gt;&lt;br/&gt;- The miner of a block can artificially inflate the feerate of the&lt;br/&gt;transactions in their mempool simply by including a few of their own&lt;br/&gt;transactions that pay extremely high feerates. This costs them&lt;br/&gt;nothing, as they collect the fees.&lt;br/&gt;- A miner constructs a block based on the transactions in their&lt;br/&gt;mempool. Your transaction&amp;#39;s feerate may have been enough to be&lt;br/&gt;included 2 blocks ago or a week ago, but it will be compared to the&lt;br/&gt;other unconfirmed transactions available to the miner now. They can&lt;br/&gt;tell you what&amp;#39;s in their mempool or what the next-block feerate is,&lt;br/&gt;but you would be a fool to believe them.&lt;br/&gt;&lt;br/&gt;See also [2],[3].&lt;br/&gt;&lt;br/&gt;&amp;gt; Provided the number of block template producing actors remains beneath, say 1000, it’d be quite feasible to publish a list of tor endpoints that nodes can independently  &#43; directly submit their transactions to. In fact, merely allowing users to select their own list of endpoints to use alternatively to the mempool would be a low effort starting point for the eventual replacement.&lt;br/&gt;&lt;br/&gt;As a thought experiment, let&amp;#39;s imagine we have some public registry of&lt;br/&gt;mining nodes&amp;#39; tor endpoints and we use it for this secondary&lt;br/&gt;direct-to-miner transaction relay network. If the registry is&lt;br/&gt;maintained (by who?) and accurate (based on whose word?), it is a&lt;br/&gt;point of failure for transaction censorship and deanonymization, as&lt;br/&gt;well as an additional barrier to becoming a miner, encouraging&lt;br/&gt;centralization.&lt;br/&gt;The other possibility is that the registry is not accurate. In fact,&lt;br/&gt;unless the registry requires miners to identify themselves (which&lt;br/&gt;others on this thread have already pointed out is ill-advised), this&lt;br/&gt;should be treated similarly to regular addr gossip. We would never&lt;br/&gt;automatically trust that the entity behind the endpoint provides the&lt;br/&gt;service it advertises, is an honest node that won&amp;#39;t simply blackhole&lt;br/&gt;our transaction, or even belongs to a Bitcoin node at all.&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;[1]: &lt;a href=&#34;https://arxiv.org/pdf/1905.10518.pdf&#34;&gt;https://arxiv.org/pdf/1905.10518.pdf&lt;/a&gt;&lt;br/&gt;[2]: &lt;a href=&#34;https://bitcointechtalk.com/an-introduction-to-bitcoin-core-fee-estimation-27920880ad0&#34;&gt;https://bitcointechtalk.com/an-introduction-to-bitcoin-core-fee-estimation-27920880ad0&lt;/a&gt;&lt;br/&gt;[3]: &lt;a href=&#34;https://gist.github.com/morcos/d3637f015bc4e607e1fd10d8351e9f41&#34;&gt;https://gist.github.com/morcos/d3637f015bc4e607e1fd10d8351e9f41&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;On Tue, Oct 26, 2021 at 8:38 AM lisa neigut via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi all,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; In a recent conversation with @glozow, I had the realization that the&lt;br/&gt;&amp;gt; mempool is obsolete and should be eliminated.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Instead, users should submit their transactions directly to mining pools,&lt;br/&gt;&amp;gt; preferably over an anonymous communication network such as tor. This can&lt;br/&gt;&amp;gt; easily be achieved by mining pools running a tor onion node for this&lt;br/&gt;&amp;gt; express purpose (or via a lightning network extension etc)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Mempools make sense in a world where mining is done by a large number of&lt;br/&gt;&amp;gt; participating nodes, eg where the block template is constructed by a&lt;br/&gt;&amp;gt; majority of the participants on the network. In this case, it is necessary&lt;br/&gt;&amp;gt; to socialize pending transaction data to all participants, as you don’t&lt;br/&gt;&amp;gt; know which participant will be constructing the winning block template.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; In reality however, mempool relay is unnecessary where the majority of&lt;br/&gt;&amp;gt; hashpower and thus block template creation is concentrated in a&lt;br/&gt;&amp;gt; semi-restricted set.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Removing the mempool would greatly reduce the bandwidth requirement for&lt;br/&gt;&amp;gt; running a node, keep intentionality of transactions private until&lt;br/&gt;&amp;gt; confirmed/irrevocable, and naturally resolve all current issues inherent in&lt;br/&gt;&amp;gt; package relay and rbf rules. It also resolves the recent minimum relay&lt;br/&gt;&amp;gt; questions, as relay is no longer a concern for unmined transactions.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Provided the number of block template producing actors remains beneath,&lt;br/&gt;&amp;gt; say 1000, it’d be quite feasible to publish a list of tor endpoints that&lt;br/&gt;&amp;gt; nodes can independently  &#43; directly submit their transactions to. In fact,&lt;br/&gt;&amp;gt; merely allowing users to select their own list of endpoints to use&lt;br/&gt;&amp;gt; alternatively to the mempool would be a low effort starting point for the&lt;br/&gt;&amp;gt; eventual replacement.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; On the other hand, removing the mempool would greatly complicate solo&lt;br/&gt;&amp;gt; mining and would also make BetterHash proposals, which move the block&lt;br/&gt;&amp;gt; template construction away from a centralized mining pool back to the&lt;br/&gt;&amp;gt; individual miner, much more difficult. It also makes explicit the target&lt;br/&gt;&amp;gt; for DoS attacks.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; A direct communication channel between block template construction venues&lt;br/&gt;&amp;gt; and transaction proposers also provides a venue for direct feedback wrt&lt;br/&gt;&amp;gt; acceptable feerates at the time, which both makes transaction confirmation&lt;br/&gt;&amp;gt; timelines less variable as well as provides block producers a mechanism for&lt;br/&gt;&amp;gt; (independently) enforcing their own minimum security budget. In other&lt;br/&gt;&amp;gt; words, expressing a minimum acceptable feerate for continued operation.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Initial feerate estimation would need to be based on published blocks, not&lt;br/&gt;&amp;gt; pending transactions (as this information would no longer be available), or&lt;br/&gt;&amp;gt; from direct interactions with block producers.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; ~niftynei&lt;br/&gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20211026/9477b0b5/attachment.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20211026/9477b0b5/attachment.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T23:00:20Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsv3xml0kphnyvj5099mgfgpc5t3cl9mhkrrxwksn2zzm56tyqtjgczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q9frlsk</id>
    
      <title type="html">📅 Original date posted:2021-09-22 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsv3xml0kphnyvj5099mgfgpc5t3cl9mhkrrxwksn2zzm56tyqtjgczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q9frlsk" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqszkqhktkphke7ww3rjy4sstv6fa33x7j766fy0gk60l2x7jcnfpaqga8r0p&#39;&gt;nevent1q…8r0p&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-09-22&lt;br/&gt;📝 Original message:Hi Bastien,&lt;br/&gt;&lt;br/&gt;&amp;gt; A package A &#43; C will be able to replace A&amp;#39; &#43; B regardless of&lt;br/&gt;&amp;gt; the weight of A&amp;#39; &#43; B?&lt;br/&gt;&lt;br/&gt;Correct, the weight of A&amp;#39; &#43; B will not prevent A&#43;C from replacing it (as&lt;br/&gt;long as A&#43;C pays enough fees). In example 2C, we would be able to replace A&lt;br/&gt;with a package.&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Wed, Sep 22, 2021 at 8:10 AM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Great, thanks for this clarification!&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Can you confirm that this won&amp;#39;t be an issue either with your&lt;br/&gt;&amp;gt; example 2C (in your first set of diagrams)? If I understand it&lt;br/&gt;&amp;gt; correctly it shouldn&amp;#39;t, but I&amp;#39;d rather be 100% sure.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; A package A &#43; C will be able to replace A&amp;#39; &#43; B regardless of&lt;br/&gt;&amp;gt; the weight of A&amp;#39; &#43; B?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le mar. 21 sept. 2021 à 18:42, Gloria Zhao &amp;lt;gloriajzhao at gmail.com&amp;gt; a&lt;br/&gt;&amp;gt; écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi Bastien,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Excellent diagram :D&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; Here the issue is that a revoked commitment tx A&amp;#39; is pinned in other&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; mempools, with a long chain of descendants (or descendants that reach&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; the maximum replaceable size).&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; We would really like A &#43; C to be able to replace this pinned A&amp;#39;.&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; We can&amp;#39;t submit individually because A on its own won&amp;#39;t replace A&amp;#39;...&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Right, this is a key motivation for having Package RBF. In this case, A&#43;C&lt;br/&gt;&amp;gt;&amp;gt; can replace A&amp;#39; &#43; B1...B24.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Due to the descendant limit (each node operator can increase it on their&lt;br/&gt;&amp;gt;&amp;gt; own node, but the default is 25), A&amp;#39; should have no more than 25&lt;br/&gt;&amp;gt;&amp;gt; descendants, even including CPFP carve out. As long as A only conflicts&lt;br/&gt;&amp;gt;&amp;gt; with A&amp;#39;, it won&amp;#39;t be trying to replace more than 100 transactions. The&lt;br/&gt;&amp;gt;&amp;gt; proposed package RBF will allow C to pay for A&amp;#39;s conflicts, since their&lt;br/&gt;&amp;gt;&amp;gt; package feerate is used in the fee comparisons. A is not a descendant of&lt;br/&gt;&amp;gt;&amp;gt; A&amp;#39;, so the existence of B1...B24 does not prevent the replacement.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Best,&lt;br/&gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; On Tue, Sep 21, 2021 at 4:18 PM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; I believe this attack is mitigated as long as we attempt to submit&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transactions individually&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Unfortunately not, as there exists a pinning scenario in LN where a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; different commit tx is pinned, but you actually can&amp;#39;t know which one.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Since I really like your diagrams, I made one as well to illustrate:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/31281497/134198114-5e9c6857-e8fc-405a-be57-18181d5e54cb.jpg&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Here the issue is that a revoked commitment tx A&amp;#39; is pinned in other&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; mempools, with a long chain of descendants (or descendants that reach&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; the maximum replaceable size).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; We would really like A &#43; C to be able to replace this pinned A&amp;#39;.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; We can&amp;#39;t submit individually because A on its own won&amp;#39;t replace A&amp;#39;...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; I would note that this proposal doesn&amp;#39;t accommodate something like&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; diagram B, where C is getting CPFP carve out and wants to bring a &#43;1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; No worries, that case shouldn&amp;#39;t be a concern.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I believe any L2 protocol can always ensure it confirms such tx trees&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;#34;one depth after the other&amp;#34; without impacting funds safety, so it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; only needs to ensure A &#43; C can get into mempools.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Le mar. 21 sept. 2021 à 13:18, Gloria Zhao &amp;lt;gloriajzhao at gmail.com&amp;gt; a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; écrit :&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi Bastien,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thank you for your feedback!&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I believe you are describing a pinning attack in which your adversarial&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; counterparty attempts to monopolize the mempool descendant limit of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; shared  transaction A in order to prevent you from submitting a fee-bumping&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child C; I&amp;#39;ve tried to illustrate this as diagram A here:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/134159860-068080d0-bbb6-4356-ae74-00df00644c74.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (please let me know if I&amp;#39;m misunderstanding).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I believe this attack is mitigated as long as we attempt to submit&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions individually (and thus take advantage of CPFP carve out)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; before attempting package validation. So, in scenario A2, even if the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool receives a package with A&#43;C, it would deduplicate A, submit C as an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; individual transaction, and allow it due to the CPFP carve out exemption. A&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; more general goal is: if a transaction would propagate successfully on its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; own now, it should still propagate regardless of whether it is included in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a package. The best way to ensure this, as far as I can tell, is to always&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; try to submit them individually first.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I would note that this proposal doesn&amp;#39;t accommodate something like&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; diagram B, where C is getting CPFP carve out and wants to bring a &#43;1 (e.g.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; C has very low fees and is bumped by D). I don&amp;#39;t think this is a use case&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; since C should be the one fee-bumping A, but since we&amp;#39;re talking about&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limitations around the CPFP carve out, this is it.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Let me know if this addresses your concerns?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; On Mon, Sep 20, 2021 at 10:19 AM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks for this detailed post!&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The illustrations you provided are very useful for this kind of graph&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; topology problems.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The rules you lay out for package RBF look good to me at first glance&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as there are some subtle improvements compared to BIP 125.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have a question regarding this rule, as your example 2C could be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; concerning for LN (unless I didn&amp;#39;t understand it correctly).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This also touches on the package RBF rule 5 (&amp;#34;The package cannot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace more than 100 mempool transactions.&amp;#34;)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We had to create the CPFP carve-out rule explicitly to work around&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this limitation, and I think it would be necessary for package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as well, because in such cases we do want to be able to submit a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package A &#43; C where C pays high fees to speed up A&amp;#39;s confirmation,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; regardless of unrelated unconfirmed children of A...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We could submit only C to benefit from the existing CPFP carve-out&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; rule, but that wouldn&amp;#39;t work if our local mempool doesn&amp;#39;t have A yet,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; but other remote mempools do.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Is my concern justified? Is this something that we should dig into a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bit deeper?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Le jeu. 16 sept. 2021 à 09:55, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi there,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I&amp;#39;m writing to propose a set of mempool policy changes to enable&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation (in preparation for package relay) in Bitcoin Core. These&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be consensus or P2P protocol changes. However, since mempool policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; significantly affects transaction propagation, I believe this is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relevant for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mailing list.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; My proposal enables packages consisting of multiple parents and 1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child. If you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; develop software that relies on specific transaction relay&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; assumptions and/or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; are interested in using package relay in the future, I&amp;#39;m very&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; interested to hear&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; your feedback on the utility or restrictiveness of these package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policies for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; your use cases.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A draft implementation of this proposal can be found in [Bitcoin Core&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; PR#22290][1].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; An illustrated version of this post can be found at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&lt;/a&gt;.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have also linked the images below.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Background&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Feel free to skip this section if you are already familiar with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and package relay terminology.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Terminology Clarifications&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Package = an ordered list of related transactions, representable by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a Directed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   Acyclic Graph.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Package Feerate = the total modified fees divided by the total&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; virtual size of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Modified fees = a transaction&amp;#39;s base fees &#43; fee delta applied&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; by the user&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       with `prioritisetransaction`. As such, we expect this to vary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; across&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempools.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Virtual Size = the maximum of virtual sizes calculated using&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [BIP141&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       virtual size][2] and sigop weight. [Implemented here in Bitcoin&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Core][3].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Note that feerate is not necessarily based on the base fees and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; serialized&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       size.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Fee-Bumping = user/wallet actions that take advantage of miner&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentives to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   boost a transaction&amp;#39;s candidacy for inclusion in a block, including&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Child Pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for Parent (CPFP) and [BIP125][12] Replace-by-Fee (RBF). Our&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; intention in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool policy is to recognize when the new transaction is more&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; economical to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mine than the original one(s) but not open DoS vectors, so there are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limitations.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The purpose of the mempool is to store the best (to be most&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentive-compatible&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with miners, highest feerate) candidates for inclusion in a block.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Miners use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mempool to build block templates. The mempool is also useful as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cache for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; boosting block relay and validation performance, aiding transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relay, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; generating feerate estimations.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Ideally, all consensus-valid transactions paying reasonable fees&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; should make it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to miners through normal transaction relay, without any special&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connectivity or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relationships with miners. On the other hand, nodes do not have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; unlimited&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; resources, and a P2P network designed to let any honest node&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; broadcast their&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions also exposes the transaction validation engine to DoS&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attacks from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; malicious peers.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; As such, for unconfirmed transactions we are considering for our&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool, we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; apply a set of validation rules in addition to consensus, primarily&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to protect&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; us from resource exhaustion and aid our efforts to keep the highest&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions. We call this mempool _policy_: a set of (configurable,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; node-specific) rules that transactions must abide by in order to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepted&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; into our mempool. Transaction &amp;#34;Standardness&amp;#34; rules and mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; restrictions such&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as &amp;#34;too-long-mempool-chain&amp;#34; are both examples of policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Package Relay and Package Mempool Accept&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In transaction relay, we currently consider transactions one at a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission to the mempool. This creates a limitation in the node&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ability to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; determine which transactions have the highest feerates, since we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cannot take&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; into account descendants (i.e. cannot use CPFP) until all the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool. Similarly, we cannot use a transaction&amp;#39;s descendants&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; when&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; considering it for RBF. When an individual transaction does not meet&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimum feerate and the user isn&amp;#39;t able to create a replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; directly, it will not be accepted by mempools.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This limitation presents a security issue for applications and users&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relying on&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time-sensitive transactions. For example, Lightning and other&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; protocols create&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; UTXOs with multiple spending paths, where one counterparty&amp;#39;s spending&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; path opens&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; up after a timelock, and users are protected from cheating scenarios&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as long as&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; they redeem on-chain in time. A key security assumption is that all&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parties&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions will propagate and confirm in a timely manner. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; assumption can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be broken if fee-bumping does not work as intended.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The end goal for Package Relay is to consider multiple transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; at the same&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time, e.g. a transaction with its high-fee child. This may help us&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; better&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; determine whether transactions should be accepted to our mempool,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; especially if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; they don&amp;#39;t meet fee requirements individually or are better RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; candidates as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. A combination of changes to mempool validation logic,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policy, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction relay allows us to better propagate the transactions with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; highest package feerates to miners, and makes fee-bumping tools more&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; powerful&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for users.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The &amp;#34;relay&amp;#34; part of Package Relay suggests P2P messaging changes, but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a large&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; part of the changes are in the mempool&amp;#39;s package validation logic. We&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; call this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Package Mempool Accept*.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Previous Work&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Given that mempool validation is DoS-sensitive and complex, it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   dangerous to haphazardly tack on package validation logic. Many&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; efforts have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; been made to make mempool validation less opaque (see [#16400][4],&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [#21062][5],&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [#22675][6], [#22796][7]).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * [#20833][8] Added basic capabilities for package validation, test&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepts only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   (no submission to mempool).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * [#21800][9] Implemented package ancestor/descendant limit checks&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for arbitrary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   packages. Still test accepts only.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Previous package relay proposals (see [#16401][10], [#19621][11]).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Existing Package Rules&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; These are in master as introduced in [#20833][8] and [#21800][9].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I&amp;#39;ll consider&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; them as &amp;#34;given&amp;#34; in the rest of this document, though they can be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; changed, since&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package validation is test-accept only right now.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    *Rationale*: This is already enforced as mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor/descendant limits.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Presumably, transactions in a package are all related, so exceeding&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this limit&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would mean that the package can either be split up or it wouldn&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pass this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Packages must be topologically sorted: if any dependencies exist&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; between&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions, parents must appear somewhere before children. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. A package cannot have conflicting transactions, i.e. none of them&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can spend&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the same inputs. This also means there cannot be duplicate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. When packages are evaluated against ancestor/descendant limits in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a test&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accept, the union of all of their descendants and ancestors is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; considered. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is essentially a &amp;#34;worst case&amp;#34; heuristic where every transaction in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is treated as each other&amp;#39;s ancestor and descendant. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Packages for which ancestor/descendant limits are accurately captured&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; by this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; heuristic: [19]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There are also limitations such as the fact that CPFP carve out is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not applied&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to package transactions. #20833 also disables RBF in package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation; this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; proposal overrides that to allow packages to use RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Proposed Changes&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The next step in the Package Mempool Accept project is to implement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to mempool, initially through RPC only. This allows us to test the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; logic before exposing it on P2P.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Summary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Packages may contain already-in-mempool transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Packages are 2 generations, Multi-Parent-1-Child.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Fee-related checks use the package feerate. This means that wallets&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; create a package that utilizes CPFP.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Parents are allowed to RBF mempool transactions with a set of rules&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; similar&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   to BIP125. This enables a combination of CPFP and RBF, where a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&amp;#39;s descendant fees pay for replacing mempool conflicts.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There is a draft implementation in [#22290][1]. It is WIP, but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feedback is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; always welcome.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Details&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Packages May Contain Already-in-Mempool Transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A package may contain transactions that are already in the mempool.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We remove&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (&amp;#34;deduplicate&amp;#34;) those transactions from the package for the purposes&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool acceptance. If a package is empty after deduplication, we do&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; nothing.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Mempools vary across the network. It&amp;#39;s possible for a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parent to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepted to the mempool of a peer on its own due to differences in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policy and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee market fluctuations. We should not reject or penalize the entire&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; an individual transaction as that could be a censorship vector.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Packages Are Multi-Parent-1-Child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Only packages of a specific topology are permitted. Namely, a package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is exactly&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1 child with all of its unconfirmed parents. After deduplication, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; may be exactly the same, empty, 1 child, 1 child with just some of its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; unconfirmed parents, etc. Note that it&amp;#39;s possible for the parents to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be indirect&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendants/ancestors of one another, or for parent and child to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; share a parent,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; so we cannot make any other topology assumptions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: This allows for fee-bumping by CPFP. Allowing multiple&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parents&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; makes it possible to fee-bump a batch of transactions. Restricting&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; packages to a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; defined topology is also easier to reason about and simplifies the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; logic greatly. Multi-parent-1-child allows us to think of the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as one big&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction, where:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Inputs = all the inputs of parents &#43; inputs of the child that come&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   confirmed UTXOs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Outputs = all the outputs of the child &#43; all outputs of the parents&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   aren&amp;#39;t spent by other transactions in the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Examples of packages that follow this rule (variations of example A&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; show some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; possibilities after deduplication): ![image][15]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Fee-Related Checks Use Package Feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Package Feerate = the total modified fees divided by the total&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; virtual size of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; To meet the two feerate requirements of a mempool, i.e., the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pre-configured&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimum relay feerate (`minRelayTxFee`) and dynamic mempool minimum&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; total package feerate is used instead of the individual feerate. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; individual&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are allowed to be below feerate requirements if the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package meets&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the feerate requirements. For example, the parent(s) in the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can have 0&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fees but be paid for by the child.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: This can be thought of as &amp;#34;CPFP within a package,&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; solving the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; issue of a parent not meeting minimum fees on its own. This allows L2&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; applications to adjust their fees at broadcast time instead of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; overshooting or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; risking getting stuck/pinned.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We use the package feerate of the package *after deduplication*.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*:  It would be incorrect to use the fees of transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; already in the mempool, as we do not want a transaction&amp;#39;s fees to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; double-counted for both its individual RBF and package RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Examples F and G [14] show the same package, but P1 is submitted&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; individually before&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the package in example G. In example F, we can see that the 300vB&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; an additional 200sat in fees, which is not enough to pay for its own&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bandwidth&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (BIP125#4). In example G, we can see that P1 pays enough to replace&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M1, but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; using P1&amp;#39;s fees again during package submission would make it look&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; like a 300sat&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; increase for a 200vB package. Even including its fees and size would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; sufficient in this example, since the 300sat looks like enough for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the 300vB&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. The calculcation after deduplication is 100sat increase for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of size 200vB, which correctly fails BIP125#4. Assume all&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions have a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; size of 100vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If a package meets feerate requirements as a package, the parents in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction are allowed to replace-by-fee mempool transactions. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child cannot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace mempool transactions. Multiple transactions can replace the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; same&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction, but in order to be valid, none of the transactions can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; try to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace an ancestor of another transaction in the same package (which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would thus&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; make its inputs unavailable).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Even if we are using package feerate, a package will not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; propagate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as intended if RBF still requires each individual transaction to meet&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate requirements.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We use a set of rules slightly modified from BIP125 as follows:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Signaling (Rule #1)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; All mempool transactions to be replaced must signal replaceability.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Package RBF signaling logic should be the same for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package RBF and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; single transaction acceptance. This would be updated if single&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation moves to full RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### New Unconfirmed Inputs (Rule #2)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A package may include new unconfirmed inputs, but the ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child must be at least as high as the ancestor feerates of every&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; being replaced. This is contrary to BIP125#2, which states &amp;#34;The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction may only include an unconfirmed input if that input was&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; included in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; one of the original transactions. (An unconfirmed input spends an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; output from a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; currently-unconfirmed transaction.)&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: The purpose of BIP125#2 is to ensure that the replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction has a higher ancestor score than the original&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction(s) (see&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [comment][13]). Example H [16] shows how adding a new unconfirmed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; input can lower the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor score of the replacement transaction. P1 is trying to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace M1, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; spends an unconfirmed output of M2. P1 pays 800sat, M1 pays 600sat,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and M2 pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 100sat. Assume all transactions have a size of 100vB. While, in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; isolation, P1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; looks like a better mining candidate than M1, it must be mined with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M2, so its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor feerate is actually 4.5sat/vB.  This is lower than M1&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate, which is 6sat/vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In package RBF, the rule analogous to BIP125#2 would be &amp;#34;none of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions in the package can spend new unconfirmed inputs.&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Example J [17] shows&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; why, if any of the package transactions have ancestors, package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate is no&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; longer accurate. Even though M2 and M3 are not ancestors of P1 (which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement transaction in an RBF), we&amp;#39;re actually interested in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; entire&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. A miner should mine M1 which is 5sat/vB instead of M2, M3,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; P1, P2, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; P3, which is only 4sat/vB. The Package RBF rule cannot be loosened to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only allow&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the child to have new unconfirmed inputs, either, because it can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; still cause us&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to overestimate the package&amp;#39;s ancestor score.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; However, enforcing a rule analogous to BIP125#2 would not only make&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; less useful, but would also break Package RBF for packages with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parents already&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool: if a package parent has already been submitted, it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would look&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; like the child is spending a &amp;#34;new&amp;#34; unconfirmed input. In example K&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [18], we&amp;#39;re&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; looking to replace M1 with the entire package including P1, P2, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; P3. We must&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; consider the case where one of the parents is already in the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (in this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; case, P2), which means we must allow P3 to have new unconfirmed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; inputs. However,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M2 lowers the ancestor score of P3 to 4.3sat/vB, so we should not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace M1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with this package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thus, the package RBF rule regarding new unconfirmed inputs is less&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; strict than&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125#2. However, we still achieve the same goal of requiring the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions to have a ancestor score at least as high as the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; original ones. As&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a result, the entire package is required to be a higher feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mining candidate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than each of the replaced transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Another note: the [comment][13] above the BIP125#2 code in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; original RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; implementation suggests that the rule was intended to be temporary.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Absolute Fee (Rule #3)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package must increase the absolute fee of the mempool, i.e. the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; total fees&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of the package must be higher than the absolute fees of the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it replaces. Combined with the CPFP rule above, this differs from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125 Rule #3&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - an individual transaction in the package may have lower fees than&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   transaction(s) it is replacing. In fact, it may have 0 fees, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Feerate (Rule #4)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package must pay for its own bandwidth; the package feerate must&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be higher&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than the replaced transactions by at least minimum relay feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (`incrementalRelayFee`). Combined with the CPFP rule above, this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; differs from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125 Rule #4 - an individual transaction in the package can have a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; lower&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate than the transaction(s) it is replacing. In fact, it may have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 0 fees,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and the child pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Total Number of Replaced Transactions (Rule #5)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package cannot replace more than 100 mempool transactions. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is identical&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to BIP125 Rule #5.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Expected FAQs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. Is it possible for only some of the package to make it into the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    Yes, it is. However, since we evict transactions from the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendant score and the package child is supposed to be sponsoring&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the fees of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; its parents, the most common scenario would be all-or-nothing. This is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentive-compatible. In fact, to be conservative, package validation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; should&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; begin by trying to submit all of the transactions individually, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only use the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package mempool acceptance logic if the parents fail due to low&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Should we allow packages to contain already-confirmed transactions?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     No, for practical reasons. In mempool validation, we actually&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; aren&amp;#39;t able to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; tell with 100% confidence if we are looking at a transaction that has&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; already&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; confirmed, because we look up inputs using a UTXO set. If we have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; historical&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; block data, it&amp;#39;s possible to look for it, but this is inefficient,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not always&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; possible for pruning nodes, and unnecessary because we&amp;#39;re not going&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to do&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; anything with the transaction anyway. As such, we already have the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; expectation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that transaction relay is somewhat &amp;#34;stateful&amp;#34; i.e. nobody should be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relaying&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions that have already been confirmed. Similarly, we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; shouldn&amp;#39;t be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relaying packages that contain already-confirmed transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [1]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&#34;&gt;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&#34;&gt;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16400&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16400&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [5]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21062&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21062&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [6]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22675&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22675&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [7]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22796&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22796&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [8]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/20833&#34;&gt;https://github.com/bitcoin/bitcoin/pull/20833&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [9]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21800&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21800&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [13]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [14]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567078-075a971c-0619-4339-9168-b41fd2b90c28.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [15]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132856734-fc17da75-f875-44bb-b954-cb7a1725cc0d.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [16]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567347-a3e2e4a8-ae9c-49f8-abb9-81e8e0aba224.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [17]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567370-21566d0e-36c8-4831-b1a8-706634540af3.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [18]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567444-bfff1142-439f-4547-800a-2ba2b0242bcb.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [19]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133456219-0bb447cb-dcb4-4a31-b9c1-7d86205b68bc.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [20]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132857787-7b7c6f56-af96-44c8-8d78-983719888c19.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210922/6d265bbb/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210922/6d265bbb/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T22:59:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsx4qyuenq9fuztq0x04vu9sqptk3c2rdx3f08fwq6536ztvft6c9qzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qylf7qj</id>
    
      <title type="html">📅 Original date posted:2021-09-21 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsx4qyuenq9fuztq0x04vu9sqptk3c2rdx3f08fwq6536ztvft6c9qzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qylf7qj" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsvuz5mgvxr8ycc6vykfxqchtc2l0gpj627fmv8a5uez5k784yhqhq7ljpvh&#39;&gt;nevent1q…jpvh&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-09-21&lt;br/&gt;📝 Original message:Hi Bastien,&lt;br/&gt;&lt;br/&gt;Excellent diagram :D&lt;br/&gt;&lt;br/&gt;&amp;gt; Here the issue is that a revoked commitment tx A&amp;#39; is pinned in other&lt;br/&gt;&amp;gt; mempools, with a long chain of descendants (or descendants that reach&lt;br/&gt;&amp;gt; the maximum replaceable size).&lt;br/&gt;&amp;gt; We would really like A &#43; C to be able to replace this pinned A&amp;#39;.&lt;br/&gt;&amp;gt; We can&amp;#39;t submit individually because A on its own won&amp;#39;t replace A&amp;#39;...&lt;br/&gt;&lt;br/&gt;Right, this is a key motivation for having Package RBF. In this case, A&#43;C&lt;br/&gt;can replace A&amp;#39; &#43; B1...B24.&lt;br/&gt;&lt;br/&gt;Due to the descendant limit (each node operator can increase it on their&lt;br/&gt;own node, but the default is 25), A&amp;#39; should have no more than 25&lt;br/&gt;descendants, even including CPFP carve out. As long as A only conflicts&lt;br/&gt;with A&amp;#39;, it won&amp;#39;t be trying to replace more than 100 transactions. The&lt;br/&gt;proposed package RBF will allow C to pay for A&amp;#39;s conflicts, since their&lt;br/&gt;package feerate is used in the fee comparisons. A is not a descendant of&lt;br/&gt;A&amp;#39;, so the existence of B1...B24 does not prevent the replacement.&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Tue, Sep 21, 2021 at 4:18 PM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; I believe this attack is mitigated as long as we attempt to submit&lt;br/&gt;&amp;gt; transactions individually&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Unfortunately not, as there exists a pinning scenario in LN where a&lt;br/&gt;&amp;gt; different commit tx is pinned, but you actually can&amp;#39;t know which one.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Since I really like your diagrams, I made one as well to illustrate:&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/31281497/134198114-5e9c6857-e8fc-405a-be57-18181d5e54cb.jpg&#34;&gt; &lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Here the issue is that a revoked commitment tx A&amp;#39; is pinned in other&lt;br/&gt;&amp;gt; mempools, with a long chain of descendants (or descendants that reach&lt;br/&gt;&amp;gt; the maximum replaceable size).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; We would really like A &#43; C to be able to replace this pinned A&amp;#39;.&lt;br/&gt;&amp;gt; We can&amp;#39;t submit individually because A on its own won&amp;#39;t replace A&amp;#39;...&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; I would note that this proposal doesn&amp;#39;t accommodate something like&lt;br/&gt;&amp;gt; diagram B, where C is getting CPFP carve out and wants to bring a &#43;1&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; No worries, that case shouldn&amp;#39;t be a concern.&lt;br/&gt;&amp;gt; I believe any L2 protocol can always ensure it confirms such tx trees&lt;br/&gt;&amp;gt; &amp;#34;one depth after the other&amp;#34; without impacting funds safety, so it&lt;br/&gt;&amp;gt; only needs to ensure A &#43; C can get into mempools.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le mar. 21 sept. 2021 à 13:18, Gloria Zhao &amp;lt;gloriajzhao at gmail.com&amp;gt; a&lt;br/&gt;&amp;gt; écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi Bastien,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thank you for your feedback!&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt;&amp;gt; &amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I believe you are describing a pinning attack in which your adversarial&lt;br/&gt;&amp;gt;&amp;gt; counterparty attempts to monopolize the mempool descendant limit of the&lt;br/&gt;&amp;gt;&amp;gt; shared  transaction A in order to prevent you from submitting a fee-bumping&lt;br/&gt;&amp;gt;&amp;gt; child C; I&amp;#39;ve tried to illustrate this as diagram A here:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/134159860-068080d0-bbb6-4356-ae74-00df00644c74.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; (please let me know if I&amp;#39;m misunderstanding).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I believe this attack is mitigated as long as we attempt to submit&lt;br/&gt;&amp;gt;&amp;gt; transactions individually (and thus take advantage of CPFP carve out)&lt;br/&gt;&amp;gt;&amp;gt; before attempting package validation. So, in scenario A2, even if the&lt;br/&gt;&amp;gt;&amp;gt; mempool receives a package with A&#43;C, it would deduplicate A, submit C as an&lt;br/&gt;&amp;gt;&amp;gt; individual transaction, and allow it due to the CPFP carve out exemption. A&lt;br/&gt;&amp;gt;&amp;gt; more general goal is: if a transaction would propagate successfully on its&lt;br/&gt;&amp;gt;&amp;gt; own now, it should still propagate regardless of whether it is included in&lt;br/&gt;&amp;gt;&amp;gt; a package. The best way to ensure this, as far as I can tell, is to always&lt;br/&gt;&amp;gt;&amp;gt; try to submit them individually first.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I would note that this proposal doesn&amp;#39;t accommodate something like&lt;br/&gt;&amp;gt;&amp;gt; diagram B, where C is getting CPFP carve out and wants to bring a &#43;1 (e.g.&lt;br/&gt;&amp;gt;&amp;gt; C has very low fees and is bumped by D). I don&amp;#39;t think this is a use case&lt;br/&gt;&amp;gt;&amp;gt; since C should be the one fee-bumping A, but since we&amp;#39;re talking about&lt;br/&gt;&amp;gt;&amp;gt; limitations around the CPFP carve out, this is it.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Let me know if this addresses your concerns?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt; Gloria&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; On Mon, Sep 20, 2021 at 10:19 AM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; wrote:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Thanks for this detailed post!&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; The illustrations you provided are very useful for this kind of graph&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; topology problems.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; The rules you lay out for package RBF look good to me at first glance&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; as there are some subtle improvements compared to BIP 125.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; I have a question regarding this rule, as your example 2C could be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; concerning for LN (unless I didn&amp;#39;t understand it correctly).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; This also touches on the package RBF rule 5 (&amp;#34;The package cannot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; replace more than 100 mempool transactions.&amp;#34;)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; We had to create the CPFP carve-out rule explicitly to work around&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; this limitation, and I think it would be necessary for package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; as well, because in such cases we do want to be able to submit a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; package A &#43; C where C pays high fees to speed up A&amp;#39;s confirmation,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; regardless of unrelated unconfirmed children of A...&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; We could submit only C to benefit from the existing CPFP carve-out&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; rule, but that wouldn&amp;#39;t work if our local mempool doesn&amp;#39;t have A yet,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; but other remote mempools do.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Is my concern justified? Is this something that we should dig into a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bit deeper?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; Le jeu. 16 sept. 2021 à 09:55, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Hi there,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I&amp;#39;m writing to propose a set of mempool policy changes to enable package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation (in preparation for package relay) in Bitcoin Core. These&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be consensus or P2P protocol changes. However, since mempool policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; significantly affects transaction propagation, I believe this is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relevant for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mailing list.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; My proposal enables packages consisting of multiple parents and 1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child. If you&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; develop software that relies on specific transaction relay assumptions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and/or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; are interested in using package relay in the future, I&amp;#39;m very&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; interested to hear&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; your feedback on the utility or restrictiveness of these package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policies for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; your use cases.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A draft implementation of this proposal can be found in [Bitcoin Core&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; PR#22290][1].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; An illustrated version of this post can be found at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&lt;/a&gt;.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; I have also linked the images below.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Background&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Feel free to skip this section if you are already familiar with mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and package relay terminology.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Terminology Clarifications&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Package = an ordered list of related transactions, representable by a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Directed&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   Acyclic Graph.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Package Feerate = the total modified fees divided by the total&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; virtual size of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Modified fees = a transaction&amp;#39;s base fees &#43; fee delta applied by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the user&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       with `prioritisetransaction`. As such, we expect this to vary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; across&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempools.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Virtual Size = the maximum of virtual sizes calculated using&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [BIP141&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       virtual size][2] and sigop weight. [Implemented here in Bitcoin&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Core][3].&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     - Note that feerate is not necessarily based on the base fees and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; serialized&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;       size.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Fee-Bumping = user/wallet actions that take advantage of miner&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentives to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   boost a transaction&amp;#39;s candidacy for inclusion in a block, including&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Child Pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for Parent (CPFP) and [BIP125][12] Replace-by-Fee (RBF). Our intention&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool policy is to recognize when the new transaction is more&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; economical to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mine than the original one(s) but not open DoS vectors, so there are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limitations.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Policy&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The purpose of the mempool is to store the best (to be most&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentive-compatible&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with miners, highest feerate) candidates for inclusion in a block.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Miners use&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mempool to build block templates. The mempool is also useful as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cache for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; boosting block relay and validation performance, aiding transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relay, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; generating feerate estimations.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Ideally, all consensus-valid transactions paying reasonable fees should&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; make it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to miners through normal transaction relay, without any special&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; connectivity or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relationships with miners. On the other hand, nodes do not have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; unlimited&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; resources, and a P2P network designed to let any honest node broadcast&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; their&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions also exposes the transaction validation engine to DoS&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; attacks from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; malicious peers.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; As such, for unconfirmed transactions we are considering for our&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool, we&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; apply a set of validation rules in addition to consensus, primarily to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; protect&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; us from resource exhaustion and aid our efforts to keep the highest fee&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions. We call this mempool _policy_: a set of (configurable,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; node-specific) rules that transactions must abide by in order to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepted&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; into our mempool. Transaction &amp;#34;Standardness&amp;#34; rules and mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; restrictions such&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as &amp;#34;too-long-mempool-chain&amp;#34; are both examples of policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Package Relay and Package Mempool Accept&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In transaction relay, we currently consider transactions one at a time&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission to the mempool. This creates a limitation in the node&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ability to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; determine which transactions have the highest feerates, since we cannot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; take&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; into account descendants (i.e. cannot use CPFP) until all the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool. Similarly, we cannot use a transaction&amp;#39;s descendants&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; when&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; considering it for RBF. When an individual transaction does not meet&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimum feerate and the user isn&amp;#39;t able to create a replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; directly, it will not be accepted by mempools.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This limitation presents a security issue for applications and users&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relying on&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time-sensitive transactions. For example, Lightning and other protocols&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; create&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; UTXOs with multiple spending paths, where one counterparty&amp;#39;s spending&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; path opens&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; up after a timelock, and users are protected from cheating scenarios as&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; long as&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; they redeem on-chain in time. A key security assumption is that all&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parties&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions will propagate and confirm in a timely manner. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; assumption can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be broken if fee-bumping does not work as intended.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The end goal for Package Relay is to consider multiple transactions at&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the same&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; time, e.g. a transaction with its high-fee child. This may help us&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; better&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; determine whether transactions should be accepted to our mempool,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; especially if&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; they don&amp;#39;t meet fee requirements individually or are better RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; candidates as a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. A combination of changes to mempool validation logic, policy,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction relay allows us to better propagate the transactions with&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; highest package feerates to miners, and makes fee-bumping tools more&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; powerful&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for users.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The &amp;#34;relay&amp;#34; part of Package Relay suggests P2P messaging changes, but a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; large&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; part of the changes are in the mempool&amp;#39;s package validation logic. We&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; call this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Package Mempool Accept*.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Previous Work&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Given that mempool validation is DoS-sensitive and complex, it would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   dangerous to haphazardly tack on package validation logic. Many&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; efforts have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; been made to make mempool validation less opaque (see [#16400][4],&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [#21062][5],&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [#22675][6], [#22796][7]).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * [#20833][8] Added basic capabilities for package validation, test&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepts only&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   (no submission to mempool).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * [#21800][9] Implemented package ancestor/descendant limit checks for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; arbitrary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   packages. Still test accepts only.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; * Previous package relay proposals (see [#16401][10], [#19621][11]).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Existing Package Rules&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; These are in master as introduced in [#20833][8] and [#21800][9]. I&amp;#39;ll&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; consider&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; them as &amp;#34;given&amp;#34; in the rest of this document, though they can be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; changed, since&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package validation is test-accept only right now.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    *Rationale*: This is already enforced as mempool ancestor/descendant&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; limits.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Presumably, transactions in a package are all related, so exceeding&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this limit&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would mean that the package can either be split up or it wouldn&amp;#39;t pass&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool policy.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Packages must be topologically sorted: if any dependencies exist&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; between&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions, parents must appear somewhere before children. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 3. A package cannot have conflicting transactions, i.e. none of them&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can spend&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the same inputs. This also means there cannot be duplicate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 4. When packages are evaluated against ancestor/descendant limits in a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; test&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accept, the union of all of their descendants and ancestors is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; considered. This&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is essentially a &amp;#34;worst case&amp;#34; heuristic where every transaction in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is treated as each other&amp;#39;s ancestor and descendant. [8]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Packages for which ancestor/descendant limits are accurately captured&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; by this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; heuristic: [19]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There are also limitations such as the fact that CPFP carve out is not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; applied&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to package transactions. #20833 also disables RBF in package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation; this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; proposal overrides that to allow packages to use RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ## Proposed Changes&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The next step in the Package Mempool Accept project is to implement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to mempool, initially through RPC only. This allows us to test the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; logic before exposing it on P2P.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Summary&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Packages may contain already-in-mempool transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Packages are 2 generations, Multi-Parent-1-Child.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Fee-related checks use the package feerate. This means that wallets&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; create a package that utilizes CPFP.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Parents are allowed to RBF mempool transactions with a set of rules&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; similar&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   to BIP125. This enables a combination of CPFP and RBF, where a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&amp;#39;s descendant fees pay for replacing mempool conflicts.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There is a draft implementation in [#22290][1]. It is WIP, but feedback&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; always welcome.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Details&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Packages May Contain Already-in-Mempool Transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A package may contain transactions that are already in the mempool. We&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; remove&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (&amp;#34;deduplicate&amp;#34;) those transactions from the package for the purposes of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool acceptance. If a package is empty after deduplication, we do&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; nothing.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Mempools vary across the network. It&amp;#39;s possible for a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parent to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; accepted to the mempool of a peer on its own due to differences in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; policy and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fee market fluctuations. We should not reject or penalize the entire&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package for&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; an individual transaction as that could be a censorship vector.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Packages Are Multi-Parent-1-Child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Only packages of a specific topology are permitted. Namely, a package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is exactly&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1 child with all of its unconfirmed parents. After deduplication, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; may be exactly the same, empty, 1 child, 1 child with just some of its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; unconfirmed parents, etc. Note that it&amp;#39;s possible for the parents to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; indirect&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendants/ancestors of one another, or for parent and child to share&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a parent,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; so we cannot make any other topology assumptions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: This allows for fee-bumping by CPFP. Allowing multiple&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parents&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; makes it possible to fee-bump a batch of transactions. Restricting&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; packages to a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; defined topology is also easier to reason about and simplifies the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; logic greatly. Multi-parent-1-child allows us to think of the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as one big&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction, where:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Inputs = all the inputs of parents &#43; inputs of the child that come&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   confirmed UTXOs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - Outputs = all the outputs of the child &#43; all outputs of the parents&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   aren&amp;#39;t spent by other transactions in the package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Examples of packages that follow this rule (variations of example A&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; show some&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; possibilities after deduplication): ![image][15]&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Fee-Related Checks Use Package Feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Package Feerate = the total modified fees divided by the total virtual&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; size of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; To meet the two feerate requirements of a mempool, i.e., the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pre-configured&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; minimum relay feerate (`minRelayTxFee`) and dynamic mempool minimum&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate, the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; total package feerate is used instead of the individual feerate. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; individual&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions are allowed to be below feerate requirements if the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package meets&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the feerate requirements. For example, the parent(s) in the package can&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; have 0&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fees but be paid for by the child.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: This can be thought of as &amp;#34;CPFP within a package,&amp;#34; solving&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; issue of a parent not meeting minimum fees on its own. This allows L2&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; applications to adjust their fees at broadcast time instead of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; overshooting or&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; risking getting stuck/pinned.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We use the package feerate of the package *after deduplication*.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*:  It would be incorrect to use the fees of transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that are&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; already in the mempool, as we do not want a transaction&amp;#39;s fees to be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; double-counted for both its individual RBF and package RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Examples F and G [14] show the same package, but P1 is submitted&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; individually before&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the package in example G. In example F, we can see that the 300vB&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; an additional 200sat in fees, which is not enough to pay for its own&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bandwidth&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (BIP125#4). In example G, we can see that P1 pays enough to replace M1,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; but&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; using P1&amp;#39;s fees again during package submission would make it look like&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a 300sat&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; increase for a 200vB package. Even including its fees and size would&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; not be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; sufficient in this example, since the 300sat looks like enough for the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 300vB&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. The calculcation after deduplication is 100sat increase for a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of size 200vB, which correctly fails BIP125#4. Assume all transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; have a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; size of 100vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; #### Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If a package meets feerate requirements as a package, the parents in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction are allowed to replace-by-fee mempool transactions. The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child cannot&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace mempool transactions. Multiple transactions can replace the same&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction, but in order to be valid, none of the transactions can try&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace an ancestor of another transaction in the same package (which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would thus&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; make its inputs unavailable).&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Even if we are using package feerate, a package will not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; propagate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; as intended if RBF still requires each individual transaction to meet&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate requirements.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We use a set of rules slightly modified from BIP125 as follows:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Signaling (Rule #1)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; All mempool transactions to be replaced must signal replaceability.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: Package RBF signaling logic should be the same for package&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; RBF and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; single transaction acceptance. This would be updated if single&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; validation moves to full RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### New Unconfirmed Inputs (Rule #2)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; A package may include new unconfirmed inputs, but the ancestor feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child must be at least as high as the ancestor feerates of every&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; being replaced. This is contrary to BIP125#2, which states &amp;#34;The&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction may only include an unconfirmed input if that input was&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; included in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; one of the original transactions. (An unconfirmed input spends an&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; output from a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; currently-unconfirmed transaction.)&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; *Rationale*: The purpose of BIP125#2 is to ensure that the replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction has a higher ancestor score than the original&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transaction(s) (see&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [comment][13]). Example H [16] shows how adding a new unconfirmed input&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; can lower the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor score of the replacement transaction. P1 is trying to replace&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M1, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; spends an unconfirmed output of M2. P1 pays 800sat, M1 pays 600sat, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M2 pays&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 100sat. Assume all transactions have a size of 100vB. While, in&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; isolation, P1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; looks like a better mining candidate than M1, it must be mined with M2,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; so its&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor feerate is actually 4.5sat/vB.  This is lower than M1&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ancestor&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate, which is 6sat/vB.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In package RBF, the rule analogous to BIP125#2 would be &amp;#34;none of the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions in the package can spend new unconfirmed inputs.&amp;#34; Example&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; J [17] shows&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; why, if any of the package transactions have ancestors, package feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is no&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; longer accurate. Even though M2 and M3 are not ancestors of P1 (which&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement transaction in an RBF), we&amp;#39;re actually interested in the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; entire&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package. A miner should mine M1 which is 5sat/vB instead of M2, M3, P1,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; P2, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; P3, which is only 4sat/vB. The Package RBF rule cannot be loosened to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only allow&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the child to have new unconfirmed inputs, either, because it can still&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; cause us&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to overestimate the package&amp;#39;s ancestor score.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; However, enforcing a rule analogous to BIP125#2 would not only make&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; less useful, but would also break Package RBF for packages with parents&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; already&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; in the mempool: if a package parent has already been submitted, it&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; would look&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; like the child is spending a &amp;#34;new&amp;#34; unconfirmed input. In example K&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [18], we&amp;#39;re&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; looking to replace M1 with the entire package including P1, P2, and P3.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; We must&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; consider the case where one of the parents is already in the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (in this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; case, P2), which means we must allow P3 to have new unconfirmed inputs.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; However,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; M2 lowers the ancestor score of P3 to 4.3sat/vB, so we should not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replace M1&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; with this package.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Thus, the package RBF rule regarding new unconfirmed inputs is less&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; strict than&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125#2. However, we still achieve the same goal of requiring the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions to have a ancestor score at least as high as the original&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ones. As&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; a result, the entire package is required to be a higher feerate mining&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; candidate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than each of the replaced transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Another note: the [comment][13] above the BIP125#2 code in the original&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; RBF&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; implementation suggests that the rule was intended to be temporary.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Absolute Fee (Rule #3)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package must increase the absolute fee of the mempool, i.e. the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; total fees&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; of the package must be higher than the absolute fees of the mempool&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it replaces. Combined with the CPFP rule above, this differs from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125 Rule #3&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; - an individual transaction in the package may have lower fees than the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   transaction(s) it is replacing. In fact, it may have 0 fees, and the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; child&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Feerate (Rule #4)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package must pay for its own bandwidth; the package feerate must be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; higher&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; than the replaced transactions by at least minimum relay feerate&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (`incrementalRelayFee`). Combined with the CPFP rule above, this&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; differs from&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; BIP125 Rule #4 - an individual transaction in the package can have a&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; lower&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; feerate than the transaction(s) it is replacing. In fact, it may have 0&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fees,&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; and the child pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ##### Total Number of Replaced Transactions (Rule #5)&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The package cannot replace more than 100 mempool transactions. This is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; identical&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; to BIP125 Rule #5.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ### Expected FAQs&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 1. Is it possible for only some of the package to make it into the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; mempool?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;    Yes, it is. However, since we evict transactions from the mempool by&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; descendant score and the package child is supposed to be sponsoring the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; fees of&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; its parents, the most common scenario would be all-or-nothing. This is&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; incentive-compatible. In fact, to be conservative, package validation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; should&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; begin by trying to submit all of the transactions individually, and&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; only use the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; package mempool acceptance logic if the parents fail due to low feerate.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 2. Should we allow packages to contain already-confirmed transactions?&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;     No, for practical reasons. In mempool validation, we actually&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; aren&amp;#39;t able to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; tell with 100% confidence if we are looking at a transaction that has&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; already&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; confirmed, because we look up inputs using a UTXO set. If we have&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; historical&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; block data, it&amp;#39;s possible to look for it, but this is inefficient, not&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; always&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; possible for pruning nodes, and unnecessary because we&amp;#39;re not going to&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; do&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; anything with the transaction anyway. As such, we already have the&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; expectation&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that transaction relay is somewhat &amp;#34;stateful&amp;#34; i.e. nobody should be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relaying&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; transactions that have already been confirmed. Similarly, we shouldn&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; be&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; relaying packages that contain already-confirmed transactions.&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [1]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&#34;&gt;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&#34;&gt;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16400&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16400&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [5]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21062&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21062&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [6]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22675&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22675&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [7]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22796&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22796&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [8]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/20833&#34;&gt;https://github.com/bitcoin/bitcoin/pull/20833&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [9]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21800&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21800&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [13]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [14]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567078-075a971c-0619-4339-9168-b41fd2b90c28.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [15]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132856734-fc17da75-f875-44bb-b954-cb7a1725cc0d.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [16]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567347-a3e2e4a8-ae9c-49f8-abb9-81e8e0aba224.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [17]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567370-21566d0e-36c8-4831-b1a8-706634540af3.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [18]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567444-bfff1142-439f-4547-800a-2ba2b0242bcb.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [19]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133456219-0bb447cb-dcb4-4a31-b9c1-7d86205b68bc.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [20]:&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132857787-7b7c6f56-af96-44c8-8d78-983719888c19.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210921/2519ec71/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210921/2519ec71/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T22:59:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2s74wvvp5rg3nnrjdpfcz4gxdlygmakkf5qc9wkyermchnn8fvtczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qt8pfau</id>
    
      <title type="html">📅 Original date posted:2021-09-21 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2s74wvvp5rg3nnrjdpfcz4gxdlygmakkf5qc9wkyermchnn8fvtczyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qt8pfau" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsyr6uky8fjrlka7efq48wk4ref98l9celpa99z74p9esnveu5mczcry7jfz&#39;&gt;nevent1q…7jfz&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-09-21&lt;br/&gt;📝 Original message:Hi Bastien,&lt;br/&gt;&lt;br/&gt;Thank you for your feedback!&lt;br/&gt;&lt;br/&gt;&amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&lt;br/&gt;&amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&lt;br/&gt;I believe you are describing a pinning attack in which your adversarial&lt;br/&gt;counterparty attempts to monopolize the mempool descendant limit of the&lt;br/&gt;shared  transaction A in order to prevent you from submitting a fee-bumping&lt;br/&gt;child C; I&amp;#39;ve tried to illustrate this as diagram A here:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/134159860-068080d0-bbb6-4356-ae74-00df00644c74.png&#34;&gt; &lt;br/&gt;(please let me know if I&amp;#39;m misunderstanding).&lt;br/&gt;&lt;br/&gt;I believe this attack is mitigated as long as we attempt to submit&lt;br/&gt;transactions individually (and thus take advantage of CPFP carve out)&lt;br/&gt;before attempting package validation. So, in scenario A2, even if the&lt;br/&gt;mempool receives a package with A&#43;C, it would deduplicate A, submit C as an&lt;br/&gt;individual transaction, and allow it due to the CPFP carve out exemption. A&lt;br/&gt;more general goal is: if a transaction would propagate successfully on its&lt;br/&gt;own now, it should still propagate regardless of whether it is included in&lt;br/&gt;a package. The best way to ensure this, as far as I can tell, is to always&lt;br/&gt;try to submit them individually first.&lt;br/&gt;&lt;br/&gt;I would note that this proposal doesn&amp;#39;t accommodate something like diagram&lt;br/&gt;B, where C is getting CPFP carve out and wants to bring a &#43;1 (e.g. C has&lt;br/&gt;very low fees and is bumped by D). I don&amp;#39;t think this is a use case since C&lt;br/&gt;should be the one fee-bumping A, but since we&amp;#39;re talking about limitations&lt;br/&gt;around the CPFP carve out, this is it.&lt;br/&gt;&lt;br/&gt;Let me know if this addresses your concerns?&lt;br/&gt;&lt;br/&gt;Thanks,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Mon, Sep 20, 2021 at 10:19 AM Bastien TEINTURIER &amp;lt;bastien at acinq.fr&amp;gt;&lt;br/&gt;wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi Gloria,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks for this detailed post!&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The illustrations you provided are very useful for this kind of graph&lt;br/&gt;&amp;gt; topology problems.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The rules you lay out for package RBF look good to me at first glance&lt;br/&gt;&amp;gt; as there are some subtle improvements compared to BIP 125.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; &amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt; &amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I have a question regarding this rule, as your example 2C could be&lt;br/&gt;&amp;gt; concerning for LN (unless I didn&amp;#39;t understand it correctly).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; This also touches on the package RBF rule 5 (&amp;#34;The package cannot&lt;br/&gt;&amp;gt; replace more than 100 mempool transactions.&amp;#34;)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; In your example we have a parent transaction A already in the mempool&lt;br/&gt;&amp;gt; and an unrelated child B. We submit a package C &#43; D where C spends&lt;br/&gt;&amp;gt; another of A&amp;#39;s inputs. You&amp;#39;re highlighting that this package may be&lt;br/&gt;&amp;gt; rejected because of the unrelated transaction(s) B.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; The way I see this, an attacker can abuse this rule to ensure&lt;br/&gt;&amp;gt; transaction A stays pinned in the mempool without confirming by&lt;br/&gt;&amp;gt; broadcasting a set of child transactions that reach these limits&lt;br/&gt;&amp;gt; and pay low fees (where A would be a commit tx in LN).&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; We had to create the CPFP carve-out rule explicitly to work around&lt;br/&gt;&amp;gt; this limitation, and I think it would be necessary for package RBF&lt;br/&gt;&amp;gt; as well, because in such cases we do want to be able to submit a&lt;br/&gt;&amp;gt; package A &#43; C where C pays high fees to speed up A&amp;#39;s confirmation,&lt;br/&gt;&amp;gt; regardless of unrelated unconfirmed children of A...&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; We could submit only C to benefit from the existing CPFP carve-out&lt;br/&gt;&amp;gt; rule, but that wouldn&amp;#39;t work if our local mempool doesn&amp;#39;t have A yet,&lt;br/&gt;&amp;gt; but other remote mempools do.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Is my concern justified? Is this something that we should dig into a&lt;br/&gt;&amp;gt; bit deeper?&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Thanks,&lt;br/&gt;&amp;gt; Bastien&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Le jeu. 16 sept. 2021 à 09:55, Gloria Zhao via bitcoin-dev &amp;lt;&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&amp;gt; a écrit :&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Hi there,&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; I&amp;#39;m writing to propose a set of mempool policy changes to enable package&lt;br/&gt;&amp;gt;&amp;gt; validation (in preparation for package relay) in Bitcoin Core. These&lt;br/&gt;&amp;gt;&amp;gt; would not&lt;br/&gt;&amp;gt;&amp;gt; be consensus or P2P protocol changes. However, since mempool policy&lt;br/&gt;&amp;gt;&amp;gt; significantly affects transaction propagation, I believe this is relevant&lt;br/&gt;&amp;gt;&amp;gt; for&lt;br/&gt;&amp;gt;&amp;gt; the mailing list.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; My proposal enables packages consisting of multiple parents and 1 child.&lt;br/&gt;&amp;gt;&amp;gt; If you&lt;br/&gt;&amp;gt;&amp;gt; develop software that relies on specific transaction relay assumptions&lt;br/&gt;&amp;gt;&amp;gt; and/or&lt;br/&gt;&amp;gt;&amp;gt; are interested in using package relay in the future, I&amp;#39;m very interested&lt;br/&gt;&amp;gt;&amp;gt; to hear&lt;br/&gt;&amp;gt;&amp;gt; your feedback on the utility or restrictiveness of these package policies&lt;br/&gt;&amp;gt;&amp;gt; for&lt;br/&gt;&amp;gt;&amp;gt; your use cases.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A draft implementation of this proposal can be found in [Bitcoin Core&lt;br/&gt;&amp;gt;&amp;gt; PR#22290][1].&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; An illustrated version of this post can be found at&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&lt;/a&gt;.&lt;br/&gt;&amp;gt;&amp;gt; I have also linked the images below.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## Background&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Feel free to skip this section if you are already familiar with mempool&lt;br/&gt;&amp;gt;&amp;gt; policy&lt;br/&gt;&amp;gt;&amp;gt; and package relay terminology.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Terminology Clarifications&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; * Package = an ordered list of related transactions, representable by a&lt;br/&gt;&amp;gt;&amp;gt; Directed&lt;br/&gt;&amp;gt;&amp;gt;   Acyclic Graph.&lt;br/&gt;&amp;gt;&amp;gt; * Package Feerate = the total modified fees divided by the total virtual&lt;br/&gt;&amp;gt;&amp;gt; size of&lt;br/&gt;&amp;gt;&amp;gt;   all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;     - Modified fees = a transaction&amp;#39;s base fees &#43; fee delta applied by&lt;br/&gt;&amp;gt;&amp;gt; the user&lt;br/&gt;&amp;gt;&amp;gt;       with `prioritisetransaction`. As such, we expect this to vary across&lt;br/&gt;&amp;gt;&amp;gt; mempools.&lt;br/&gt;&amp;gt;&amp;gt;     - Virtual Size = the maximum of virtual sizes calculated using [BIP141&lt;br/&gt;&amp;gt;&amp;gt;       virtual size][2] and sigop weight. [Implemented here in Bitcoin&lt;br/&gt;&amp;gt;&amp;gt; Core][3].&lt;br/&gt;&amp;gt;&amp;gt;     - Note that feerate is not necessarily based on the base fees and&lt;br/&gt;&amp;gt;&amp;gt; serialized&lt;br/&gt;&amp;gt;&amp;gt;       size.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; * Fee-Bumping = user/wallet actions that take advantage of miner&lt;br/&gt;&amp;gt;&amp;gt; incentives to&lt;br/&gt;&amp;gt;&amp;gt;   boost a transaction&amp;#39;s candidacy for inclusion in a block, including&lt;br/&gt;&amp;gt;&amp;gt; Child Pays&lt;br/&gt;&amp;gt;&amp;gt; for Parent (CPFP) and [BIP125][12] Replace-by-Fee (RBF). Our intention in&lt;br/&gt;&amp;gt;&amp;gt; mempool policy is to recognize when the new transaction is more&lt;br/&gt;&amp;gt;&amp;gt; economical to&lt;br/&gt;&amp;gt;&amp;gt; mine than the original one(s) but not open DoS vectors, so there are some&lt;br/&gt;&amp;gt;&amp;gt; limitations.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Policy&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The purpose of the mempool is to store the best (to be most&lt;br/&gt;&amp;gt;&amp;gt; incentive-compatible&lt;br/&gt;&amp;gt;&amp;gt; with miners, highest feerate) candidates for inclusion in a block. Miners&lt;br/&gt;&amp;gt;&amp;gt; use&lt;br/&gt;&amp;gt;&amp;gt; the mempool to build block templates. The mempool is also useful as a&lt;br/&gt;&amp;gt;&amp;gt; cache for&lt;br/&gt;&amp;gt;&amp;gt; boosting block relay and validation performance, aiding transaction&lt;br/&gt;&amp;gt;&amp;gt; relay, and&lt;br/&gt;&amp;gt;&amp;gt; generating feerate estimations.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Ideally, all consensus-valid transactions paying reasonable fees should&lt;br/&gt;&amp;gt;&amp;gt; make it&lt;br/&gt;&amp;gt;&amp;gt; to miners through normal transaction relay, without any special&lt;br/&gt;&amp;gt;&amp;gt; connectivity or&lt;br/&gt;&amp;gt;&amp;gt; relationships with miners. On the other hand, nodes do not have unlimited&lt;br/&gt;&amp;gt;&amp;gt; resources, and a P2P network designed to let any honest node broadcast&lt;br/&gt;&amp;gt;&amp;gt; their&lt;br/&gt;&amp;gt;&amp;gt; transactions also exposes the transaction validation engine to DoS&lt;br/&gt;&amp;gt;&amp;gt; attacks from&lt;br/&gt;&amp;gt;&amp;gt; malicious peers.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; As such, for unconfirmed transactions we are considering for our mempool,&lt;br/&gt;&amp;gt;&amp;gt; we&lt;br/&gt;&amp;gt;&amp;gt; apply a set of validation rules in addition to consensus, primarily to&lt;br/&gt;&amp;gt;&amp;gt; protect&lt;br/&gt;&amp;gt;&amp;gt; us from resource exhaustion and aid our efforts to keep the highest fee&lt;br/&gt;&amp;gt;&amp;gt; transactions. We call this mempool _policy_: a set of (configurable,&lt;br/&gt;&amp;gt;&amp;gt; node-specific) rules that transactions must abide by in order to be&lt;br/&gt;&amp;gt;&amp;gt; accepted&lt;br/&gt;&amp;gt;&amp;gt; into our mempool. Transaction &amp;#34;Standardness&amp;#34; rules and mempool&lt;br/&gt;&amp;gt;&amp;gt; restrictions such&lt;br/&gt;&amp;gt;&amp;gt; as &amp;#34;too-long-mempool-chain&amp;#34; are both examples of policy.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Package Relay and Package Mempool Accept&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In transaction relay, we currently consider transactions one at a time for&lt;br/&gt;&amp;gt;&amp;gt; submission to the mempool. This creates a limitation in the node&amp;#39;s&lt;br/&gt;&amp;gt;&amp;gt; ability to&lt;br/&gt;&amp;gt;&amp;gt; determine which transactions have the highest feerates, since we cannot&lt;br/&gt;&amp;gt;&amp;gt; take&lt;br/&gt;&amp;gt;&amp;gt; into account descendants (i.e. cannot use CPFP) until all the&lt;br/&gt;&amp;gt;&amp;gt; transactions are&lt;br/&gt;&amp;gt;&amp;gt; in the mempool. Similarly, we cannot use a transaction&amp;#39;s descendants when&lt;br/&gt;&amp;gt;&amp;gt; considering it for RBF. When an individual transaction does not meet the&lt;br/&gt;&amp;gt;&amp;gt; mempool&lt;br/&gt;&amp;gt;&amp;gt; minimum feerate and the user isn&amp;#39;t able to create a replacement&lt;br/&gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt; directly, it will not be accepted by mempools.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; This limitation presents a security issue for applications and users&lt;br/&gt;&amp;gt;&amp;gt; relying on&lt;br/&gt;&amp;gt;&amp;gt; time-sensitive transactions. For example, Lightning and other protocols&lt;br/&gt;&amp;gt;&amp;gt; create&lt;br/&gt;&amp;gt;&amp;gt; UTXOs with multiple spending paths, where one counterparty&amp;#39;s spending&lt;br/&gt;&amp;gt;&amp;gt; path opens&lt;br/&gt;&amp;gt;&amp;gt; up after a timelock, and users are protected from cheating scenarios as&lt;br/&gt;&amp;gt;&amp;gt; long as&lt;br/&gt;&amp;gt;&amp;gt; they redeem on-chain in time. A key security assumption is that all&lt;br/&gt;&amp;gt;&amp;gt; parties&amp;#39;&lt;br/&gt;&amp;gt;&amp;gt; transactions will propagate and confirm in a timely manner. This&lt;br/&gt;&amp;gt;&amp;gt; assumption can&lt;br/&gt;&amp;gt;&amp;gt; be broken if fee-bumping does not work as intended.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The end goal for Package Relay is to consider multiple transactions at&lt;br/&gt;&amp;gt;&amp;gt; the same&lt;br/&gt;&amp;gt;&amp;gt; time, e.g. a transaction with its high-fee child. This may help us better&lt;br/&gt;&amp;gt;&amp;gt; determine whether transactions should be accepted to our mempool,&lt;br/&gt;&amp;gt;&amp;gt; especially if&lt;br/&gt;&amp;gt;&amp;gt; they don&amp;#39;t meet fee requirements individually or are better RBF&lt;br/&gt;&amp;gt;&amp;gt; candidates as a&lt;br/&gt;&amp;gt;&amp;gt; package. A combination of changes to mempool validation logic, policy, and&lt;br/&gt;&amp;gt;&amp;gt; transaction relay allows us to better propagate the transactions with the&lt;br/&gt;&amp;gt;&amp;gt; highest package feerates to miners, and makes fee-bumping tools more&lt;br/&gt;&amp;gt;&amp;gt; powerful&lt;br/&gt;&amp;gt;&amp;gt; for users.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The &amp;#34;relay&amp;#34; part of Package Relay suggests P2P messaging changes, but a&lt;br/&gt;&amp;gt;&amp;gt; large&lt;br/&gt;&amp;gt;&amp;gt; part of the changes are in the mempool&amp;#39;s package validation logic. We&lt;br/&gt;&amp;gt;&amp;gt; call this&lt;br/&gt;&amp;gt;&amp;gt; *Package Mempool Accept*.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Previous Work&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; * Given that mempool validation is DoS-sensitive and complex, it would be&lt;br/&gt;&amp;gt;&amp;gt;   dangerous to haphazardly tack on package validation logic. Many efforts&lt;br/&gt;&amp;gt;&amp;gt; have&lt;br/&gt;&amp;gt;&amp;gt; been made to make mempool validation less opaque (see [#16400][4],&lt;br/&gt;&amp;gt;&amp;gt; [#21062][5],&lt;br/&gt;&amp;gt;&amp;gt; [#22675][6], [#22796][7]).&lt;br/&gt;&amp;gt;&amp;gt; * [#20833][8] Added basic capabilities for package validation, test&lt;br/&gt;&amp;gt;&amp;gt; accepts only&lt;br/&gt;&amp;gt;&amp;gt;   (no submission to mempool).&lt;br/&gt;&amp;gt;&amp;gt; * [#21800][9] Implemented package ancestor/descendant limit checks for&lt;br/&gt;&amp;gt;&amp;gt; arbitrary&lt;br/&gt;&amp;gt;&amp;gt;   packages. Still test accepts only.&lt;br/&gt;&amp;gt;&amp;gt; * Previous package relay proposals (see [#16401][10], [#19621][11]).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Existing Package Rules&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; These are in master as introduced in [#20833][8] and [#21800][9]. I&amp;#39;ll&lt;br/&gt;&amp;gt;&amp;gt; consider&lt;br/&gt;&amp;gt;&amp;gt; them as &amp;#34;given&amp;#34; in the rest of this document, though they can be changed,&lt;br/&gt;&amp;gt;&amp;gt; since&lt;br/&gt;&amp;gt;&amp;gt; package validation is test-accept only right now.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;&amp;gt;&amp;gt; `MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;    *Rationale*: This is already enforced as mempool ancestor/descendant&lt;br/&gt;&amp;gt;&amp;gt; limits.&lt;br/&gt;&amp;gt;&amp;gt; Presumably, transactions in a package are all related, so exceeding this&lt;br/&gt;&amp;gt;&amp;gt; limit&lt;br/&gt;&amp;gt;&amp;gt; would mean that the package can either be split up or it wouldn&amp;#39;t pass&lt;br/&gt;&amp;gt;&amp;gt; this&lt;br/&gt;&amp;gt;&amp;gt; mempool policy.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. Packages must be topologically sorted: if any dependencies exist&lt;br/&gt;&amp;gt;&amp;gt; between&lt;br/&gt;&amp;gt;&amp;gt; transactions, parents must appear somewhere before children. [8]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 3. A package cannot have conflicting transactions, i.e. none of them can&lt;br/&gt;&amp;gt;&amp;gt; spend&lt;br/&gt;&amp;gt;&amp;gt; the same inputs. This also means there cannot be duplicate transactions.&lt;br/&gt;&amp;gt;&amp;gt; [8]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 4. When packages are evaluated against ancestor/descendant limits in a&lt;br/&gt;&amp;gt;&amp;gt; test&lt;br/&gt;&amp;gt;&amp;gt; accept, the union of all of their descendants and ancestors is&lt;br/&gt;&amp;gt;&amp;gt; considered. This&lt;br/&gt;&amp;gt;&amp;gt; is essentially a &amp;#34;worst case&amp;#34; heuristic where every transaction in the&lt;br/&gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt; is treated as each other&amp;#39;s ancestor and descendant. [8]&lt;br/&gt;&amp;gt;&amp;gt; Packages for which ancestor/descendant limits are accurately captured by&lt;br/&gt;&amp;gt;&amp;gt; this&lt;br/&gt;&amp;gt;&amp;gt; heuristic: [19]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; There are also limitations such as the fact that CPFP carve out is not&lt;br/&gt;&amp;gt;&amp;gt; applied&lt;br/&gt;&amp;gt;&amp;gt; to package transactions. #20833 also disables RBF in package validation;&lt;br/&gt;&amp;gt;&amp;gt; this&lt;br/&gt;&amp;gt;&amp;gt; proposal overrides that to allow packages to use RBF.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ## Proposed Changes&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The next step in the Package Mempool Accept project is to implement&lt;br/&gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt; to mempool, initially through RPC only. This allows us to test the&lt;br/&gt;&amp;gt;&amp;gt; submission&lt;br/&gt;&amp;gt;&amp;gt; logic before exposing it on P2P.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Summary&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; - Packages may contain already-in-mempool transactions.&lt;br/&gt;&amp;gt;&amp;gt; - Packages are 2 generations, Multi-Parent-1-Child.&lt;br/&gt;&amp;gt;&amp;gt; - Fee-related checks use the package feerate. This means that wallets can&lt;br/&gt;&amp;gt;&amp;gt; create a package that utilizes CPFP.&lt;br/&gt;&amp;gt;&amp;gt; - Parents are allowed to RBF mempool transactions with a set of rules&lt;br/&gt;&amp;gt;&amp;gt; similar&lt;br/&gt;&amp;gt;&amp;gt;   to BIP125. This enables a combination of CPFP and RBF, where a&lt;br/&gt;&amp;gt;&amp;gt; transaction&amp;#39;s descendant fees pay for replacing mempool conflicts.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; There is a draft implementation in [#22290][1]. It is WIP, but feedback is&lt;br/&gt;&amp;gt;&amp;gt; always welcome.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Details&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; #### Packages May Contain Already-in-Mempool Transactions&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A package may contain transactions that are already in the mempool. We&lt;br/&gt;&amp;gt;&amp;gt; remove&lt;br/&gt;&amp;gt;&amp;gt; (&amp;#34;deduplicate&amp;#34;) those transactions from the package for the purposes of&lt;br/&gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt; mempool acceptance. If a package is empty after deduplication, we do&lt;br/&gt;&amp;gt;&amp;gt; nothing.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: Mempools vary across the network. It&amp;#39;s possible for a parent&lt;br/&gt;&amp;gt;&amp;gt; to be&lt;br/&gt;&amp;gt;&amp;gt; accepted to the mempool of a peer on its own due to differences in policy&lt;br/&gt;&amp;gt;&amp;gt; and&lt;br/&gt;&amp;gt;&amp;gt; fee market fluctuations. We should not reject or penalize the entire&lt;br/&gt;&amp;gt;&amp;gt; package for&lt;br/&gt;&amp;gt;&amp;gt; an individual transaction as that could be a censorship vector.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; #### Packages Are Multi-Parent-1-Child&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Only packages of a specific topology are permitted. Namely, a package is&lt;br/&gt;&amp;gt;&amp;gt; exactly&lt;br/&gt;&amp;gt;&amp;gt; 1 child with all of its unconfirmed parents. After deduplication, the&lt;br/&gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt; may be exactly the same, empty, 1 child, 1 child with just some of its&lt;br/&gt;&amp;gt;&amp;gt; unconfirmed parents, etc. Note that it&amp;#39;s possible for the parents to be&lt;br/&gt;&amp;gt;&amp;gt; indirect&lt;br/&gt;&amp;gt;&amp;gt; descendants/ancestors of one another, or for parent and child to share a&lt;br/&gt;&amp;gt;&amp;gt; parent,&lt;br/&gt;&amp;gt;&amp;gt; so we cannot make any other topology assumptions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: This allows for fee-bumping by CPFP. Allowing multiple&lt;br/&gt;&amp;gt;&amp;gt; parents&lt;br/&gt;&amp;gt;&amp;gt; makes it possible to fee-bump a batch of transactions. Restricting&lt;br/&gt;&amp;gt;&amp;gt; packages to a&lt;br/&gt;&amp;gt;&amp;gt; defined topology is also easier to reason about and simplifies the&lt;br/&gt;&amp;gt;&amp;gt; validation&lt;br/&gt;&amp;gt;&amp;gt; logic greatly. Multi-parent-1-child allows us to think of the package as&lt;br/&gt;&amp;gt;&amp;gt; one big&lt;br/&gt;&amp;gt;&amp;gt; transaction, where:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; - Inputs = all the inputs of parents &#43; inputs of the child that come from&lt;br/&gt;&amp;gt;&amp;gt;   confirmed UTXOs&lt;br/&gt;&amp;gt;&amp;gt; - Outputs = all the outputs of the child &#43; all outputs of the parents that&lt;br/&gt;&amp;gt;&amp;gt;   aren&amp;#39;t spent by other transactions in the package&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Examples of packages that follow this rule (variations of example A show&lt;br/&gt;&amp;gt;&amp;gt; some&lt;br/&gt;&amp;gt;&amp;gt; possibilities after deduplication): ![image][15]&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; #### Fee-Related Checks Use Package Feerate&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Package Feerate = the total modified fees divided by the total virtual&lt;br/&gt;&amp;gt;&amp;gt; size of&lt;br/&gt;&amp;gt;&amp;gt; all transactions in the package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; To meet the two feerate requirements of a mempool, i.e., the&lt;br/&gt;&amp;gt;&amp;gt; pre-configured&lt;br/&gt;&amp;gt;&amp;gt; minimum relay feerate (`minRelayTxFee`) and dynamic mempool minimum&lt;br/&gt;&amp;gt;&amp;gt; feerate, the&lt;br/&gt;&amp;gt;&amp;gt; total package feerate is used instead of the individual feerate. The&lt;br/&gt;&amp;gt;&amp;gt; individual&lt;br/&gt;&amp;gt;&amp;gt; transactions are allowed to be below feerate requirements if the package&lt;br/&gt;&amp;gt;&amp;gt; meets&lt;br/&gt;&amp;gt;&amp;gt; the feerate requirements. For example, the parent(s) in the package can&lt;br/&gt;&amp;gt;&amp;gt; have 0&lt;br/&gt;&amp;gt;&amp;gt; fees but be paid for by the child.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: This can be thought of as &amp;#34;CPFP within a package,&amp;#34; solving&lt;br/&gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt; issue of a parent not meeting minimum fees on its own. This allows L2&lt;br/&gt;&amp;gt;&amp;gt; applications to adjust their fees at broadcast time instead of&lt;br/&gt;&amp;gt;&amp;gt; overshooting or&lt;br/&gt;&amp;gt;&amp;gt; risking getting stuck/pinned.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; We use the package feerate of the package *after deduplication*.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*:  It would be incorrect to use the fees of transactions that&lt;br/&gt;&amp;gt;&amp;gt; are&lt;br/&gt;&amp;gt;&amp;gt; already in the mempool, as we do not want a transaction&amp;#39;s fees to be&lt;br/&gt;&amp;gt;&amp;gt; double-counted for both its individual RBF and package RBF.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Examples F and G [14] show the same package, but P1 is submitted&lt;br/&gt;&amp;gt;&amp;gt; individually before&lt;br/&gt;&amp;gt;&amp;gt; the package in example G. In example F, we can see that the 300vB package&lt;br/&gt;&amp;gt;&amp;gt; pays&lt;br/&gt;&amp;gt;&amp;gt; an additional 200sat in fees, which is not enough to pay for its own&lt;br/&gt;&amp;gt;&amp;gt; bandwidth&lt;br/&gt;&amp;gt;&amp;gt; (BIP125#4). In example G, we can see that P1 pays enough to replace M1,&lt;br/&gt;&amp;gt;&amp;gt; but&lt;br/&gt;&amp;gt;&amp;gt; using P1&amp;#39;s fees again during package submission would make it look like a&lt;br/&gt;&amp;gt;&amp;gt; 300sat&lt;br/&gt;&amp;gt;&amp;gt; increase for a 200vB package. Even including its fees and size would not&lt;br/&gt;&amp;gt;&amp;gt; be&lt;br/&gt;&amp;gt;&amp;gt; sufficient in this example, since the 300sat looks like enough for the&lt;br/&gt;&amp;gt;&amp;gt; 300vB&lt;br/&gt;&amp;gt;&amp;gt; package. The calculcation after deduplication is 100sat increase for a&lt;br/&gt;&amp;gt;&amp;gt; package&lt;br/&gt;&amp;gt;&amp;gt; of size 200vB, which correctly fails BIP125#4. Assume all transactions&lt;br/&gt;&amp;gt;&amp;gt; have a&lt;br/&gt;&amp;gt;&amp;gt; size of 100vB.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; #### Package RBF&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; If a package meets feerate requirements as a package, the parents in the&lt;br/&gt;&amp;gt;&amp;gt; transaction are allowed to replace-by-fee mempool transactions. The child&lt;br/&gt;&amp;gt;&amp;gt; cannot&lt;br/&gt;&amp;gt;&amp;gt; replace mempool transactions. Multiple transactions can replace the same&lt;br/&gt;&amp;gt;&amp;gt; transaction, but in order to be valid, none of the transactions can try to&lt;br/&gt;&amp;gt;&amp;gt; replace an ancestor of another transaction in the same package (which&lt;br/&gt;&amp;gt;&amp;gt; would thus&lt;br/&gt;&amp;gt;&amp;gt; make its inputs unavailable).&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: Even if we are using package feerate, a package will not&lt;br/&gt;&amp;gt;&amp;gt; propagate&lt;br/&gt;&amp;gt;&amp;gt; as intended if RBF still requires each individual transaction to meet the&lt;br/&gt;&amp;gt;&amp;gt; feerate requirements.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; We use a set of rules slightly modified from BIP125 as follows:&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ##### Signaling (Rule #1)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; All mempool transactions to be replaced must signal replaceability.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: Package RBF signaling logic should be the same for package&lt;br/&gt;&amp;gt;&amp;gt; RBF and&lt;br/&gt;&amp;gt;&amp;gt; single transaction acceptance. This would be updated if single transaction&lt;br/&gt;&amp;gt;&amp;gt; validation moves to full RBF.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ##### New Unconfirmed Inputs (Rule #2)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; A package may include new unconfirmed inputs, but the ancestor feerate of&lt;br/&gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt; child must be at least as high as the ancestor feerates of every&lt;br/&gt;&amp;gt;&amp;gt; transaction&lt;br/&gt;&amp;gt;&amp;gt; being replaced. This is contrary to BIP125#2, which states &amp;#34;The&lt;br/&gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt; transaction may only include an unconfirmed input if that input was&lt;br/&gt;&amp;gt;&amp;gt; included in&lt;br/&gt;&amp;gt;&amp;gt; one of the original transactions. (An unconfirmed input spends an output&lt;br/&gt;&amp;gt;&amp;gt; from a&lt;br/&gt;&amp;gt;&amp;gt; currently-unconfirmed transaction.)&amp;#34;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; *Rationale*: The purpose of BIP125#2 is to ensure that the replacement&lt;br/&gt;&amp;gt;&amp;gt; transaction has a higher ancestor score than the original transaction(s)&lt;br/&gt;&amp;gt;&amp;gt; (see&lt;br/&gt;&amp;gt;&amp;gt; [comment][13]). Example H [16] shows how adding a new unconfirmed input&lt;br/&gt;&amp;gt;&amp;gt; can lower the&lt;br/&gt;&amp;gt;&amp;gt; ancestor score of the replacement transaction. P1 is trying to replace&lt;br/&gt;&amp;gt;&amp;gt; M1, and&lt;br/&gt;&amp;gt;&amp;gt; spends an unconfirmed output of M2. P1 pays 800sat, M1 pays 600sat, and&lt;br/&gt;&amp;gt;&amp;gt; M2 pays&lt;br/&gt;&amp;gt;&amp;gt; 100sat. Assume all transactions have a size of 100vB. While, in&lt;br/&gt;&amp;gt;&amp;gt; isolation, P1&lt;br/&gt;&amp;gt;&amp;gt; looks like a better mining candidate than M1, it must be mined with M2,&lt;br/&gt;&amp;gt;&amp;gt; so its&lt;br/&gt;&amp;gt;&amp;gt; ancestor feerate is actually 4.5sat/vB.  This is lower than M1&amp;#39;s ancestor&lt;br/&gt;&amp;gt;&amp;gt; feerate, which is 6sat/vB.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; In package RBF, the rule analogous to BIP125#2 would be &amp;#34;none of the&lt;br/&gt;&amp;gt;&amp;gt; transactions in the package can spend new unconfirmed inputs.&amp;#34; Example J&lt;br/&gt;&amp;gt;&amp;gt; [17] shows&lt;br/&gt;&amp;gt;&amp;gt; why, if any of the package transactions have ancestors, package feerate&lt;br/&gt;&amp;gt;&amp;gt; is no&lt;br/&gt;&amp;gt;&amp;gt; longer accurate. Even though M2 and M3 are not ancestors of P1 (which is&lt;br/&gt;&amp;gt;&amp;gt; the&lt;br/&gt;&amp;gt;&amp;gt; replacement transaction in an RBF), we&amp;#39;re actually interested in the&lt;br/&gt;&amp;gt;&amp;gt; entire&lt;br/&gt;&amp;gt;&amp;gt; package. A miner should mine M1 which is 5sat/vB instead of M2, M3, P1,&lt;br/&gt;&amp;gt;&amp;gt; P2, and&lt;br/&gt;&amp;gt;&amp;gt; P3, which is only 4sat/vB. The Package RBF rule cannot be loosened to&lt;br/&gt;&amp;gt;&amp;gt; only allow&lt;br/&gt;&amp;gt;&amp;gt; the child to have new unconfirmed inputs, either, because it can still&lt;br/&gt;&amp;gt;&amp;gt; cause us&lt;br/&gt;&amp;gt;&amp;gt; to overestimate the package&amp;#39;s ancestor score.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; However, enforcing a rule analogous to BIP125#2 would not only make&lt;br/&gt;&amp;gt;&amp;gt; Package RBF&lt;br/&gt;&amp;gt;&amp;gt; less useful, but would also break Package RBF for packages with parents&lt;br/&gt;&amp;gt;&amp;gt; already&lt;br/&gt;&amp;gt;&amp;gt; in the mempool: if a package parent has already been submitted, it would&lt;br/&gt;&amp;gt;&amp;gt; look&lt;br/&gt;&amp;gt;&amp;gt; like the child is spending a &amp;#34;new&amp;#34; unconfirmed input. In example K [18],&lt;br/&gt;&amp;gt;&amp;gt; we&amp;#39;re&lt;br/&gt;&amp;gt;&amp;gt; looking to replace M1 with the entire package including P1, P2, and P3.&lt;br/&gt;&amp;gt;&amp;gt; We must&lt;br/&gt;&amp;gt;&amp;gt; consider the case where one of the parents is already in the mempool (in&lt;br/&gt;&amp;gt;&amp;gt; this&lt;br/&gt;&amp;gt;&amp;gt; case, P2), which means we must allow P3 to have new unconfirmed inputs.&lt;br/&gt;&amp;gt;&amp;gt; However,&lt;br/&gt;&amp;gt;&amp;gt; M2 lowers the ancestor score of P3 to 4.3sat/vB, so we should not replace&lt;br/&gt;&amp;gt;&amp;gt; M1&lt;br/&gt;&amp;gt;&amp;gt; with this package.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Thus, the package RBF rule regarding new unconfirmed inputs is less&lt;br/&gt;&amp;gt;&amp;gt; strict than&lt;br/&gt;&amp;gt;&amp;gt; BIP125#2. However, we still achieve the same goal of requiring the&lt;br/&gt;&amp;gt;&amp;gt; replacement&lt;br/&gt;&amp;gt;&amp;gt; transactions to have a ancestor score at least as high as the original&lt;br/&gt;&amp;gt;&amp;gt; ones. As&lt;br/&gt;&amp;gt;&amp;gt; a result, the entire package is required to be a higher feerate mining&lt;br/&gt;&amp;gt;&amp;gt; candidate&lt;br/&gt;&amp;gt;&amp;gt; than each of the replaced transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; Another note: the [comment][13] above the BIP125#2 code in the original&lt;br/&gt;&amp;gt;&amp;gt; RBF&lt;br/&gt;&amp;gt;&amp;gt; implementation suggests that the rule was intended to be temporary.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ##### Absolute Fee (Rule #3)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The package must increase the absolute fee of the mempool, i.e. the total&lt;br/&gt;&amp;gt;&amp;gt; fees&lt;br/&gt;&amp;gt;&amp;gt; of the package must be higher than the absolute fees of the mempool&lt;br/&gt;&amp;gt;&amp;gt; transactions&lt;br/&gt;&amp;gt;&amp;gt; it replaces. Combined with the CPFP rule above, this differs from BIP125&lt;br/&gt;&amp;gt;&amp;gt; Rule #3&lt;br/&gt;&amp;gt;&amp;gt; - an individual transaction in the package may have lower fees than the&lt;br/&gt;&amp;gt;&amp;gt;   transaction(s) it is replacing. In fact, it may have 0 fees, and the&lt;br/&gt;&amp;gt;&amp;gt; child&lt;br/&gt;&amp;gt;&amp;gt; pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ##### Feerate (Rule #4)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The package must pay for its own bandwidth; the package feerate must be&lt;br/&gt;&amp;gt;&amp;gt; higher&lt;br/&gt;&amp;gt;&amp;gt; than the replaced transactions by at least minimum relay feerate&lt;br/&gt;&amp;gt;&amp;gt; (`incrementalRelayFee`). Combined with the CPFP rule above, this differs&lt;br/&gt;&amp;gt;&amp;gt; from&lt;br/&gt;&amp;gt;&amp;gt; BIP125 Rule #4 - an individual transaction in the package can have a lower&lt;br/&gt;&amp;gt;&amp;gt; feerate than the transaction(s) it is replacing. In fact, it may have 0&lt;br/&gt;&amp;gt;&amp;gt; fees,&lt;br/&gt;&amp;gt;&amp;gt; and the child pays for RBF.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ##### Total Number of Replaced Transactions (Rule #5)&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; The package cannot replace more than 100 mempool transactions. This is&lt;br/&gt;&amp;gt;&amp;gt; identical&lt;br/&gt;&amp;gt;&amp;gt; to BIP125 Rule #5.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; ### Expected FAQs&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 1. Is it possible for only some of the package to make it into the&lt;br/&gt;&amp;gt;&amp;gt; mempool?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;    Yes, it is. However, since we evict transactions from the mempool by&lt;br/&gt;&amp;gt;&amp;gt; descendant score and the package child is supposed to be sponsoring the&lt;br/&gt;&amp;gt;&amp;gt; fees of&lt;br/&gt;&amp;gt;&amp;gt; its parents, the most common scenario would be all-or-nothing. This is&lt;br/&gt;&amp;gt;&amp;gt; incentive-compatible. In fact, to be conservative, package validation&lt;br/&gt;&amp;gt;&amp;gt; should&lt;br/&gt;&amp;gt;&amp;gt; begin by trying to submit all of the transactions individually, and only&lt;br/&gt;&amp;gt;&amp;gt; use the&lt;br/&gt;&amp;gt;&amp;gt; package mempool acceptance logic if the parents fail due to low feerate.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; 2. Should we allow packages to contain already-confirmed transactions?&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt;     No, for practical reasons. In mempool validation, we actually aren&amp;#39;t&lt;br/&gt;&amp;gt;&amp;gt; able to&lt;br/&gt;&amp;gt;&amp;gt; tell with 100% confidence if we are looking at a transaction that has&lt;br/&gt;&amp;gt;&amp;gt; already&lt;br/&gt;&amp;gt;&amp;gt; confirmed, because we look up inputs using a UTXO set. If we have&lt;br/&gt;&amp;gt;&amp;gt; historical&lt;br/&gt;&amp;gt;&amp;gt; block data, it&amp;#39;s possible to look for it, but this is inefficient, not&lt;br/&gt;&amp;gt;&amp;gt; always&lt;br/&gt;&amp;gt;&amp;gt; possible for pruning nodes, and unnecessary because we&amp;#39;re not going to do&lt;br/&gt;&amp;gt;&amp;gt; anything with the transaction anyway. As such, we already have the&lt;br/&gt;&amp;gt;&amp;gt; expectation&lt;br/&gt;&amp;gt;&amp;gt; that transaction relay is somewhat &amp;#34;stateful&amp;#34; i.e. nobody should be&lt;br/&gt;&amp;gt;&amp;gt; relaying&lt;br/&gt;&amp;gt;&amp;gt; transactions that have already been confirmed. Similarly, we shouldn&amp;#39;t be&lt;br/&gt;&amp;gt;&amp;gt; relaying packages that contain already-confirmed transactions.&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&amp;gt; [1]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [2]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&#34;&gt;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [3]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&#34;&gt;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16400&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16400&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [5]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21062&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21062&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [6]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22675&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22675&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [7]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22796&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22796&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [8]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/20833&#34;&gt;https://github.com/bitcoin/bitcoin/pull/20833&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [9]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21800&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21800&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [12]: &lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [13]:&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt; [14]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567078-075a971c-0619-4339-9168-b41fd2b90c28.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [15]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132856734-fc17da75-f875-44bb-b954-cb7a1725cc0d.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [16]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567347-a3e2e4a8-ae9c-49f8-abb9-81e8e0aba224.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [17]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567370-21566d0e-36c8-4831-b1a8-706634540af3.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [18]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567444-bfff1142-439f-4547-800a-2ba2b0242bcb.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [19]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133456219-0bb447cb-dcb4-4a31-b9c1-7d86205b68bc.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; [20]:&lt;br/&gt;&amp;gt;&amp;gt;  &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132857787-7b7c6f56-af96-44c8-8d78-983719888c19.png&#34;&gt; &lt;br/&gt;&amp;gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&amp;gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210921/505919a9/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210921/505919a9/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T22:59:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqgxky2s8mesrvzksc3n286xykqce8gjvy68rpq2t5r7jegm37degzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q3zs00p</id>
    
      <title type="html">📅 Original date posted:2021-09-16 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqgxky2s8mesrvzksc3n286xykqce8gjvy68rpq2t5r7jegm37degzyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2q3zs00p" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsg94te9zq3mt0nyv6ypxh24vsvqapy7myk84jc7fns8n26x7vjaxssst2l6&#39;&gt;nevent1q…t2l6&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-09-16&lt;br/&gt;📝 Original message:Hi there,&lt;br/&gt;&lt;br/&gt;I&amp;#39;m writing to propose a set of mempool policy changes to enable package&lt;br/&gt;validation (in preparation for package relay) in Bitcoin Core. These would&lt;br/&gt;not&lt;br/&gt;be consensus or P2P protocol changes. However, since mempool policy&lt;br/&gt;significantly affects transaction propagation, I believe this is relevant&lt;br/&gt;for&lt;br/&gt;the mailing list.&lt;br/&gt;&lt;br/&gt;My proposal enables packages consisting of multiple parents and 1 child. If&lt;br/&gt;you&lt;br/&gt;develop software that relies on specific transaction relay assumptions&lt;br/&gt;and/or&lt;br/&gt;are interested in using package relay in the future, I&amp;#39;m very interested to&lt;br/&gt;hear&lt;br/&gt;your feedback on the utility or restrictiveness of these package policies&lt;br/&gt;for&lt;br/&gt;your use cases.&lt;br/&gt;&lt;br/&gt;A draft implementation of this proposal can be found in [Bitcoin Core&lt;br/&gt;PR#22290][1].&lt;br/&gt;&lt;br/&gt;An illustrated version of this post can be found at&lt;br/&gt;&lt;a href=&#34;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&#34;&gt;https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a&lt;/a&gt;.&lt;br/&gt;I have also linked the images below.&lt;br/&gt;&lt;br/&gt;## Background&lt;br/&gt;&lt;br/&gt;Feel free to skip this section if you are already familiar with mempool&lt;br/&gt;policy&lt;br/&gt;and package relay terminology.&lt;br/&gt;&lt;br/&gt;### Terminology Clarifications&lt;br/&gt;&lt;br/&gt;* Package = an ordered list of related transactions, representable by a&lt;br/&gt;Directed&lt;br/&gt;  Acyclic Graph.&lt;br/&gt;* Package Feerate = the total modified fees divided by the total virtual&lt;br/&gt;size of&lt;br/&gt;  all transactions in the package.&lt;br/&gt;    - Modified fees = a transaction&amp;#39;s base fees &#43; fee delta applied by the&lt;br/&gt;user&lt;br/&gt;      with `prioritisetransaction`. As such, we expect this to vary across&lt;br/&gt;mempools.&lt;br/&gt;    - Virtual Size = the maximum of virtual sizes calculated using [BIP141&lt;br/&gt;      virtual size][2] and sigop weight. [Implemented here in Bitcoin&lt;br/&gt;Core][3].&lt;br/&gt;    - Note that feerate is not necessarily based on the base fees and&lt;br/&gt;serialized&lt;br/&gt;      size.&lt;br/&gt;&lt;br/&gt;* Fee-Bumping = user/wallet actions that take advantage of miner incentives&lt;br/&gt;to&lt;br/&gt;  boost a transaction&amp;#39;s candidacy for inclusion in a block, including Child&lt;br/&gt;Pays&lt;br/&gt;for Parent (CPFP) and [BIP125][12] Replace-by-Fee (RBF). Our intention in&lt;br/&gt;mempool policy is to recognize when the new transaction is more economical&lt;br/&gt;to&lt;br/&gt;mine than the original one(s) but not open DoS vectors, so there are some&lt;br/&gt;limitations.&lt;br/&gt;&lt;br/&gt;### Policy&lt;br/&gt;&lt;br/&gt;The purpose of the mempool is to store the best (to be most&lt;br/&gt;incentive-compatible&lt;br/&gt;with miners, highest feerate) candidates for inclusion in a block. Miners&lt;br/&gt;use&lt;br/&gt;the mempool to build block templates. The mempool is also useful as a cache&lt;br/&gt;for&lt;br/&gt;boosting block relay and validation performance, aiding transaction relay,&lt;br/&gt;and&lt;br/&gt;generating feerate estimations.&lt;br/&gt;&lt;br/&gt;Ideally, all consensus-valid transactions paying reasonable fees should&lt;br/&gt;make it&lt;br/&gt;to miners through normal transaction relay, without any special&lt;br/&gt;connectivity or&lt;br/&gt;relationships with miners. On the other hand, nodes do not have unlimited&lt;br/&gt;resources, and a P2P network designed to let any honest node broadcast their&lt;br/&gt;transactions also exposes the transaction validation engine to DoS attacks&lt;br/&gt;from&lt;br/&gt;malicious peers.&lt;br/&gt;&lt;br/&gt;As such, for unconfirmed transactions we are considering for our mempool, we&lt;br/&gt;apply a set of validation rules in addition to consensus, primarily to&lt;br/&gt;protect&lt;br/&gt;us from resource exhaustion and aid our efforts to keep the highest fee&lt;br/&gt;transactions. We call this mempool _policy_: a set of (configurable,&lt;br/&gt;node-specific) rules that transactions must abide by in order to be accepted&lt;br/&gt;into our mempool. Transaction &amp;#34;Standardness&amp;#34; rules and mempool restrictions&lt;br/&gt;such&lt;br/&gt;as &amp;#34;too-long-mempool-chain&amp;#34; are both examples of policy.&lt;br/&gt;&lt;br/&gt;### Package Relay and Package Mempool Accept&lt;br/&gt;&lt;br/&gt;In transaction relay, we currently consider transactions one at a time for&lt;br/&gt;submission to the mempool. This creates a limitation in the node&amp;#39;s ability&lt;br/&gt;to&lt;br/&gt;determine which transactions have the highest feerates, since we cannot take&lt;br/&gt;into account descendants (i.e. cannot use CPFP) until all the transactions&lt;br/&gt;are&lt;br/&gt;in the mempool. Similarly, we cannot use a transaction&amp;#39;s descendants when&lt;br/&gt;considering it for RBF. When an individual transaction does not meet the&lt;br/&gt;mempool&lt;br/&gt;minimum feerate and the user isn&amp;#39;t able to create a replacement transaction&lt;br/&gt;directly, it will not be accepted by mempools.&lt;br/&gt;&lt;br/&gt;This limitation presents a security issue for applications and users&lt;br/&gt;relying on&lt;br/&gt;time-sensitive transactions. For example, Lightning and other protocols&lt;br/&gt;create&lt;br/&gt;UTXOs with multiple spending paths, where one counterparty&amp;#39;s spending path&lt;br/&gt;opens&lt;br/&gt;up after a timelock, and users are protected from cheating scenarios as&lt;br/&gt;long as&lt;br/&gt;they redeem on-chain in time. A key security assumption is that all parties&amp;#39;&lt;br/&gt;transactions will propagate and confirm in a timely manner. This assumption&lt;br/&gt;can&lt;br/&gt;be broken if fee-bumping does not work as intended.&lt;br/&gt;&lt;br/&gt;The end goal for Package Relay is to consider multiple transactions at the&lt;br/&gt;same&lt;br/&gt;time, e.g. a transaction with its high-fee child. This may help us better&lt;br/&gt;determine whether transactions should be accepted to our mempool,&lt;br/&gt;especially if&lt;br/&gt;they don&amp;#39;t meet fee requirements individually or are better RBF candidates&lt;br/&gt;as a&lt;br/&gt;package. A combination of changes to mempool validation logic, policy, and&lt;br/&gt;transaction relay allows us to better propagate the transactions with the&lt;br/&gt;highest package feerates to miners, and makes fee-bumping tools more&lt;br/&gt;powerful&lt;br/&gt;for users.&lt;br/&gt;&lt;br/&gt;The &amp;#34;relay&amp;#34; part of Package Relay suggests P2P messaging changes, but a&lt;br/&gt;large&lt;br/&gt;part of the changes are in the mempool&amp;#39;s package validation logic. We call&lt;br/&gt;this&lt;br/&gt;*Package Mempool Accept*.&lt;br/&gt;&lt;br/&gt;### Previous Work&lt;br/&gt;&lt;br/&gt;* Given that mempool validation is DoS-sensitive and complex, it would be&lt;br/&gt;  dangerous to haphazardly tack on package validation logic. Many efforts&lt;br/&gt;have&lt;br/&gt;been made to make mempool validation less opaque (see [#16400][4],&lt;br/&gt;[#21062][5],&lt;br/&gt;[#22675][6], [#22796][7]).&lt;br/&gt;* [#20833][8] Added basic capabilities for package validation, test accepts&lt;br/&gt;only&lt;br/&gt;  (no submission to mempool).&lt;br/&gt;* [#21800][9] Implemented package ancestor/descendant limit checks for&lt;br/&gt;arbitrary&lt;br/&gt;  packages. Still test accepts only.&lt;br/&gt;* Previous package relay proposals (see [#16401][10], [#19621][11]).&lt;br/&gt;&lt;br/&gt;### Existing Package Rules&lt;br/&gt;&lt;br/&gt;These are in master as introduced in [#20833][8] and [#21800][9]. I&amp;#39;ll&lt;br/&gt;consider&lt;br/&gt;them as &amp;#34;given&amp;#34; in the rest of this document, though they can be changed,&lt;br/&gt;since&lt;br/&gt;package validation is test-accept only right now.&lt;br/&gt;&lt;br/&gt;1. A package cannot exceed `MAX_PACKAGE_COUNT=25` count and&lt;br/&gt;`MAX_PACKAGE_SIZE=101KvB` total size [8]&lt;br/&gt;&lt;br/&gt;   *Rationale*: This is already enforced as mempool ancestor/descendant&lt;br/&gt;limits.&lt;br/&gt;Presumably, transactions in a package are all related, so exceeding this&lt;br/&gt;limit&lt;br/&gt;would mean that the package can either be split up or it wouldn&amp;#39;t pass this&lt;br/&gt;mempool policy.&lt;br/&gt;&lt;br/&gt;2. Packages must be topologically sorted: if any dependencies exist between&lt;br/&gt;transactions, parents must appear somewhere before children. [8]&lt;br/&gt;&lt;br/&gt;3. A package cannot have conflicting transactions, i.e. none of them can&lt;br/&gt;spend&lt;br/&gt;the same inputs. This also means there cannot be duplicate transactions. [8]&lt;br/&gt;&lt;br/&gt;4. When packages are evaluated against ancestor/descendant limits in a test&lt;br/&gt;accept, the union of all of their descendants and ancestors is considered.&lt;br/&gt;This&lt;br/&gt;is essentially a &amp;#34;worst case&amp;#34; heuristic where every transaction in the&lt;br/&gt;package&lt;br/&gt;is treated as each other&amp;#39;s ancestor and descendant. [8]&lt;br/&gt;Packages for which ancestor/descendant limits are accurately captured by&lt;br/&gt;this&lt;br/&gt;heuristic: [19]&lt;br/&gt;&lt;br/&gt;There are also limitations such as the fact that CPFP carve out is not&lt;br/&gt;applied&lt;br/&gt;to package transactions. #20833 also disables RBF in package validation;&lt;br/&gt;this&lt;br/&gt;proposal overrides that to allow packages to use RBF.&lt;br/&gt;&lt;br/&gt;## Proposed Changes&lt;br/&gt;&lt;br/&gt;The next step in the Package Mempool Accept project is to implement&lt;br/&gt;submission&lt;br/&gt;to mempool, initially through RPC only. This allows us to test the&lt;br/&gt;submission&lt;br/&gt;logic before exposing it on P2P.&lt;br/&gt;&lt;br/&gt;### Summary&lt;br/&gt;&lt;br/&gt;- Packages may contain already-in-mempool transactions.&lt;br/&gt;- Packages are 2 generations, Multi-Parent-1-Child.&lt;br/&gt;- Fee-related checks use the package feerate. This means that wallets can&lt;br/&gt;create a package that utilizes CPFP.&lt;br/&gt;- Parents are allowed to RBF mempool transactions with a set of rules&lt;br/&gt;similar&lt;br/&gt;  to BIP125. This enables a combination of CPFP and RBF, where a&lt;br/&gt;transaction&amp;#39;s descendant fees pay for replacing mempool conflicts.&lt;br/&gt;&lt;br/&gt;There is a draft implementation in [#22290][1]. It is WIP, but feedback is&lt;br/&gt;always welcome.&lt;br/&gt;&lt;br/&gt;### Details&lt;br/&gt;&lt;br/&gt;#### Packages May Contain Already-in-Mempool Transactions&lt;br/&gt;&lt;br/&gt;A package may contain transactions that are already in the mempool. We&lt;br/&gt;remove&lt;br/&gt;(&amp;#34;deduplicate&amp;#34;) those transactions from the package for the purposes of&lt;br/&gt;package&lt;br/&gt;mempool acceptance. If a package is empty after deduplication, we do&lt;br/&gt;nothing.&lt;br/&gt;&lt;br/&gt;*Rationale*: Mempools vary across the network. It&amp;#39;s possible for a parent&lt;br/&gt;to be&lt;br/&gt;accepted to the mempool of a peer on its own due to differences in policy&lt;br/&gt;and&lt;br/&gt;fee market fluctuations. We should not reject or penalize the entire&lt;br/&gt;package for&lt;br/&gt;an individual transaction as that could be a censorship vector.&lt;br/&gt;&lt;br/&gt;#### Packages Are Multi-Parent-1-Child&lt;br/&gt;&lt;br/&gt;Only packages of a specific topology are permitted. Namely, a package is&lt;br/&gt;exactly&lt;br/&gt;1 child with all of its unconfirmed parents. After deduplication, the&lt;br/&gt;package&lt;br/&gt;may be exactly the same, empty, 1 child, 1 child with just some of its&lt;br/&gt;unconfirmed parents, etc. Note that it&amp;#39;s possible for the parents to be&lt;br/&gt;indirect&lt;br/&gt;descendants/ancestors of one another, or for parent and child to share a&lt;br/&gt;parent,&lt;br/&gt;so we cannot make any other topology assumptions.&lt;br/&gt;&lt;br/&gt;*Rationale*: This allows for fee-bumping by CPFP. Allowing multiple parents&lt;br/&gt;makes it possible to fee-bump a batch of transactions. Restricting packages&lt;br/&gt;to a&lt;br/&gt;defined topology is also easier to reason about and simplifies the&lt;br/&gt;validation&lt;br/&gt;logic greatly. Multi-parent-1-child allows us to think of the package as&lt;br/&gt;one big&lt;br/&gt;transaction, where:&lt;br/&gt;&lt;br/&gt;- Inputs = all the inputs of parents &#43; inputs of the child that come from&lt;br/&gt;  confirmed UTXOs&lt;br/&gt;- Outputs = all the outputs of the child &#43; all outputs of the parents that&lt;br/&gt;  aren&amp;#39;t spent by other transactions in the package&lt;br/&gt;&lt;br/&gt;Examples of packages that follow this rule (variations of example A show&lt;br/&gt;some&lt;br/&gt;possibilities after deduplication): ![image][15]&lt;br/&gt;&lt;br/&gt;#### Fee-Related Checks Use Package Feerate&lt;br/&gt;&lt;br/&gt;Package Feerate = the total modified fees divided by the total virtual size&lt;br/&gt;of&lt;br/&gt;all transactions in the package.&lt;br/&gt;&lt;br/&gt;To meet the two feerate requirements of a mempool, i.e., the pre-configured&lt;br/&gt;minimum relay feerate (`minRelayTxFee`) and dynamic mempool minimum&lt;br/&gt;feerate, the&lt;br/&gt;total package feerate is used instead of the individual feerate. The&lt;br/&gt;individual&lt;br/&gt;transactions are allowed to be below feerate requirements if the package&lt;br/&gt;meets&lt;br/&gt;the feerate requirements. For example, the parent(s) in the package can&lt;br/&gt;have 0&lt;br/&gt;fees but be paid for by the child.&lt;br/&gt;&lt;br/&gt;*Rationale*: This can be thought of as &amp;#34;CPFP within a package,&amp;#34; solving the&lt;br/&gt;issue of a parent not meeting minimum fees on its own. This allows L2&lt;br/&gt;applications to adjust their fees at broadcast time instead of overshooting&lt;br/&gt;or&lt;br/&gt;risking getting stuck/pinned.&lt;br/&gt;&lt;br/&gt;We use the package feerate of the package *after deduplication*.&lt;br/&gt;&lt;br/&gt;*Rationale*:  It would be incorrect to use the fees of transactions that are&lt;br/&gt;already in the mempool, as we do not want a transaction&amp;#39;s fees to be&lt;br/&gt;double-counted for both its individual RBF and package RBF.&lt;br/&gt;&lt;br/&gt;Examples F and G [14] show the same package, but P1 is submitted&lt;br/&gt;individually before&lt;br/&gt;the package in example G. In example F, we can see that the 300vB package&lt;br/&gt;pays&lt;br/&gt;an additional 200sat in fees, which is not enough to pay for its own&lt;br/&gt;bandwidth&lt;br/&gt;(BIP125#4). In example G, we can see that P1 pays enough to replace M1, but&lt;br/&gt;using P1&amp;#39;s fees again during package submission would make it look like a&lt;br/&gt;300sat&lt;br/&gt;increase for a 200vB package. Even including its fees and size would not be&lt;br/&gt;sufficient in this example, since the 300sat looks like enough for the 300vB&lt;br/&gt;package. The calculcation after deduplication is 100sat increase for a&lt;br/&gt;package&lt;br/&gt;of size 200vB, which correctly fails BIP125#4. Assume all transactions have&lt;br/&gt;a&lt;br/&gt;size of 100vB.&lt;br/&gt;&lt;br/&gt;#### Package RBF&lt;br/&gt;&lt;br/&gt;If a package meets feerate requirements as a package, the parents in the&lt;br/&gt;transaction are allowed to replace-by-fee mempool transactions. The child&lt;br/&gt;cannot&lt;br/&gt;replace mempool transactions. Multiple transactions can replace the same&lt;br/&gt;transaction, but in order to be valid, none of the transactions can try to&lt;br/&gt;replace an ancestor of another transaction in the same package (which would&lt;br/&gt;thus&lt;br/&gt;make its inputs unavailable).&lt;br/&gt;&lt;br/&gt;*Rationale*: Even if we are using package feerate, a package will not&lt;br/&gt;propagate&lt;br/&gt;as intended if RBF still requires each individual transaction to meet the&lt;br/&gt;feerate requirements.&lt;br/&gt;&lt;br/&gt;We use a set of rules slightly modified from BIP125 as follows:&lt;br/&gt;&lt;br/&gt;##### Signaling (Rule #1)&lt;br/&gt;&lt;br/&gt;All mempool transactions to be replaced must signal replaceability.&lt;br/&gt;&lt;br/&gt;*Rationale*: Package RBF signaling logic should be the same for package RBF&lt;br/&gt;and&lt;br/&gt;single transaction acceptance. This would be updated if single transaction&lt;br/&gt;validation moves to full RBF.&lt;br/&gt;&lt;br/&gt;##### New Unconfirmed Inputs (Rule #2)&lt;br/&gt;&lt;br/&gt;A package may include new unconfirmed inputs, but the ancestor feerate of&lt;br/&gt;the&lt;br/&gt;child must be at least as high as the ancestor feerates of every transaction&lt;br/&gt;being replaced. This is contrary to BIP125#2, which states &amp;#34;The replacement&lt;br/&gt;transaction may only include an unconfirmed input if that input was&lt;br/&gt;included in&lt;br/&gt;one of the original transactions. (An unconfirmed input spends an output&lt;br/&gt;from a&lt;br/&gt;currently-unconfirmed transaction.)&amp;#34;&lt;br/&gt;&lt;br/&gt;*Rationale*: The purpose of BIP125#2 is to ensure that the replacement&lt;br/&gt;transaction has a higher ancestor score than the original transaction(s)&lt;br/&gt;(see&lt;br/&gt;[comment][13]). Example H [16] shows how adding a new unconfirmed input can&lt;br/&gt;lower the&lt;br/&gt;ancestor score of the replacement transaction. P1 is trying to replace M1,&lt;br/&gt;and&lt;br/&gt;spends an unconfirmed output of M2. P1 pays 800sat, M1 pays 600sat, and M2&lt;br/&gt;pays&lt;br/&gt;100sat. Assume all transactions have a size of 100vB. While, in isolation,&lt;br/&gt;P1&lt;br/&gt;looks like a better mining candidate than M1, it must be mined with M2, so&lt;br/&gt;its&lt;br/&gt;ancestor feerate is actually 4.5sat/vB.  This is lower than M1&amp;#39;s ancestor&lt;br/&gt;feerate, which is 6sat/vB.&lt;br/&gt;&lt;br/&gt;In package RBF, the rule analogous to BIP125#2 would be &amp;#34;none of the&lt;br/&gt;transactions in the package can spend new unconfirmed inputs.&amp;#34; Example J&lt;br/&gt;[17] shows&lt;br/&gt;why, if any of the package transactions have ancestors, package feerate is&lt;br/&gt;no&lt;br/&gt;longer accurate. Even though M2 and M3 are not ancestors of P1 (which is the&lt;br/&gt;replacement transaction in an RBF), we&amp;#39;re actually interested in the entire&lt;br/&gt;package. A miner should mine M1 which is 5sat/vB instead of M2, M3, P1, P2,&lt;br/&gt;and&lt;br/&gt;P3, which is only 4sat/vB. The Package RBF rule cannot be loosened to only&lt;br/&gt;allow&lt;br/&gt;the child to have new unconfirmed inputs, either, because it can still&lt;br/&gt;cause us&lt;br/&gt;to overestimate the package&amp;#39;s ancestor score.&lt;br/&gt;&lt;br/&gt;However, enforcing a rule analogous to BIP125#2 would not only make Package&lt;br/&gt;RBF&lt;br/&gt;less useful, but would also break Package RBF for packages with parents&lt;br/&gt;already&lt;br/&gt;in the mempool: if a package parent has already been submitted, it would&lt;br/&gt;look&lt;br/&gt;like the child is spending a &amp;#34;new&amp;#34; unconfirmed input. In example K [18],&lt;br/&gt;we&amp;#39;re&lt;br/&gt;looking to replace M1 with the entire package including P1, P2, and P3. We&lt;br/&gt;must&lt;br/&gt;consider the case where one of the parents is already in the mempool (in&lt;br/&gt;this&lt;br/&gt;case, P2), which means we must allow P3 to have new unconfirmed inputs.&lt;br/&gt;However,&lt;br/&gt;M2 lowers the ancestor score of P3 to 4.3sat/vB, so we should not replace M1&lt;br/&gt;with this package.&lt;br/&gt;&lt;br/&gt;Thus, the package RBF rule regarding new unconfirmed inputs is less strict&lt;br/&gt;than&lt;br/&gt;BIP125#2. However, we still achieve the same goal of requiring the&lt;br/&gt;replacement&lt;br/&gt;transactions to have a ancestor score at least as high as the original&lt;br/&gt;ones. As&lt;br/&gt;a result, the entire package is required to be a higher feerate mining&lt;br/&gt;candidate&lt;br/&gt;than each of the replaced transactions.&lt;br/&gt;&lt;br/&gt;Another note: the [comment][13] above the BIP125#2 code in the original RBF&lt;br/&gt;implementation suggests that the rule was intended to be temporary.&lt;br/&gt;&lt;br/&gt;##### Absolute Fee (Rule #3)&lt;br/&gt;&lt;br/&gt;The package must increase the absolute fee of the mempool, i.e. the total&lt;br/&gt;fees&lt;br/&gt;of the package must be higher than the absolute fees of the mempool&lt;br/&gt;transactions&lt;br/&gt;it replaces. Combined with the CPFP rule above, this differs from BIP125&lt;br/&gt;Rule #3&lt;br/&gt;- an individual transaction in the package may have lower fees than the&lt;br/&gt;  transaction(s) it is replacing. In fact, it may have 0 fees, and the child&lt;br/&gt;pays for RBF.&lt;br/&gt;&lt;br/&gt;##### Feerate (Rule #4)&lt;br/&gt;&lt;br/&gt;The package must pay for its own bandwidth; the package feerate must be&lt;br/&gt;higher&lt;br/&gt;than the replaced transactions by at least minimum relay feerate&lt;br/&gt;(`incrementalRelayFee`). Combined with the CPFP rule above, this differs&lt;br/&gt;from&lt;br/&gt;BIP125 Rule #4 - an individual transaction in the package can have a lower&lt;br/&gt;feerate than the transaction(s) it is replacing. In fact, it may have 0&lt;br/&gt;fees,&lt;br/&gt;and the child pays for RBF.&lt;br/&gt;&lt;br/&gt;##### Total Number of Replaced Transactions (Rule #5)&lt;br/&gt;&lt;br/&gt;The package cannot replace more than 100 mempool transactions. This is&lt;br/&gt;identical&lt;br/&gt;to BIP125 Rule #5.&lt;br/&gt;&lt;br/&gt;### Expected FAQs&lt;br/&gt;&lt;br/&gt;1. Is it possible for only some of the package to make it into the mempool?&lt;br/&gt;&lt;br/&gt;   Yes, it is. However, since we evict transactions from the mempool by&lt;br/&gt;descendant score and the package child is supposed to be sponsoring the&lt;br/&gt;fees of&lt;br/&gt;its parents, the most common scenario would be all-or-nothing. This is&lt;br/&gt;incentive-compatible. In fact, to be conservative, package validation should&lt;br/&gt;begin by trying to submit all of the transactions individually, and only&lt;br/&gt;use the&lt;br/&gt;package mempool acceptance logic if the parents fail due to low feerate.&lt;br/&gt;&lt;br/&gt;2. Should we allow packages to contain already-confirmed transactions?&lt;br/&gt;&lt;br/&gt;    No, for practical reasons. In mempool validation, we actually aren&amp;#39;t&lt;br/&gt;able to&lt;br/&gt;tell with 100% confidence if we are looking at a transaction that has&lt;br/&gt;already&lt;br/&gt;confirmed, because we look up inputs using a UTXO set. If we have historical&lt;br/&gt;block data, it&amp;#39;s possible to look for it, but this is inefficient, not&lt;br/&gt;always&lt;br/&gt;possible for pruning nodes, and unnecessary because we&amp;#39;re not going to do&lt;br/&gt;anything with the transaction anyway. As such, we already have the&lt;br/&gt;expectation&lt;br/&gt;that transaction relay is somewhat &amp;#34;stateful&amp;#34; i.e. nobody should be relaying&lt;br/&gt;transactions that have already been confirmed. Similarly, we shouldn&amp;#39;t be&lt;br/&gt;relaying packages that contain already-confirmed transactions.&lt;br/&gt;&lt;br/&gt;[1]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22290&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22290&lt;/a&gt;&lt;br/&gt;[2]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&#34;&gt;https://github.com/bitcoin/bips/blob/1f0b563738199ca60d32b4ba779797fc97d040fe/bip-0141.mediawiki#transaction-size-calculations&lt;/a&gt;&lt;br/&gt;[3]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&#34;&gt;https://github.com/bitcoin/bitcoin/blob/94f83534e4b771944af7d9ed0f40746f392eb75e/src/policy/policy.cpp#L282&lt;/a&gt;&lt;br/&gt;[4]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16400&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16400&lt;/a&gt;&lt;br/&gt;[5]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21062&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21062&lt;/a&gt;&lt;br/&gt;[6]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22675&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22675&lt;/a&gt;&lt;br/&gt;[7]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/22796&#34;&gt;https://github.com/bitcoin/bitcoin/pull/22796&lt;/a&gt;&lt;br/&gt;[8]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/20833&#34;&gt;https://github.com/bitcoin/bitcoin/pull/20833&lt;/a&gt;&lt;br/&gt;[9]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21800&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21800&lt;/a&gt;&lt;br/&gt;[10]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/16401&#34;&gt;https://github.com/bitcoin/bitcoin/pull/16401&lt;/a&gt;&lt;br/&gt;[11]: &lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/19621&#34;&gt;https://github.com/bitcoin/bitcoin/pull/19621&lt;/a&gt;&lt;br/&gt;[12]: &lt;a href=&#34;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&#34;&gt;https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki&lt;/a&gt;&lt;br/&gt;[13]:&lt;br/&gt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&#34;&gt;https://github.com/bitcoin/bitcoin/pull/6871/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R1101-R1104&lt;/a&gt;&lt;br/&gt;[14]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567078-075a971c-0619-4339-9168-b41fd2b90c28.png&#34;&gt; &lt;br/&gt;[15]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132856734-fc17da75-f875-44bb-b954-cb7a1725cc0d.png&#34;&gt; &lt;br/&gt;[16]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567347-a3e2e4a8-ae9c-49f8-abb9-81e8e0aba224.png&#34;&gt; &lt;br/&gt;[17]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567370-21566d0e-36c8-4831-b1a8-706634540af3.png&#34;&gt; &lt;br/&gt;[18]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133567444-bfff1142-439f-4547-800a-2ba2b0242bcb.png&#34;&gt; &lt;br/&gt;[19]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/133456219-0bb447cb-dcb4-4a31-b9c1-7d86205b68bc.png&#34;&gt; &lt;br/&gt;[20]:&lt;br/&gt; &lt;img src=&#34;https://user-images.githubusercontent.com/25183001/132857787-7b7c6f56-af96-44c8-8d78-983719888c19.png&#34;&gt; &lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210916/d71208a2/attachment-0001.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210916/d71208a2/attachment-0001.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T22:59:15Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsdpvwkwvrvjn0sl36wpq5aawrmqcr4pf6r8jzrzhkwsu7petskq3czyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgzf5mn</id>
    
      <title type="html">📅 Original date posted:2021-04-26 📝 Original message:Hi ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsdpvwkwvrvjn0sl36wpq5aawrmqcr4pf6r8jzrzhkwsu7petskq3czyzhrhfjgp2n8h80hgg6m9fq77trgfwexnxtg5ax3xu3q5ugqq7s2qgzf5mn" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs2apsuhszv440dtt3rc6gmprz3dz27k9f8e48dj3ejventdez9t6g603ck2&#39;&gt;nevent1q…3ck2&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;📅 Original date posted:2021-04-26&lt;br/&gt;📝 Original message:Hi Antoine,&lt;br/&gt;&lt;br/&gt;Thanks for initiating this! I&amp;#39;m interested in joining. Since I mostly live&lt;br/&gt;in L1, my primary goal is to understand what simplest version of package&lt;br/&gt;relay would be sufficient to support transaction relay assumptions made by&lt;br/&gt;L2 applications. For example, if a parent &#43; child package covers the vast&lt;br/&gt;majority of cases and a package limit of 2 is considered acceptable, that&lt;br/&gt;could simplify things quite a bit.&lt;br/&gt;&lt;br/&gt;A small note - I believe package relay and sponsorship (or other&lt;br/&gt;fee-bumping primitive) should be separate discussions.&lt;br/&gt;&lt;br/&gt;Re: L2-zoology... In general, for the purpose of creating a stable API /&lt;br/&gt;set of assumptions between layers, I&amp;#39;d like to be as concrete as possible.&lt;br/&gt;Speaking for myself, if I&amp;#39;m TDDing for a specific L2 attack, I need test&lt;br/&gt;vectors. A simple description of mempool contents &#43; p2p messages sent is&lt;br/&gt;fine, but pubkeys &#43; transaction hex would be appreciated because we don&amp;#39;t&lt;br/&gt;(and probably shouldn&amp;#39;t, for the purpose of maintainability) have a lot of&lt;br/&gt;tooling to build L2 transactions in Bitcoin Core. In the other direction,&lt;br/&gt;it&amp;#39;s hard to make any guarantees given the complexity of mempool policy,&lt;br/&gt;but perhaps it could be helpful to expose a configurable RPC (e.g. #21413&lt;br/&gt;&amp;lt;&lt;a href=&#34;https://github.com/bitcoin/bitcoin/pull/21413&amp;gt&#34;&gt;https://github.com/bitcoin/bitcoin/pull/21413&amp;gt&lt;/a&gt;;) to test a range of&lt;br/&gt;scenarios?&lt;br/&gt;&lt;br/&gt;Anyway, looking forward to discussions :)&lt;br/&gt;&lt;br/&gt;Best,&lt;br/&gt;Gloria&lt;br/&gt;&lt;br/&gt;On Fri, Apr 23, 2021 at 8:51 AM Antoine Riard via bitcoin-dev &amp;lt;&lt;br/&gt;bitcoin-dev at lists.linuxfoundation.org&amp;gt; wrote:&lt;br/&gt;&lt;br/&gt;&amp;gt; Hi,&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; During the lastest years, tx-relay and mempool acceptances rules of the&lt;br/&gt;&amp;gt; base layer have been sources of major security and operational concerns for&lt;br/&gt;&amp;gt; Lightning and other Bitcoin second-layers [0]. I think those areas require&lt;br/&gt;&amp;gt; significant improvements to ease design and deployment of higher Bitcoin&lt;br/&gt;&amp;gt; layers and I believe this opinion is shared among the L2 dev community. In&lt;br/&gt;&amp;gt; order to make advancements, it has been discussed a few times in the last&lt;br/&gt;&amp;gt; months to organize in-person workshops to discuss those issues with the&lt;br/&gt;&amp;gt; presence of both L1/L2 devs to make exchange fruitful.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Unfortunately, I don&amp;#39;t think we&amp;#39;ll be able to organize such in-person&lt;br/&gt;&amp;gt; workshops this year (because you know travel is hard those days...) As a&lt;br/&gt;&amp;gt; substitution, I&amp;#39;m proposing a series of one or more irc meetings. That&lt;br/&gt;&amp;gt; said, this substitution has the happy benefit to gather far more folks&lt;br/&gt;&amp;gt; interested by those issues that you can fit in a room.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; # Scope&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I would like to propose the following 4 items as topics of discussion.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 1) Package relay design or another generic L2 fee-bumping primitive like&lt;br/&gt;&amp;gt; sponsorship [0]. IMHO, this primitive should at least solve mempools spikes&lt;br/&gt;&amp;gt; making obsolete propagation of transactions with pre-signed feerate, solve&lt;br/&gt;&amp;gt; pinning attacks compromising Lightning/multi-party contract protocol&lt;br/&gt;&amp;gt; safety, offer an usable and stable API to L2 software stack, stay&lt;br/&gt;&amp;gt; compatible with miner and full-node operators incentives and obviously&lt;br/&gt;&amp;gt; minimize CPU/memory DoS vectors.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 2) Deprecation of opt-in RBF toward full-rbf. Opt-in RBF makes it trivial&lt;br/&gt;&amp;gt; for an attacker to partition network mempools in divergent subsets and from&lt;br/&gt;&amp;gt; then launch advanced security or privacy attacks against a Lightning node.&lt;br/&gt;&amp;gt; Note, it might also be a concern for bandwidth bleeding attacks against L1&lt;br/&gt;&amp;gt; nodes.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 3) Guidelines about coordinated cross-layers security disclosures.&lt;br/&gt;&amp;gt; Mitigating a security issue around tx-relay or the mempool in Core might&lt;br/&gt;&amp;gt; have harmful implications for downstream projects. Ideally, L2 projects&lt;br/&gt;&amp;gt; maintainers should be ready to upgrade their protocols in emergency in&lt;br/&gt;&amp;gt; coordination with base layers developers.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 4) Guidelines about L2 protocols onchain security design. Currently&lt;br/&gt;&amp;gt; deployed like Lightning are making a bunch of assumptions on tx-relay and&lt;br/&gt;&amp;gt; mempool acceptances rules. Those rules are non-normative, non-reliable and&lt;br/&gt;&amp;gt; lack documentation. Further, they&amp;#39;re devoid of tooling to enforce them at&lt;br/&gt;&amp;gt; runtime [2]. IMHO, it could be preferable to identify a subset of them on&lt;br/&gt;&amp;gt; which second-layers protocols can do assumptions without encroaching too&lt;br/&gt;&amp;gt; much on nodes&amp;#39;s policy realm or making the base layer development in those&lt;br/&gt;&amp;gt; areas too cumbersome.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; I&amp;#39;m aware that some folks are interested in other topics such as extension&lt;br/&gt;&amp;gt; of Core&amp;#39;s mempools package limits or better pricing of RBF replacement. So&lt;br/&gt;&amp;gt; l propose a 2-week concertation period to submit other topics related to&lt;br/&gt;&amp;gt; tx-relay or mempools improvements towards L2s before to propose a finalized&lt;br/&gt;&amp;gt; scope and agenda.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; # Goals&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 1) Reaching technical consensus.&lt;br/&gt;&amp;gt; 2) Reaching technical consensus, before seeking community consensus as it&lt;br/&gt;&amp;gt; likely has ecosystem-wide implications.&lt;br/&gt;&amp;gt; 3) Establishing a security incident response policy which can be applied&lt;br/&gt;&amp;gt; by dev teams in the future.&lt;br/&gt;&amp;gt; 4) Establishing a philosophy design and associated documentations (BIPs,&lt;br/&gt;&amp;gt; best practices, ...)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; # Timeline&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; 2021-04-23: Start of concertation period&lt;br/&gt;&amp;gt; 2021-05-07: End of concertation period&lt;br/&gt;&amp;gt; 2021-05-10: Proposition of workshop agenda and schedule&lt;br/&gt;&amp;gt; late 2021-05/2021-06: IRC meetings&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; As the problem space is savagely wide, I&amp;#39;ve started a collection of&lt;br/&gt;&amp;gt; documents to assist this workshop : &lt;a href=&#34;https://github.com/ariard/L2-zoology&#34;&gt;https://github.com/ariard/L2-zoology&lt;/a&gt;&lt;br/&gt;&amp;gt; Still wip, but I&amp;#39;ll have them in a good shape at agenda publication, with&lt;br/&gt;&amp;gt; reading suggestions and open questions to structure discussions.&lt;br/&gt;&amp;gt; Also working on transaction pinning and mempool partitions attacks&lt;br/&gt;&amp;gt; simulations.&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; If L2s security/p2p/mempool is your jam, feel free to get involved :)&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; Cheers,&lt;br/&gt;&amp;gt; Antoine&lt;br/&gt;&amp;gt;&lt;br/&gt;&amp;gt; [0] For e.g see optech section on transaction pinning attacks :&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://bitcoinops.org/en/topics/transaction-pinning/&#34;&gt;https://bitcoinops.org/en/topics/transaction-pinning/&lt;/a&gt;&lt;br/&gt;&amp;gt; [1]&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-September/018168.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-September/018168.html&lt;/a&gt;&lt;br/&gt;&amp;gt; [2] Lack of reference tooling make it easier to have bug slip in like&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-October/002858.html&#34;&gt;https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-October/002858.html&lt;/a&gt;&lt;br/&gt;&amp;gt; _______________________________________________&lt;br/&gt;&amp;gt; bitcoin-dev mailing list&lt;br/&gt;&amp;gt; bitcoin-dev at lists.linuxfoundation.org&lt;br/&gt;&amp;gt; &lt;a href=&#34;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#34;&gt;https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&lt;/a&gt;&lt;br/&gt;&amp;gt;&lt;br/&gt;-------------- next part --------------&lt;br/&gt;An HTML attachment was scrubbed...&lt;br/&gt;URL: &amp;lt;&lt;a href=&#34;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210426/9f3369ef/attachment.html&amp;gt&#34;&gt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210426/9f3369ef/attachment.html&amp;gt&lt;/a&gt;;
    </content>
    <updated>2023-06-07T22:52:15Z</updated>
  </entry>

</feed>