From 55f663737f57e4ba898143e573970f4849cd37ff Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Mon, 11 May 2015 14:30:58 -0400 Subject: [PATCH] Update HDPrivateKey docs. Fixes #1209 --- docs/hierarchical.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/hierarchical.md b/docs/hierarchical.md index da84b9b..8988a72 100644 --- a/docs/hierarchical.md +++ b/docs/hierarchical.md @@ -15,15 +15,17 @@ An instance of a [PrivateKey](privatekey.md) that also contains information requ Sample usage: ```javascript +var bitcore = require('bitcore'); +var HDPrivateKey = bitcore.HDPrivateKey; + var hdPrivateKey = new HDPrivateKey(); var retrieved = new HDPrivateKey('xpriv...'); -var derived = privateKey.derive("m/0'"); +var derived = hdPrivateKey.derive("m/0'"); var derivedByNumber = hdPrivateKey.derive(1).derive(2, true); var derivedByArgument = hdPrivateKey.derive("m/1/2'"); assert(derivedByNumber.xprivkey === derivedByArgument.xprivkey); -var address = new Address(privateKey.publicKey, Networks.livenet); -var redeem = new Transaction().from(output).to(target, 10000).sign(derived.privateKey); +var address = derived.privateKey.toAddress(); // obtain HDPublicKey var hdPublicKey = hdPrivateKey.hdPublicKey;