mcdallas / cryptotools

MIT License
206 stars 80 forks source link

Get a P2WSH-P2SH address from Xprv.from_mnemonic #7

Closed reiven closed 5 years ago

reiven commented 5 years ago

Hi, it will be great to get a P2WSH-P2SH address from HD Wallet, in the same way Trezor and Ledger are doing. Is there any way to do so?

reiven commented 5 years ago

Sorry, i've just found a way to do this:

>>> m = Xprv.from_mnemonic('twelve words .. ..')
>>> M = m.to_xpub()
>>> (M/44/0/0/0/0).key.to_address('P2WPKH-P2SH')
'2N95dX2Pg6ntvpQbj8YZNhfBhv8HjyYkWp6'