bip32grs
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

bip32grs

A BIP32 compatible library written in TypeScript with transpiled JavaScript committed to git.

Example

TypeScript

import BIP32Factory from 'bip32grs';
import * as ecc from 'tiny-secp256k1';
import { BIP32Interface } from 'bip32grs';
// You must wrap a tiny-secp256k1 compatible implementation
const bip32 = BIP32Factory(ecc);

let node: BIP32Interface = bip32.fromBase58('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBsoWepH');

let child: BIP32Interface = node.derivePath('m/0/0');
// ...

NodeJS

let BIP32Factory = require('bip32grs').default
// tiny-secp256k1 v2 is ES module and must be imported, not required
// (This requires v14 of node or greater)
// But as long as you implement the interface, any library is fine
import('tiny-secp256k1').then(ecc => BIP32Factory(ecc)).then(bip32 => {
  let node = bip32.fromBase58('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBsoWepH')

  let child = node.derivePath('m/0/0')
  // ...
})

LICENSE MIT

A derivation (and extraction for modularity) of the HDWallet/HDNode written and tested by groestlcoinjs-lib contributors since 2014.

Install

npm i bip32grs

DownloadsWeekly Downloads

121

Version

3.0.1

License

MIT

Unpacked Size

23.7 kB

Total Files

11

Last publish

Collaborators

  • gruve-p