Bitcoinjs-lib: bip32 from bip39: Error: Expected Buffer, got Promise

Created on 5 Apr 2019  路  2Comments  路  Source: bitcoinjs/bitcoinjs-lib

My dependencies:

    "bip32": "^1.0.3",
    "bip39": "^3.0.0",
    "bitcoinjs-lib": "^5.0.0"

If I do

const mnemonic = 'praise you muffin lion enable neck grocery crumble super myself license ghost'

const seed = bip39.mnemonicToSeed(mnemonic)
const root = bip32.fromSeed(seed)

const node = root.derivePath("m/0'/0/0")

It stops with

Error: Expected Buffer, got Promise

It seems that bip32.fromSeed(seed) now it returns a promise to be solved?

Most helpful comment

Use bip39 v2 or switch to mnemonicToSeedSync.

v3 changed the API to use async Promises which are faster

All 2 comments

Use bip39 v2 or switch to mnemonicToSeedSync.

v3 changed the API to use async Promises which are faster

Can also resolve promises as follows 馃憤
`const mnemonic = 'praise you muffin lion enable neck grocery crumble super myself license ghost'

const seed = bip39.mnemonicToSeed(mnemonic)
seed.then( s => {
const root = bip32.fromSeed(s)
const node = root.derivePath("m/0'/0/0")`
})

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itsMikeLowrey picture itsMikeLowrey  路  3Comments

Beardcoding picture Beardcoding  路  3Comments

LeonYanghaha picture LeonYanghaha  路  3Comments

ghost picture ghost  路  3Comments

namnv04 picture namnv04  路  3Comments