Bitcoin Forum

Bitcoin => Electrum => Topic started by: cellard on March 10, 2019, 03:41:22 AM



Title: Move bech32 private keys into Core?
Post by: cellard on March 10, 2019, 03:41:22 AM
Which is the correct and definitive best way to do this? I want to move some coins in an electrum wallet, inside a regular wallet.dat Core wallet. I don't want to send the coins, I just want to own the private keys. How do I exactly do this move? Im not familiar with electrum. In Core I don't remember how to import the private keys but I think it was pretty easy, I can look it up. I just want to know if someone has done this recently in recent versions, because many tutorials are now outdated as both the GUi and the cvar commands change over time.


Title: Re: Move bech32 private keys into Core?
Post by: pooya87 on March 10, 2019, 04:05:06 AM
Which is the correct and definitive best way to do this?

the "correct" way is ALWAYS to move the coins also known as sweeping whenever you want  to change wallets for many reasons including security ;)

How do I exactly do this move? Im not familiar with electrum.
i am assuming you are using the latest version, if you are using a version between 3.0 and 3.0.6, this answer is invalid due to the usage of versioned private keys which need to be converted first (upgrading to latest version takes care of that)

go to your address tab and select the address you want to transfer, right click on it and select Private Key. (if you have password it will be required) a new window will show up showing you the private key which will be in form of type:key
in your case it will be p2wpkh:<privatekey> so just copy the <privatekey> part and import that in your core wallet.

Quote
In Core I don't remember how to import the private keys but I think it was pretty easy, I can look it up.
i am not familiar with core that much but i believe in there you don't have the option to tell the wallet the address type! so it checks all the possible addresses!


Title: Re: Move bech32 private keys into Core?
Post by: HCP on March 10, 2019, 07:43:37 AM
i am not familiar with core that much but i believe in there you don't have the option to tell the wallet the address type! so it checks all the possible addresses!
Correct... In Bitcoin Core, you don't have the option to tell the wallet the address type when importing... but I believe that it doesn't check all of them. Instead, it simply imports the private key and creates the address for whatever addresstype the wallet is currently set to.

By default, Bitcoin Core uses "ps2h-segwit" addresses, but you can specify the -addresstype option on the commandline (or in bitcoin.conf) when starting up to override this temporarily... import your key to create the address you want, then shutdown and restart without the option specified to return back to default.
Quote
-addresstype

What type of addresses to use ("legacy", "p2sh-segwit", or "bech32", default: "p2sh-segwit")

Note: I have NOT tested this, so would advise running some tests on a dummy wallet.dat before attempting this to ensure that it works as you want before attempting it on a "live" wallet.

OP should also note that as pooya87 suggested, sweeping the coins would be the ideal solution... by importing a private key, you will need to ensure that you update all your backups of wallet.dat as older versions of the wallet.dat will not be able to recover that private key as it was not created by the embedded seed.


Title: Re: Move bech32 private keys into Core?
Post by: cellard on March 11, 2019, 03:35:22 AM
you will need to ensure that you update all your backups of wallet.dat as older versions of the wallet.dat will not be able to recover that private key as it was not created by the embedded seed.

Well I just realized this is key. I just wanted to avoid having to contact the chipmixer admin to change my address if I could avoid it since managers are too busy and so I am. There's also the nice feel of having an older coinbase for hodlers but I guess that's just a geeky thing.

Another reason was to have the key on my wallet so I don't need to keep track of an additional wallet (in this case the electrum wallet). Even if you move the coins and the electrum wallet is worth 0 after, you still want to have access to that private key. For instance lets say you sell these coins someday to buy a house, authorities may ask for origin of funds. The key must coincide with the moment where accrual happens, as in being able to prove it came from a legit activity (in this case, the address matching with the payment from the manager, so you can sign it and prove it).

I am just trying to stay ahead when it comes to taxes, trying to get everything in order. When BTC is worth $100k in a couple of years people will want to buy some property with it and then you must be ready for an audit and things like these can make the difference from avoided getting f*cked in the ass by the confiscator.