From ad3ef8d1aec5e6cd5cb36030dfb1f799f80f254c Mon Sep 17 00:00:00 2001 From: edtubbs Date: Mon, 4 Nov 2024 13:48:28 -0600 Subject: [PATCH] such: updated usage for public child keys doc: updated derive_child_keys and example in tools.md --- doc/tools.md | 12 +++++++++++- src/cli/such.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/tools.md b/doc/tools.md index 0610e98c7..221036e5b 100644 --- a/doc/tools.md +++ b/doc/tools.md @@ -67,7 +67,7 @@ Below is a list of all the commands and the flags that they require. As a remind | p2pkh | -k | -t | Generates a p2pkh address derived from the public key specified. Include the testnet flag if it was generated from testnet. | | bip32_extended_master_key | None | -t | Generate an extended master private key from a secp256k1 context for either mainnet or testnet. | | bip32maintotest | -p | None | Convert a mainnet private key into an equivalent testnet key. | -| derive_child_keys | -p, -m | -t | Generates a child key derived from the specified private key using the specified derivation path. +| derive_child_keys | -p, -m | -t | Generates a child key derived from the specified public or private key using the specified derivation path. | generate_mnemonic | None | -e, -y, -w, -b | Generates a 24-word english seed phrase randomly or from optional hex entropy. | | list_encryption_keys_in_tpm | None | None | List the encryption keys in the TPM. | | decrypt_master_key | -y | -j | Decrypt the master key with the TPM or SW. | @@ -135,6 +135,16 @@ Below are some examples on how to use the `such` tool in practice. > child index: -2147483647 > p2pkh address: DFqonEEA56VE8zEGvhXNgjiPT3PaPFNQQu +##### Derive public child key (second child key at level 2 in this case, non-hardened) + + ./such -c derive_child_keys -m m/1 -p dgub8sdBNNzYwKo1KKQcQoJXMDwEg3fgX52aY2aSuSGMXepn71kMtZoN7BVwWp7JT582EDT8djTpCMx7Nd62nJ8u8xNmszEXrmsHWf6XQccjiLg + > ext key: dgub8q9VuPpS4NijK4e7Cc7WaKGD6QHjUB3YkJi83imYVvBRGjrKwPcNFjNcmNt2UnEuhFmKhcmo8aRQABUhq55H3ackUBGj3nJDTMpcP6ALoiN + > extended pubkey: dgub8q9VuPpS4NijK4e7Cc7WaKGD6QHjUB3YkJi83imYVvBRGjrKwPcNFjNcmNt2UnEuhFmKhcmo8aRQABUhq55H3ackUBGj3nJDTMpcP6ALoiN + > pubkey hex: 02cbfea5f5cf7d28b9111e92f05356a39a64f19247e539b428ef91e70a6900ae71 + > depth: 2 + > child index: 1 + > p2pkh address: D7M52mS3ZTrPXgRmfjpV5pPSG2E2TsfZAi + #### Generate a random BIP39 seed phrase #### See "Seed phrases" in address.md, for additional guidance diff --git a/src/cli/such.c b/src/cli/such.c index 5b615b476..d2827c053 100644 --- a/src/cli/such.c +++ b/src/cli/such.c @@ -655,7 +655,7 @@ static void print_usage() printf("mnemonic_to_key (requires -n or -y , -j (use_tpm), -o , -g , -i and -a, all optional),\n"); printf("mnemonic_to_addresses (requires -n or -y , -j (use_tpm), -o , -g , -i and -a, all optional),\n"); printf("print_keys (requires -p ),\n"); - printf("derive_child_keys (requires -m -p ),\n"); + printf("derive_child_keys (requires -m -p ),\n"); printf("sign (-x -s