From c554e6ff5c2c543997841c0fb0a506262843e8df Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Mon, 12 Dec 2016 10:54:08 +1100 Subject: BIP44 Account xprv and xpub keys are shown which are used for import / export in most BIP44 wallets. --- src/index.html | 55 ++++++++++++++++++++++++++++++++----------------------- src/js/index.js | 23 +++++++++++++++++++++++ 2 files changed, 55 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/index.html b/src/index.html index aab473c..e3eebd6 100644 --- a/src/index.html +++ b/src/index.html @@ -312,6 +312,36 @@ +
+ +
+

The account extendend keys can be used for importing to most BIP44 compatible wallets, such as mycelium or electrum.

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+

The BIP32 derivation path and extended keys are the basis for the derived addresses.

+
+
@@ -343,27 +373,6 @@ Use hardened addresses
-
- -
-

- m/44'/0'/0' generates extended keys for import / export -

-

- m/44'/0'/1' for the next account. Continue incrementing for more accounts (most use a single account). -

-

- m/44'/0'/0'/0 generates public addresses -

-

- m/44'/0'/0'/1 generates change addresses -

-

- For more info see the - Mycelium Wallet homepage -

-
-
@@ -394,13 +403,13 @@
- +
- +
diff --git a/src/js/index.js b/src/js/index.js index 6367c01..748a2ba 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -51,6 +51,8 @@ DOM.bip44purpose = $("#bip44 .purpose"); DOM.bip44coin = $("#bip44 .coin"); DOM.bip44account = $("#bip44 .account"); + DOM.bip44accountXprv = $("#bip44 .account-xprv"); + DOM.bip44accountXpub = $("#bip44 .account-xpub"); DOM.bip44change = $("#bip44 .change"); DOM.generatedStrength = $(".generate-container .strength"); DOM.hardenedAddresses = $(".hardened-addresses"); @@ -239,6 +241,9 @@ return; } bip32ExtendedKey = calcBip32ExtendedKey(derivationPath); + if (bip44TabSelected()) { + displayBip44Info(); + } displayBip32Info(); hidePending(); } @@ -450,6 +455,24 @@ return false; } + function displayBip44Info() { + // Get the derivation path for the account + var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); + var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); + var account = parseIntNoNaN(DOM.bip44account.val(), 0); + var path = "m/"; + path += purpose + "'/"; + path += coin + "'/"; + path += account + "'/"; + // Calculate the account extended keys + var accountExtendedKey = calcBip32ExtendedKey(path); + var accountXprv = accountExtendedKey.toBase58(); + var accountXpub = accountExtendedKey.toBase58(false); + // Display the extended keys + DOM.bip44accountXprv.val(accountXprv); + DOM.bip44accountXpub.val(accountXpub); + } + function displayBip32Info() { // Display the key DOM.seed.val(seed); -- cgit v1.2.3