<oembed><type>rich</type><version>1.0</version><title>Antoine Riard [ARCHIVE] wrote</title><author_name>Antoine Riard [ARCHIVE] (npub1vj…4x8dd)</author_name><author_url>https://yabu.me/npub1vjzmc45k8dgujppapp2ue20h3l9apnsntgv4c0ukncvv549q64gsz4x8dd</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2022-02-17&#xA;📝 Original message:While I roughly agree with the thesis that different replacement policies&#xA;offer marginal block reward gains _in the current state_ of the ecosystem,&#xA;I would be more conservative about extending the conclusions to the&#xA;medium/long-term future.&#xA;&#xA;&gt; I suspect the &#34;economically rational&#34; choice would be to happily trade&#xA;&gt; off that immediate loss against even a small chance of a simpler policy&#xA;&gt; encouraging higher adoption of bitcoin, _or_ a small chance of more&#xA;&gt; on-chain activity due to higher adoption of bitcoin protocols like&#xA;&gt; lightning and thus a lower chance of an empty mempool in future.&#xA;&#xA;This is making the assumption that the economic interests of the different&#xA;class of actors in the Bitcoin ecosystem are not only well-understood but&#xA;also aligned. We have seen in the past mining actors behaviors delaying the&#xA;adoption of protocol upgrades which were expected to encourage higher&#xA;adoption of Bitcoin. Further, if miners likely have an incentive to see an&#xA;increase of on-chain activity, there is also the possibility that lightning&#xA;will be so throughput-efficient to drain mempools backlog, to a point where&#xA;the block demand is not high enough to pay back the cost of mining hardware&#xA;and operational infrastructure. Or at least not matching the return on&#xA;mining investments expectations.&#xA;&#xA;Of course, it could be argued that as a utxo-sharing protocol like&#xA;lightning just compresses the number of payments per block space unit, it&#xA;lowers the fees burden, thus making Bitcoin as a payment system far more&#xA;attractive for a wider population of users. In fine increasing the block&#xA;space demand and satisfying the miners.&#xA;&#xA;In the state of today&#39;s knowledge, this hypothesis sounds the most&#xA;plausible. Though, I would say it&#39;s better to be cautious until we&#xA;understand better the interactions between the different layers of the&#xA;Bitcoin ecosystem ?&#xA;&#xA;&gt; Certainly those percentages can be expected to double every four years as&#xA;&gt; the block reward halves (assuming we don&#39;t also reduce the min relay fee&#xA;&gt; and block min tx fee), but I think for both miners and network stability,&#xA;&gt; it&#39;d be better to have the mempool backlog increase over time, which&#xA;&gt; would both mean there&#39;s no/less need to worry about the special case of&#xA;&gt; the mempool being empty, and give a better incentive for people to pay&#xA;&gt; higher fees for quicker confirmations.&#xA;&#xA;Intuitively, if we assume that liquidity isn&#39;t free on lightning [0], there&#xA;should be a subjective equilibrium where it&#39;s cheaper to open new channels&#xA;to reduce one&#39;s own graph traversal instead of paying too high routing fees.&#xA;&#xA;As the core of the network should start to be more busy, I think we should&#xA;see more LN actors doing that kind of arbitrage, guaranteeing in the&#xA;long-term mempools backlog.&#xA;&#xA;&gt; If you really want to do that&#xA;&gt; optimally, I think you have to have a mempool that retains conflicting&#xA;&gt; txs and runs a dynamic programming solution to pick the best set, rather&#xA;&gt; than today&#39;s simple greedy algorithms both for building the block and&#xA;&gt; populating the mempool?&#xA;&#xA;As of today, I think power efficiency of mining chips and access to&#xA;affordable sources of energy are more significant factors of the&#xA;rentability of mining operations rather than optimality of block&#xA;construction/replacement policy. IMO, making the argument that small deltas&#xA;in block reward gains aren&#39;t that much relevant.&#xA;&#xA;That said, the former factors might become a commodity, and the latter one&#xA;become a competitive advantage. It could incentivize the development of&#xA;such greedy algorithms, potentially in a covert way as we have seen with&#xA;AsicBoost ?&#xA;&#xA;&gt; Is there a plausible example where the difference isn&#39;t that marginal?&#xA;&#xA;The paradigm might change in the future. If we see the deployment of&#xA;channel factories/payment pools, we might have users competing to spend a&#xA;shared-utxo with different liquidity needs and thus ready to overbid. Lack&#xA;of a &#34;conflict pool&#34; logic might make you lose income.&#xA;&#xA;&gt; Always accepting (package/descendent) fee rate increases removes the&#xA;possibility of pinning entirely, I think&#xA;&#xA;I think the pinnings we&#39;re affected with today are due to the ability of a&#xA;malicious counterparty to halt the on-chain resolution of the channel. The&#xA;presence of a  pinning commitment transaction with low-chance of&#xA;confirmation (abuse of BIP125 rule 3)&#xA;prevents the honest counterparty to fee-bump her own version of the&#xA;commitment, thus redeeming a HTLC before timelock expiration. As long as&#xA;one commitment confirms, independently of who issued it, the pinning is&#xA;over. I think moving to replace-by-feerate allows the honest counterparty&#xA;to fee-bump her commitment, thus offering a compelling block space demand,&#xA;or forces the malicious counterparty to enter in a fee race.&#xA;&#xA;&#xA;To gather my thinking on the subject, the replace-by-feerate policy could&#xA;produce lower fees blocks in the presence of today&#39;s environment of&#xA;empty/low-fulfilled blocks. That said, the delta sounds marginal enough&#xA;w.r.t other factors of mining business units&#xA;to not be worried (or at least low-key) about the potential implications on&#xA;centralization. If the risk is perceived as too intolerable, it could be&#xA;argued an intermediate solution would be to deploy a &#34;dual&#34; RBF policy&#xA;(replace-by-fee for the top of the mempool, replace-by-feerate&#xA;for the remaining part).&#xA;&#xA;Still, I believe we might have to adopt more sophisticated replacement&#xA;policies in the long term to level the field among the mining ecosystem if&#xA;block construction/mempool acceptance strategies become a competitive&#xA;factor. Default to do so might provoke a latent centralization of mining&#xA;due to heterogeneity in the block reward offered. This heterogeneity would&#xA;also likely downgrade the safety of L2 nodes, as those actors wouldn&#39;t be&#xA;able to know how to format their fee-bumpings, in the lack of _a_ mempool&#xA;replacement standard.&#xA;&#xA;&gt; Note that if we did have this policy, you could abuse it to cheaply drain&#xA;&gt; people&#39;s mempools: if there was a 300MB backlog, you could publish 2980&#xA;&gt; 100kB txs paying a fee rate just below the next block fee, meaning you&#39;d&#xA;&gt; kick out the previous backlog and your transactions take up all but the&#xA;&gt; top 2MB of the mempool; if you then replace them all with perhaps 2980&#xA;&gt; 100B txs paying a slightly higher fee rate, the default mempool will be&#xA;&gt; left with only 2.3MB, at an ultimate cost to you of only about 30% of a&#xA;&gt; block in fees, and you could then fill the mempool back up by spamming&#xA;&gt; 300MB of ultra low fee rate txs.&#xA;&#xA;I believe we might have bandwidth-bleeding issues with our current&#xA;replacement policy. I think it would be good to have a cost estimate of&#xA;them and ensure a newer replacement policy would stay in the same bounds.&#xA;&#xA;&gt; I think spam prevention at the outbound relay level isn&#39;t enough to&#xA;&gt; prevent that: an attacker could contact every public node and relay the&#xA;&gt; txs directly, clearing out the mempool of most public nodes directly. So&#xA;&gt; you&#39;d want some sort of spam prevention on inbound txs too?&#xA;&#xA;That we have to think about replacement spam prevention sounds reasonable&#xA;to me. I would be worried about utxo-based replacement limitations which&#xA;could be abused in the context of multi-party protocol (introducing a new&#xA;pinning vector). One solution&#xA;could be to have a per-party transaction &#34;tag&#34; and allocate a replacement&#xA;slot in function ? Maybe preventing a malicious counterparty to abuse a&#xA;&#34;global&#34; utxo slot during periods of low fees...&#xA;&#xA;Antoine&#xA;&#xA;[0] https://twitter.com/alexbosworth/status/1476946257939628035&#xA;&#xA;Le jeu. 17 févr. 2022 à 09:32, Anthony Towns via bitcoin-dev &lt;&#xA;bitcoin-dev at lists.linuxfoundation.org&gt; a écrit :&#xA;&#xA;&gt; On Thu, Feb 10, 2022 at 07:12:16PM -0500, Matt Corallo via bitcoin-dev&#xA;&gt; wrote:&#xA;&gt; &gt; This is where *all* the complexity comes from. If our goal is to &#34;ensure&#xA;&gt; a&#xA;&gt; &gt; bump increases a miner&#39;s overall revenue&#34; (thus not wasting relay for&#xA;&gt; &gt; everyone else), then we precisely *do* need&#xA;&gt; &gt; &gt; Special consideration for &#34;what should be in the next&#xA;&gt; &gt; &gt; block&#34; and/or the caching of block templates seems like an imposing&#xA;&gt; &gt; &gt; dependency&#xA;&gt; &gt; Whether a transaction increases a miner&#39;s revenue depends precisely on&#xA;&gt; &gt; whether the transaction (package) being replaced is in the next block -&#xA;&gt; if&#xA;&gt; &gt; it is, you care about the absolute fee of the package and its&#xA;&gt; replacement.&#xA;&gt;&#xA;&gt; On Thu, Feb 10, 2022 at 11:44:38PM +0000, darosior via bitcoin-dev wrote:&#xA;&gt; &gt; It&#39;s not that simple. As a miner, if i have less than 1vMB of&#xA;&gt; transactions in my mempool. I don&#39;t want a 10sats/vb transaction paying&#xA;&gt; 100000sats by a 100sats/vb transaction paying only 10000sats.&#xA;&gt;&#xA;&gt; Is it really true that miners do/should care about that?&#xA;&gt;&#xA;&gt; If you did this particular example, the miner would be losing 90k sats&#xA;&gt; in fees, which would be at most 1.44 *millionths* of a percent of the&#xA;&gt; block reward with the subsidy at 6.25BTC per block, even if there were&#xA;&gt; no other transactions in the mempool. Even cumulatively, 10sats/vb over&#xA;&gt; 1MB versus 100sats/vb over 10kB is only a 1.44% loss of block revenue.&#xA;&gt;&#xA;&gt; I suspect the &#34;economically rational&#34; choice would be to happily trade&#xA;&gt; off that immediate loss against even a small chance of a simpler policy&#xA;&gt; encouraging higher adoption of bitcoin, _or_ a small chance of more&#xA;&gt; on-chain activity due to higher adoption of bitcoin protocols like&#xA;&gt; lightning and thus a lower chance of an empty mempool in future.&#xA;&gt;&#xA;&gt; If the network has an &#34;empty mempool&#34; (say less than 2MvB-10MvB of&#xA;&gt; backlog even if you have access to every valid 1+ sat/vB tx on any node&#xA;&gt; connected to the network), then I don&#39;t think you&#39;ll generally have txs&#xA;&gt; with fee rates greater than ~20 sat/vB (ie 20x the minimum fee rate),&#xA;&gt; which means your maximum loss is about 3% of block revenue, at least&#xA;&gt; while the block subsidy remains at 6.25BTC/block.&#xA;&gt;&#xA;&gt; Certainly those percentages can be expected to double every four years as&#xA;&gt; the block reward halves (assuming we don&#39;t also reduce the min relay fee&#xA;&gt; and block min tx fee), but I think for both miners and network stability,&#xA;&gt; it&#39;d be better to have the mempool backlog increase over time, which&#xA;&gt; would both mean there&#39;s no/less need to worry about the special case of&#xA;&gt; the mempool being empty, and give a better incentive for people to pay&#xA;&gt; higher fees for quicker confirmations.&#xA;&gt;&#xA;&gt; If we accept that logic (and assuming we had some additional policy&#xA;&gt; to prevent p2p relay spam due to replacement txs), we could make&#xA;&gt; the mempool accept policy for replacements just be (something like)&#xA;&gt; &#34;[package] feerate is greater than max(descendent fee rate)&#34;, which&#xA;&gt; seems like it&#39;d be pretty straightforward to deal with in general?&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; Thinking about it a little more; I think the decision as to whether&#xA;&gt; you want to have a &#34;100kvB at 10sat/vb&#34; tx or a conflicting &#34;1kvB at&#xA;&gt; 100sat/vb&#34; tx in your mempool if you&#39;re going to take into account&#xA;&gt; unrelated, lower fee rate txs that are also in the mempool makes block&#xA;&gt; building &#34;more&#34; of an NP-hard problem and makes the greedy solution&#xA;&gt; we&#39;ve currently got much more suboptimal -- if you really want to do that&#xA;&gt; optimally, I think you have to have a mempool that retains conflicting&#xA;&gt; txs and runs a dynamic programming solution to pick the best set, rather&#xA;&gt; than today&#39;s simple greedy algorithms both for building the block and&#xA;&gt; populating the mempool?&#xA;&gt;&#xA;&gt; For example, if you had two such replacements come through the network,&#xA;&gt; a miner could want to flip from initially accepting the first replacement,&#xA;&gt; to unaccepting it:&#xA;&gt;&#xA;&gt; Initial mempool: two big txs at 100k each, many small transactions at&#xA;&gt; 15s/vB and 1s/vB&#xA;&gt;&#xA;&gt;  [100kvB at 20s/vB] [850kvB at 15s/vB] [100kvB at 12s/vB] [1000kvB at&#xA;&gt; 1s/vB]&#xA;&gt;    -&gt; 0.148 BTC for 1MvB (100*20 + 850*15 + 50*1)&#xA;&gt;&#xA;&gt; Replacement for the 20s/vB tx paying a higher fee rate but lower total&#xA;&gt; fee; that&#39;s worth including:&#xA;&gt;&#xA;&gt;  [10kvB at 100s/vB] [850kvB at 15s/vB] [100kvB at 12s/vB [1000kvB at 1s/vB]&#xA;&gt;    -&gt; 0.1499 BTC for 1MvB (10*100 + 850*15 + 100*12 + 40*1)&#xA;&gt;&#xA;&gt; Later, replacement for the 12s/vB tx comes in, also paying higher fee&#xA;&gt; rate but lower total fee. Worth including, but only if you revert the&#xA;&gt; original replacement:&#xA;&gt;&#xA;&gt;  [100kvB at 20s/vB] [50kvB at 20s/vB] [850kvB at 15s/vB] [1000kvB at 1s/vB]&#xA;&gt;    -&gt; 0.16 BTC for 1MvB (150*20 + 850*15)&#xA;&gt;&#xA;&gt;  [10kvB at 100s/vB] [50kvB at 20s/vB] [850kvB at 15s/vB] [1000kvB at 1s/vB]&#xA;&gt;    -&gt; 0.1484 BTC for 1MvB (10*100 + 50*20 + 850*15 + 90*1)&#xA;&gt;&#xA;&gt; Algorithms/mempool policies you might have, and their results with&#xA;&gt; this example:&#xA;&gt;&#xA;&gt;  * current RBF rules: reject both replacements because they don&#39;t&#xA;&gt;    increase the absolute fee, thus get the minimum block fees of&#xA;&gt;    0.148 BTC&#xA;&gt;&#xA;&gt;  * reject RBF unless it increases the fee rate, and get 0.1484 BTC in&#xA;&gt;    fees&#xA;&gt;&#xA;&gt;  * reject RBF if it&#39;s lower fee rate or immediately decreases the block&#xA;&gt;    reward: so, accept the first replacement, but reject the second,&#xA;&gt;    getting 0.1499 BTC&#xA;&gt;&#xA;&gt;  * only discard a conflicting tx when it pays both a lower fee rate and&#xA;&gt;    lower absolute fees, and choose amongst conflicting txs optimally&#xA;&gt;    via some complicated tx allocation algorithm when generating a block,&#xA;&gt;    and get 0.16 BTC&#xA;&gt;&#xA;&gt; In this example, those techniques give 92.5%, 92.75%, 93.69% and 100% of&#xA;&gt; total possible fees you could collect; and 99.813%, 99.819%, 99.84% and&#xA;&gt; 100% of the total possible block reward at 6.25BTC/block.&#xA;&gt;&#xA;&gt; Is there a plausible example where the difference isn&#39;t that marginal?&#xA;&gt; Seems like the simplest solution of just checking the (package/descendent)&#xA;&gt; fee rate increases works well enough here at least.&#xA;&gt;&#xA;&gt; If 90kvB of unrelated txs at 14s/vB were then added to the mempool, then&#xA;&gt; replacing both txs becomes (just barely) optimal, meaning the smartest&#xA;&gt; possible algorithm and the dumbest one of just considering the fee rate&#xA;&gt; produce the same result, while the others are worse:&#xA;&gt;&#xA;&gt;  [10kvB at 100s/vB] [50kvB at 20s/vB] [850kvB at 15s/vB] [90kvB at 14s/vB]&#xA;&gt;    -&gt; 0.1601 BTC for 1MvB&#xA;&gt;    (accepting both)&#xA;&gt;&#xA;&gt;  [100kvB at 20s/vB] [50kvB at 20s/vB] [850kvB at 15s/vB] [90kvB at 14s/vB]&#xA;&gt;    -&gt; 0.1575 BTC for 1MvB&#xA;&gt;    (accepting only the second replacement)&#xA;&gt;&#xA;&gt;  [10kvB at 100s/vB] [850kvB at 15s/vB] [90kvB at 14s/vB] [100kvB at 12s/vB]&#xA;&gt;    -&gt; 0.1551 BTC for 1MvB&#xA;&gt;    (first replacement only, optimal tx selection: 10*100, 850*15, 50*14,&#xA;&gt; 100*12)&#xA;&gt;&#xA;&gt;  [100kvB at 20s/vB] [850kvB at 15s/vB] [90kvB at 14s/vB] [100kvB at 12s/vB]&#xA;&gt;    -&gt; 0.1545 BTC for 1MvB&#xA;&gt;    (accepting neither replacement)&#xA;&gt;&#xA;&gt;  [10kvB at 100s/vB] [850kvB at 15s/vB] [90kvB at 14s/vB] [100kvB at 12s/vB]&#xA;&gt;    -&gt; 0.1506 BTC for 1MvB&#xA;&gt;    (first replacement only, greedy tx selection: 10*100, 850*15, 90*14,&#xA;&gt; 50*1)&#xA;&gt;&#xA;&gt; Always accepting (package/descendent) fee rate increases removes the&#xA;&gt; possibility of pinning entirely, I think -- you still have the problem&#xA;&gt; where someone else might get a conflicting transaction confirmed first,&#xA;&gt; but they can&#39;t get a conflicting tx stuck in the mempool without&#xA;&gt; confirming if you&#39;re willing to pay enough to get it confirmed.&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; Note that if we did have this policy, you could abuse it to cheaply drain&#xA;&gt; people&#39;s mempools: if there was a 300MB backlog, you could publish 2980&#xA;&gt; 100kB txs paying a fee rate just below the next block fee, meaning you&#39;d&#xA;&gt; kick out the previous backlog and your transactions take up all but the&#xA;&gt; top 2MB of the mempool; if you then replace them all with perhaps 2980&#xA;&gt; 100B txs paying a slightly higher fee rate, the default mempool will be&#xA;&gt; left with only 2.3MB, at an ultimate cost to you of only about 30% of a&#xA;&gt; block in fees, and you could then fill the mempool back up by spamming&#xA;&gt; 300MB of ultra low fee rate txs.&#xA;&gt;&#xA;&gt; I think spam prevention at the outbound relay level isn&#39;t enough to&#xA;&gt; prevent that: an attacker could contact every public node and relay the&#xA;&gt; txs directly, clearing out the mempool of most public nodes directly. So&#xA;&gt; you&#39;d want some sort of spam prevention on inbound txs too?&#xA;&gt;&#xA;&gt; So I think you&#39;d need to carefully think about relay spam before making&#xA;&gt; this sort of change.  Also, if we had tx rebroadcast implemented then&#xA;&gt; having just a few nodes with large mempools might allow the network to&#xA;&gt; recover from this situation automatically.&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt; aj&#xA;&gt;&#xA;&gt; _______________________________________________&#xA;&gt; bitcoin-dev mailing list&#xA;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220217/b4aa2987/attachment-0001.html&gt;</html></oembed>