Bitcoin Forum
June 14, 2025, 09:00:04 PM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does Electrum decide from which of my addresses the BTCs are sent?  (Read 118 times)
thoste (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 9


View Profile
November 01, 2024, 02:13:05 PM
Merited by ABCbits (2)
 #1

Assume I have (simplified) the following addresses with BTCs on them

111111 with 0.100 BTC
222222 with 0.200 BTC
333333 with 0.300 BTC
444444 with 0.400 BTC

Now I want to send someone 0.280 BTC.

I go to "Send" tab fill in the target address and amount and click "Pay".
Now Electrum decides automatically from which of my addresses the BTCs are taken.

As far as I can see its always the addresses with the biggest amount. Here 444444.

Why ?

Why not properly do I cleanup and take the money from addresses 111111 and 222222?
If always the biggest amount addresses are taken then users will end up with thousands addresses with micro amounts.

Can I somehow tell Electrum to use another addresses selection strategy?
Or even select the input addresses manually?

Sorry for this newbie question.
Charles-Tim
Legendary
*
Offline Offline

Activity: 1946
Merit: 5614


Leading Crypto Sports Betting & Casino Platform


View Profile
November 01, 2024, 02:30:57 PM
Merited by Pmalek (2), hosemary (2), ABCbits (1)
 #2

Can I somehow tell Electrum to use another addresses selection strategy?
Or even select the input addresses manually?
If you want to manually spend from an address or some addresses of your choice, use coin control.

On desktop Electrum wallet:
To access coin control, click on 'view' on the generally user interface and check ✔️ coins. The coin tab will appear which you can use to freeze UTXOs, addresses and to spend from addresses that you want to spend from.

On mobile Electrum wallet:
You can only use coin control to freeze address, addresses or coins but it can not be used to spend UTXOs.

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
Mia Chloe
Hero Member
*****
Offline Offline

Activity: 742
Merit: 1232


Contact me for your designs...


View Profile
November 01, 2024, 03:40:21 PM
 #3

Charles- Tim has said pretty much. Now the way wallets work, they try to be efficient in the way they spend your coins and if you make use of an HD wallet which of course many persons use now, the wallet tries to save fees, and also spend your coins while simultaneously trying to make use of change addresses and sweeping to make your transactions more anonymous and difficult to trace. That's why every time you press receive on Electrum you get a new wallet address so your funds are not traced to a single address.

The idea of spending is your wallet looks for a single address that can pay for the transaction and if there's none it will consolidate funds from the available addresses, meaning you will have multiple inputs.

hosemary
Legendary
*
Offline Offline

Activity: 2800
Merit: 6238



View Profile
November 01, 2024, 05:20:59 PM
Merited by pooya87 (2), Pmalek (2), ABCbits (1), Charles-Tim (1)
 #4

If you make a transaction from electrum without using coin control, electrum minimize the number of used addresses and at the same time consolidate UTXOs that are assosiated with the same address.

Let's say you have three UTXOs in your wallet.

UTXO A: 0.01 BTC
UTXO B: 0.02 BTC
UTXO C: 0.03 BTC
UTXO D: 0.04 BTC

Assume that UTXOs B, C and D are assoisated with the same address.
Now, if you want to make a transaction spending 0.035 BTC (without using coin control), electrum will use all UTXOs B, C and D.



As already stated by Charles-Tim, use coin control to tell electrum which UTXO(s) you want to be used for your transaction.

▄███████████████████▄
████████████████████████

██████████▀▀▀▀██████████
███████████████▀▀███████
█████████▄▄███▄▄█████
████████▀▀████▀███████
█████████▄▄██▀██████████
████████████▄███████████
██████████████▄█████████
██████████▀▀███▀▀███████
███████████████████████
█████████▄▄████▄▄████████
▀███████████████████▀
.
 BC.GAME 
███████████████
███████████████
███████████████
███████████████
██████▀░▀██████
████▀░░░░░▀████
███░░░░░░░░░███
███▄░░▄░▄░░▄███
█████▀░░░▀█████

███████████████

███████████████

███████████████

███████████████
███████████████
███████████████
███████████████
███████████████
███░░▀░░░▀░░███
███░░▄▄▄░░▄████
███▄▄█▀░░▄█████
█████▀░░▐██████
█████░░░░██████

███████████████

███████████████

███████████████

███████████████
███████████████
███████████████
███████████████
███████████████
██████▀▀░▀▄░███
████▀░░▄░▄░▀███
███▀░░▀▄▀▄░▄███
███▄░░▀░▀░▄████
███░▀▄░▄▄██████

███████████████

███████████████

███████████████

███████████████

DEPOSIT BONUS
.1000%.
GET FREE
...5 BTC...

REFER & EARN
..$1000 + 15%..
COMMISSION


 Play Now 
nc50lc
Legendary
*
Offline Offline

Activity: 2814
Merit: 7297


Self-proclaimed Genius


View Profile
November 02, 2024, 03:49:29 AM
Merited by Pmalek (2), Charles-Tim (1)
 #5

As far as I can see its always the addresses with the biggest amount. Here 444444.
Not aways, it depends on the output's amount and each UTXO's state.

Here's a similar scenario created in testnet:
UTXO:0.0028tBTC output amount:0.001tBTC output amount:

Quote from: thoste
Why ?
Electrum is prioritizing "privacy" on its coin-selection before "efficiency".

This comment in Electrum's "coinchooser.py" script explains it in a nice way: github.com/spesmilo/electrum/blob/master/electrum/coinchooser.py
Bonus if you can read python since you can check "why" right there.

thoste (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 9


View Profile
November 05, 2024, 07:44:06 AM
 #6

Can I somehow tell Electrum to use another addresses selection strategy?
Or even select the input addresses manually?
If you want to manually spend from an address or some addresses of your choice, use coin control.

On desktop Electrum wallet:
To access coin control, click on 'view' on the generally user interface and check ✔️ coins. The coin tab will appear which you can use to freeze UTXOs, addresses and to spend from addresses that you want to spend from.

Ok, thank you so far. But there is still confusion.
I am now on the "Coins" Tab.
I right click on a certain address and a context menu appears

When I select now

"Freeze"-->Freeze Coin

does that mean that (for the next transaction) this BTC address should be taken or the opposite?

Whats the difference between

"Freeze"-->Freeze Coin
and
"Freeze"-->Address

?
Shouldn't it be the same?

I guess "Freeze" means "Don't touch".

So if I want the opposite and force an address to be used I have to select "Add to Coin control". Correct?
nc50lc
Legendary
*
Offline Offline

Activity: 2814
Merit: 7297


Self-proclaimed Genius


View Profile
November 05, 2024, 08:03:18 AM
 #7

"Freeze"-->Freeze Coin

does that mean that (for the next transaction) this BTC address should be taken or the opposite?
-snip-
I guess "Freeze" means "Don't touch".
All the UTXO (coins) associated with that address wont be used in any of your new transactions.

The freeze setting is permanent until you unfreeze it
But will only work client-side, means that if you have other instance of your wallet, your freeze selections wont apply there automatically.

Quote from: thoste
Whats the difference between

"Freeze"-->Freeze Coin
and
"Freeze"-->Address

?
Shouldn't it be the same?
"Freeze Coin" only freezes certain UTXO. Useful in case you're reusing address and don't want Electrum's default coin-selection that uses all of the UTXOs of the same address.
"Freeze Address" freezes all of the UTXO that's associated with that address.

Quote from: thoste
So if I want the opposite and force an address to be used I have to select "Add to Coin control". Correct?
Correct.
It will apply as long as "Coin control active" message is displayed.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!