Bitcoin Forum

Bitcoin => Electrum => Topic started by: NotATether on March 31, 2020, 02:50:12 PM



Title: How to send unspent outputs to another address in Electrum?
Post by: NotATether on March 31, 2020, 02:50:12 PM
I have a small amount of bitcoin, 0.0008BTC in a legacy "1" electrum wallet, a larger amount 0.0079BTC in another, segwit "3" electrum wallet, and now I want to send these to my bech32 electrum wallet address. I can always just transfer then directly with a 1 sat/byte transaction fee but if I am going to buy something anyway, how do I tell electrum to direct the unspent transaction outputs to my bech32 address (which is in another wallet)?


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: OmegaStarScream on March 31, 2020, 03:00:41 PM
If I understood your request, you can simply use the "Pay to many" feature (Tools menu) and send funds to both the seller + your bech32 address at once.


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: bitmover on March 31, 2020, 04:01:41 PM
Wouldn't it be easier just to make two transactions to the address you want? One from each wallet.

There is also a tab called Coins. It is usually hidden. Click View > Show Coins.

There you can select exactly the output you want to spend, but it has to be in the same wallet.


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: Csmiami on March 31, 2020, 04:06:24 PM
Not sure this can be done; but you could try to import the private key of the legacy address into the segwit one, and create a single transaction that will take both imputs?


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: hosseinimr93 on March 31, 2020, 04:40:26 PM
From my understanding your question is how to import both of legacy segwit address (address starting with 1) and nested segwit address (address starting with 3) in a single wallet and then send the funds to two other addresses.

Create a new wallet in Electrum.
Select "Import addresses or private keys"

Enter private keys of both of your addresses.
Just note that you must add p2wpkh-p2sh: before private key of your segwit address.

Code:
Private key of your legacy address
p2wpkh-p2sh:private key of your segwit address


Then you will have both of your addresses in a single wallet.
In order to be able to send bitcoin to multiple addresses, as OmegaStarScream said, select "tools" at top of the window then click on "Pay to many".

Edit:
Are you sure the address starting with 3 is a segwit address?
If you have created that address using Electrum, that's not segwit. That's a legacy address.


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: asu on March 31, 2020, 05:11:05 PM
OP needs us to enlighten more about his request.

Edit: Are you sure the address starting with 3 is a segwit address?
If you have created that address using Electrum, that's not segwit. That's a legacy address.

Starting with “3” is a P2SH Nested Segwit addresses.

You can read more details here > Legacy vs Segwit wallets. Whats the difference? (https://bitcointalk.org/index.php?topic=2251039.msg22764587#msg22764587) / Difference between SegWit addresses (https://bitcointalk.org/index.php?topic=2347427.0).


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: khaled0111 on March 31, 2020, 05:15:56 PM
As OmegaStarScream suggested, from Electrum, select pay to many, send the payment amount to the merchant's address and the rest to your bech32 address.

A change address is nothing else but a transaction output that your wallet generates and you can set it manually.



Title: Re: How to send unspent outputs to another address in Electrum?
Post by: NotATether on March 31, 2020, 05:25:57 PM
OP needs us to enlighten more about his request.

Sorry I should have been more clear, I'm not trying to make a single transaction from two addresses at once, I'm trying to redirect the UTXO of one of the addresses to my bech32 address, and then repeat the same process for my other address.

Are you sure the address starting with 3 is a segwit address?
If you have created that address using Electrum, that's not segwit. That's a legacy address.

I managed to create a segwit wallet by importing a random bip39 seed phrase, and then from the import screen select p2sh-segwit from the "Script type and Derivation path" screen.

But anyway, I was wondering if I purchase something using my legacy address, how to redirect the UTXO from that address to my bech32 address/wallet. Same with my p2sh-segwit address.


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: hosseinimr93 on March 31, 2020, 05:28:25 PM
Starting with “3” is a P2SH Nested Segwit addresses.

You can read more details here > Legacy vs Segwit wallets. Whats the difference? (https://bitcointalk.org/index.php?topic=2251039.msg22764587#msg22764587) / Difference between SegWit addresses (https://bitcointalk.org/index.php?topic=2347427.0).
No
Addresses starting with 3 are P2SH, but they are not always segwit.
Look at the bold part of achow101 post which you suggested to read.

So ive always had my bitcoin in my hardware wallet. Now there are 2 options: Legacy and Segwit. Whats the actual difference ?
Legacy means that you will be using addresses of the form 1... Segwit means that you will be using addresses of the form 3... or bc1... (one is for P2SH nested segwit and the other is for native segwit). Note that 3... addresses are for P2SH addresses in general and are not just for segwit. bc1... addresses are for segwit specifically but not all wallets support it yet.

And following post made by o_e_l_e_o

Addresses which begin with 3 may or may not be SegWit, and may or may not be multi-sig. It all depends on how you set it up. Electrum does not create SegWit addresses beginning with 3 though - it will only let you import them. So if you created your 3 addresses in Electrum, which it very much sounds like you did, then it will be multi-sig legacy rather than SegWit or multi-sig SegWit.



But anyway, I was wondering if I purchase something using my legacy address, how to redirect the UTXO from that address to my bech32 address/wallet. Same with my p2sh-segwit address.
When you send your bitcoins, Electrum automatically send the remaining balance to your change address. As your change address is not a bc1 address, the best thing you can do is to enable "Pay to many" and send the remaining to your bc1 address manually, so there is no remaining bitcoin.

Assume that you are going to send 0.01 BTC to an address while your balance is 0.02 BTC
Send 0.01 to that address and send 0.01 minus transaction fee to your bc1 address. (A better solution for sending the remaining balance suggested by o_e_l_e_o in the next post)


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: o_e_l_e_o on March 31, 2020, 07:14:46 PM
But anyway, I was wondering if I purchase something using my legacy address, how to redirect the UTXO from that address to my bech32 address/wallet. Same with my p2sh-segwit address.
You got the correct answer on the first reply by OmegaStarScream. The only way to redirect your change to a different wallet is to use the "Pay to many" feature.

In your legacy wallet, open the "Send" tab, and then click on Tools -> Pay to many
In the "Pay to" box, enter the address you want to pay, followed by a comma and a space, and then the amount you want to pay
In a new line, enter the address of your Bech32 wallet you want to the change to be sent to, followed by a comma, a space, and then an exclamation mark (!) - the exclamantion mark means "send all remaining funds"
Adjust the fee as you like and hit send

Your "Pay to" box should look something like this:
Code:
1addressforpurchase, 0.1
bc1yourbech32address, !


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: BitMaxz on March 31, 2020, 11:47:15 PM
Sorry I should have been more clear, I'm not trying to make a single transaction from two addresses at once, I'm trying to redirect the UTXO of one of the addresses to my bech32 address, and then repeat the same process for my other address.

But anyway, I was wondering if I purchase something using my legacy address, how to redirect the UTXO from that address to my bech32 address/wallet. Same with my p2sh-segwit address.

It seems that you are talking about auto forwarder or redirect the unspent bitcoin from one of your addresses to your another bitcoin address.
Am I correct?

If I'm correct I think you will need a script to automate send the unspent bitcoin to your other wallet.

Take a look at this one Linux based below.
- https://bitcointalk.org/index.php?topic=214086.msg3361837#msg3361837

This might be what you looking for.


Title: Re: How to send unspent outputs to another address in Electrum?
Post by: Abdussamad on April 02, 2020, 08:29:04 PM
using the bech32 wallet you can sweep (https://bitcoinelectrum.com/sweeping-your-private-keys-into-electrum/) the two orphaned private keys (legacy and p2sh-segwit)  thereby sending the coins to an address in the bech32 wallet. make sure you append p2wpkh-p2sh: to the private key for the p2sh segwit address (3 address).