CoinChooser is prone to create dust
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Description
The default (and currently only) coin selection policy is unlikely to spend small value coins.
This is due to strip_unneeded:
https://github.com/spesmilo/electrum/blob/75e30ddc9dd97f11db19d609d0d1d4780dc3885a/electrum/coinchooser.py#L81-L88
There are (at least) three things to optimise for in a coin selection policy:
- user's privacy
- fee cost to the user
- health of network (e.g. number of UTXOs)
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading electrum/coinchooser.py, especially the linked strip_unneeded implementation, to understand how the current coin selection policy avoids small-value coins. The issue discusses privacy, fee cost, and UTXO health but does not define a concrete policy or acceptance criteria, so done would require an agreed design and corresponding tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100