joinmarket-clientserver icon indicating copy to clipboard operation
joinmarket-clientserver copied to clipboard

Some ideas on improving coin selection

Open kristapsk opened this issue 1 year ago • 6 comments

  1. Currently coin selection makes no distinction between coins sent to EXTERNAL vs INTERNAL addresses. When doing coinjoin as a maker, from yield generator, IMO it would make sense to prioritize EXTERNAL UTXOs. As they are likely unmixed coins and you want to mix them ASAP.

  2. When doing payment as a taker, we could prioritize cj-out UTXOs vs others as they have potentially bigger anonymity set. This one was already discussed somewhere (IRC?).

  3. When doing non-cj simple send to P2WPKH address, we could try to select two inputs even when only one is required, so that tx looks more like a potential payjoin tx. Also discussed before somewhere. Question is does it makes sense to do it at all. Probably it does when txfee is low ("low" could be configurable, defaulting to something like 2 or 3 sat/vB), as it also cheap way to consolidate UTXOs. OTOH, if mixing taker and maker modes, it's always cheaper to consolidate UTXOs as a maker, as then taker pays the transaction fee.

These ideas involves potentially three new values to take into account when doing coin selection: a) are we in maker or taker mode, b) what is UTXO status (cj-out or something else), c) what is tx feerate.

Would love to hear counterarguments about these ideas.

kristapsk avatar Dec 17 '22 23:12 kristapsk