Skip to content

Instantly share code, notes, and snippets.

@XertroV
Last active August 29, 2015 14:05
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 XertroV/de7c9de6d6f94e855cc6 to your computer and use it in GitHub Desktop.
Save XertroV/de7c9de6d6f94e855cc6 to your computer and use it in GitHub Desktop.
""" Trezor wipe-and-load script. Generates fresh keys (or inserts predetermined mnemonic) """
from trezorlib.client import TrezorClient
from trezorlib.transport_hid import HidTransport
import mnemonic
m = mnemonic.Mnemonic('english')
priv = m.generate(256)
devices = HidTransport.enumerate()
transport = HidTransport(devices[0])
client = TrezorClient(transport)
status = client.wipe_device()
print status
pin = ""
pin_protect = False
label = "My Sexy Trezor"
lang = "en"
# HINT: to restore from a seed, just copy paste the wordlist in here:
# priv = 'words go here in order'
status = client.load_device_by_mnemonic(priv, pin, pin_protect, label, lang)
print status
print
print 'BACKUP SEED:'
print priv
print repr(priv)
print
print 'Some addrs:'
for i in range(10):
print client.get_address('Bitcoin', [i])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment