0

I am trying to run the example code in the bip32-utils taken here (https://github.com/bitcoinjs/bip32-utils) of:

const bip39 = require('bip39')
const bitcoin = require('bitcoinjs-lib')
const bip32utils = require('bip32-utils')

let mnemonic = bip39.generateMnemonic()
let seed = bip39.mnemonicToSeedSync(mnemonic)

let hdNode = bitcoin.bip32.fromSeed(seed)

let childNode = hdNode.deriveHardened(0)
let external = childNode.derive(0)
let internal = childNode.derive(1)
let account = new bip32utils.Account([
  new bip32utils.Chain(external.neutered()),
  new bip32utils.Chain(internal.neutered())
])

console.log(account.getChainAddress(0))

But i keep getting this typeError of node.getAddress is not a function, any suggestions?

1 Answer 1

1

Bitcoinjs-lib no longer contains the BIP-32 functionality you are trying to use:

https://github.com/bitcoinjs/bitcoinjs-lib/commit/84bc2ea6bf62ddb26fa9cb023b765d414f98f982

You need to use https://github.com/bitcoinjs/bip32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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