I'm trying to understand bip32 hardened mechanism, but I'm confused about it.
I got xpubKey from this site, and what I'm trying to do is demonstrate failure when trying to generate child pubkey from hardened xpubkey.
Here's my test details.
- network : bitcoin testnet
- mnemonic : dash axis fat pilot truly river guitar sea tonight popular type ill inmate quote upset
- parent path : m/44'
parent xpubKey : tpubDA4h4NTsxqEXATU9dPS22ZVuBHd2jVketkP8RNhBZ6fMhW9WuMhrjf37qNmfmLQZoFreLmHf9LsTnvW2eJYx1fkzo7vVxsf7bKVixz2FjGw
target child path : m/44'/0 (non regular, just for test)
and I wrote some js code, and I assumed to fail, but succeeded.
const bitcoinjs = require('bitcoinjs-lib'); const xpubKey = 'tpubDA4h4NTsxqEXATU9dPS22ZVuBHd2jVk...'; const parentNode = bitcoinjs.bip32.fromBase58(xpubKey, bitcoinjs.networks.testnet); //////// // I THOUGHT BELOW WILL FAIL! //////// // trying to get m/44'/0 const derived = parentNode.derive(0); // result was valid public key for m/44'/0 console.log(derived.publicKey);
In my thought, if I have a valid xpubKey(hardened or not), means that I have a valid chain code and public key for current node (means that I can derive children).
So what's meaning of
Hardened public keys cannot derive any children?
FYI, I quoted that in this video (20:24).