in

Bitcoin : Help with BitcoinJS-lib

Bitcoin : Help with BitcoinJS-lib



Hello, i’m learning about bitcoin, and bitcoinjs-lib (https://github.com/bitcoinjs/bitcoinjs-lib)

I created a dummy wallet on coinomi using this mnemonic (‘eight better wealth display father cave suffer game sign health fit exchange noble tunnel poet remember owner letter submit illness cage calm dry noble’)

and i’m trying to generate a Deterministic wallet with it.

Here is my code

` const bip39 = require(‘bip39’)`

` const bip32 = require(‘bip32’)`

` const bitcoin = require(‘bitcoinjs-lib’)`

` const network = bitcoin.networks.bitcoin;`

` function getAddress (node) {`

` return bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address`

` }`

` const mnemonic = ‘eight better wealth display father cave suffer game sign health fit
exchange
noble tunnel poet remember owner letter submit illness cage calm dry noble’`

` console.log(‘Testing mnemonic: ‘,bip39.validateMnemonic(mnemonic))`

` const seed = bip39.mnemonicToSeed(mnemonic)`

` const root = bip32.fromSeed(seed)`

` console.log(“m/0’/0/1 ->”,getAddress(root.derivePath(“m/0’/0/1”)));`

` console.log(“m/0’/0/2 ->”,getAddress(root.derivePath(“m/0’/0/2”)));`

.

and this is the output that i got

.

`Testing mnemonic: true`

`m/0’/0/1 -> 17tdSW83Vjw23TdQsmZDtBAupan9WiGGd5`

`m/0’/0/2 -> 17bYSjEXwZxMgVkRRt9pJgDgExiX8Xht3b`

Then I go to (https://www.coinomi.com/recovery-phrase-tool.html) to test if my results are correct, and it isn’t, could someone help me with this please. How to fix the code?




View the link

Bitcoin



Bitcoin is a distributed, worldwide, decentralized digital money. Bitcoins are issued and managed without any central authority.
FindCrypto scans the web for the latest Bitcoin news, so you can find all the latest and breaking news in one convenient location.Author: Iniroo

Score: 2

Don’t forget to share the post if you love it !

Bitcoin : EatBCH update for June

CryptoCurrency : Trade War Will Launch Bitcoin As The New Gold