I have a segwit private key that I generated from another app. How can I create a new electrum wallet file with just this private key in there?

I tried creating a new electrum 3 wallet with this command: electrum create --segwit

Then I tried to do an importpirvkey but it says that type of wallet doesnt support importing of addresses. How can I import my bc1 address into electrum as my only address?


1 Answer 1


Use this python script:

from electrum import bitcoin

print( bitcoin.serialize_privkey( privkey, compressed, "p2wpkh") )

Run the above in python 3 and then import the priv key it outputs into electrum as per this guide.

The reason you have to do this is because Electrum went its own way with the private key format. See the release notes for 3.0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.