I'm still new to bitcoin and experimenting a lot with bitcoinjs-lib in JavaScript.
How do I create a readable string from a private key? This is my current setup:
const seed = bip39.mnemonicToSeed(seedPhrase)
const bitcoinNetwork = bitcoin.networks.testnet
const hdMaster = bitcoin.bip32.fromSeed(seed, bitcoinNetwork) // seed from above
const keyPair = hdMaster.derivePath('m/0')
// try to get private key as readable string
const privateKeyBuffer = Buffer.from(keyPair.privateKey)
const privateKey = privateKeyBuffer.toString('utf8')
console.log('privateKey → ', privateKey)
// fail to get private key as readable string
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
any ideas for me?