0

Based on the answer HERE

The following is possible

entropy --> random number  --> phrase --> private key --> public key --> address
                   |                        ^   |
                   '------------------------'   +--> private key --> pubkey --> addr
                                                +--> private key --> pubkey --> addr
                                                :
                                                '--> private key --> pubkey --> addr

Because HD wallets generate a new address for each transaction, behind the scenes they are using the fixed derivation path to generate new private keys and public keys from which to create the address.

many other private keys are generated from this using a "derivation path" which can differ between different brands of wallet. The derivation path is chosen by the developers and some different developers chose different derivation paths.

So my question how do i generate a private key from another private key or derivation path like stated in the answer of that post?

1

1 Answer 1

1

To generate a private key from another private key or derivation path, you can use a process called "key derivation". Key derivation is a way to create a new private key from an existing private key by using a mathematical function.

To derive a private key from another private key, you can use a key derivation function (KDF) such as PBKDF2 (Password-Based Key Derivation Function 2) or BIP32 (Bitcoin Improvement Proposal 32). These functions use the existing private key and a derivation path (a series of numbers and letters that specify how the new private key should be derived) as input, and produce a new private key as output.

Here is an example of how you might use BIP32 to derive a new private key from an existing private key:

# Import the BIP32 library
import BIP32

# Create a BIP32 instance
bip32 = BIP32.new()

# Set the existing private key
bip32.set_private_key(existing_private_key)

# Derive the new private key using the specified derivation path
new_private_key = bip32.derive_path(derivation_path)

Note that the exact steps for generating a private key from another private key will vary depending on the specific KDF and programming language you are using. It is also important to keep your private keys safe and secure, as they can be used to access and spend your Bitcoin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.