-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Update: here's code to meet the 39 and 44 spec, but since they use hardened derivation for the change and receiving trees it breaks the general structure of the wallet and requires a much bigger re-write :(
# This matches https://www.reddit.com/r/Bitcoin/comments/2srxr2/what_is_the_difference_between_bip_32_and_bip_44/
from mnemonic import Mnemonic
m = Mnemonic('english')
hexlify(m.to_seed(mnemonic='cheese upset pudding inmate flavor crush hard same element index laugh supreme'))
b'8b3137dc79f912e4c5cddbe4bbe313abd0a0a8cf2441dcf4d664655087e8c202431e8e7b2503e63426703b3c773a12473a94c39058e7fb0784ab570b80ed0a23'
from bitmerchant.wallet import Wallet
from binascii import unhexlify
wallet = Wallet.from_master_secret(unhexlify(b'8b3137dc79f912e4c5cddbe4bbe313abd0a0a8cf2441dcf4d664655087e8c202431e8e7b2503e63426703b3c773a12473a94c39058e7fb0784ab570b80ed0a23'))
wallet.serialize_b58()
xprv9s21ZrQH143K3Wjn9PzvdHooVbaSauXnawrxMhi7BdR1PrC41x51WTBWybzSjUaiPVH6BusrpupCkouMgAkBGtNJhb3bqpmRuKG5vrH96GL
wallet.get_child_for_path("m/44'/0'/0'/0/0").to_address() # '1LPdUu1qKXFTowobD9uB62QesdodtV2ugx'
change_wallet = wallet.get_child_for_path('''m/44'/0'/0'/0/0''')
change_wallet.to_address() # '1LPdUu1qKXFTowobD9uB62QesdodtV2ugx'
change_wallet.export_to_wif() # 'KziXBfNy2eZEKHdZeBZQ3ZyW3joXcv2k66yHuKPaDgNwEX76wMPU'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels