-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
CoinChooser is prone to create dust #4853
Comments
@SomberNight really, #3 is trivial and should be ignored |
We're having the same issue, a wallet with a forever increasing amount of small change. Similar to "Enable output value rounding" Would it be a good idea to have a feature that find output that match the sent amount to more or less 1000 sat, (average to being fair) |
Latest release should create really small change with lower probability than when this issue was opened, see e.g. e864fa5 Lines 20 to 24 in 8c1adc2
@Transisto could you please detail how you are using Electrum somewhat? Over what time and after roughly how many txns created do you now have a lot of small change outputs? How many is a lot; what kind of UTXO distribution do you have? During this time, have you used a version that had above commit (3.3.7+)? |
381 UTXO Regardless of our use-case I'm pretty sure a setting for what we consider useless precision could help with finding loosely matching UTXO combination and eventually build some transactions without change. When I read :
Does that mean it needs perfect to the satoshi matching UTXO to save change on a transactoin? |
I believe the max it is willing to sacrifice is the dust threshold, applied after the privacy rounding. |
That'd be great news, Thanks for your answers. |
546 sat is 4 cents, it's not helping reducing dust and change creation (reduced privacy). For comparison the dust threshold for Wasabi is 0.0001 (75 cents) |
The default (and currently only) coin selection policy is unlikely to spend small value coins.
This is due to
strip_unneeded
:electrum/electrum/coinchooser.py
Lines 81 to 88 in 75e30dd
There are (at least) three things to optimise for in a coin selection policy:
This behaviour is good for the user's privacy in most cases, as selecting a few large value inputs links together fewer coins than selecting many small value inputs.
It is however bad for the network (there will be more UTXOs overall). Further, if feerates rise such that the effective value of the UTXO becomes negative, it will never be spent, making the pollution permanent.
We could have another coin selection policy which consolidates UTXOs. One nice but complex idea would be to monitor historical fee levels. During local minimums it's better to spend many small value inputs; and if fees are high, it's better to spend few high value ones. This would also be cheaper for the user.
The text was updated successfully, but these errors were encountered: