Bitcoin Forum
January 18, 2021, 07:53:27 AM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum/Bitcoin Core Importing Keys  (Read 150 times)
NameTaken
Hero Member
*****
Offline Offline

Activity: 630
Merit: 502


View Profile
January 31, 2018, 11:28:58 AM
 #1

I created a new Electrum 3.0.5 Segwit wallet then exported its private keys but when trying to import those keys into Bitcoin Core 0.16, I get "Invalid private key encoding" error.
When I create a Bech32 address in Bitcoin Core then import that private key into Electrum, the public address gets converted into legacy format starting with "1".
1610956407
Hero Member
*
Offline Offline

Posts: 1610956407

View Profile Personal Message (Offline)

Ignore
1610956407
Reply with quote  #2

1610956407
Report to moderator
1610956407
Hero Member
*
Offline Offline

Posts: 1610956407

View Profile Personal Message (Offline)

Ignore
1610956407
Reply with quote  #2

1610956407
Report to moderator
1610956407
Hero Member
*
Offline Offline

Posts: 1610956407

View Profile Personal Message (Offline)

Ignore
1610956407
Reply with quote  #2

1610956407
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 302

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
January 31, 2018, 06:15:10 PM
 #2

Hello, stranger from the future.
How is Bitcoin Core 0.16?
Abdussamad
Legendary
*
Offline Offline

Activity: 2716
Merit: 1305



View Profile
January 31, 2018, 09:34:43 PM
Last edit: January 31, 2018, 09:48:30 PM by Abdussamad
Merited by squatter (1), xdrpx (1)
 #3

Electrum went its own way with the private key format. See the release notes for 3.0:

https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES#L94

I strongly recommend simply sending the coins over to the core wallet in an on-chain transaction.

However if you want to convert the priv keys to a standard format then here is how you can do that:

On the console tab (view show > console if it doesn't appear) type this:

Code:
format,privkey,compressed=bitcoin.deserialize_privkey("<yourprivatekeyhere>")

Then to generate the key for importing into core do:

Code:
bitcoin.serialize_privkey( privkey, compressed, "p2pkh")

The above should output a key in the standard WIF. You may need to addwitnessaddress for this address in core's debug console.

NameTaken
Hero Member
*****
Offline Offline

Activity: 630
Merit: 502


View Profile
February 01, 2018, 02:28:08 AM
Last edit: February 01, 2018, 03:24:52 AM by NameTaken
 #4

Hello, stranger from the future.
How is Bitcoin Core 0.16?
I saw Bitcoin Core v0.16.0rc1 with full Segwit support was released so I compiled from source.

Electrum went its own way with the private key format. See the release notes for 3.0:

https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES#L94

I strongly recommend simply sending the coins over to the core wallet in an on-chain transaction.

However if you want to convert the priv keys to a standard format then here is how you can do that:

On the console tab (view show > console if it doesn't appear) type this:

Code:
format,privkey,compressed=bitcoin.deserialize_privkey("<yourprivatekeyhere>")

Then to generate the key for importing into core do:

Code:
bitcoin.serialize_privkey( privkey, compressed, "p2pkh")

The above should output a key in the standard WIF. You may need to addwitnessaddress for this address in core's debug console.


Thanks for the info. Fees shouldn't be much of a problem now by send from a Segwit address to another Segwit address. Last thing I'm wondering about is Electrum still supports importing normal Bech32 private key format but after importing from Bitcoin Core, the public address gets converted into legacy format starting with "1".
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!