Skip to content

Instantly share code, notes, and snippets.

@nodech
Created November 6, 2018 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodech/4dc52f73960bbb08a52e4851f9a7bdbb to your computer and use it in GitHub Desktop.
Save nodech/4dc52f73960bbb08a52e4851f9a7bdbb to your computer and use it in GitHub Desktop.
Get wif from mnemonic for certain path.
const {hd, KeyRing} = require('bcoin');
const {HDPrivateKey} = hd;
const mnemonic = 'midnight volcano start infant error drama bulk disorder'
+ ' mouse key cliff climb buyer wage ceiling load express earth trick'
+ ' broccoli siege math hope attend';
const privateKey = HDPrivateKey.fromPhrase(mnemonic);
const deriveSomething = privateKey.derivePath(`m/44'/1/0/0/0`);
const ring = KeyRing.fromPrivate(deriveSomething.privateKey);
console.log(ring.toSecret('regtest'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment