0

The below is the snippet from bip-32. I do not understand under what circumstance would 'parent extended public key' be exposed? In the case of e-commerce a 'child extended public key' is derived from 'parent extended public key'. The e-commerce website only needs to know 'child extended public key' to derive public key/addresses. In such case, will knowing 'child extended public key' expose 'parent extended private key'?

"One weakness that may not be immediately obvious, is that knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key (and thus every private and public key descending from it)."

Example of code snippet in Javascript

function testXPub() {
 const mnemonic = 'ddddddddddddddddddddddddddddddddddddddddddddddd'
 const seed = bip39.mnemonicToSeed(mnemonic)
 const node = bip32.fromSeed(seed)
 const xpubNode = node.neutered()
 console.log("xpubNode :%o", xpubNode)
 console.log("xpubNode (string): %o", xpubNode.toBase58())

 const xpub_m_0_node = xpubNode.derive(0)
 console.log("xpub_m_0_node :%o", xpub_m_0_node)
 console.log("xpubNode (string): %o", xpub_m_0_node.toBase58())
 const xpub_m_0_0_node = xpubNode.derive(0).derive(0)
 console.log("xpub_m_0_0_node :%o", xpub_m_0_0_node)
 console.log("xpubNode (string): %o", xpub_m_0_0_node.toBase58())
}

So instead of sharing xpubNode, i would share xpub_m_0_0_node.

  • Not sure how is related to the suggested link? I am interested to understand as per bip32, why would anyone share the 'parent extended public key'? The use case for xpub I assume will be the 'child extended public key' derive from parent extended public key. – brianinhk Aug 14 '18 at 14:25
0

I am interested to understand as per bip32, why would anyone share the 'parent extended public key'?

The purpose of sharing the parent extended public key is so that child public keys (and thus addresses) can be derived from it without needing to know about a bunch of addresses individually. This is easier for separated setups where an online computer only has the public keys as the online computer does not need to be constantly refreshed with more addresses to watch for. It can generate the addresses itself.

In such case, will knowing 'child extended public key' expose 'parent extended private key'?

No. Only knowing both the parent extended public key and a child private key derived with unhardened derivation exposes the parent private key.

  • For the first question, wouldn't the online computer only needs 'child extended public key' to be able to generate new addresses without need of private key? I assume 'child extended public key' will be derive from another machine by another person using 'parent chain code', 'parent public key and non hardened index. – brianinhk Aug 15 '18 at 12:00
  • A child public key cannot derive its siblings. It can only derive its own children, so it itself becomes a parent public key. – Andrew Chow Aug 15 '18 at 17:17
  • I am only interested to understand if i have a child extended public key which is derived from extended public key, will the 'child extended public key' with any non-hardened private key descending from it susceptible for someone to know super parent extended private key? i.e. 'extended private key' --derive--> 'extended public key' --derive--> 'extended public key' – brianinhk Aug 19 '18 at 2:46
  • No, as I said in my answer, it is impossible to derive any parent keys from just child key, extended or not, public or not. – Andrew Chow Aug 19 '18 at 3:38
  • Sorry, Andrew, I am still not getting it. I have edited my answer with a sample code in Javascript. If you see from the above, I can derive many level of extended public key. Is that not true? – brianinhk Aug 19 '18 at 3:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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