1

I want to make a payment of x BTC.

My Electrum wallet shows two "output points" in the Coins tab (with the same address). Both of these show an amount much larger than x BTC.

If go to the Send tab and start to make a payment to an address, then click "Pay..." and then "Advanced", I can see two inputs, which seem to correspond to the two "output points" in the Coins tab and show the same amounts. The transaction size is 447 bytes. I abandon this transaction.

If I go to the Coins tab, right click on one of the two "output points" and choose "Spend", Electrum shows a green banner saying "Coin control active". If I start to make the same payment, the "Advanced" dialog now only shows one input and the transaction size is 226 bytes.

This looks to me as though I can make the same transaction and incur a smaller fee by using "coin control". Am I missing something? Is there a disadvantage or risk to doing this? I'm thinking there must be, otherwise Electrum would just do it automatically.

I could understand needing two inputs to the transaction if x was more than the amount associated with each one of my two "output points", but it isn't.

Thanks!

0

2 Answers 2

2

Electrum used both UTXO, even if only one was needed, to protect your privacy albeit at the expense of higher fee.

This is from the Electrum source code and explain this choice:

Attempts to better preserve user privacy.
First, if any coin is spent from a user address, all coins are.
Compared to spending from other addresses to make up an amount, this reduces
information leakage about sender holdings.  It also helps to
reduce blockchain UTXO bloat, and reduce future privacy loss that
would come from reusing that address' remaining UTXOs.
Second, it penalizes change that is quite different to the sent amount.
Third, it penalizes change that is too big.

This looks to me as though I can make the same transaction and incur a smaller fee by using "coin control". Am I missing something?

No, you are right, if you wish focus more on fee minimization instead of privacy, you can achieve better result doing so manually than rely on the Electrum coin control policy.

Is there a disadvantage or risk to doing this? I'm thinking there must be, otherwise Electrum would just do it automatically

There are multiple goal you may want achieve with a coin selection strategy and there is no one strategy that solves all problems, so wallets adopt different strategies depending on their priorities; but these strategy are meant for unskilled user or user that don't care these things (eg. the Coins tab is hidden by default on Electrum)... If you know how bitcoin transactions works and what UTXO are, probably you prefer do your own coin selection manually based on the needs of a specific transaction.

2
  • Thank you! This makes sense. I've been reading around a bit more and it looks like a) I re-used addresses in the past, which I now realise I shouldn't have done b) Electrum is making this more expensive transaction to fix that. My current inclination is to let Electrum use a two input transaction and accept the larger fee this time, then my next transaction will automatically be a one-input transaction anyway as I will no longer have multiple coins sharing an address. Does that seem reasonable/correct?
    – Steve
    Apr 7, 2021 at 14:59
  • yes, you got the point ... but keep in mind that Electrum can choose a sub optimal UTXOs group (from the fees side) in other cases as well, so if you care, take a look on "advanced tab" anyway. Apr 7, 2021 at 16:58
1

Coin selection algorithm in Electrum favours privacy so its using all the UTXOs associated with the address as explained by leevancleef. To reproduce this I followed the below steps in Electrum 4.0.9:

  1. Send some amount to one of the addresses from coins tab.

  2. Freeze other coins

  3. Try to create a transaction paying amount less than both coins available for address: tb1q5rxjgxwmvx6q7hdt4ha9cp939fzp0zuxrh8vr0

electrum-coins

electrum-transaction

Electrum had 2 coin selection algorightms eearlier:

COIN_CHOOSERS = {'Priority': CoinChooserOldestFirst,
                 'Privacy': CoinChooserPrivacy}

Priority was removed because of some changes in Bitcoin Core according to this comment: https://github.com/spesmilo/electrum/issues/5359#issuecomment-538828046

I would prefer wallets using multiple algorithms, one by default and provide option to use others. I wanted to test how things work with two algorithms used in past but Electrum 3.0.1 was not syncing with the network.

1
  • Thanks for taking the trouble to reproduce this, much appreciated!
    – Steve
    Apr 7, 2021 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.