Skip to content
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

"coinselect" always expose the largest UTXO no matter how small the payment is because it sorts by descending value. #74

Open
Transisto opened this issue Oct 5, 2022 · 5 comments

Comments

@Transisto
Copy link

Transisto commented Oct 5, 2022

This is a huge privacy issue.

It's exposing a larger balance than required to the recipient.

Why is it sorting by descending?

Unless it's doing something more advanced to solve that "knapsack' like problem.
It should first try to find the smallest single UTXO that is bigger than the sent amount by going up the list (asending)
If it didn't find any it should take the largest one and go back from to smallest until it finds one that is larger than what's missing. If not take 1st + 2nd largest and keep adding to it until total it's enough.

@Transisto Transisto changed the title "coinselect" always expose the largest UTXO no matter how small the payment is because it sorts by decending value. "coinselect" always expose the largest UTXO no matter how small the payment is because it sorts by descending value. Oct 5, 2022
@KorbisInc
Copy link

KorbisInc commented Aug 29, 2023

@Transisto I noticed this also, but I think it has to do with minimizing the final fee, since more UTXO = higher fee?

I'm about to use this in production so I'd greatly appreciate if you have more opinions around this.

For context: as a service, privacy isnt a goal for ourselves, but reduced fee costs are.

@Transisto
Copy link
Author

Transisto commented Aug 30, 2023 via email

@KorbisInc
Copy link

@Transisto what I meant was, if it were the other way around, maybe it'd use many small UTXOs - but yeah, obviously there are ways to use "the least largest, satisfactory utxo". Maybe it's more effective to use the largest UTXO as many times as possible before using the small ones? It's hard to say. @Overtorment what do you think or know about this?

@Transisto
Copy link
Author

Transisto commented Aug 30, 2023 via email

@KorbisInc
Copy link

KorbisInc commented Aug 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants