bitcoinjs / bip32

A BIP32 compatible library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exporting public keys

eozturk1 opened this issue · comments

I asked this on StackOverflow but got no response.

How can one export the derived public keys in a non-binary format? For instance,

var node = bip32js.bip32.fromBase58('<some private key>');
var child = node.derivePath('m/0/0');
var publicKey = child.publicKey(); // This gets the public key for the child
console.log(btoa(publicKey)) // This gives an error since the returned public key is not a string

publicKey is a Buffer.

publicKey.toString('hex') will turn it into a hex string.