Note: this is no longer recommended since p2wpkh (bech32) support among other wallets/sites/exchanges has reached a very high level. Just choose segwit when creating an electrum wallet.
Electrum’s usual segwit wallets are not p2sh. They have bech32 (bc1..) addresses. That means that you may not be able to receive money in them from some wallets and websites because they don’t yet support bech32 addresses. p2sh segwit wallets OTOH use p2sh addresses beginning with 3 that everyone supports sending to.
On *nix systems including Linux, FreeBSD and MacOSx you can simply use this script to generate an extended private key and then pipe it to electrum:
python3 xprv.py -g p2wpkh-p2sh -d "m/" -p|electrum -w wallet_file_name restore -
1. Get Entropy
On Windows create an electrum wallet and then abort the process once you’ve acquired an Electrum generated seed.
Then you restore your wallet with two small changes to the usual process:
- During the seed entry screen click on options and check bip39. Then paste in the seed you generated in the first step. Electrum will warn you that this is not a valid bip39 seed but it’ll let you proceed to the next step anyway.
- The next step is the one where you set the derivation path and there you click on “p2sh-segwit BIP49”
That’s it. You will now have a p2sh segwit wallet. You can confirm by looking at Wallet menu > Information where it should say p2wpkh-p2sh as the script type.
Because you are using the seed mnemonic in an unusual way you cannot rely on it as a form of backup. Instead make a soft copy backup via file menu > save copy.