Post
Topic
Board Electrum
Re: Internal algorithm how Electrum auto-selects addresses to spend money from?
by
nc50lc
on 16/12/2021, 12:26:59 UTC
Sample addresses:

11....11   0.06 BTC
22....22   0.05 BTC
33....33   0.03 BTC
44....44   0.02 BTC
55....55   0.01.BTC

BTCs to transfer: 0.09 BTC
-snip-
Which algorithm is implemented?
How about an actual test? (Amounts down by 2 decimal points 'cause I don't have enough testnet coins)

Done in "testnet":
Here's the coins (UTXO)


When sending 0.0009 BTC @1sat/vB, it will select "0.0006" and "0.0004" since those are the best candidates to fulfill the will-be-sent amount and the fee.
Pretty much your number 2 algorithm.


But as you can see in the replies above and the overwhelming "coinchooser.py" code of Electrum, it's much more complicated that your list.