<p>Yes, parent extended private key(xprv) is required to derive hardened child xpub. You may use non-hardened derivation for child keys if you don't want access to parent xprv, but less secure as exposure of one child private key and parent xpub can result in all coins stolen.</p>
<p>You can find the detail of child key derivation(CKD) functions in <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions" rel="nofollow noreferrer">BIP32</a>.</p>

CC BY-SA 4.0
2024-07-23T18:13:22.993Z
That's what I thought. I believe hardened derivation is best for my project so I'm going to try a workaround where I generate many child xpubs at a time and store them along with their derivation paths so I can query that file for "new" extended keys. Thanks for the help!
Myles Sherman
CC BY-SA 4.0
2024-07-23T06:07:39.507Z
2024-07-23T06:07:39.507Z
Hyunhum Cho
<p>I am trying to create a java method that gets the xPub associated at the childnumber of the input hardened:</p>
<pre><code>  private String getDerivedXPubFromPathAndXPub(Integer childNumber, String xPub) {
    return childXPub;
  }
</code></pre>
<p>For example, getDerivedXPubFromPathAndXPub(20, xpub123) would return the child at m/20H where m is xpub123. Do I need to have the xpriv for xpub123 in order to do so? This method in my program is used for account creation and I need to find a way to create new master keys from a single key without 24/7 access to my private keys.</p>

<bip32-hd-wallets><java><xpub><bip><hardened-derivation>
xPriv needed to derive hardened child xPubs?
Myles Sherman
# xPriv needed to derive hardened child xPubs?

(Asked by: username_0 on 2024-07-20)

I am trying to create a java method that gets the xPub associated at the childnumber of the input hardened:

```
  private String getDerivedXPubFromPathAndXPub(Integer childNumber, String xPub) {
    return childXPub;
  }

```

For example, getDerivedXPubFromPathAndXPub(20, xpub123) would return the child at m/20H where m is xpub123. Do I need to have the xpriv for xpub123 in order to do so? This method in my program is used for account creation and I need to find a way to create new master keys from a single key without 24/7 access to my private keys.

**Tags:** bip32-hd-wallets, java, xpub, bip, hardened-derivation


---

## 1 answers

### Answer by username_1 on 2024-07-23. Score: 1

Yes, parent extended private key(xprv) is required to derive hardened child xpub. You may use non-hardened derivation for child keys if you don't want access to parent xprv, but less secure as exposure of one child private key and parent xpub can result in all coins stolen.

You can find the detail of child key derivation(CKD) functions in [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions).

> **Comments:**
> **username_0**: That's what I thought. I believe hardened derivation is best for my project so I'm going to try a workaround where I generate many child xpubs at a time and store them along with their derivation paths so I can query that file for "new" extended keys. Thanks for the help!  

---

