Browse Source

tests/integration: add testnet bip32 example

hk-custom-address
Daniel Cousens 8 years ago
committed by Daniel Cousens
parent
commit
8e1c69183f
  1. 7
      test/integration/bip32.js

7
test/integration/bip32.js

@ -9,6 +9,13 @@ var ecurve = require('ecurve')
var secp256k1 = ecurve.getCurveByName('secp256k1')
describe('bitcoinjs-lib (BIP32)', function () {
it('can import a BIP32 testnet xpriv and export to WIF', function () {
var xpriv = 'tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK'
var node = bitcoin.HDNode.fromBase58(xpriv, bitcoin.networks.testnet)
assert.equal(node.keyPair.toWIF(), 'cQfoY67cetFNunmBUX5wJiw3VNoYx3gG9U9CAofKE6BfiV1fSRw7')
})
it('can create a BIP32 wallet external address', function () {
var path = "m/0'/0/0"
var root = bitcoin.HDNode.fromSeedHex('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd')

Loading…
Cancel
Save