Bitcoin Forum

Bitcoin => Electrum => Topic started by: Bitcoin_Arena on June 05, 2021, 10:40:25 PM



Title: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: Bitcoin_Arena on June 05, 2021, 10:40:25 PM
So I was trying to take advantage of today's low fee rate to spend all the bitcoins from some address without expecting any change but to my dismay, some small amount of change BTC was sent back to the address.

When creating the transaction, Under amount, I hit the max button, Clicked on pay and under the confirm transaction tab, I adjusted the fee rate and hit send. I didn't expect the transaction to have two outputs ( the address I was spending the BTC to and the address the change got sent to) as show in the screenshot

https://i.imgur.com/CcODzEL.png

The small change was probably as a result of me adjusting the fee rate. Shouldn't the Max button be enough for Electrum to understand that I want to spend all the Bitcoins to the specified Bitcoin address?

Is there anyway around this (Avoiding unnecessary outputs due to fee adjustment)?


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: Charles-Tim on June 05, 2021, 10:58:52 PM
I checked my last transaction on electrum, I always make a transaction of 1 input most of the time, I checked the last one and no change address because I pressed on max and yet I edited the fee. Immediately my balance appeared zero, I tracked it on blockchain and no change address involved. I have never consolidated inputs before, neither have I sent many inputs before, but I still think electrum should not have UTXO sent to change address so far you send the maximum amount of bitcoin on your electrum wallet. This is strange to me.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: ranochigo on June 06, 2021, 12:08:13 AM
It shouldn't happen. After the user clicks Max, Electrum will send all the remainder after the fees when the user adjusts the fees in the advanced preview and should never send anything back to the change address. I'm unable to replicate this. When you adjust the fees in the advanced preview, did Electrum add another change address at that point?


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: nc50lc on June 06, 2021, 03:21:09 AM
-snip-
The small change was probably as a result of me adjusting the fee rate. Shouldn't the Max button be enough for Electrum to understand that I want to spend all the Bitcoins to the specified Bitcoin address?
I have reproduced this by changing something in the setting that'll make max button non-highlighted.
That makes the displayed to-be-sent value an absolute amount (not affected by 'max'), so changing the fee will produce a change.

Here's what I've done:
  • Put an address in the send tab, click "Max". Max will be highlighted indicating that it's active.
  • Go to "Tools->Preferences", Untick/Tick something under 'transactions' tab. I've tried 'RBF', 'output rounding' and 'change address'.
  • When you close the preferences window, the max button will be inactive but the previous amount will stay. So it'll act as a manually input amount instead of the auto adjusting max amount.

I don't know if there are other factors that can untoggled the max button but you must have done something that untoggled it before you clicked the send button.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: o_e_l_e_o on June 06, 2021, 08:08:27 AM
I have reproduced this by changing something in the setting that'll make max button non-highlighted.
I can confirm this as well. Changing something about the transaction's settings seems to make Electrum lock in the currently displayed value instead of keeping it as a variable.

I would suggest OP to start using "Advanced Preview", but even in you don't use it, later versions of Electrum will still display a transaction window which show you your transaction, including all the outputs at the bottom, before you sign and broadcast it. You should have been able to pick up this change address prior to broadcasting the transaction.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: hosseinimr93 on June 06, 2021, 09:10:33 AM
I have reproduced this by changing something in the setting that'll make max button non-highlighted.
I tried very much to reproduce the same thing doing what you did. I couldn't until I figured out something weird.

Go to "Preferences" and then "Fiat" tab. Change the "Fiat currency" to "None". Now do those steps.
You will see that "Max" button won't be disabled.

Go to "Fiat" tab and change the "Fiat currency" to USD or any other currency. Now do those steps.
You will see that "Max" button will be disabled.
There is no need to change something in "Transactions" tab. It's enough to open "Preferences" and close it.

What I understood is that, the "max" button is disabled after opening and closing "Preferences" only when electrum is showing the fiat value.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: mocacinno on June 06, 2021, 09:34:13 AM
Looks a lot like this issue i had about a year ago
https://bitcointalk.org/index.php?topic=5262327.msg54799647#msg54799647

The strange this was that i saw this "glitch", i documented it with screenshots, but when i tried to replicate the issue one day after raising it, i was unable to reproduce it myself... For some strange reason, it seems like a complete reboot did solve my issue... No idear why... No idear if it was restarting electrum or my os that did the trick, or maybe it was something i did before or during the initial transaction creation.

I'm just posting the link here to see if there are any similarity's between this situation and the situation i documented about a year ago.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: LoyceV on June 06, 2021, 03:23:13 PM
The small change was probably as a result of me adjusting the fee rate. Shouldn't the Max button be enough for Electrum to understand that I want to spend all the Bitcoins to the specified Bitcoin address?
I've seen this happen, but didn't think much of it. Electrum has some annoyances, just like it usually recommends a fee much higher than needed (https://jochen-hoenicke.de/queue/#BTC,24h,weight).

Quote
Is there anyway around this (Avoiding unnecessary outputs due to fee adjustment)?
In Preferences, enable Advanced preview. You'll still need to check it, but at least it shows the outputs before sending.
In my opinion, Electrum had a better interface to send payments before I upgraded (I think I came from version 3.3.8).



Any reason you're not using Segwit (for lower fees)?


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: khaled0111 on June 06, 2021, 06:15:04 PM
The small change was probably as a result of me adjusting the fee rate. Shouldn't the Max button be enough for Electrum to understand that I want to spend all the Bitcoins to the specified Bitcoin address?
The problem here is that you didn't hit the "send" button right after you adjusted the fees.
The only way for this to happen is if you adjust the fee rate to something lower, obviously, then you close the "confirm transaction" window and adjust something in the transaction preferences. By doing this, Electrum will act as if you are going to create a new transaction. Hence why the max button become clickable again. It's annoying but it makes sense.


Any reason you're not using Segwit (for lower fees)?
BC do not support segwit addreses.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: Pmalek on June 06, 2021, 07:00:18 PM
I performed a few consolidations with Ledger + Electrum a few days ago when it was possible to get a transaction confirmed for below 1.5 Sats/vByte and the software didn't send any change back to one of my addresses. I also used the max button and advanced preview is turned on my end. Since it seems to have something to do with adjusting the settings after selecting which coins to spend from, I can only advice you to edit your preferences before you begin the process of selecting coins for your transaction.

Wouldn't the second output still appear on the screen of your hardware device before you broadcast the transaction even if you don't have advanced preview enabled?


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: o_e_l_e_o on June 06, 2021, 07:23:18 PM
Wouldn't the second output still appear on the screen of your hardware device before you broadcast the transaction even if you don't have advanced preview enabled?
Not necessarily. Some hardware wallets will automatically verify the change address internally (since the change address should match one stored on the hardware device) and not display it to the user for verification. Also, he never mentioned using a hardware wallet at all - he might be using Electrum as a hot wallet.

And even if you don't have advanced preview enabled, you still get the transaction window showing all your outputs after you click "Send" but before you broadcast the transaction, so it should be trivial to pick up the mistake there.


Title: Re: Is there a way of avoiding unnecessary outputs due to fee rate adjustments?
Post by: nc50lc on June 07, 2021, 02:37:53 AM
I have reproduced this by changing something in the setting that'll make max button non-highlighted.
I tried very much to reproduce the same thing doing what you did. I couldn't until I figured out something weird.
Yup, there are settings that won't trigger the issue and I haven't tested them all.
What works at my end are the ones listed in my original reply, any one of the three.
I've also noticed that once a setting inactivated the max button, it won't do it again the second time unless Electrum restart.

The small change was probably as a result of me adjusting the fee rate. Shouldn't the Max button be enough for Electrum to understand that I want to spend all the Bitcoins to the specified Bitcoin address?
The problem here is that you didn't hit the "send" button right after you adjusted the fees.
I believe that's not the issue, it originated in the 'send' tab's "max" button so, he just have to click "Max" and then "Pay..." without doing anything in between that can deactivate the max toggle.