Skip to content

Instantly share code, notes, and snippets.

@SomberNight
Last active November 4, 2022 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SomberNight/30e98a0e384cec2c1dc970d6c88c5a49 to your computer and use it in GitHub Desktop.
Save SomberNight/30e98a0e384cec2c1dc970d6c88c5a49 to your computer and use it in GitHub Desktop.
Extract seed and xprv from seed_v14 Electrum wallet file using modern Electrum
# Script to extract seed and xprv from old "v14" wallet file using modern Electrum (tested with 4.3.2).
# You can use this script if you are getting the following error when opening your wallet:
# WalletFileException("Your wallet has an unsupported seed version: 14.\n\nTo open this wallet, try 'git checkout seed_v14'")
import json
import electrum
from electrum.storage import WalletStorage
from electrum.keystore import BIP32_KeyStore
password = "1234"
path = "/home/user/.electrum/wallets/this_should_be_the_path_to_your_wallet_file"
storage = WalletStorage(path)
if not storage.file_exists():
raise Exception("wallet file not found")
if storage.is_encrypted():
storage.decrypt(password)
data = json.loads(storage.read())
ks_dict = data['keystore']
assert ks_dict.get('type') == 'bip32'
ks = BIP32_KeyStore(ks_dict)
seed = ks.get_seed(password)
print(f"seed: {seed}")
xprv = ks.get_master_private_key(password)
print(f"xprv: {xprv}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment