Author

Topic: [Discussion] Best algorithm for utxo selection for sending. (Read 729 times)

hero member
Activity: 836
Merit: 1030
bits of proof
I'd add one that comes up if dealing with HD wallets:
- compact key index range used

If wallet is busy, then you'd also aim to preserve optimal coin fragmentation, that is some logarithmic scale as if handling traditional cash.
legendary
Activity: 3528
Merit: 4945
When choosing a UTXO selection method, it is probably a good idea to determine what the goal is?

Some possible goals (each that might have a different UTXO selection algorithm):
  • Minimize transaction fees for current transaction
  • Minimize estimated total transaction fees for future transactions
  • Maximize bitcoin days destroyed
  • Minimize bitcoin days destroyed
  • Minimize address connections as inputs to transactions
  • Minimize total unspent outputs
  • Minimize transaction change
sr. member
Activity: 475
Merit: 254
Hi all.

I would like to ask the opinion of the dev community about utxo selection when sending.

I see a lot of wallets use the following method.

Code:
1st priority: block height - ascending
2nd priority: value - ascending

I am wondering what the benefits and drawbacks of this method are.

Also, I am wondering if there are alternative utxo selection methods that have different properties.

Using the kind of defacto standard utxo selection:

So if we had 8 BTC in block 4 and 1.5 AND 0.5 BTC utxos in block 6...

For any value (even 0.5 BTC) up to 8 BTC, it will always use the 8 BTC utxo first.
Then up to 8.5 BTC it will use the 8 BTC input and the 0.5 BTC input.
Then up to 10 BTC it will use all three utxos.

So as an alternative example:
Using the above example, up to 0.5 BTC should use the 0.5 BTC input, from > 0.5 to 1.5 should use only the 1.5 BTC input, and Something > 8.5 and up to 9.5 should only use 8 BTC and the 1.5 BTC utxo.


How would my selection method differ in benefits and demerits?
Jump to: