kanzure/webcash

Sorting webcash in wallet to enable effecient consolidation

Opened this issue · 3 comments

Does it make sense to auto-sort webcash secrets in the wallet?
This mimics real life behaviour where you use up small denoms for any transaction before dipping into bigger denoms.
Currently the wallet searches for exact value or consolidates top of stack, irrespective of value.

I have an implementation and PR available to be merged.

"Random" was found to be a somewhat good coin selection algorithm for bitcoin. Random sort (or rather, random choice) could work. Originally when I made the reference wallet software, I decided against random choice because at the time there was no deterministic wallet, and it would be better to let wallet backups keep the majority of existing outputs with some sense of rotation over time corresponding to wallet backup rotation itself. Maybe picking the smallest outputs would have been ideal at that time to help preserve backups of larger value outputs

By picking smaller denomination outputs before larger denomination outputs, the wallet could become easily exhausted of small denomination outputs, leaving only a single larger denomination output. In the asymptotic case, this turns into a wallet that has a single output and after each payment also has only a single output (leftover change). From a privacy perspective, this is not ideal.

On the other hand, output consolidation helps the server and the wallets.

It's tricky.

the motivation was sever/wallet, but privacy is a good pt. I will close this issue as most likely such feature can be implemented by a wallet client serving a specific need.

It's a reasonable issue worthy of discussion.