From 8e1c69183f74acce06d6e35b614e504b18bb04e1 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 29 Mar 2017 13:59:42 +1100 Subject: [PATCH] tests/integration: add testnet bip32 example --- test/integration/bip32.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/integration/bip32.js b/test/integration/bip32.js index 9f5b9a9..25db93d 100644 --- a/test/integration/bip32.js +++ b/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')