Last active
June 7, 2019 05:09
-
-
Save fkfk/9a9041462c007994f12e20809c5f077c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
bip32, | |
payments | |
} = require('bitcoinjs-lib') | |
const mnemonic = require('./external/mnemonic.js') // https://github.com/ggozad/mnemonic.js | |
const buffer = require("safe-buffer") | |
const words = "like like like like like like like like like like like like" // your mnemonic | |
const network = { | |
bip32: { | |
public: 0x0488b21e, | |
private: 0x0488ade4 | |
}, | |
pubKeyHash: 50, | |
scriptHash: 55, | |
wif: 178 | |
} | |
const seed = mnemonic.fromWords(words.split(" ")) | |
const seedBuf = Buffer.from(seed.toHex(), 'hex') | |
const node = bip32.fromSeed(seedBuf, network) | |
console.log(payments.p2pkh({ | |
pubkey: node.deriveHardened(0).derive(0).derive(0).publicKey, | |
network: node.network | |
}).address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment