bitcoin-ibe
bitcoin-ibe copied to clipboard
How to derive child from ParentPublicKey?
Here is my code:
/**
* Derive a child from an Xpub using a string for derivation
*
* See: https://github.com/monkeylord/bitcoin-ibe#derive-public-key-with-parent-public-key
*
* @param xpub Xpub string (ex: xpub123....
* @param derive arbitrary derivation string (ex: "some string")
*/
public deriveChildFromXpub(xpub: string, derive: string): string {
const pubKey = new bsv.HDPublicKey(xpub);
const childPublicKey = ibe.CKDpub(pubKey, derive); // ERROR HERE!
const bsvAddres = new bsv.Address(childPublicKey.publicKey);
return bsvAddres.toString();
}
Here is the error I get with the latest version of bsv.js
First argument is an unrecognized data format.\n
at PublicKey._classifyArgs (/Users/user/git/me/api/node_modules/bsv/lib/publickey.js:86:11)