diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-12-12 11:05:56 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-12-12 11:05:56 +1100 |
commit | 20083ab9e9ae519400447fc97c3cd1b86ffcad57 (patch) | |
tree | 8ce3c13dfa91fd67a103495dd52e8925aac0107b /bip39-standalone.html | |
parent | c554e6ff5c2c543997841c0fb0a506262843e8df (diff) | |
download | BIP39-20083ab9e9ae519400447fc97c3cd1b86ffcad57.tar.gz BIP39-20083ab9e9ae519400447fc97c3cd1b86ffcad57.tar.zst BIP39-20083ab9e9ae519400447fc97c3cd1b86ffcad57.zip |
BIP44 account extended keys compiled to standalone
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r-- | bip39-standalone.html | 99 |
1 files changed, 70 insertions, 29 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index 1d0e1cf..45380a3 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -317,6 +317,36 @@ | |||
317 | </div> | 317 | </div> |
318 | </div> | 318 | </div> |
319 | <div class="form-group"> | 319 | <div class="form-group"> |
320 | <label class="col-sm-2 control-label"> | ||
321 | </label> | ||
322 | <div class="col-sm-10"> | ||
323 | <p data-translate>The account extendend keys can be used for importing to most BIP44 compatible wallets, such as mycelium or electrum.</p> | ||
324 | </div> | ||
325 | </div> | ||
326 | <div class="form-group"> | ||
327 | <label for="account-xprv" class="col-sm-2 control-label"> | ||
328 | <span data-translate>Account Extended Private Key</span> | ||
329 | </label> | ||
330 | <div class="col-sm-10"> | ||
331 | <textarea id="account-xprv" type="text" class="account-xprv form-control" readonly data-show-qr></textarea> | ||
332 | </div> | ||
333 | </div> | ||
334 | <div class="form-group"> | ||
335 | <label for="account-xpub" class="col-sm-2 control-label"> | ||
336 | <span data-translate>Account Extended Public Key</span> | ||
337 | </label> | ||
338 | <div class="col-sm-10"> | ||
339 | <textarea id="account-xpub" type="text" class="account-xpub form-control" readonly data-show-qr></textarea> | ||
340 | </div> | ||
341 | </div> | ||
342 | <div class="form-group"> | ||
343 | <label class="col-sm-2 control-label"> | ||
344 | </label> | ||
345 | <div class="col-sm-10"> | ||
346 | <p data-translate>The BIP32 derivation path and extended keys are the basis for the derived addresses.</p> | ||
347 | </div> | ||
348 | </div> | ||
349 | <div class="form-group"> | ||
320 | <label for="bip44-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label> | 350 | <label for="bip44-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label> |
321 | <div class="col-sm-10"> | 351 | <div class="col-sm-10"> |
322 | <input id="bip44-path" type="text" class="path form-control" value="m/44'/0'/0'/0" readonly="readonly"> | 352 | <input id="bip44-path" type="text" class="path form-control" value="m/44'/0'/0'/0" readonly="readonly"> |
@@ -348,27 +378,6 @@ | |||
348 | </label> | 378 | </label> |
349 | </div> | 379 | </div> |
350 | <div class="form-group"> | 380 | <div class="form-group"> |
351 | <label for="mycelium-path" class="col-sm-2 control-label" data-translate>Mycelium Wallet</label> | ||
352 | <div class="col-sm-10"> | ||
353 | <p class="form-control no-border" data-translate-html> | ||
354 | <code>m/44'/0'/0'</code> generates extended keys for import / export | ||
355 | </p> | ||
356 | <p class="form-control no-border" data-translate-html> | ||
357 | <code>m/44'/0'/1'</code> for the next account. Continue incrementing for more accounts (most use a single account). | ||
358 | </p> | ||
359 | <p class="form-control no-border" data-translate-html> | ||
360 | <code>m/44'/0'/0'/0</code> generates public addresses | ||
361 | </p> | ||
362 | <p class="form-control no-border" data-translate-html> | ||
363 | <code>m/44'/0'/0'/1</code> generates change addresses | ||
364 | </p> | ||
365 | <p class="form-control no-border" data-translate-html> | ||
366 | For more info see the | ||
367 | <a href="http://www.mycelium.com/" target="_blank">Mycelium Wallet homepage</a> | ||
368 | </p> | ||
369 | </div> | ||
370 | </div> | ||
371 | <div class="form-group"> | ||
372 | <label for="core-path" class="col-sm-2 control-label" data-translate>Bitcoin Core</label> | 381 | <label for="core-path" class="col-sm-2 control-label" data-translate>Bitcoin Core</label> |
373 | <div class="col-sm-10"> | 382 | <div class="col-sm-10"> |
374 | <p class="form-control no-border" data-translate-html> | 383 | <p class="form-control no-border" data-translate-html> |
@@ -398,13 +407,13 @@ | |||
398 | </div> | 407 | </div> |
399 | <form class="form-horizontal" role="form"> | 408 | <form class="form-horizontal" role="form"> |
400 | <div class="form-group"> | 409 | <div class="form-group"> |
401 | <label for="extended-priv-key" class="col-sm-2 control-label" data-translate>BIP32 Extended Key</label> | 410 | <label for="extended-priv-key" class="col-sm-2 control-label" data-translate>BIP32 Extended Private Key</label> |
402 | <div class="col-sm-10"> | 411 | <div class="col-sm-10"> |
403 | <textarea id="extended-priv-key" class="extended-priv-key form-control" readonly="readonly" data-show-qr></textarea> | 412 | <textarea id="extended-priv-key" class="extended-priv-key form-control" readonly="readonly" data-show-qr></textarea> |
404 | </div> | 413 | </div> |
405 | </div> | 414 | </div> |
406 | <div class="form-group"> | 415 | <div class="form-group"> |
407 | <label for="extended-pub-key" class="col-sm-2 control-label" data-translate>BIP32 Extended Key (addresses only)</label> | 416 | <label for="extended-pub-key" class="col-sm-2 control-label" data-translate>BIP32 Extended Public Key</label> |
408 | <div class="col-sm-10"> | 417 | <div class="col-sm-10"> |
409 | <textarea id="extended-pub-key" class="extended-pub-key form-control" readonly="readonly" data-show-qr></textarea> | 418 | <textarea id="extended-pub-key" class="extended-pub-key form-control" readonly="readonly" data-show-qr></textarea> |
410 | </div> | 419 | </div> |
@@ -18653,6 +18662,8 @@ window.Entropy = new (function() { | |||
18653 | DOM.bip44purpose = $("#bip44 .purpose"); | 18662 | DOM.bip44purpose = $("#bip44 .purpose"); |
18654 | DOM.bip44coin = $("#bip44 .coin"); | 18663 | DOM.bip44coin = $("#bip44 .coin"); |
18655 | DOM.bip44account = $("#bip44 .account"); | 18664 | DOM.bip44account = $("#bip44 .account"); |
18665 | DOM.bip44accountXprv = $("#bip44 .account-xprv"); | ||
18666 | DOM.bip44accountXpub = $("#bip44 .account-xpub"); | ||
18656 | DOM.bip44change = $("#bip44 .change"); | 18667 | DOM.bip44change = $("#bip44 .change"); |
18657 | DOM.generatedStrength = $(".generate-container .strength"); | 18668 | DOM.generatedStrength = $(".generate-container .strength"); |
18658 | DOM.hardenedAddresses = $(".hardened-addresses"); | 18669 | DOM.hardenedAddresses = $(".hardened-addresses"); |
@@ -18840,7 +18851,10 @@ window.Entropy = new (function() { | |||
18840 | showValidationError(errorText); | 18851 | showValidationError(errorText); |
18841 | return; | 18852 | return; |
18842 | } | 18853 | } |
18843 | calcBip32ExtendedKey(derivationPath); | 18854 | bip32ExtendedKey = calcBip32ExtendedKey(derivationPath); |
18855 | if (bip44TabSelected()) { | ||
18856 | displayBip44Info(); | ||
18857 | } | ||
18844 | displayBip32Info(); | 18858 | displayBip32Info(); |
18845 | hidePending(); | 18859 | hidePending(); |
18846 | } | 18860 | } |
@@ -18920,7 +18934,7 @@ window.Entropy = new (function() { | |||
18920 | } | 18934 | } |
18921 | 18935 | ||
18922 | function calcBip32ExtendedKey(path) { | 18936 | function calcBip32ExtendedKey(path) { |
18923 | bip32ExtendedKey = bip32RootKey; | 18937 | var extendedKey = bip32RootKey; |
18924 | // Derive the key from the path | 18938 | // Derive the key from the path |
18925 | var pathBits = path.split("/"); | 18939 | var pathBits = path.split("/"); |
18926 | for (var i=0; i<pathBits.length; i++) { | 18940 | for (var i=0; i<pathBits.length; i++) { |
@@ -18931,12 +18945,13 @@ window.Entropy = new (function() { | |||
18931 | } | 18945 | } |
18932 | var hardened = bit[bit.length-1] == "'"; | 18946 | var hardened = bit[bit.length-1] == "'"; |
18933 | if (hardened) { | 18947 | if (hardened) { |
18934 | bip32ExtendedKey = bip32ExtendedKey.deriveHardened(index); | 18948 | extendedKey = extendedKey.deriveHardened(index); |
18935 | } | 18949 | } |
18936 | else { | 18950 | else { |
18937 | bip32ExtendedKey = bip32ExtendedKey.derive(index); | 18951 | extendedKey = extendedKey.derive(index); |
18938 | } | 18952 | } |
18939 | } | 18953 | } |
18954 | return extendedKey | ||
18940 | } | 18955 | } |
18941 | 18956 | ||
18942 | function showValidationError(errorText) { | 18957 | function showValidationError(errorText) { |
@@ -18989,7 +19004,7 @@ window.Entropy = new (function() { | |||
18989 | } | 19004 | } |
18990 | 19005 | ||
18991 | function getDerivationPath() { | 19006 | function getDerivationPath() { |
18992 | if (DOM.bip44tab.hasClass("active")) { | 19007 | if (bip44TabSelected()) { |
18993 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | 19008 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); |
18994 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | 19009 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); |
18995 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | 19010 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); |
@@ -19004,7 +19019,7 @@ window.Entropy = new (function() { | |||
19004 | console.log("Using derivation path from BIP44 tab: " + derivationPath); | 19019 | console.log("Using derivation path from BIP44 tab: " + derivationPath); |
19005 | return derivationPath; | 19020 | return derivationPath; |
19006 | } | 19021 | } |
19007 | else if (DOM.bip32tab.hasClass("active")) { | 19022 | else if (bip32TabSelected()) { |
19008 | var derivationPath = DOM.bip32path.val(); | 19023 | var derivationPath = DOM.bip32path.val(); |
19009 | console.log("Using derivation path from BIP32 tab: " + derivationPath); | 19024 | console.log("Using derivation path from BIP32 tab: " + derivationPath); |
19010 | return derivationPath; | 19025 | return derivationPath; |
@@ -19051,6 +19066,24 @@ window.Entropy = new (function() { | |||
19051 | return false; | 19066 | return false; |
19052 | } | 19067 | } |
19053 | 19068 | ||
19069 | function displayBip44Info() { | ||
19070 | // Get the derivation path for the account | ||
19071 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | ||
19072 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | ||
19073 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | ||
19074 | var path = "m/"; | ||
19075 | path += purpose + "'/"; | ||
19076 | path += coin + "'/"; | ||
19077 | path += account + "'/"; | ||
19078 | // Calculate the account extended keys | ||
19079 | var accountExtendedKey = calcBip32ExtendedKey(path); | ||
19080 | var accountXprv = accountExtendedKey.toBase58(); | ||
19081 | var accountXpub = accountExtendedKey.toBase58(false); | ||
19082 | // Display the extended keys | ||
19083 | DOM.bip44accountXprv.val(accountXprv); | ||
19084 | DOM.bip44accountXpub.val(accountXpub); | ||
19085 | } | ||
19086 | |||
19054 | function displayBip32Info() { | 19087 | function displayBip32Info() { |
19055 | // Display the key | 19088 | // Display the key |
19056 | DOM.seed.val(seed); | 19089 | DOM.seed.val(seed); |
@@ -19541,6 +19574,14 @@ window.Entropy = new (function() { | |||
19541 | DOM.qrHint.toggleClass("hidden"); | 19574 | DOM.qrHint.toggleClass("hidden"); |
19542 | } | 19575 | } |
19543 | 19576 | ||
19577 | function bip44TabSelected() { | ||
19578 | return DOM.bip44tab.hasClass("active"); | ||
19579 | } | ||
19580 | |||
19581 | function bip32TabSelected() { | ||
19582 | return DOM.bip32tab.hasClass("active"); | ||
19583 | } | ||
19584 | |||
19544 | var networks = [ | 19585 | var networks = [ |
19545 | { | 19586 | { |
19546 | name: "Bitcoin", | 19587 | name: "Bitcoin", |