Bitcoin Forum

Bitcoin => Electrum => Topic started by: deepskydiver on February 10, 2021, 03:34:58 AM



Title: Electrum and change addresses
Post by: deepskydiver on February 10, 2021, 03:34:58 AM
Hi everyone,

I have an Electrum wallet which contains addresses originally created in multibit. In that wallet there are no change addresses.
My question is firstly - where do I find documentation on precisely how electrum deals with change?
My specific questions are:
* will it add change addresses to my wallet?
* can I use one of my existing addresses as a change address?

Thanks!


Title: Re: Electrum and change addresses
Post by: odolvlobo on February 10, 2021, 05:51:43 AM
I have an Electrum wallet which contains addresses originally created in multibit. In that wallet there are no change addresses.
My question is firstly - where do I find documentation on precisely how electrum deals with change?
My specific questions are:
* will it add change addresses to my wallet?
* can I use one of my existing addresses as a change address?

Electrum generates change addresses in a way similar to the way that it generates receiving addresses. Are you interested in the details?
Yes, you can list all the change addresses - click on addresses tab and scroll to the bottom.
Yes, but there is no good reason to.


Title: Re: Electrum and change addresses
Post by: pooya87 on February 10, 2021, 05:56:26 AM
* will it add change addresses to my wallet?
Yes. Change addresses are derived similarly as any other addresses from your mnemonic (seed phrase). There is a derivation path depending on your address types such as m/0'/0/0 that Electrum uses to get your main addresses and it changes the last index to 1 for change addresses meaning the path becomes m/0'/1/0 for the first change address.

Quote
* can I use one of my existing addresses as a change address?
Technically there is absolutely no difference between a change address and "main" addresses in your wallet. They are all similar addresses of the same type with private keys and all derived from the same seed. The only difference is their "category".


Title: Re: Electrum and change addresses
Post by: NeuroticFish on February 10, 2021, 06:24:04 AM
As said, change addresses are ... just addresses.
The point of having change addresses is to have a new one available every time you need them, i.e. when you make new transactions.
If you add by hand one or two addresses will not really be what Electrum expects (from change addresses point of view)

If you want to get most of Electrum, I think that the better move is to wait for the price stabilize and then the transaction fees drop, and then transfer your coins to an address from newly created Electrum wallet.
Since Electrum is HD wallet, it generates all the addresses from the same seed, so it brings you more advantages. And some of those addresses will be seen as change addresses.


Title: Re: Electrum and change addresses
Post by: o_e_l_e_o on February 10, 2021, 12:06:21 PM
How did you import your address from Multibit to Electrum? If you imported them using your seed phrase, then Electrum will automatically generate change addresses from this seed phrase as the posters above have said. However, if you extracted and imported individual private keys, then Electrum will not generate any new change addresses and should simply send any change back to the address it came from.

If you did import individual private keys, then for the sake of having an up-to-date back up and letting Electrum automatically generate change addresses (which is better for your privacy), then as NeuroticFish says I would create a new Electrum wallet from scratch and seed your coins to it once the mempool empties out a bit.


Title: Re: Electrum and change addresses
Post by: DireWolfM14 on February 11, 2021, 03:02:05 AM
* will it add change addresses to my wallet?

As o_e_l_e_o said above, if you imported via seed phrase, then yes.

* can I use one of my existing addresses as a change address?

To use a specific address as a your change wallet you can use the "send to many" feature.  In the "send to" field you can list multiple addresses, followed by a comma, then the amount you want to send.  Use a exclamation point for the last address, which will be your change address.  The exclamation point will select the remaining amount, minus fees to send to that address.

Example:

1xFirstPaymentAddressxxxxxxxx,0.0035
1xSecondPaymentAddressxxxxx,0.004
1xSpecificChangeAddressxxxxxx,!

Electrum will show you the outputs before you confirm them, and you can double check the addresses there.  If the change address is in your wallet it'll be highlighted in green.  The change addresses created by Electrum will be highlighted in yellow.


Title: Re: Electrum and change addresses
Post by: deepskydiver on February 16, 2021, 12:48:34 AM
Thank you everyone. My background is having not done anything with my bitcoin for I guess 8 years now. And over that period things change and formats and software do too.

I imported my keys into Electrum from private keys. So the wallet has no seedphrase.

So of course I have the private keys, encrypted in cold storage. I guess I have a preference for having the private keys - in that they are are the literal key as opposed to a seedphrase. And that made me feel more comfortable when multibit went the way of the dinosaurs. And if Electrum does too and I have the keys I can't be cutoff from by bitcoin. Hence the question about change addresses - because even if I setup a new wallet I have to move bitcoin out to it. And I have this fear of losing some of it as my wallet isn't a typical wallet.

That's why I wanted to know how Electrum functioned for that use case - private key import - given that in my eyes at least it's the only platform independent way to hold bitcoin.


Title: Re: Electrum and change addresses
Post by: o_e_l_e_o on February 16, 2021, 04:04:10 AM
In that case, your Electrum wallet will not create any new address to be used for change. If you send coins from one of your imported addresses, then the default action which should happen is that any change is sent back to the same address it came from. While poor for privacy, there is nothing stopping you from doing this and you won't lose any coins doing so.

After you create the transaction in Electrum, you will be met with a preview screen which will show all the addresses you are sending coins to, include your change. So if you are sending some coins to a single address, then you should see two outputs in this box - one to the address you are paying, and a second with your change returning to the same address it came from. Make sure this is the case before you sign and broadcast the transaction. If for some reason your change is not being sent to the correct address, then you can use the instructions from DireWolfM14 above to specify where you want the change to go.


Title: Re: Electrum and change addresses
Post by: pooya87 on February 16, 2021, 05:00:36 AM
Thank you everyone. My background is having not done anything with my bitcoin for I guess 8 years now. And over that period things change and formats and software do too.

I imported my keys into Electrum from private keys. So the wallet has no seedphrase.

So of course I have the private keys, encrypted in cold storage. I guess I have a preference for having the private keys - in that they are are the literal key as opposed to a seedphrase. And that made me feel more comfortable when multibit went the way of the dinosaurs. And if Electrum does too and I have the keys I can't be cutoff from by bitcoin. Hence the question about change addresses - because even if I setup a new wallet I have to move bitcoin out to it. And I have this fear of losing some of it as my wallet isn't a typical wallet.

That's why I wanted to know how Electrum functioned for that use case - private key import - given that in my eyes at least it's the only platform independent way to hold bitcoin.
Keep in mind that it is best if you create a physical backup of your wallet rather than a digital one, meaning storing your encrypted wallet file on disk is not as safe as storing the keys on a piece of paper (or better yet do both). Now things can be come challenging if the number of individual keys you have is large or if you don't want to or can't use a printer because writing down the encrypted keys on paper is hard.
This is why seed phrase was created.

Also keep in mind that your concerns would have been valid for a closed source wallet not for something that is 100% open source and is as popular as Electrum. We already know all the details of how each private key is created from that seed phrase so even if Electrum wasn't being developed in the future we can reproduce it easily.