Last active
December 30, 2021 00:32
-
-
Save WietseWind/e9af4a3ba3f406a287dd6e9bd030412f to your computer and use it in GitHub Desktop.
Mnemonic Ripple Wallet generator - https://runkit.com/wietsewind/ripple-mnemonic-wallet-generator
This file contains 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 bip39 = require("bip39"); | |
const bip32 = require("ripple-bip32"); | |
const ripple = require('ripple-keypairs') | |
var mnemonic = 'novel matter final only nice cheese address cradle civil crash great flame struggle consider crowd surface purpose saddle mango endless mixed trial tape wrap' | |
// Or generate: | |
// mnemonic = bip39.generateMnemonic() | |
console.log('mnemonic: ' + mnemonic) | |
const seed = bip39.mnemonicToSeed(mnemonic) // add second argument for 25th word encrypted | |
console.log('seed: ', seed) | |
const m = bip32.fromSeedBuffer(seed) | |
console.log('m: ', m) | |
const keyPair = m.derivePath("m/44'/144'/0'/0/0").keyPair.getKeyPairs() | |
const address = ripple.deriveAddress(keyPair.publicKey) | |
console.log('privateKey: ' + keyPair.privateKey) | |
console.log('publicKey: ' + keyPair.publicKey) | |
console.log('address: ' + address) |
I think bip39 has been updated, if it gives you "Promise ..." and throws an error change
mnemonicToSeed
tomnemonicToSeedSync
Definitely possible. The most recent (working, supported) implementation is embedded in https://www.npmjs.com/package/xrpl-accountlib :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think bip39 has been updated, if it gives you "Promise ..." and throws an error change
mnemonicToSeed
tomnemonicToSeedSync