<p>To generate a private key from another private key or derivation path, you can use a process called &quot;key derivation&quot;. Key derivation is a way to create a new private key from an existing private key by using a mathematical function.</p>
<p>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.</p>
<p>Here is an example of how you might use BIP32 to derive a new private key from an existing private key:</p>
<pre class="lang-python prettyprint-override"><code># 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)
</code></pre>
<p>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.</p>

CC BY-SA 4.0
2022-12-05T17:59:32.147Z
2022-12-05T17:59:32.147Z
Monstrum
<p>Based on the answer <a href="https://bitcoin.stackexchange.com/questions/100891/what-is-the-relationship-between-a-bitcoin-private-key-public-key-address">HERE</a></p>
<p>The following is possible</p>
<pre><code>entropy --&gt; random number  --&gt; phrase --&gt; private key --&gt; public key --&gt; address
                   |                        ^   |
                   '------------------------'   +--&gt; private key --&gt; pubkey --&gt; addr
                                                +--&gt; private key --&gt; pubkey --&gt; addr
                                                :
                                                '--&gt; private key --&gt; pubkey --&gt; addr
</code></pre>
<blockquote>
<p>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.</p>
<p><em>many other private keys are generated from this using a &quot;derivation path&quot; which can differ between different brands of wallet. The
derivation path is chosen by the developers and some different
developers chose different derivation paths.</em></p>
</blockquote>
<p>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?</p>

CC BY-SA 4.0
2022-12-05T13:35:04.560Z
See https://tzumby.github.io/bip32_cheat_sheet/
RedGrittyBrick
<private-key><bip32-hd-wallets>
how to generate private keys from derivation paths or from another private keys?
Alexio puk2sefu
# how to generate private keys from derivation paths or from another private keys?

(Asked by: username_0 on 2022-12-05)

Based on the answer [HERE](https://bitcoin.stackexchange.com/questions/100891/what-is-the-relationship-between-a-bitcoin-private-key-public-key-address)

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?

**Tags:** private-key, bip32-hd-wallets

> **Comments:**
> **username_1**: See https://tzumby.github.io/bip32_cheat_sheet/  

---

## 1 answers

### Answer by username_2 on 2022-12-05. Score: 1 | Accepted answer

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:

```python
# 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.


---

