项目作者: you21979

项目描述 :
bip32 for ripple. compatible with ledger wallet nano s
高级语言: JavaScript
项目地址: git://github.com/you21979/node-ripple-bip32.git
创建时间: 2017-06-28T05:35:30Z
项目社区:https://github.com/you21979/node-ripple-bip32

开源协议:MIT License

下载


node-ripple-bip32

NPM
Build Status
Coverage Status

bip32 for ripple

compatible with ledger wallet nano s

warning

There is no ripple secret key of the ripple address created using this library, so care must be taken when handling it.
You can not use the ripple ecosystem handling existing ripple secret keys.

install

  1. npm i ripple-bip32

usage

additional install

  1. npm i bip39

code

  1. const bip39 = require("bip39");
  2. const bip32 = require("ripple-bip32");
  3. const mnemonic = bip39.generateMnemonic()
  4. // bip39 mnemonic
  5. console.log(mnemonic)
  6. const seed = bip39.mnemonicToSeed(mnemonic)
  7. // seed hex string
  8. console.log(seed.toString('hex'))
  9. const m = bip32.fromSeedBuffer(seed)
  10. // master xprv
  11. console.log(m.toBase58())
  12. // xprv
  13. console.log(m.derivePath("m/44'/144'/0'").toBase58())
  14. // xpub
  15. console.log(m.derivePath("m/44'/144'/0'").neutered().toBase58())
  16. // ripple address
  17. console.log(m.derivePath("m/44'/144'/0'/0/0").getAddress())
  18. // publickey / privatekey
  19. console.log(m.derivePath("m/44'/144'/0'/0/0").keyPair.getKeyPairs())

transaction sign ?

To sign using the private key generated using this library, please see below.

see https://github.com/you21979/node-ripple-sign-keypairs

original library

https://github.com/bitcoinjs/bitcoinjs-lib