Post
Topic
Board Electrum
Merits 8 from 4 users
Topic OP
Internal algorithm how Electrum auto-selects addresses to spend money from?
by
pxstein
on 16/12/2021, 10:10:20 UTC
⭐ Merited by o_e_l_e_o (4) ,Pmalek (2) ,ETFbitcoin (1) ,hosseinimr93 (1)
Assume I want to send BTCs to someone else.

On the "Adresses" tab I have multiple yellow addresses containing BTCs.
Furthermore I don't use the right click context menu "Spend from" to manually select the addresses
which should be used for the next transaction.

So Electrum will automatically choose the addresses.

How does this auto-selection algorithm work?

I can think of

1.) Select addresses with the biggest BTC amount first
     =minimize the number of used addresses

2.) Same as 1. but more smarter:
     Select addresses with the biggest BTC amount first
     but try to minimize change too

3.) Try to consilidate as much addresses
     = minimize the number of addresses in wallet which contain BTCs afterwards

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

Resulting used addresses for algorithms:

1.) 11.....11 + 22...22
2.) 11.....11 + 33...33
3.) 22.....22 + 33....33 + 44....44 + 55....55

Which algorithm is implemented?

Can I select algorithm?

Is the algorithm Electrum specific or defined for all BTC wallet software?