Skip to content

Instantly share code, notes, and snippets.

@jonatack
Forked from mflaxman/trezor_recovery.py
Created August 16, 2017 17:41
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 jonatack/057ec77259ede24b91c3f19aed4a0eb8 to your computer and use it in GitHub Desktop.
Save jonatack/057ec77259ede24b91c3f19aed4a0eb8 to your computer and use it in GitHub Desktop.
Proof you can recover your Trezor funds without a Trezor (if it breaks and/or the company goes out of business)
from bitmerchant.wallet import Wallet
from mnemonic import Mnemonic
# put in whatever Trezor generates for you here (or backup from this empty/insecure one as a test)
mnemonic = 'clean health food open blood network differ female lion eagle rough upon update zone antique defense venture uncover mobile charge actress film vocal enough'
passphrase = '' # empty string or whatever you actually choose
path = "m/44'/0'/0'/0/0" # whatever shows up on the UI for that account (everything will start with m/44'/0' since it's bip44)
child = Wallet.from_master_secret(Mnemonic('english').to_seed(mnemonic, passphrase)).get_child_for_path(path)
child.to_address() # '18K9axbPpwqZgngB58nuwsYevL2z6ey4YG' (confirm this matches what Trezor is showing you)
child.export_to_wif() # 'L4orhKxb9YSGRHZvv8th3KeUqRz6x3PPmdqLThajUgSesTovfKPG' (what you can use to spend the funds for the previous address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment