I am searching for an exact python code that can take a standard wallet seed as input and output the the root key or xpub master public key. I had tried several codes but none of them gave me the 'exact same' xpub mpk as of the real electrum wallet. Can I get some help.

  • thanks to give me this website name but this might take some time to understand what all this site has to offer. I will answer the question my self I got any break through .Thanks again
    – he lo
    Commented Jan 25 at 19:52
  • iancoleman xpub doesn't match the electrum one
    – he lo
    Commented Jan 25 at 20:01

1 Answer 1


You cannot convert an Electrum seed phrase to a BIP39 seed phrase, because in the process of deriving the master private keys, both algorithms use a different salt. This means, you cannot use Electrum seed phrases to generate BIP39-phrase addresses.

However, it is possible to derive Electrum addresses from Electrum seed phrases even outside Electrum. There is a short guide here even though it is for testnet, it also works for mainnet just by switching the coin type.

To quote it:

  1. Download bip39-standalone.html.

  2. Go to line 28611 and replace "return h == nh;" with "return true;".

  3. Go to line 28639 and replace "mnemonic" with "electrum".

  4. Open bip39-standalone.html in your browser and paste your seed phrase.

  5. Select "Bitcoin - Testnet" from "Coin".

  6. In "Derivation Path", select BIP141, P2WPKH and use: m/0'/0

Note: To get P2PKH address use the m/0 path, m/0'/0 is only for Electrum's segwit P2WPKH.

  • the answer is correct and i also found a working tool right next to what you mention here github.com/FarCanary/ElectrumSeedTester
    – he lo
    Commented Jan 26 at 12:21
  • actually its js code also i am unable to extract any python code from it or interpret how the html is actually calculating in short no progress made
    – he lo
    Commented Jan 26 at 13:34

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.