Skip to content

Commit

Permalink
Revert "derivation from just a master public key (#11140)" (#11143)
Browse files Browse the repository at this point in the history
This reverts commit db536c6.
  • Loading branch information
wjblanke authored and emlowe committed Apr 21, 2022
1 parent 0f44195 commit 004dfa9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
7 changes: 0 additions & 7 deletions chia/cmds/keys_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
master_sk_to_pool_sk,
master_sk_to_wallet_sk,
master_sk_to_wallet_sk_unhardened,
master_pk_to_wallet_pk_unhardened,
)


Expand Down Expand Up @@ -98,13 +97,7 @@ def show_all_keys(show_mnemonic: bool, non_observer_derivation: bool):
if non_observer_derivation
else master_sk_to_wallet_sk_unhardened(sk, uint32(0))
)
# Test pk derivation
wallet_root_unhardened = master_pk_to_wallet_pk_unhardened(sk.get_g1(), uint32(0))
wallet_address: str = encode_puzzle_hash(create_puzzlehash_for_pk(first_wallet_sk.get_g1()), prefix)
wallet_address_from_unhard_root: str = encode_puzzle_hash(
create_puzzlehash_for_pk(wallet_root_unhardened), prefix
)
assert wallet_address == wallet_address_from_unhard_root
print(f"First wallet address{' (non-observer)' if non_observer_derivation else ''}: {wallet_address}")
assert seed is not None
if show_mnemonic:
Expand Down
15 changes: 0 additions & 15 deletions chia/wallet/derive_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ def _derive_path(sk: PrivateKey, path: List[int]) -> PrivateKey:
return sk


def _derive_path_pub(pk: G1Element, path: List[int]) -> G1Element:
for index in path:
pk = AugSchemeMPL.derive_child_pk_unhardened(pk, index)
return pk


def _derive_path_unhardened(sk: PrivateKey, path: List[int]) -> PrivateKey:
for index in path:
sk = AugSchemeMPL.derive_child_sk_unhardened(sk, index)
Expand All @@ -46,20 +40,11 @@ def master_sk_to_wallet_sk_intermediate(master: PrivateKey) -> PrivateKey:
return _derive_path(master, [12381, 8444, 2])


def master_pk_to_wallet_pk_intermediate(master: G1Element) -> G1Element:
return _derive_path_pub(master, [12381, 8444, 2])


def master_sk_to_wallet_sk(master: PrivateKey, index: uint32) -> PrivateKey:
intermediate = master_sk_to_wallet_sk_intermediate(master)
return _derive_path(intermediate, [index])


def master_pk_to_wallet_pk_unhardened(master: G1Element, index: uint32) -> G1Element:
intermediate = master_pk_to_wallet_pk_intermediate(master)
return _derive_path_pub(intermediate, [index])


def master_sk_to_wallet_sk_unhardened_intermediate(master: PrivateKey) -> PrivateKey:
return _derive_path_unhardened(master, [12381, 8444, 2])

Expand Down

0 comments on commit 004dfa9

Please sign in to comment.