Also, because of this, you're also unable to import a segwit WIF from Electrum into Bitcoin Core because Core doesn't understand the custom WIF.
However, Electrum internally maintains backwards compatibility so you can convert an Electrum custom WIF to one Core understands.
How To Convert An Electrum segwit WIF to standard WIF
For P2SH-P2WPKH addresses:
Open the console in Electrum and type the following code . (Press enter after each line)
Code:
key = 'L4wAtJ8RYaxtRYZxUwZRH8qGYVv1LUP3RAh9ER9KK2HeTXW6v4Ru'
txin_type, secret, compressed = bitcoin.deserialize_privkey(key)
wif2 = bitcoin.serialize_privkey(secret, compressed, 'p2wpkh-p2sh')
print(wif2)
It should print a WIF that you can import into Bitcoin Core.
For P2WPKH addresses (Bech32)
Type the following code, replacing the private key there with yours.
Code:
key = 'LAst2SKVNx36PUY2q49cyLCcpze1YMvdJ66z3uKuiyaLKTVVsH3J'
txin_type, secret, compressed = bitcoin.deserialize_privkey(key)
wif2 = bitcoin.serialize_privkey(secret, compressed, 'p2pkh')
print(wif2)
How To Import Segwit WIF from Bitcoin Core to Electrum
This one is simple to do.
NB: For this to work you need to be on Electrum version 3.1.1 and above
For P2SH-P2WPKH addresses (Addresses starting with "3")
Just add p2wpkh-p2sh: directly in front of your private key.
For example
Code:
p2wpkh-p2sh:5BitcoinPrivateKey
For P2WPKH addresses (Bech32, starting with 'bc1')
This time we'll add p2wpkh: in front of the private key.
For example
Code:
p2wpkh:5PrivateKey