Author

Topic: Electrum default coin selection (Read 222 times)

legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
May 31, 2021, 07:54:17 AM
#12
Although it's the user's job to learn how to properly send and receive bitcoin, I still think users should be informed that they are about to spend an unnecessary amount of UTXOs for a transaction that can be spent by using only one input that is big enough. Some sort of pop-up or system notification would be nice.  
Electrum does give a warning if the fees is outrageously large when compared to the amount that is supposed to be sent. That should be sufficient.

If the transaction size is too big, and the user ends up paying too much, then the user will notice and adjust either their fees or their inputs accordingly. If it doesn't trigger the warning, then the fees should be within an acceptable amount and since it is a consolidation transaction in a sense, it is still beneficial to the user as it can potentially save more on the fees in the long run. While there is nothing wrong with a dialog or a popup, users tend to be quite myopic and won't see the point behind specific client behavior such as this.
legendary
Activity: 2268
Merit: 18771
May 31, 2021, 07:52:12 AM
#11
ranochigo's explanation about the buckets system makes sense, but being overconcerned with privacy can certainly cause you to lose a lot of money.
But again, consider the alternative. Electrum has no way of knowing if the user is going to choose to pay 1 sat/vbyte or 100 sat/vbyte, or if their next transaction is going to pay 1 sat/vbyte or 100 sat/vbyte, or any subsequent transaction after that. It simply has to ignore the fees and consolidate whatever it can, whenever it can, without compromising privacy by linking different addresses together. Otherwise, a user is going to be left with dozens of small inputs across different addresses, plus dozens of small change outputs across different addresses, and end up paying more in fees in the long run, as well as compromising their privacy.

Some sort of pop-up or system notification would be nice.
I don't think it would solve the issue. A simple pop up saying "Do you want to save fees by using fewer inputs?" will result in everyone who doesn't understand coin control clicking on "Yes". No one is not going to want to save on fees. Which just leads us back down the route of loads of small inputs across multiple addresses.

If the user doesn't want to use coin control, then Electrum is going to have to consolidate all their inputs for them at some point. Better to do it on a per-transaction and per-address basis when privacy can be maintained, rather than in one big transaction using every address in their wallet.
legendary
Activity: 2730
Merit: 7065
May 31, 2021, 07:41:25 AM
#10
I had no idea that Electrum does what hosseinimr93 mentioned by default. ranochigo's explanation about the buckets system makes sense, but being overconcerned with privacy can certainly cause you to lose a lot of money. Although it's the user's job to learn how to properly send and receive bitcoin, I still think users should be informed that they are about to spend an unnecessary amount of UTXOs for a transaction that can be spent by using only one input that is big enough. Some sort of pop-up or system notification would be nice.  
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
May 30, 2021, 06:20:51 PM
#9
Electrum old versions used to let the user choose between priority and privacy coin selection. When you select priority, Electrum will use the oldest utxos as inputs. Not sure why this feature was removed!
It was there when Bitcoin Core still considered transaction priority in their relaying and miners still mined free transaction. It was removed once Bitcoin Core removed the logic as well. Don't see much point in keeping this as spending coins in chronological order is quite detrimental to the user's privacy as well.

Might seem paradoxical since the client leaks so much privacy but it's better than them not doing anything about it.
legendary
Activity: 2380
Merit: 5213
May 30, 2021, 02:25:49 PM
#8
Electrum old versions used to let the user choose between priority and privacy coin selection. When you select priority, Electrum will use the oldest utxos as inputs. Not sure why this feature was removed!
I didn't know this. Thanks for the info.
I just made a search and found the following image from an old post made by TryNinja.



So, they removed the choosing UTXOs selection method option and electrum is now using the privacy method as the default coin selection method.
legendary
Activity: 2744
Merit: 3096
Top Crypto Casino
May 30, 2021, 01:57:02 PM
#7
Electrum old versions used to let the user choose between priority and privacy coin selection. When you select priority, Electrum will use the oldest utxos as inputs. Not sure why this feature was removed!
Although the current algorithm might be good for users privacy as it ensures an address can't be reused, it surely will make them lose a lot of money on fees.
legendary
Activity: 2268
Merit: 18771
May 29, 2021, 03:17:16 AM
#6
You need to consider the alternative.

If someone isn't going to use coin control, then the two options are for Electrum either to use all the inputs on a given address to fund a transaction (as it does currently), or to use the bare minimum number of inputs to fund a transaction. If it only uses the minimum number of inputs and no more, then pretty much every transaction the user makes will create another change output, often for a small amount. Over time, they will end up with even more inputs that need spent, even more being paid in fees, and linking multiple transactions together because of multiple small change outputs that need consolidated, thereby decreasing their privacy.

The best option is obviously to use coin control and consolidate when fees are low, but in the absence of that, then Electrum's current behavior is the better of the remaining options.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
May 28, 2021, 11:20:51 PM
#5
You can manually choose what you want to spend on the coins tab if you want to reduce the fee but how about if you are going to spend them all in the future?

You still have many outputs so you will still pay a huge fee in the future if you are going to spend them all in one transaction.

They set Electrum to merge all UTXO by default and sent it to address destination and change address but if you don't want to pay a large fee always make a transaction when the network is not congested.
It isn't always an option for users to only use Electrum when the network is not congested. Users have to actively use coin control to change their outputs. Consolidation transactions should only be done when it is not congested but normal transactions should not be treated as consolidation transactions. It is unnecessary and incurs too much fees.

In normal usage as intended, the user won't run into such issues. Electrum tries to get their users to use different addresses from each transactions. This makes it such that each bucket only has 1 UTXO as the address is only used once. Hence, the transaction would end up being the most efficient. If the user reuses their addresses, this won't hold true and the user has to adjust it manually.
legendary
Activity: 2702
Merit: 4002
May 28, 2021, 03:56:33 PM
#4
The main advantage of Coin Control is not saving money by suggesting fewer inputs but rather increasing privacy.
Sometimes you get a small sums (dust transaction) which with abuse may cause all addresses associated with your account to be disclosed.
If you do not know how to control your currencies, you may end up revealing all the addresses that the wallet initiates.
legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook
May 28, 2021, 12:08:41 PM
#3
You can manually choose what you want to spend on the coins tab if you want to reduce the fee but how about if you are going to spend them all in the future?

You still have many outputs so you will still pay a huge fee in the future if you are going to spend them all in one transaction.

They set Electrum to merge all UTXO by default and sent it to address destination and change address but if you don't want to pay a large fee always make a transaction when the network is not congested.

And I think they shouldn't need to change it in the future it depends on users if how they want to make a transaction on Electrum they can enable the coins tab and spend what coins they want to spend.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
May 28, 2021, 11:54:06 AM
#2
The way Electrum functions is that it primarily tries to group the UTXOs into "buckets" with each bucket containing UTXOs associated with the same address. If any coins is being spent from a specific bucket (or address) in this case, then Electrum attempts to spend all of the UTXOs that are grouped into the same bucket as a way of consolidating and avoiding privacy leakage. A second bucket or more buckets would be selected if and only if a single bucket cannot fulfill your requirement. You have to manually select the inputs to spend via coin chooser if you want to spend specific inputs or avoid spending all of them.

With your example, all of the inputs are grouped into the same bucket as they are all associated with the same address and also all confirmed. Electrum thus selects to spend that bucket and it has to spend all of the UTXOs.

Electrum tries to maximize the user's privacy in this case. There isn't anyway to disable this kind of coin selection AFAIK. Interesting to note that other than this, Electrum also tries to only spend coins from the same bucket or select buckets which would produce the change that has the closest value to the recipient amount.
legendary
Activity: 2380
Merit: 5213
May 28, 2021, 11:39:51 AM
#1
Newbies usually don't have any information about coin control and how extra inputs can make them waste money on transactions fee. If the coins aren't selected by the user manually, they will be selected by electrum automatically.

The problem is that electrum selects the UTXOs based on balance of addresses, not UTXOs amounts.

Let's say I have 1.5  BTC in my wallet. UTXO A is in address A and is worth 1 BTC. UTXO B is in address B and is worth 0.5 BTC. If I want to spend 0.75 BTC, electrum selects the UTXO A and doesn't touch UTXO B. Everything is fine here.

I imported two random addresses into a watch-only wallet.
bc1qnntxhtfa7446euhyx9yxygwjql84rrpsk52c9y and 1KVkFrQyx1C8gxCz461o9ChZjEEDDAbLxB have received 0.515 BTC and 0.043 BTC in single transactions consecutively.
The image below has been taken from "Coins" tab.



Now, I am spending 0.5 BTC. As you see in the image below, electrum is only using bc1qnntxhtfa7446euhyx9yxygwjql84rrpsk52c9y and doesn't use 1KVkFrQyx1C8gxCz461o9ChZjEEDDAbLxB. It's 100% OK.




The problem is when the user has received multiple UTXOs in a single address.
I imported 1ChancecoinXXXXXXXXXXXXXXXXXZELUFD into a watch-only wallet.
The address has received 480 BTC in 267 transactions.
The image below has been taken from "Coins" tab.



Now, I am spending 0.1 BTC.
As displayed in the image below, electrum is using all the 267 UTXOs and makes the user waste a big money on transaction fee.
This transaction could be made with only 1 input.




Have developers designed the default coin selection in this way for a reason? Or you think they should change it in the next updates?
Jump to: