-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Reduce minrelaytxfee to 100 sats/kvB #32959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32959. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
|
Looks like |
Assuming there are miners using Bitcoin Core to mine, then the |
Wouldn't a 100x reduction be more in line? i.e. something like 10 sat/kvB? |
Dropped in a PR here to add testing so this passes. |
Every commit needs to pass CI independently, and instead of merge commits or cherry-picks, we usually add co-authors. And could you please explain how you got to the 10x reduction, did you conduct some analysis or is it just a hunch? |
18ab60a
to
8b05fd6
Compare
test: Update p2p_ibd_tx_relay.py to support minrelaytxfee as low as 100 sats/kvB.
8b05fd6
to
7f2e35a
Compare
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
Concept ACK |
The question is whether DoS protection back then was actually sufficient, or if the increase in fiat terms was the luck we needed. I don't know the answer to that. As an example, a recent DoS fix involved a rate limiting mechanism that was set to 7 transactions per second. This rate limit is based on how many transactions fit in a block. It seems plausible, but I don't know, if a lower relay fee would have made it cheaper to DoS nodes before v25.0. It'd be interesting to simulate that with Warnet. Another difference between now and back then is the presence of Lightning and other systems that are sensitive to mempool shenanigans in general. Again I don't know if those attacks scale with the minimum relay fee either. If that research has already been done, please link to it. Otherwise I would not be in favor (although we may not have a choice if the full-RBF game is repeated). Finally in terms of pure node performance, it might be better to wait for cluster mempool #30289 to be deployed. |
small nit: The PR description should rather point to this commit: 9e93640 |
Better to (also) point to #6722 as it has the discussion from back then. |
DUST_RELAY_TX_FEE should be decreased along with this as well... |
That value is used to calculate the minimum output amount, not the fee rate of a tx. That seems orthogonal to the goal of this PR. |
The two concepts of "dust limit" and minRelayTxFee are logically related and the former was originally derived from the latter in the implementation (see commit eb30d1a introducing the dustRelayFee). If this logical relationship is abandoned, it would be better to explain why and what is the economic rationale behind the determination of the value defining the "dust limit". |
DEFAULT_MIN_RELAY_TX_FEE and DUST_RELAY_TX_FEE serve different purposes. The former is about protecting the P2P network, while the latter also aims at protecting the UTXO set from DoS attacks. Given that half of the UTXO set is spam these days, it seems like the dust limit should rather get increased than decreased. So it's a whole different discussion, and I would not want to conflate these two in this PR. |
It's ridiculous to obsess over "spam" and have it dictate policy, rather than rely on economic incentives. Dust limits should be set based on it being economical to spend a UTXO at minimum relay fees, rather than your misplaced notion of "spam". |
This is an ideological stance that ignores how Bitcoin has operated for basically its entire existence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing DEFAULT_MIN_RELAY_TX_FEE
only makes sense to me in conjunction with reducing DEFAULT_BLOCK_MIN_TX_FEE
. Otherwise nodes become subject to free relay attacks that could be used to waste bandwidth across the network with transactions that are not even in danger of getting mined in most blocks.
DEFAULT_INCREMENTAL_RELAY_FEE
should be decreased along with this as well.
That’s probably a bad idea, as it would increase the surface for bandwidth wasting attacks 10× even on top of what dropping the DEFAULT_MIN_RELAY_TX_FEE
would do.
While I’m sympathetic to users wanting to transact (and especially consolidate) at lower feerates whenever blockspace demand is as low as it currently is, this drops a full block’s minimum transaction fees to ~100,000 sats, or about ~0.03% of the current subsidy. That seems like the wrong signal when the ecosystem’s long-term roadmap relies on transaction fees eventually funding mining.
If this idea gets traction, perhaps it would be interesting to combine a reduction of the minimum relay transaction fee rate with shifting the denomination of fee rates to sats/WU and setting a new minimum relay transaction fee rate to 100 sats/kWU instead which would be 0.4 sats/vB rather than 0.1 sats/vB.
@@ -28,17 +28,17 @@ | |||
) | |||
from test_framework.test_framework import BitcoinTestFramework | |||
|
|||
MAX_FEE_FILTER = Decimal(9170997) / COIN | |||
NORMAL_FEE_FILTER = Decimal(100) / COIN | |||
MAX_FEE_FILTER = Decimal(9936506) / COIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t understand why the MAX_FEE_FILTER
line was changed, could you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I evaluated why the test was failing, I noticed that changing the value for NORMAL_FEE_FILTER
on its own was insufficient for making the test pass. Digging further into the mechanics on how the policy filters worked, and looking logs on my local version of the code this is what I found:
I made the change from 9170997
to 9936506
because, reducing minrelaytxfee halves min_fee_limit (500→50, fees.cpp:1090). This alters the geometric sequence in MakeFeeSet (fees.cpp:1092-1095).
With spacing=1.1 (set in fees.h:322), starting lower fits one more bucket before capping at 1e7, yielding a higher max (9936506
) due to floating point multiplication.
This can be verified independently if you run FeeFilterRounder with CFeeRate(100) vs CFeeRate(1000), and call round(MAX_MONEY).
To @instagibbs's point, if the better approach is write a new set of tests instead of working with the poorly written tests we have now, happy to help when I have time.
If tests aren't breaking, a good place to start would be to write a test that breaks on these changes, then fix them in feature commit. As of now, nothing breaks which is concerning. On the meta level: Very low feerate transactions have negligible impact on mining profitability in terms of block templates themselves. It's not obvious that the price going up 10x means we get to lower the default by 10x, because it's a more important system now and the stakes are simply higher. The most persuasive argument for this would be that miners have diverged from defaults and it is impacting block relay and the DoS risk of 10x lower fees is acceptable. Note that under transactional load(which is what we need long term anyways for consensus stability), this change is a no-op, so I'm not convinced at all this is the right tradeoff. |
The mempool is already constrained by This proposed configuration provides a practical balance between usability and relay robustness: static constexpr unsigned int DEFAULT_MIN_RELAY_TX_FEE{100}; // 0.1 sat/vB
static constexpr unsigned int DEFAULT_INCREMENTAL_RELAY_FEE{400}; // 0.4 sat/vB
No clear DoS vector is introduced by this change that doesn't already require significant real-world cost and effort from an attacker. |
Previous settings have been:
(Going by commit dates rather than merge/release dates) These changes were largely irrelevant to people making transactions however, since most wallets were setting fees to a flat rate per transaction (eg, 10000 sats, independent of the transaction size) prior to 2016. The rationale for the 5sat-to-1sat change was the cost of relaying a tx across the network -- 1kB of data across 100k nodes is at least 100MB of data, at 10c/GB (contemporary ec2 bandwidth pricing) is 1c total; and 1000sats at $250/BTC 0.25c total. Today, ec2 prices don't seem much different, and node counts aren't much higher, so at current prices, paying for relay would be closer to 0.01sat/vb. A rate of 0.1sat/vb would cover growing the node count to 1M nodes, and 1sat/vb would cover growing the node count to 10M nodes. So from a "free relay" perspective, I think 0.1 sat/vb is likely fine, both for min-fee and min-incremental-fee. If the p2p network grows to much more than 1M nodes, that might not be true though. A full block of min fee txs would currently set fees at 0.32% of the total block reward; dividing that by 10 will delay hitting 1% from being ~7 years away to ~20 years away. If you're looking towards keeping hashrate reltively stable in an environment where the BTC price stabilises instead of continuing to more than double every four years, this is probably a step backwards, and setting an expectation that it fees will either decrease in BTC terms or stay stable in fiat/real terms is probably misleading, even in the medium term. Likewise if you're looking to maximise miner revenue: it's better to mine 101kvB of 1sat/vb txs than 1MvB of 0.1sat/vb txs. But if miners want transactors to be subsidised even more than they already are, I guess that's their business. In any event, I think not accepting these txs for relay significantly affects block relay, both due to not already having the transaction data already downloaded and having to validate their signatures in the critical path to accepting the block. I've started seeing CPU spikes on one of my nodes which I think is a result of this (I don't find it particularly concerning since that node (a) runs a debug build which does extra processing, (b) accepts significantly more connections than the default, and (c) runs on a small/slow VPS); those spikes seem to have been resolved by accepting the lower fee txs, though time will tell. Personally, I'm pretty disappointed at the lack of any attempt to justify and coordinate this change it in advance to avoid hitting problems in practice. Huge amounts of FAFO energy these days. |
@RobinLinus do you plan on addressing review here? Reminder that feature freeze is less than a month from now. |
Reducing the default minimum relay feerate is safe if we're confident that plenty of hash power is in fact mining those transactions. The block minimum tx feerate default does not need to be tied to that change if you think of it in terms of a recommendation for profitability: while miners may choose to mine transactions with feerates so low that they may be losing subsidy revenue on stales, there's no reason to do it by default. Besides, worst case is that your mempool will fill up with low feerate junk that no-one is mining, eventually hitting the size limit, and the problem will mostly fix itself as the minimum is increased automatically. Meanwhile, decreasing the default relay feerate in a world where plenty of blocks do in fact have those transactions in them will decrease propagation time and reduce stales for everyone because it'll improve block reconstruction rates. So no, I don't think we need to necessarily tie those two parameters together. Finally, it'd be good to get some data on sub-1sat/vB-delta RBF replacements. My Alice and Bob OpenTimestamps calendars are producing them. But I don't know if anything else is. |
This discussion is getting close to being off topic. You're really discussing the wider problem of how to pay for mining security going forward. Given how many miners have started mining sub-1sat/vB transactions, even when no widely deployed fork of Bitcoin Core relays them by default, it's clear that the forces at play here are purely economic. There's nothing we can do in Core to entice higher fee revenue if market dynamics simply don't provide a reason for that fee revenue to exist; we've done an excellent job of decoupling transactional use of Bitcoin with on-chain transaction fees, and we're only going to do an even better job of that in the future as L2 systems like Lightning and Ark are even further deployed. Anything Core tries to do here is almost certainly going to take the form of some kind of censorship/filtering of low feerate transactions, and that clearly does not work. Obviously, there's another solution that has worked so far for reliably paying for mining security, taxation of BTC savings. But discussion of the economics of that (and fee revenue) really belongs on venues like the mailing list. Not this PR. |
As hinted by @glozow above, The following PRs might be interesting to the people developing this PR: |
Since similar arguments keep coming up: The sole purpose of the minimum relay fee should be DoS protection. Trying to fix the security budget by imposing administered prices on block space seems misguided—market forces will likely circumvent such price controls and make things worse in the process. |
Maybe the intent of my comment wasn’t clear. We are seeing that blocks including lower feerate transactions take significantly longer to get propagated, and the way I’m reading the sentiment here, a lot of people do not share my concern over a potential DoS protection reduction. In so far, it seems that there is at least interest in this PR being further developed. My suggestion is that if someone were to address the review feedback here, they should probably lower all three settings, not just the one. However, this breaks a dozen tests or so, there seem to be some more missing that it should be breaking, and feerate estimation currently doesn’t do below 1 s/vB, so this PR might be more involved than it seems at first glance. Regarding the expectations around feerates, my concern is rather that overly cheap blockspace fosters the creation of some use cases that will inherently get priced out in the long run again, so facilitating the oddly low feerates at this time may set us up for a social backlash later down the road. OTOH, people getting outspent is a pretty clear signal that might speak for itself clearly enough. |
IMHO it would probably be reasonable to stagger changes to wallet/fee estimation for one release, and only change the thresholds for mempool/relay and possibly mining initially. Based on some stats from my own nodes, I would assume that relaying sub-1 sat/vB transactions will still be spotty for some time after a new version with changed defaults is released. Node 1: Of 199 connected nodes, 146 set a minfeefilter; 141 are using the default, while 5 are 100 sats/vkB or below. 45 nodes are running 29.x Node 2: Of 188 connected nodes, 138 set a minfeefilter; 134 are using the default, while 4 are 100 sats/vkB or below. 42 nodes are running 29.x In other words, 95%+ of nodes are using the default relay thresholds, and ~25% are on 29.x three months after release. So for nodes with fewer connections, lower-fee transactions might not reliably propagate for some time unless you actively seek out nodes that will accept them. (For comparison, Bitnodes is reporting 16.95% on 29.0.0.) There are quite a few nodes that do not set a minfeefilter, but I would assume that most of those are either non-relaying spy nodes that I failed to block, or older nodes that predate this filter but that still won't relay transactions with lower fees. |
@RobinLinus, are you planning on working on this? |
I'm interested in working on this, but I'm currently too busy moving apartments. I plan to revisit it in about two weeks. In the meantime, it would be greatly appreciated if someone could help fix the tests that fail when adjusting |
@murchandamus I'm busy with this to make some progress while @RobinLinus is away, what's the process - create a new PR as a continuation of this one? When you say "there seem to be some more missing that it should be breaking" - what do you mean? |
This comment was marked as abuse.
This comment was marked as abuse.
Concept ACK. |
@delta1 i would suggest picking up #13990 and #13922. In this order, or make a good argument why it would be fine to lower the settings without first making the fee estimation be compatible. Feel free to ping me for review, i think this is important it makes it into the next release. I'm managing expectations however since, as it's been pointed out multiple times already, this is a lot less trivial than some people in this thread seem to assume. |
@darosior thanks I intend to make fee estimation work correctly as well |
Given that this branch is on Robin’s repository, it would be the easiest to create your own branch and PR (unless you are working with Robin on it and are talking about making a pull request to his branch). Please be sure to address the comments from this PR on your new PR.
I was referring to what instagibbs said above:
|
I don't think fee estimation should be a blocker for the relay change. If anything, the reverse: while sub-1sat/vb txs don't relay well, it would be annoying if your fee estimates dropped resulting in your txs also not relaying well. You could get the best of both worlds by fixing fee estimation first, then having a hardcoded flag day when the default relay fee automatically drops, but that ship has probably sailed. |
Concept NACK. Everything below 1s/vB is spam. There's no reason to change the default.
It's the USD that has fallen, Bitcoin has remained more or less the same.
DoS resistance is clearly insufficient even at 1s/vB. Also, this logically implies a reduction of the dust limit, making spam attacks even worse on that front. |
Actually, Bitcoin probably hasn't even kept up its value, so if anything we should be looking to increase the default relay fee, if maintaining the same actual-value cost is the goal. |
Concept NACK. Everything below 1s/vB is spam. There's no reason to change the default.
FYI my two OpenTimestamps calendars are creating sub-1sat/vB transactions:
https://alice.btc.calendar.opentimestamps.org/
https://bob.btc.calendar.opentimestamps.org/
The operator of the Finney calendar has told me he's looking into doing that as
well.
Also BlueWallet recently merged a pull-req to allow users to choose sub-1sat/vB
fees.
|
It's the USD that has fallen, Bitcoin has remained more or less the same.
This is clearly not true. If you compute the Big Mac Index for Bitcoin and USD,
Bitcoin has clearly made enormous gains over the time period in question.
https://en.wikipedia.org/wiki/Big_Mac_Index
|
This comment was marked as abuse.
This comment was marked as abuse.
It's irrelevant whether or not anyone considers any transaction "spam", all that matters is if miners are mining them, and they are. At the time of this writing, looking back at the last three days worth of blocks, there are about 100 blocks containing <1 sat/vB transactions, and the only pools that have mined blocks with empty space instead of these transactions are ViaBTC and WhitePool. All you accomplish by rejecting transactions that are getting mined is slowing down block propagation, and potentially wasting CPU cycles and bandwidth by downloading and processing the transaction twice. People who really want to do this are of course free to override the config, but doing it by default is detrimental. |
Of course it's relevant if we're discussing what we relay and what we don't.
Completely false. It's sad to see such obvious dishonesty in here. |
Closing this, in favour of #33106 (this can't be merged as is, and author is unavailable). |
…ayfee, minrelaytxfee ba84a25 [doc] update mempool-replacements.md for incremental relay feerate change (glozow) 18720bc [doc] release note for min feerate changes (glozow) 6da5de5 [policy] lower default minrelaytxfee and incrementalrelayfee to 100sat/kvB (glozow) 2e515d2 [prep/test] make wallet_fundrawtransaction's minrelaytxfee assumption explicit (glozow) 457cfb6 [prep/util] help MockMempoolMinFee handle more precise feerates (glozow) 3eab8b7 [prep/test] replace magic number 1000 with respective feerate vars (glozow) 5f2df0e [miner] lower default -blockmintxfee to 1sat/kvB (glozow) d6213d6 [doc] assert that default min relay feerate and incremental are the same (glozow) 1fbee5d [test] explicitly check default -minrelaytxfee and -incrementalrelayfee (glozow) 72dc184 [test] RBF rule 4 for various incrementalrelayfee settings (glozow) 85f4988 [test] check bypass of minrelay for various minrelaytxfee settings (glozow) e5f896b [test] check miner doesn't select 0fee transactions (glozow) Pull request description: ML post for discussion about the general concept, how this impacts the wider ecosystem, philosophy about minimum feerates, etc: https://delvingbitcoin.org/t/changing-the-minimum-relay-feerate/1886 This PR is inspired by #13922 and #32959 to lower the minimum relay feerate in response to bitcoin's exchange rate changes in the last ~10 years. It lowers the default `-minrelaytxfee` and `-incrementalrelayfee`, and knocks `-blockmintxfee` down to the minimum nonzero setting. Also adds some tests for the settings and pulls in #32750. The minimum relay feerate is a DoS protection rule, representing a price on the network bandwidth used to relay transactions that have no PoW. While relay nodes don't all collect fees, the assumption is that if nodes on the network use their resources to relay this transaction, it will reach a miner and the attacker's money will be spent once it is mined. The incremental relay feerate is similar: it's used to price the relay of replacement transactions (the additional fees need to cover the new transactions at this feerate) and evicted transactions (following a trim, the new mempool minimum feerate is the package feerate of what was removed + incremental). Also note that many nodes on the network have elected to relay/mine lower feerate transactions. Miners (some say up to 85%) are choosing to mine these low feerate transactions instead of leaving block space unfilled, but these blocks have extremely poor compact block reconstruction rates with nodes that rejected or didn't hear about those transactions earlier. - #33106 (comment) - https://x.com/caesrcd/status/1947022514267230302 - https://mempool.space/block/00000000000000000001305770e0aa279dcd8ba8be18c3d5cf736a26f77e06fd - https://mempool.space/block/00000000000000000001b491649ec030aa8e003e1f4f9d3b24bb99ba16f91e97 - https://x.com/mononautical/status/1949452586391855121 While it wouldn't make sense to loosen DoS restrictions recklessly in response to these events, I think the current price is higher than necessary, and this motivates us changing the default soon. Since the minimum relay feerate defines an amount as too small based on what it costs the attacker, it makes sense to consider BTC's conversion rate to what resources you can buy in the "real world." Going off of [this comment](#32959 (comment)) and [this comment](#33106 (comment)) - Let's say an attacker wants to use/exhaust the network's bandwidth, and has the choice between renting resources from a commercial provider and getting the network to "spam" itself it by sending unconfirmed transactions. We'd like the latter to be more expensive than the former. - The bandwidth for relaying a transaction across the network is roughly its serialized size (plus relay overhead) x number of nodes. A 1000vB transaction is 1000-4000B serialized. With 100k nodes, that's 0.1-0.4GB - If the going rate for ec2 bandwidth is 10c/GB, that's like 1-4c per kvB of transaction data - Then a 1000vB transaction should pay at least 4c - $0.04 USD is 40 satoshis at 100k USD/BTC - Baking in some margin for changes in USD/BTC conversion rate, number of nodes (and thus bandwidth), and commercial service costs, I think 50-100 satoshis is on the conservative end but in the right ballpark - At least 97% of the recent sub-1sat/vB transactions would be accepted with a new threshold of 0.1sat/vB: #33106 (comment) List of feerates that are changed and why: - min relay feerate: significant conversion rate changes, see above - incremental relay feerate: should follow min relay feerate, see above - block minimum feerate: shouldn’t be above min relay feerate, otherwise the node accepts transactions it will never mine. I've knocked it down to the bare minimum of 1sat/kvB. Now that we no longer have coin age priority (removed in v0.15), I think we can leave it to the `CheckFeeRate` policy rule to enforce a minimum entry price, and the block assembly code should just fill up the block with whatever it finds in mempool. List of feerates that are not changed and why: - dust feerate: this feerate cannot be changed as flexibly as the minrelay feerate. A much longer record of low feerate transactions being mined is needed to motivate a decrease there. - maxfeerate (RPC, wallet): I think the conversion rate is relevant as well, but out of scope for this PR - minimum feerate returned by fee estimator: should be done later. In the past, we've excluded new policy defaults from fee estimation until we feel confident they represent miner policy (e.g. #9519). Also, the fee estimator itself doesn't have support for sub-1sat/vB yet. - all wallet feerates (mintxfee, fallbackfee, discardfee, consolidatefeerate, WALLET_INCREMENTAL_RELAY_FEE, etc.): should be done later. Our standard procedure is to do wallet changes at least 1 release after policy changes. ACKs for top commit: achow101: ACK ba84a25 gmaxwell: ACK ba84a25 jsarenik: Tested ACK ba84a25 darosior: ACK ba84a25 ajtowns: ACK ba84a25 davidgumberg: crACK ba84a25 w0xlt: ACK ba84a25 caesrcd: reACK ba84a25 ismaelsadeeq: re-ACK ba84a25 Tree-SHA512: b4c35e8b506b1184db466551a7e2e48bb1e535972a8dbcaa145ce3a8bfdcc70a8807dc129460f129a9d31024174d34077154a387c32f1a3e6831f6fa5e9c399e
Motivation
The default relay-fee (-minrelaytxfee) was set to 1000 sat/kvB about 10 years ago. Over that period the USD price of BTC has risen by roughly 2-3 orders of magnitude, making the economic cost of relaying small transactions disproportionately high.
Proposed change
Lower the default to 100 sat/kvB—a 10× reduction—bringing the effective USD cost back in line. This maintains DoS resistance without discouraging low-value UTXO consolidation.