Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add segwit xpub to ku #384

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion pycoin/cmds/ku.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from pycoin.networks.default import get_current_netcode
from pycoin.networks.registry import network_codes, network_for_netcode


HASH160_RE = re.compile(r"^([0-9a-fA-F]{40})$")


Expand Down Expand Up @@ -67,6 +66,21 @@ def add_output(json_key, value=None, human_readable_key=None):
if subkey_path:
add_output("subkey_path", subkey_path)

if isinstance(key, BIP32Node):
if(key._network.parse._bip49_pub_prefix and key._network.parse._bip49_prv_prefix):
if key._secret_exponent:
add_output("p2sh_segwit wallet key",
key._network.bip49_as_string(key.serialize(as_private=True), as_private=True))
add_output("p2sh_segwit public version",
key._network.bip49_as_string(key.serialize(as_private=False), as_private=False))

if(key._network.parse._bip84_pub_prefix and key._network.parse._bip84_prv_prefix):
if key._secret_exponent:
add_output("segwit wallet key",
key._network.bip84_as_string(key.serialize(as_private=True), as_private=True))
add_output("segwit public version",
key._network.bip84_as_string(key.serialize(as_private=False), as_private=False))

for k, v, text in key.ku_output():
add_output(k, v, text)

Expand Down
1 change: 1 addition & 0 deletions pycoin/networks/bitcoinish.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def electrum_public(master_public_key):

network.bip32_as_string = bip32_as_string
network.bip49_as_string = bip49_as_string
network.bip84_as_string = bip84_as_string
network.sec_text_for_blob = sec_text_for_blob
network.wif_for_blob = wif_for_blob

Expand Down