Last active
May 23, 2021 09:08
-
-
Save romanz/4b32782bfc0ff4984713 to your computer and use it in GitHub Desktop.
Creates public and private keys from Electrum 2.0 seed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' Run from "electrum/lib" directory. | |
''' | |
import bitcoin, mnemonic | |
mn = raw_input("Enter mnemonic (13 words)").strip() | |
s = mnemonic.Mnemonic.mnemonic_to_seed(mn, '') | |
print 'seed:', repr(s) | |
xprv, xpub = bitcoin.bip32_root(s) | |
print 'root:', xprv, xpub | |
xprv, xpub = bitcoin.bip32_private_derivation(xprv, "m/", "m/44'/0'") | |
print 'master:', xprv, xpub | |
xprv, xpub = bitcoin.bip32_private_derivation(xprv, "", "0'") # 1st account | |
print 'account #0:', xprv, xpub | |
# generate first receiving addresses (not change = #0) | |
for i in range(10): | |
prv, pub = bitcoin.bip32_private_derivation(xprv, "", "0/%d" % (i,)) | |
pub = bitcoin.deserialize_xkey(pub)[-1] | |
prv = bitcoin.deserialize_xkey(prv)[-1] | |
addr = bitcoin.public_key_to_bc_address(pub) | |
wif = bitcoin.SecretToASecret(prv, compressed=True) | |
print '%4d: %s %s' % (i, addr, wif) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes so I have cloned & altered it slightly to work with the current implementation in Electrum 2.7:
https://gist.github.com/kumrzz/9ca3fe4fcdf39ebd4a862154c5c2ddb3