I'm testing segwit bech32 addresses and generated the following using bitcoinjs:

address: bc1qc7u5njf4nf2rj3zys642mfc7nct6kdven8j4e9

private key: 5Kkzs8XrJNAmf9VQDFeGBfaRvSByAvPK6DbDXw5BVqswWaXSG2Y

When I import this private key into electrum 3.0.5, it imports it as the following address: 1KD3SE71kGAcxw57BvcmUzsHwx3QxdPBW7

How do I go about sweeping funds from the bc1... address if electrum 3.0.5 sees the legacy format address instead?


Use Electrum 3.1.1 and prepend "p2wpkh:" to the private key before importing or sweeping it. For example:


enter image description here

  • how do you output the segwit address just to make sure it matches that private key? Mar 24 '18 at 4:23
  • 1
    bitcoin.address_from_private_key("p2wpkh:5Kkzs8XrJNAmf9VQDFeGBfaRvSByAvPK6DbDXw5BVqswWaXSG2Y") in the console tab of electrum (view menu> show console if you can't see that tab)
    – Abdussamad
    Mar 24 '18 at 4:28
  • thanks! I'm curious to how did you even figure this out to put "p2wpkh:" in front of the address? Mar 26 '18 at 16:19
  • @Patoshiパトシ It's in the release notes for 3.1: github.com/spesmilo/electrum/blob/master/RELEASE-NOTES#L72
    – Abdussamad
    Mar 27 '18 at 14:38
  • thanks. I'm trying to output the 3xxx address and tried p2sh:5Kkzs8XrJNAmf9VQDFe.... that doesnt work. what is the prefix for that? Mar 27 '18 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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