3 // mnemonics is populated as required by getLanguage
4 var mnemonics
= { "english": new Mnemonic("english") };
5 var mnemonic
= mnemonics
["english"];
7 var bip32RootKey
= null;
8 var bip32ExtendedKey
= null;
9 var network
= bitcoinjs
.bitcoin
.networks
.bitcoin
;
10 var addressRowTemplate
= $("#address-row-template");
13 var showAddress
= true;
14 var showPubKey
= true;
15 var showPrivKey
= true;
17 var litecoinUseLtub
= true;
19 var entropyChangeTimeoutEvent
= null;
20 var phraseChangeTimeoutEvent
= null;
21 var rootKeyChangedTimeoutEvent
= null;
23 var generationProcesses
= [];
26 DOM
.network
= $(".network");
27 DOM
.bip32Client
= $("#bip32-client");
28 DOM
.phraseNetwork
= $("#network-phrase");
29 DOM
.useEntropy
= $(".use-entropy");
30 DOM
.entropyContainer
= $(".entropy-container");
31 DOM
.entropy
= $(".entropy");
32 DOM
.entropyFiltered
= DOM
.entropyContainer
.find(".filtered");
33 DOM
.entropyType
= DOM
.entropyContainer
.find(".type");
34 DOM
.entropyCrackTime
= DOM
.entropyContainer
.find(".crack-time");
35 DOM
.entropyEventCount
= DOM
.entropyContainer
.find(".event-count");
36 DOM
.entropyBits
= DOM
.entropyContainer
.find(".bits");
37 DOM
.entropyBitsPerEvent
= DOM
.entropyContainer
.find(".bits-per-event");
38 DOM
.entropyWordCount
= DOM
.entropyContainer
.find(".word-count");
39 DOM
.entropyBinary
= DOM
.entropyContainer
.find(".binary");
40 DOM
.entropyWordIndexes
= DOM
.entropyContainer
.find(".word-indexes");
41 DOM
.entropyChecksum
= DOM
.entropyContainer
.find(".checksum");
42 DOM
.entropyMnemonicLength
= DOM
.entropyContainer
.find(".mnemonic-length");
43 DOM
.entropyWeakEntropyOverrideWarning
= DOM
.entropyContainer
.find(".weak-entropy-override-warning");
44 DOM
.entropyFilterWarning
= DOM
.entropyContainer
.find(".filter-warning");
45 DOM
.phrase
= $(".phrase");
46 DOM
.passphrase
= $(".passphrase");
47 DOM
.generateContainer
= $(".generate-container");
48 DOM
.generate
= $(".generate");
49 DOM
.seed
= $(".seed");
50 DOM
.rootKey
= $(".root-key");
51 DOM
.litecoinLtubContainer
= $(".litecoin-ltub-container");
52 DOM
.litecoinUseLtub
= $(".litecoin-use-ltub");
53 DOM
.extendedPrivKey
= $(".extended-priv-key");
54 DOM
.extendedPubKey
= $(".extended-pub-key");
55 DOM
.bip32tab
= $("#bip32-tab");
56 DOM
.bip44tab
= $("#bip44-tab");
57 DOM
.bip49tab
= $("#bip49-tab");
58 DOM
.bip84tab
= $("#bip84-tab");
59 DOM
.bip141tab
= $("#bip141-tab");
60 DOM
.bip32panel
= $("#bip32");
61 DOM
.bip44panel
= $("#bip44");
62 DOM
.bip49panel
= $("#bip49");
63 DOM
.bip32path
= $("#bip32-path");
64 DOM
.bip44path
= $("#bip44-path");
65 DOM
.bip44purpose
= $("#bip44 .purpose");
66 DOM
.bip44coin
= $("#bip44 .coin");
67 DOM
.bip44account
= $("#bip44 .account");
68 DOM
.bip44accountXprv
= $("#bip44 .account-xprv");
69 DOM
.bip44accountXpub
= $("#bip44 .account-xpub");
70 DOM
.bip44change
= $("#bip44 .change");
71 DOM
.bip49unavailable
= $("#bip49 .unavailable");
72 DOM
.bip49available
= $("#bip49 .available");
73 DOM
.bip49path
= $("#bip49-path");
74 DOM
.bip49purpose
= $("#bip49 .purpose");
75 DOM
.bip49coin
= $("#bip49 .coin");
76 DOM
.bip49account
= $("#bip49 .account");
77 DOM
.bip49accountXprv
= $("#bip49 .account-xprv");
78 DOM
.bip49accountXpub
= $("#bip49 .account-xpub");
79 DOM
.bip49change
= $("#bip49 .change");
80 DOM
.bip84path
= $("#bip84-path");
81 DOM
.bip84purpose
= $("#bip84 .purpose");
82 DOM
.bip84coin
= $("#bip84 .coin");
83 DOM
.bip84account
= $("#bip84 .account");
84 DOM
.bip84accountXprv
= $("#bip84 .account-xprv");
85 DOM
.bip84accountXpub
= $("#bip84 .account-xpub");
86 DOM
.bip84change
= $("#bip84 .change");
87 DOM
.bip141unavailable
= $("#bip141 .unavailable");
88 DOM
.bip141available
= $("#bip141 .available");
89 DOM
.bip141path
= $("#bip141-path");
90 DOM
.bip141semantics
= $(".bip141-semantics");
91 DOM
.generatedStrength
= $(".generate-container .strength");
92 DOM
.generatedStrengthWarning
= $(".generate-container .warning");
93 DOM
.hardenedAddresses
= $(".hardened-addresses");
94 DOM
.bitcoinCashAddressTypeContainer
= $(".bch-addr-type-container");
95 DOM
.bitcoinCashAddressType
= $("[name=bch-addr-type]")
96 DOM
.useBip38
= $(".use-bip38");
97 DOM
.bip38Password
= $(".bip38-password");
98 DOM
.addresses
= $(".addresses");
99 DOM
.csvTab
= $("#csv-tab a");
101 DOM
.rowsToAdd
= $(".rows-to-add");
102 DOM
.more
= $(".more");
103 DOM
.moreRowsStartIndex
= $(".more-rows-start-index");
104 DOM
.feedback
= $(".feedback");
105 DOM
.tab
= $(".derivation-type a");
106 DOM
.indexToggle
= $(".index-toggle");
107 DOM
.addressToggle
= $(".address-toggle");
108 DOM
.publicKeyToggle
= $(".public-key-toggle");
109 DOM
.privateKeyToggle
= $(".private-key-toggle");
110 DOM
.languages
= $(".languages a");
111 DOM
.qrContainer
= $(".qr-container");
112 DOM
.qrHider
= DOM
.qrContainer
.find(".qr-hider");
113 DOM
.qrImage
= DOM
.qrContainer
.find(".qr-image");
114 DOM
.qrHint
= DOM
.qrContainer
.find(".qr-hint");
115 DOM
.showQrEls
= $("[data-show-qr]");
119 DOM
.generatedStrength
.on("change", generatedStrengthChanged
);
120 DOM
.network
.on("change", networkChanged
);
121 DOM
.bip32Client
.on("change", bip32ClientChanged
);
122 DOM
.useEntropy
.on("change", setEntropyVisibility
);
123 DOM
.entropy
.on("input", delayedEntropyChanged
);
124 DOM
.entropyMnemonicLength
.on("change", entropyChanged
);
125 DOM
.phrase
.on("input", delayedPhraseChanged
);
126 DOM
.passphrase
.on("input", delayedPhraseChanged
);
127 DOM
.generate
.on("click", generateClicked
);
128 DOM
.more
.on("click", showMore
);
129 DOM
.rootKey
.on("input", delayedRootKeyChanged
);
130 DOM
.litecoinUseLtub
.on("change", litecoinUseLtubChanged
);
131 DOM
.bip32path
.on("input", calcForDerivationPath
);
132 DOM
.bip44account
.on("input", calcForDerivationPath
);
133 DOM
.bip44change
.on("input", calcForDerivationPath
);
134 DOM
.bip49account
.on("input", calcForDerivationPath
);
135 DOM
.bip49change
.on("input", calcForDerivationPath
);
136 DOM
.bip84account
.on("input", calcForDerivationPath
);
137 DOM
.bip84change
.on("input", calcForDerivationPath
);
138 DOM
.bip141path
.on("input", calcForDerivationPath
);
139 DOM
.bip141semantics
.on("change", tabChanged
);
140 DOM
.tab
.on("shown.bs.tab", tabChanged
);
141 DOM
.hardenedAddresses
.on("change", calcForDerivationPath
);
142 DOM
.useBip38
.on("change", calcForDerivationPath
);
143 DOM
.bip38Password
.on("change", calcForDerivationPath
);
144 DOM
.indexToggle
.on("click", toggleIndexes
);
145 DOM
.addressToggle
.on("click", toggleAddresses
);
146 DOM
.publicKeyToggle
.on("click", togglePublicKeys
);
147 DOM
.privateKeyToggle
.on("click", togglePrivateKeys
);
148 DOM
.csvTab
.on("click", updateCsv
);
149 DOM
.languages
.on("click", languageChanged
);
150 DOM
.bitcoinCashAddressType
.on("change", bitcoinCashAddressTypeChange
);
151 setQrEvents(DOM
.showQrEls
);
154 hideValidationError();
155 populateNetworkSelect();
156 populateClientSelect();
161 function generatedStrengthChanged() {
162 var strength
= parseInt(DOM
.generatedStrength
.val());
164 DOM
.generatedStrengthWarning
.removeClass("hidden");
167 DOM
.generatedStrengthWarning
.addClass("hidden");
171 function networkChanged(e
) {
173 clearAddressesList();
174 DOM
.litecoinLtubContainer
.addClass("hidden");
175 DOM
.bitcoinCashAddressTypeContainer
.addClass("hidden");
176 var networkIndex
= e
.target
.value
;
177 var network
= networks
[networkIndex
];
179 if (network
.segwitAvailable
) {
180 adjustNetworkForSegwit();
181 showSegwitAvailable();
184 showSegwitUnavailable();
194 function bip32ClientChanged(e
) {
195 var clientIndex
= DOM
.bip32Client
.val();
196 if (clientIndex
== "custom") {
197 DOM
.bip32path
.prop("readonly", false);
200 DOM
.bip32path
.prop("readonly", true);
201 clients
[clientIndex
].onSelect();
211 function setEntropyVisibility() {
212 if (isUsingOwnEntropy()) {
213 DOM
.entropyContainer
.removeClass("hidden");
214 DOM
.generateContainer
.addClass("hidden");
215 DOM
.phrase
.prop("readonly", true);
220 DOM
.entropyContainer
.addClass("hidden");
221 DOM
.generateContainer
.removeClass("hidden");
222 DOM
.phrase
.prop("readonly", false);
227 function delayedPhraseChanged() {
228 hideValidationError();
231 bip32ExtendedKey
= null;
232 clearAddressesList();
234 if (phraseChangeTimeoutEvent
!= null) {
235 clearTimeout(phraseChangeTimeoutEvent
);
237 phraseChangeTimeoutEvent
= setTimeout(phraseChanged
, 400);
240 function phraseChanged() {
242 setMnemonicLanguage();
243 // Get the mnemonic phrase
244 var phrase
= DOM
.phrase
.val();
245 var errorText
= findPhraseErrors(phrase
);
247 showValidationError(errorText
);
250 // Calculate and display
251 var passphrase
= DOM
.passphrase
.val();
252 calcBip32RootKeyFromSeed(phrase
, passphrase
);
253 calcForDerivationPath();
254 // Show the word indexes
258 function tabChanged() {
260 adjustNetworkForSegwit();
261 var phrase
= DOM
.phrase
.val();
263 // Calculate and display for mnemonic
264 var errorText
= findPhraseErrors(phrase
);
266 showValidationError(errorText
);
269 // Calculate and display
270 var passphrase
= DOM
.passphrase
.val();
271 calcBip32RootKeyFromSeed(phrase
, passphrase
);
274 // Calculate and display for root key
275 var rootKeyBase58
= DOM
.rootKey
.val();
276 var errorText
= validateRootKey(rootKeyBase58
);
278 showValidationError(errorText
);
281 // Calculate and display
282 calcBip32RootKeyFromBase58(rootKeyBase58
);
284 calcForDerivationPath();
287 function delayedEntropyChanged() {
288 hideValidationError();
290 if (entropyChangeTimeoutEvent
!= null) {
291 clearTimeout(entropyChangeTimeoutEvent
);
293 entropyChangeTimeoutEvent
= setTimeout(entropyChanged
, 400);
296 function entropyChanged() {
297 // If blank entropy, clear mnemonic, addresses, errors
298 if (DOM
.entropy
.val().trim().length
== 0) {
300 clearEntropyFeedback();
302 showValidationError("Blank entropy");
305 // Get the current phrase to detect changes
306 var phrase
= DOM
.phrase
.val();
307 // Set the phrase from the entropy
308 setMnemonicFromEntropy();
309 // Recalc addresses if the phrase has changed
310 var newPhrase
= DOM
.phrase
.val();
311 if (newPhrase
!= phrase
) {
312 if (newPhrase
.length
== 0) {
324 function delayedRootKeyChanged() {
325 // Warn if there is an existing mnemonic or passphrase.
326 if (DOM
.phrase
.val().length
> 0 || DOM
.passphrase
.val().length
> 0) {
327 if (!confirm("This will clear existing mnemonic and passphrase")) {
328 DOM
.rootKey
.val(bip32RootKey
);
332 hideValidationError();
334 // Clear existing mnemonic and passphrase
336 DOM
.passphrase
.val("");
338 if (rootKeyChangedTimeoutEvent
!= null) {
339 clearTimeout(rootKeyChangedTimeoutEvent
);
341 rootKeyChangedTimeoutEvent
= setTimeout(rootKeyChanged
, 400);
344 function rootKeyChanged() {
346 hideValidationError();
347 var rootKeyBase58
= DOM
.rootKey
.val();
348 var errorText
= validateRootKey(rootKeyBase58
);
350 showValidationError(errorText
);
353 // Calculate and display
354 calcBip32RootKeyFromBase58(rootKeyBase58
);
355 calcForDerivationPath();
358 function litecoinUseLtubChanged() {
359 litecoinUseLtub
= DOM
.litecoinUseLtub
.prop("checked");
360 if (litecoinUseLtub
) {
361 network
= bitcoinjs
.bitcoin
.networks
.litecoin
;
364 network
= bitcoinjs
.bitcoin
.networks
.litecoinXprv
;
369 function calcForDerivationPath() {
371 clearAddressesList();
373 // Don't show segwit if it's selected but network doesn't support it
374 if (segwitSelected() && !networkHasSegwit()) {
377 // Get the derivation path
378 var derivationPath
= getDerivationPath();
379 var errorText
= findDerivationPathErrors(derivationPath
);
381 showValidationError(errorText
);
384 bip32ExtendedKey
= calcBip32ExtendedKey(derivationPath
);
385 if (bip44TabSelected()) {
388 else if (bip49TabSelected()) {
391 else if (bip84TabSelected()) {
397 function generateClicked() {
398 if (isUsingOwnEntropy()) {
403 setTimeout(function() {
404 setMnemonicLanguage();
405 var phrase
= generateRandomPhrase();
413 function languageChanged() {
414 setTimeout(function() {
415 setMnemonicLanguage();
416 if (DOM
.phrase
.val().length
> 0) {
417 var newPhrase
= convertPhraseToNewLanguage();
418 DOM
.phrase
.val(newPhrase
);
422 DOM
.generate
.trigger("click");
427 function bitcoinCashAddressTypeChange() {
431 function toggleIndexes() {
432 showIndex
= !showIndex
;
433 $("td.index span").toggleClass("invisible");
436 function toggleAddresses() {
437 showAddress
= !showAddress
;
438 $("td.address span").toggleClass("invisible");
441 function togglePublicKeys() {
442 showPubKey
= !showPubKey
;
443 $("td.pubkey span").toggleClass("invisible");
446 function togglePrivateKeys() {
447 showPrivKey
= !showPrivKey
;
448 $("td.privkey span").toggleClass("invisible");
453 function generateRandomPhrase() {
454 if (!hasStrongRandom()) {
455 var errorText
= "This browser does not support strong randomness";
456 showValidationError(errorText
);
459 // get the amount of entropy to use
460 var numWords
= parseInt(DOM
.generatedStrength
.val());
461 var strength
= numWords
/ 3 * 32;
462 var buffer
= new Uint8Array(strength
/ 8);
463 // create secure entropy
464 var data
= crypto
.getRandomValues(buffer
);
466 var words
= mnemonic
.toMnemonic(data
);
467 DOM
.phrase
.val(words
);
469 var entropyHex
= uint8ArrayToHex(data
);
470 DOM
.entropy
.val(entropyHex
);
471 // ensure entropy fields are consistent with what is being displayed
472 DOM
.entropyMnemonicLength
.val("raw");
476 function calcBip32RootKeyFromSeed(phrase
, passphrase
) {
477 seed
= mnemonic
.toSeed(phrase
, passphrase
);
478 bip32RootKey
= bitcoinjs
.bitcoin
.HDNode
.fromSeedHex(seed
, network
);
481 function calcBip32RootKeyFromBase58(rootKeyBase58
) {
482 bip32RootKey
= bitcoinjs
.bitcoin
.HDNode
.fromBase58(rootKeyBase58
, network
);
485 function calcBip32ExtendedKey(path
) {
486 // Check there's a root key to derive from
490 var extendedKey
= bip32RootKey
;
491 // Derive the key from the path
492 var pathBits
= path
.split("/");
493 for (var i
=0; i
<pathBits
.length
; i
++) {
494 var bit
= pathBits
[i
];
495 var index
= parseInt(bit
);
499 var hardened
= bit
[bit
.length
-1] == "'";
500 var isPriv
= !(extendedKey
.isNeutered());
501 var invalidDerivationPath
= hardened
&& !isPriv
;
502 if (invalidDerivationPath
) {
506 extendedKey
= extendedKey
.deriveHardened(index
);
509 extendedKey
= extendedKey
.derive(index
);
515 function showValidationError(errorText
) {
521 function hideValidationError() {
527 function findPhraseErrors(phrase
) {
528 // Preprocess the words
529 phrase
= mnemonic
.normalizeString(phrase
);
530 var words
= phraseToWordArray(phrase
);
531 // Detect blank phrase
532 if (words
.length
== 0) {
533 return "Blank mnemonic";
536 for (var i
=0; i
<words
.length
; i
++) {
538 var language
= getLanguage();
539 if (WORDLISTS
[language
].indexOf(word
) == -1) {
540 console
.log("Finding closest match to " + word
);
541 var nearestWord
= findNearestWord(word
);
542 return word
+ " not in wordlist, did you mean " + nearestWord
+ "?";
545 // Check the words are valid
546 var properPhrase
= wordArrayToPhrase(words
);
547 var isValid
= mnemonic
.check(properPhrase
);
549 return "Invalid mnemonic";
554 function validateRootKey(rootKeyBase58
) {
556 bitcoinjs
.bitcoin
.HDNode
.fromBase58(rootKeyBase58
, network
);
559 return "Invalid root key";
564 function getDerivationPath() {
565 if (bip44TabSelected()) {
566 var purpose
= parseIntNoNaN(DOM
.bip44purpose
.val(), 44);
567 var coin
= parseIntNoNaN(DOM
.bip44coin
.val(), 0);
568 var account
= parseIntNoNaN(DOM
.bip44account
.val(), 0);
569 var change
= parseIntNoNaN(DOM
.bip44change
.val(), 0);
571 path
+= purpose
+ "'/";
573 path
+= account
+ "'/";
575 DOM
.bip44path
.val(path
);
576 var derivationPath
= DOM
.bip44path
.val();
577 console
.log("Using derivation path from BIP44 tab: " + derivationPath
);
578 return derivationPath
;
580 else if (bip49TabSelected()) {
581 var purpose
= parseIntNoNaN(DOM
.bip49purpose
.val(), 49);
582 var coin
= parseIntNoNaN(DOM
.bip49coin
.val(), 0);
583 var account
= parseIntNoNaN(DOM
.bip49account
.val(), 0);
584 var change
= parseIntNoNaN(DOM
.bip49change
.val(), 0);
586 path
+= purpose
+ "'/";
588 path
+= account
+ "'/";
590 DOM
.bip49path
.val(path
);
591 var derivationPath
= DOM
.bip49path
.val();
592 console
.log("Using derivation path from BIP49 tab: " + derivationPath
);
593 return derivationPath
;
595 else if (bip84TabSelected()) {
596 var purpose
= parseIntNoNaN(DOM
.bip84purpose
.val(), 84);
597 var coin
= parseIntNoNaN(DOM
.bip84coin
.val(), 0);
598 var account
= parseIntNoNaN(DOM
.bip84account
.val(), 0);
599 var change
= parseIntNoNaN(DOM
.bip84change
.val(), 0);
601 path
+= purpose
+ "'/";
603 path
+= account
+ "'/";
605 DOM
.bip84path
.val(path
);
606 var derivationPath
= DOM
.bip84path
.val();
607 console
.log("Using derivation path from BIP84 tab: " + derivationPath
);
608 return derivationPath
;
610 else if (bip32TabSelected()) {
611 var derivationPath
= DOM
.bip32path
.val();
612 console
.log("Using derivation path from BIP32 tab: " + derivationPath
);
613 return derivationPath
;
615 else if (bip141TabSelected()) {
616 var derivationPath
= DOM
.bip141path
.val();
617 console
.log("Using derivation path from BIP141 tab: " + derivationPath
);
618 return derivationPath
;
621 console
.log("Unknown derivation path");
625 function findDerivationPathErrors(path
) {
626 // TODO is not perfect but is better than nothing
628 // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#test-vectors
630 // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#extended-keys
631 var maxDepth
= 255; // TODO verify this!!
632 var maxIndexValue
= Math
.pow(2, 31); // TODO verify this!!
633 if (path
[0] != "m") {
634 return "First character must be 'm'";
636 if (path
.length
> 1) {
637 if (path
[1] != "/") {
638 return "Separator must be '/'";
640 var indexes
= path
.split("/");
641 if (indexes
.length
> maxDepth
) {
642 return "Derivation depth is " + indexes
.length
+ ", must be less than " + maxDepth
;
644 for (var depth
= 1; depth
<indexes
.length
; depth
++) {
645 var index
= indexes
[depth
];
646 var invalidChars
= index
.replace(/^[0-9]+'?$/g, "")
647 if (invalidChars
.length
> 0) {
648 return "Invalid characters " + invalidChars
+ " found at depth " + depth
;
650 var indexValue
= parseInt(index
.replace("'", ""));
652 return "Invalid number at depth " + depth
;
654 if (indexValue
> maxIndexValue
) {
655 return "Value of " + indexValue
+ " at depth " + depth
+ " must be less than " + maxIndexValue
;
659 // Check root key exists or else derivation path is useless!
661 return "No root key";
663 // Check no hardened derivation path when using xpub keys
664 var hardenedPath
= path
.indexOf("'") > -1;
665 var hardenedAddresses
= bip32TabSelected() && DOM
.hardenedAddresses
.prop("checked");
666 var hardened
= hardenedPath
|| hardenedAddresses
;
667 var isXpubkey
= bip32RootKey
.isNeutered();
668 if (hardened
&& isXpubkey
) {
669 return "Hardened derivation path is invalid with xpub key";
674 function displayBip44Info() {
675 // Get the derivation path for the account
676 var purpose
= parseIntNoNaN(DOM
.bip44purpose
.val(), 44);
677 var coin
= parseIntNoNaN(DOM
.bip44coin
.val(), 0);
678 var account
= parseIntNoNaN(DOM
.bip44account
.val(), 0);
680 path
+= purpose
+ "'/";
682 path
+= account
+ "'/";
683 // Calculate the account extended keys
684 var accountExtendedKey
= calcBip32ExtendedKey(path
);
685 var accountXprv
= accountExtendedKey
.toBase58();
686 var accountXpub
= accountExtendedKey
.neutered().toBase58();
687 // Display the extended keys
688 DOM
.bip44accountXprv
.val(accountXprv
);
689 DOM
.bip44accountXpub
.val(accountXpub
);
692 function displayBip49Info() {
693 // Get the derivation path for the account
694 var purpose
= parseIntNoNaN(DOM
.bip49purpose
.val(), 49);
695 var coin
= parseIntNoNaN(DOM
.bip49coin
.val(), 0);
696 var account
= parseIntNoNaN(DOM
.bip49account
.val(), 0);
698 path
+= purpose
+ "'/";
700 path
+= account
+ "'/";
701 // Calculate the account extended keys
702 var accountExtendedKey
= calcBip32ExtendedKey(path
);
703 var accountXprv
= accountExtendedKey
.toBase58();
704 var accountXpub
= accountExtendedKey
.neutered().toBase58();
705 // Display the extended keys
706 DOM
.bip49accountXprv
.val(accountXprv
);
707 DOM
.bip49accountXpub
.val(accountXpub
);
710 function displayBip84Info() {
711 // Get the derivation path for the account
712 var purpose
= parseIntNoNaN(DOM
.bip84purpose
.val(), 84);
713 var coin
= parseIntNoNaN(DOM
.bip84coin
.val(), 0);
714 var account
= parseIntNoNaN(DOM
.bip84account
.val(), 0);
716 path
+= purpose
+ "'/";
718 path
+= account
+ "'/";
719 // Calculate the account extended keys
720 var accountExtendedKey
= calcBip32ExtendedKey(path
);
721 var accountXprv
= accountExtendedKey
.toBase58();
722 var accountXpub
= accountExtendedKey
.neutered().toBase58();
723 // Display the extended keys
724 DOM
.bip84accountXprv
.val(accountXprv
);
725 DOM
.bip84accountXpub
.val(accountXpub
);
728 function displayBip32Info() {
731 var rootKey
= bip32RootKey
.toBase58();
732 DOM
.rootKey
.val(rootKey
);
733 var xprvkeyB58
= "NA";
734 if (!bip32ExtendedKey
.isNeutered()) {
735 xprvkeyB58
= bip32ExtendedKey
.toBase58();
737 var extendedPrivKey
= xprvkeyB58
;
738 DOM
.extendedPrivKey
.val(extendedPrivKey
);
739 var extendedPubKey
= bip32ExtendedKey
.neutered().toBase58();
740 DOM
.extendedPubKey
.val(extendedPubKey
);
741 // Display the addresses and privkeys
742 clearAddressesList();
743 var initialAddressCount
= parseInt(DOM
.rowsToAdd
.val());
744 displayAddresses(0, initialAddressCount
);
747 function displayAddresses(start
, total
) {
748 generationProcesses
.push(new (function() {
752 this.stop = function() {
753 for (var i
=0; i
<rows
.length
; i
++) {
754 rows
[i
].shouldGenerate
= false;
759 for (var i
=0; i
<total
; i
++) {
760 var index
= i
+ start
;
761 var isLast
= i
== total
- 1;
762 rows
.push(new TableRow(index
, isLast
));
768 function segwitSelected() {
769 return bip49TabSelected() || bip84TabSelected() || bip141TabSelected();
772 function p2wpkhSelected() {
773 return bip84TabSelected() ||
774 bip141TabSelected() && DOM
.bip141semantics
.val() == "p2wpkh";
777 function p2wpkhInP2shSelected() {
778 return bip49TabSelected() ||
779 (bip141TabSelected() && DOM
.bip141semantics
.val() == "p2wpkh-p2sh");
782 function TableRow(index
, isLast
) {
785 this.shouldGenerate
= true;
786 var useHardenedAddresses
= DOM
.hardenedAddresses
.prop("checked");
787 var useBip38
= DOM
.useBip38
.prop("checked");
788 var bip38password
= DOM
.bip38Password
.val();
789 var isSegwit
= segwitSelected();
790 var segwitAvailable
= networkHasSegwit();
791 var isP2wpkh
= p2wpkhSelected();
792 var isP2wpkhInP2sh
= p2wpkhInP2shSelected();
798 function calculateValues() {
799 setTimeout(function() {
800 if (!self
.shouldGenerate
) {
803 // derive HDkey for this row of the table
805 if (useHardenedAddresses
) {
806 key
= bip32ExtendedKey
.deriveHardened(index
);
809 key
= bip32ExtendedKey
.derive(index
);
811 // bip38 requires uncompressed keys
812 // see https://github.com/iancoleman/bip39/issues/140#issuecomment-352164035
813 var keyPair
= key
.keyPair
;
814 var useUncompressed
= useBip38
;
815 if (useUncompressed
) {
816 keyPair
= new bitcoinjs
.bitcoin
.ECPair(keyPair
.d
, null, { compressed: false });
819 var address
= keyPair
.getAddress().toString();
821 var hasPrivkey
= !key
.isNeutered();
824 privkey
= keyPair
.toWIF(network
);
825 // BIP38 encode private key if required
827 privkey
= bitcoinjsBip38
.encrypt(keyPair
.d
.toBuffer(), false, bip38password
, function(p
) {
828 console
.log("Progressed " + p
.percent
.toFixed(1) + "% for index " + index
);
833 var pubkey
= keyPair
.getPublicKeyBuffer().toString('hex');
834 var indexText
= getDerivationPath() + "/" + index
;
835 if (useHardenedAddresses
) {
836 indexText
= indexText
+ "'";
838 // Ethereum values are different
839 if (networks
[DOM
.network
.val()].name
== "ETH - Ethereum") {
840 var privKeyBuffer
= keyPair
.d
.toBuffer(32);
841 privkey
= privKeyBuffer
.toString('hex');
842 var addressBuffer
= ethUtil
.privateToAddress(privKeyBuffer
);
843 var hexAddress
= addressBuffer
.toString('hex');
844 var checksumAddress
= ethUtil
.toChecksumAddress(hexAddress
);
845 address
= ethUtil
.addHexPrefix(checksumAddress
);
846 privkey
= ethUtil
.addHexPrefix(privkey
);
847 pubkey
= ethUtil
.addHexPrefix(pubkey
);
849 // Ripple values are different
850 if (networks
[DOM
.network
.val()].name
== "XRP - Ripple") {
851 privkey
= convertRipplePriv(privkey
);
852 address
= convertRippleAdrr(address
);
854 // Bitcoin Cash address format may vary
855 if (networks
[DOM
.network
.val()].name
== "BCH - Bitcoin Cash") {
856 var bchAddrType
= DOM
.bitcoinCashAddressType
.filter(":checked").val();
857 if (bchAddrType
== "cashaddr") {
858 address
= bchaddr
.toCashAddress(address
);
860 else if (bchAddrType
== "bitpay") {
861 address
= bchaddr
.toBitpayAddress(address
);
864 // Segwit addresses are different
866 if (!segwitAvailable
) {
870 var keyhash
= bitcoinjs
.bitcoin
.crypto
.hash160(key
.getPublicKeyBuffer());
871 var scriptpubkey
= bitcoinjs
.bitcoin
.script
.witnessPubKeyHash
.output
.encode(keyhash
);
872 address
= bitcoinjs
.bitcoin
.address
.fromOutputScript(scriptpubkey
, network
)
874 else if (isP2wpkhInP2sh
) {
875 var keyhash
= bitcoinjs
.bitcoin
.crypto
.hash160(key
.getPublicKeyBuffer());
876 var scriptsig
= bitcoinjs
.bitcoin
.script
.witnessPubKeyHash
.output
.encode(keyhash
);
877 var addressbytes
= bitcoinjs
.bitcoin
.crypto
.hash160(scriptsig
);
878 var scriptpubkey
= bitcoinjs
.bitcoin
.script
.scriptHash
.output
.encode(addressbytes
);
879 address
= bitcoinjs
.bitcoin
.address
.fromOutputScript(scriptpubkey
, network
)
882 addAddressToList(indexText
, address
, pubkey
, privkey
);
894 function showMore() {
895 var rowsToAdd
= parseInt(DOM
.rowsToAdd
.val());
896 if (isNaN(rowsToAdd
)) {
898 DOM
.rowsToAdd
.val("20");
900 var start
= parseInt(DOM
.moreRowsStartIndex
.val())
902 start
= lastIndexInTable() + 1;
905 var newStart
= start
+ rowsToAdd
;
906 DOM
.moreRowsStartIndex
.val(newStart
);
908 if (rowsToAdd
> 200) {
909 var msg
= "Generating " + rowsToAdd
+ " rows could take a while. ";
910 msg
+= "Do you want to continue?";
915 displayAddresses(start
, rowsToAdd
);
918 function clearDisplay() {
919 clearAddressesList();
921 hideValidationError();
924 function clearAddressesList() {
925 DOM
.addresses
.empty();
930 function stopGenerating() {
931 while (generationProcesses
.length
> 0) {
932 var generation
= generationProcesses
.shift();
937 function clearKeys() {
942 function clearRootKey() {
946 function clearDerivedKeys() {
947 DOM
.extendedPrivKey
.val("");
948 DOM
.extendedPubKey
.val("");
949 DOM
.bip44accountXprv
.val("");
950 DOM
.bip44accountXpub
.val("");
953 function addAddressToList(indexText
, address
, pubkey
, privkey
) {
954 var row
= $(addressRowTemplate
.html());
956 var indexCell
= row
.find(".index span");
957 var addressCell
= row
.find(".address span");
958 var pubkeyCell
= row
.find(".pubkey span");
959 var privkeyCell
= row
.find(".privkey span");
961 indexCell
.text(indexText
);
962 addressCell
.text(address
);
963 pubkeyCell
.text(pubkey
);
964 privkeyCell
.text(privkey
);
967 indexCell
.addClass("invisible");
970 addressCell
.addClass("invisible");
973 pubkeyCell
.addClass("invisible");
976 privkeyCell
.addClass("invisible");
978 DOM
.addresses
.append(row
);
979 var rowShowQrEls
= row
.find("[data-show-qr]");
980 setQrEvents(rowShowQrEls
);
983 function hasStrongRandom() {
984 return 'crypto' in window
&& window
['crypto'] !== null;
987 function disableForms() {
988 $("form").on("submit", function(e
) {
993 function parseIntNoNaN(val
, defaultVal
) {
994 var v
= parseInt(val
);
1001 function showPending() {
1003 .text("Calculating...")
1007 function findNearestWord(word
) {
1008 var language
= getLanguage();
1009 var words
= WORDLISTS
[language
];
1010 var minDistance
= 99;
1011 var closestWord
= words
[0];
1012 for (var i
=0; i
<words
.length
; i
++) {
1013 var comparedTo
= words
[i
];
1014 if (comparedTo
.indexOf(word
) == 0) {
1017 var distance
= Levenshtein
.get(word
, comparedTo
);
1018 if (distance
< minDistance
) {
1019 closestWord
= comparedTo
;
1020 minDistance
= distance
;
1026 function hidePending() {
1032 function populateNetworkSelect() {
1033 for (var i
=0; i
<networks
.length
; i
++) {
1034 var network
= networks
[i
];
1035 var option
= $("<option>");
1036 option
.attr("value", i
);
1037 option
.text(network
.name
);
1038 if (network
.name
== "BTC - Bitcoin") {
1039 option
.prop("selected", true);
1041 DOM
.phraseNetwork
.append(option
);
1045 function populateClientSelect() {
1046 for (var i
=0; i
<clients
.length
; i
++) {
1047 var client
= clients
[i
];
1048 var option
= $("<option>");
1049 option
.attr("value", i
);
1050 option
.text(client
.name
);
1051 DOM
.bip32Client
.append(option
);
1055 function getLanguage() {
1056 var defaultLanguage
= "english";
1057 // Try to get from existing phrase
1058 var language
= getLanguageFromPhrase();
1059 // Try to get from url if not from phrase
1060 if (language
.length
== 0) {
1061 language
= getLanguageFromUrl();
1063 // Default to English if no other option
1064 if (language
.length
== 0) {
1065 language
= defaultLanguage
;
1070 function getLanguageFromPhrase(phrase
) {
1071 // Check if how many words from existing phrase match a language.
1074 phrase
= DOM
.phrase
.val();
1076 if (phrase
.length
> 0) {
1077 var words
= phraseToWordArray(phrase
);
1078 var languageMatches
= {};
1079 for (l
in WORDLISTS
) {
1080 // Track how many words match in this language
1081 languageMatches
[l
] = 0;
1082 for (var i
=0; i
<words
.length
; i
++) {
1083 var wordInLanguage
= WORDLISTS
[l
].indexOf(words
[i
]) > -1;
1084 if (wordInLanguage
) {
1085 languageMatches
[l
]++;
1088 // Find languages with most word matches.
1089 // This is made difficult due to commonalities between Chinese
1090 // simplified vs traditional.
1091 var mostMatches
= 0;
1092 var mostMatchedLanguages
= [];
1093 for (var l
in languageMatches
) {
1094 var numMatches
= languageMatches
[l
];
1095 if (numMatches
> mostMatches
) {
1096 mostMatches
= numMatches
;
1097 mostMatchedLanguages
= [l
];
1099 else if (numMatches
== mostMatches
) {
1100 mostMatchedLanguages
.push(l
);
1104 if (mostMatchedLanguages
.length
> 0) {
1105 // Use first language and warn if multiple detected
1106 language
= mostMatchedLanguages
[0];
1107 if (mostMatchedLanguages
.length
> 1) {
1108 console
.warn("Multiple possible languages");
1109 console
.warn(mostMatchedLanguages
);
1116 function getLanguageFromUrl() {
1117 for (var language
in WORDLISTS
) {
1118 if (window
.location
.hash
.indexOf(language
) > -1) {
1125 function setMnemonicLanguage() {
1126 var language
= getLanguage();
1127 // Load the bip39 mnemonic generator for this language if required
1128 if (!(language
in mnemonics
)) {
1129 mnemonics
[language
] = new Mnemonic(language
);
1131 mnemonic
= mnemonics
[language
];
1134 function convertPhraseToNewLanguage() {
1135 var oldLanguage
= getLanguageFromPhrase();
1136 var newLanguage
= getLanguageFromUrl();
1137 var oldPhrase
= DOM
.phrase
.val();
1138 var oldWords
= phraseToWordArray(oldPhrase
);
1140 for (var i
=0; i
<oldWords
.length
; i
++) {
1141 var oldWord
= oldWords
[i
];
1142 var index
= WORDLISTS
[oldLanguage
].indexOf(oldWord
);
1143 var newWord
= WORDLISTS
[newLanguage
][index
];
1144 newWords
.push(newWord
);
1146 newPhrase
= wordArrayToPhrase(newWords
);
1150 // TODO look at jsbip39 - mnemonic.splitWords
1151 function phraseToWordArray(phrase
) {
1152 var words
= phrase
.split(/\s/g);
1154 for (var i
=0; i
<words
.length
; i
++) {
1155 var word
= words
[i
];
1156 if (word
.length
> 0) {
1157 noBlanks
.push(word
);
1163 // TODO look at jsbip39 - mnemonic.joinWords
1164 function wordArrayToPhrase(words
) {
1165 var phrase
= words
.join(" ");
1166 var language
= getLanguageFromPhrase(phrase
);
1167 if (language
== "japanese") {
1168 phrase
= words
.join("\u3000");
1173 function isUsingOwnEntropy() {
1174 return DOM
.useEntropy
.prop("checked");
1177 function setMnemonicFromEntropy() {
1178 clearEntropyFeedback();
1179 // Get entropy value
1180 var entropyStr
= DOM
.entropy
.val();
1181 // Work out minimum base for entropy
1182 var entropy
= Entropy
.fromString(entropyStr
);
1183 if (entropy
.binaryStr
.length
== 0) {
1186 // Show entropy details
1187 showEntropyFeedback(entropy
);
1188 // Use entropy hash if not using raw entropy
1189 var bits
= entropy
.binaryStr
;
1190 var mnemonicLength
= DOM
.entropyMnemonicLength
.val();
1191 if (mnemonicLength
!= "raw") {
1192 // Get bits by hashing entropy with SHA256
1193 var hash
= sjcl
.hash
.sha256
.hash(entropy
.cleanStr
);
1194 var hex
= sjcl
.codec
.hex
.fromBits(hash
);
1195 bits
= BigInteger
.parse(hex
, 16).toString(2);
1196 while (bits
.length
% 256 != 0) {
1199 // Truncate hash to suit number of words
1200 mnemonicLength
= parseInt(mnemonicLength
);
1201 var numberOfBits
= 32 * mnemonicLength
/ 3;
1202 bits
= bits
.substring(0, numberOfBits
);
1203 // show warning for weak entropy override
1204 if (mnemonicLength
/ 3 * 32 > entropy
.binaryStr
.length
) {
1205 DOM
.entropyWeakEntropyOverrideWarning
.removeClass("hidden");
1208 DOM
.entropyWeakEntropyOverrideWarning
.addClass("hidden");
1212 // hide warning for weak entropy override
1213 DOM
.entropyWeakEntropyOverrideWarning
.addClass("hidden");
1215 // Discard trailing entropy
1216 var bitsToUse
= Math
.floor(bits
.length
/ 32) * 32;
1217 var start
= bits
.length
- bitsToUse
;
1218 var binaryStr
= bits
.substring(start
);
1219 // Convert entropy string to numeric array
1220 var entropyArr
= [];
1221 for (var i
=0; i
<binaryStr
.length
/ 8; i
++) {
1222 var byteAsBits
= binaryStr
.substring(i
*8, i
*8+8);
1223 var entropyByte
= parseInt(byteAsBits
, 2);
1224 entropyArr
.push(entropyByte
)
1226 // Convert entropy array to mnemonic
1227 var phrase
= mnemonic
.toMnemonic(entropyArr
);
1228 // Set the mnemonic in the UI
1229 DOM
.phrase
.val(phrase
);
1230 // Show the word indexes
1232 // Show the checksum
1236 function clearEntropyFeedback() {
1237 DOM
.entropyCrackTime
.text("...");
1238 DOM
.entropyType
.text("");
1239 DOM
.entropyWordCount
.text("0");
1240 DOM
.entropyEventCount
.text("0");
1241 DOM
.entropyBitsPerEvent
.text("0");
1242 DOM
.entropyBits
.text("0");
1243 DOM
.entropyFiltered
.html(" ");
1244 DOM
.entropyBinary
.html(" ");
1247 function showEntropyFeedback(entropy
) {
1248 var numberOfBits
= entropy
.binaryStr
.length
;
1249 var timeToCrack
= "unknown";
1251 var z
= zxcvbn(entropy
.base
.parts
.join(""));
1252 timeToCrack
= z
.crack_times_display
.offline_fast_hashing_1e10_per_second
;
1253 if (z
.feedback
.warning
!= "") {
1254 timeToCrack
= timeToCrack
+ " - " + z
.feedback
.warning
;
1258 console
.log("Error detecting entropy strength with zxcvbn:");
1261 var entropyTypeStr
= getEntropyTypeStr(entropy
);
1262 var wordCount
= Math
.floor(numberOfBits
/ 32) * 3;
1263 var bitsPerEvent
= entropy
.bitsPerEvent
.toFixed(2);
1264 var spacedBinaryStr
= addSpacesEveryElevenBits(entropy
.binaryStr
);
1265 DOM
.entropyFiltered
.html(entropy
.cleanHtml
);
1266 DOM
.entropyType
.text(entropyTypeStr
);
1267 DOM
.entropyCrackTime
.text(timeToCrack
);
1268 DOM
.entropyEventCount
.text(entropy
.base
.ints
.length
);
1269 DOM
.entropyBits
.text(numberOfBits
);
1270 DOM
.entropyWordCount
.text(wordCount
);
1271 DOM
.entropyBinary
.text(spacedBinaryStr
);
1272 DOM
.entropyBitsPerEvent
.text(bitsPerEvent
);
1273 // detect and warn of filtering
1274 var rawNoSpaces
= DOM
.entropy
.val().replace(/\s/g, "");
1275 var cleanNoSpaces
= entropy
.cleanStr
.replace(/\s/g, "");
1276 var isFiltered
= rawNoSpaces
.length
!= cleanNoSpaces
.length
;
1278 DOM
.entropyFilterWarning
.removeClass('hidden');
1281 DOM
.entropyFilterWarning
.addClass('hidden');
1285 function getEntropyTypeStr(entropy
) {
1286 var typeStr
= entropy
.base
.str
;
1287 // Add some detail if these are cards
1288 if (entropy
.base
.asInt
== 52) {
1289 var cardDetail
= []; // array of message strings
1290 // Detect duplicates
1292 var dupeTracker
= {};
1293 for (var i
=0; i
<entropy
.base
.parts
.length
; i
++) {
1294 var card
= entropy
.base
.parts
[i
];
1295 var cardUpper
= card
.toUpperCase();
1296 if (cardUpper
in dupeTracker
) {
1299 dupeTracker
[cardUpper
] = true;
1301 if (dupes
.length
> 0) {
1302 var dupeWord
= "duplicates";
1303 if (dupes
.length
== 1) {
1304 dupeWord
= "duplicate";
1306 var msg
= dupes
.length
+ " " + dupeWord
+ ": " + dupes
.slice(0,3).join(" ");
1307 if (dupes
.length
> 3) {
1310 cardDetail
.push(msg
);
1313 var uniqueCards
= [];
1314 for (var uniqueCard
in dupeTracker
) {
1315 uniqueCards
.push(uniqueCard
);
1317 if (uniqueCards
.length
== 52) {
1318 cardDetail
.unshift("full deck");
1320 // Detect missing cards
1321 var values
= "A23456789TJQK";
1323 var missingCards
= [];
1324 for (var i
=0; i
<suits
.length
; i
++) {
1325 for (var j
=0; j
<values
.length
; j
++) {
1326 var card
= values
[j
] + suits
[i
];
1327 if (!(card
in dupeTracker
)) {
1328 missingCards
.push(card
);
1332 // Display missing cards if six or less, ie clearly going for full deck
1333 if (missingCards
.length
> 0 && missingCards
.length
<= 6) {
1334 var msg
= missingCards
.length
+ " missing: " + missingCards
.slice(0,3).join(" ");
1335 if (missingCards
.length
> 3) {
1338 cardDetail
.push(msg
);
1340 // Add card details to typeStr
1341 if (cardDetail
.length
> 0) {
1342 typeStr
+= " (" + cardDetail
.join(", ") + ")";
1348 function setQrEvents(els
) {
1349 els
.on("mouseenter", createQr
);
1350 els
.on("mouseleave", destroyQr
);
1351 els
.on("click", toggleQr
);
1354 function createQr(e
) {
1355 var content
= e
.target
.textContent
|| e
.target
.value
;
1363 DOM
.qrImage
.append(qrEl
);
1365 DOM
.qrHider
.addClass("hidden");
1368 DOM
.qrHider
.removeClass("hidden");
1370 DOM
.qrContainer
.removeClass("hidden");
1374 function destroyQr() {
1375 DOM
.qrImage
.text("");
1376 DOM
.qrContainer
.addClass("hidden");
1379 function toggleQr() {
1381 DOM
.qrHider
.toggleClass("hidden");
1382 DOM
.qrHint
.toggleClass("hidden");
1385 function bip44TabSelected() {
1386 return DOM
.bip44tab
.hasClass("active");
1389 function bip32TabSelected() {
1390 return DOM
.bip32tab
.hasClass("active");
1393 function networkHasSegwit() {
1394 return networks
[DOM
.network
.val()].segwitAvailable
;
1397 function bip49TabSelected() {
1398 return DOM
.bip49tab
.hasClass("active");
1401 function bip84TabSelected() {
1402 return DOM
.bip84tab
.hasClass("active");
1405 function bip141TabSelected() {
1406 return DOM
.bip141tab
.hasClass("active");
1409 function setHdCoin(coinValue
) {
1410 DOM
.bip44coin
.val(coinValue
);
1411 DOM
.bip49coin
.val(coinValue
);
1412 DOM
.bip84coin
.val(coinValue
);
1415 function showSegwitAvailable() {
1416 DOM
.bip49unavailable
.addClass("hidden");
1417 DOM
.bip49available
.removeClass("hidden");
1418 DOM
.bip141unavailable
.addClass("hidden");
1419 DOM
.bip141available
.removeClass("hidden");
1422 function showSegwitUnavailable() {
1423 DOM
.bip49available
.addClass("hidden");
1424 DOM
.bip49unavailable
.removeClass("hidden");
1425 DOM
.bip141available
.addClass("hidden");
1426 DOM
.bip141unavailable
.removeClass("hidden");
1429 function adjustNetworkForSegwit() {
1430 // If segwit is selected the xpub/xprv prefixes need to be adjusted
1431 // to avoid accidentally importing BIP49 xpub to BIP44 watch only
1433 // See https://github.com/iancoleman/bip39/issues/125
1434 var segwitNetworks
= null;
1435 // if a segwit network is alread selected, need to use base network to
1436 // look up new parameters
1437 if ("baseNetwork" in network
) {
1438 network
= bitcoinjs
.bitcoin
.networks
[network
.baseNetwork
];
1440 // choose the right segwit params
1441 if (p2wpkhSelected() && "p2wpkh" in network
) {
1442 network
= network
.p2wpkh
;
1444 else if (p2wpkhInP2shSelected() && "p2wpkhInP2sh" in network
) {
1445 network
= network
.p2wpkhInP2sh
;
1449 function lastIndexInTable() {
1450 var pathText
= DOM
.addresses
.find(".index").last().text();
1451 var pathBits
= pathText
.split("/");
1452 var lastBit
= pathBits
[pathBits
.length
-1];
1453 var lastBitClean
= lastBit
.replace("'", "");
1454 return parseInt(lastBitClean
);
1457 function uint8ArrayToHex(a
) {
1459 for (var i
=0; i
<a
.length
; i
++) {
1460 var h
= a
[i
].toString(16);
1461 while (h
.length
< 2) {
1469 function showWordIndexes() {
1470 var phrase
= DOM
.phrase
.val();
1471 var words
= phraseToWordArray(phrase
);
1472 var wordIndexes
= [];
1473 var language
= getLanguage();
1474 for (var i
=0; i
<words
.length
; i
++) {
1475 var word
= words
[i
];
1476 var wordIndex
= WORDLISTS
[language
].indexOf(word
);
1477 wordIndexes
.push(wordIndex
);
1479 var wordIndexesStr
= wordIndexes
.join(", ");
1480 DOM
.entropyWordIndexes
.text(wordIndexesStr
);
1483 function showChecksum() {
1484 var phrase
= DOM
.phrase
.val();
1485 var words
= phraseToWordArray(phrase
);
1486 var checksumBitlength
= words
.length
/ 3;
1489 var language
= getLanguage();
1490 for (var i
=words
.length
-1; i
>=0; i
--) {
1491 var word
= words
[i
];
1492 var wordIndex
= WORDLISTS
[language
].indexOf(word
);
1493 var wordBinary
= wordIndex
.toString(2);
1494 while (wordBinary
.length
< 11) {
1495 wordBinary
= "0" + wordBinary
;
1497 var binaryStr
= wordBinary
+ binaryStr
;
1498 if (binaryStr
.length
>= checksumBitlength
) {
1499 var start
= binaryStr
.length
- checksumBitlength
;
1500 var end
= binaryStr
.length
;
1501 checksum
= binaryStr
.substring(start
, end
);
1502 // add spaces so the last group is 11 bits, not the first
1503 checksum
= checksum
.split("").reverse().join("")
1504 checksum
= addSpacesEveryElevenBits(checksum
);
1505 checksum
= checksum
.split("").reverse().join("")
1509 DOM
.entropyChecksum
.text(checksum
);
1512 function updateCsv() {
1513 var tableCsv
= "path,address,public key,private key\n";
1514 var rows
= DOM
.addresses
.find("tr");
1515 for (var i
=0; i
<rows
.length
; i
++) {
1516 var row
= $(rows
[i
]);
1517 var cells
= row
.find("td");
1518 for (var j
=0; j
<cells
.length
; j
++) {
1519 var cell
= $(cells
[j
]);
1520 if (!cell
.children().hasClass("invisible")) {
1521 tableCsv
= tableCsv
+ cell
.text();
1523 if (j
!= cells
.length
- 1) {
1524 tableCsv
= tableCsv
+ ",";
1527 tableCsv
= tableCsv
+ "\n";
1529 DOM
.csv
.val(tableCsv
);
1532 function addSpacesEveryElevenBits(binaryStr
) {
1533 return binaryStr
.match(/.{1,11}/g).join(" ");
1538 name: "AC - Asiacoin",
1539 segwitAvailable: false,
1540 onSelect: function() {
1541 network
= bitcoinjs
.bitcoin
.networks
.asiacoin
;
1546 name: "ACC - Adcoin",
1547 segwitAvailable: true,
1548 onSelect: function() {
1549 network
= bitcoinjs
.bitcoin
.networks
.adcoin
;
1554 name: "AUR - Auroracoin",
1555 segwitAvailable: false,
1556 onSelect: function() {
1557 network
= bitcoinjs
.bitcoin
.networks
.auroracoin
;
1563 segwitAvailable: false,
1564 onSelect: function() {
1565 network
= bitcoinjs
.bitcoin
.networks
.axe
;
1570 name: "BCA - Bitcoin Atom",
1571 segwitAvailable: true,
1572 onSelect: function() {
1573 network
= bitcoinjs
.bitcoin
.networks
.atom
;
1578 name: "BCH - Bitcoin Cash",
1579 segwitAvailable: false,
1580 onSelect: function() {
1581 DOM
.bitcoinCashAddressTypeContainer
.removeClass("hidden");
1586 name: "BEET - Beetlecoin",
1587 segwitAvailable: false,
1588 onSelect: function() {
1589 network
= bitcoinjs
.bitcoin
.networks
.beetlecoin
;
1594 name: "BELA - Belacoin",
1595 segwitAvailable: false,
1596 onSelect: function() {
1597 network
= bitcoinjs
.bitcoin
.networks
.belacoin
;
1602 name: "BLK - BlackCoin",
1603 segwitAvailable: false,
1604 onSelect: function() {
1605 network
= bitcoinjs
.bitcoin
.networks
.blackcoin
;
1610 name: "BRIT - Britcoin",
1611 segwitAvailable: false,
1612 onSelect: function() {
1613 network
= bitcoinjs
.bitcoin
.networks
.britcoin
;
1618 name: "BSD - Bitsend",
1619 segwitAvailable: true,
1620 onSelect: function() {
1621 network
= bitcoinjs
.bitcoin
.networks
.bitsend
;
1627 segwitAvailable: false,
1628 onSelect: function() {
1629 network
= bitcoinjs
.bitcoin
.networks
.bata
;
1634 name: "BTC - Bitcoin",
1635 segwitAvailable: true,
1636 onSelect: function() {
1637 network
= bitcoinjs
.bitcoin
.networks
.bitcoin
;
1642 name: "BTC - Bitcoin Testnet",
1643 segwitAvailable: true,
1644 onSelect: function() {
1645 network
= bitcoinjs
.bitcoin
.networks
.testnet
;
1650 name: "BTCP - Bitcoin Private",
1651 segwitAvailable: true,
1652 onSelect: function() {
1653 network
= bitcoinjs
.bitcoin
.networks
.bitcoinprivate
;
1658 name: "BTCZ - Bitcoinz",
1659 segwitAvailable: false,
1660 onSelect: function() {
1661 network
= bitcoinjs
.bitcoin
.networks
.bitcoinz
;
1666 name: "BTG - Bitcoin Gold",
1667 segwitAvailable: true,
1668 onSelect: function() {
1669 network
= bitcoinjs
.bitcoin
.networks
.bgold
;
1674 name: "BTX - Bitcore",
1675 segwitAvailable: true,
1676 onSelect: function() {
1677 network
= bitcoinjs
.bitcoin
.networks
.bitcore
;
1682 name: "CCN - Cannacoin",
1683 segwitAvailable: false,
1684 onSelect: function() {
1685 network
= bitcoinjs
.bitcoin
.networks
.cannacoin
;
1690 name: "CDN - Canadaecoin",
1691 segwitAvailable: false,
1692 onSelect: function() {
1693 network
= bitcoinjs
.bitcoin
.networks
.canadaecoin
;
1698 name: "CLAM - Clams",
1699 segwitAvailable: false,
1700 onSelect: function() {
1701 network
= bitcoinjs
.bitcoin
.networks
.clam
;
1706 name: "CLUB - Clubcoin",
1707 segwitAvailable: false,
1708 onSelect: function() {
1709 network
= bitcoinjs
.bitcoin
.networks
.clubcoin
;
1714 name: "CMP - Compcoin",
1715 segwitAvailable: false,
1716 onSelect: function() {
1717 network
= bitcoinjs
.bitcoin
.networks
.compcoin
;
1722 name: "CRAVE - Crave",
1723 segwitAvailable: false,
1724 onSelect: function() {
1725 network
= bitcoinjs
.bitcoin
.networks
.crave
;
1730 name: "CRW - Crown",
1731 segwitAvailable: false,
1732 onSelect: function() {
1733 network
= bitcoinjs
.bitcoin
.networks
.crown
;
1738 name: "DASH - Dash",
1739 segwitAvailable: false,
1740 onSelect: function() {
1741 network
= bitcoinjs
.bitcoin
.networks
.dash
;
1746 name: "DASH - Dash Testnet",
1747 segwitAvailable: false,
1748 onSelect: function() {
1749 network
= bitcoinjs
.bitcoin
.networks
.dashtn
;
1754 name: "DFC - Defcoin",
1755 segwitAvailable: false,
1756 onSelect: function() {
1757 network
= bitcoinjs
.bitcoin
.networks
.defcoin
;
1762 name: "DGB - Digibyte",
1763 segwitAvailable: true,
1764 onSelect: function() {
1765 network
= bitcoinjs
.bitcoin
.networks
.digibyte
;
1770 name: "DGC - Digitalcoin",
1771 segwitAvailable: false,
1772 onSelect: function() {
1773 network
= bitcoinjs
.bitcoin
.networks
.digitalcoin
;
1778 name: "DMD - Diamond",
1779 segwitAvailable: false,
1780 onSelect: function() {
1781 network
= bitcoinjs
.bitcoin
.networks
.diamond
;
1786 name: "DNR - Denarius",
1787 segwitAvailable: false,
1788 onSelect: function() {
1789 network
= bitcoinjs
.bitcoin
.networks
.denarius
;
1794 name: "DOGE - Dogecoin",
1795 segwitAvailable: false,
1796 onSelect: function() {
1797 network
= bitcoinjs
.bitcoin
.networks
.dogecoin
;
1802 name: "ECN - Ecoin",
1803 segwitAvailable: false,
1804 onSelect: function() {
1805 network
= bitcoinjs
.bitcoin
.networks
.ecoin
;
1810 name: "EDRC - Edrcoin",
1811 segwitAvailable: false,
1812 onSelect: function() {
1813 network
= bitcoinjs
.bitcoin
.networks
.edrcoin
;
1818 name: "EFL - Egulden",
1819 segwitAvailable: true,
1820 onSelect: function() {
1821 network
= bitcoinjs
.bitcoin
.networks
.egulden
;
1826 name: "EMC2 - Einsteinium",
1827 segwitAvailable: false,
1828 onSelect: function() {
1829 network
= bitcoinjs
.bitcoin
.networks
.einsteinium
;
1834 name: "ERC - Europecoin",
1835 segwitAvailable: false,
1836 onSelect: function() {
1837 network
= bitcoinjs
.bitcoin
.networks
.europecoin
;
1842 name: "ETH - Ethereum",
1843 segwitAvailable: false,
1844 onSelect: function() {
1845 network
= bitcoinjs
.bitcoin
.networks
.bitcoin
;
1850 name: "EXCL - Exclusivecoin",
1851 segwitAvailable: false,
1852 onSelect: function() {
1853 network
= bitcoinjs
.bitcoin
.networks
.exclusivecoin
;
1858 name: "FJC - Fujicoin",
1859 segwitAvailable: true,
1860 onSelect: function() {
1861 network
= bitcoinjs
.bitcoin
.networks
.fujicoin
;
1866 name: "FLASH - Flashcoin",
1867 segwitAvailable: false,
1868 onSelect: function() {
1869 network
= bitcoinjs
.bitcoin
.networks
.flashcoin
;
1874 name: "FRST - Firstcoin",
1875 segwitAvailable: false,
1876 onSelect: function() {
1877 network
= bitcoinjs
.bitcoin
.networks
.firstcoin
;
1882 name: "FTC - Feathercoin",
1883 segwitAvailable: true,
1884 onSelect: function() {
1885 network
= bitcoinjs
.bitcoin
.networks
.feathercoin
;
1890 name: "GAME - GameCredits",
1891 segwitAvailable: false,
1892 onSelect: function() {
1893 network
= bitcoinjs
.bitcoin
.networks
.game
;
1898 name: "GBX - Gobyte",
1899 segwitAvailable: false,
1900 onSelect: function() {
1901 network
= bitcoinjs
.bitcoin
.networks
.gobyte
;
1906 name: "GCR - GCRCoin",
1907 segwitAvailable: false,
1908 onSelect: function() {
1909 network
= bitcoinjs
.bitcoin
.networks
.gcr
;
1914 name: "GRC - Gridcoin",
1915 segwitAvailable: false,
1916 onSelect: function() {
1917 network
= bitcoinjs
.bitcoin
.networks
.gridcoin
;
1922 name: "HNC - Helleniccoin",
1923 segwitAvailable: false,
1924 onSelect: function() {
1925 network
= bitcoinjs
.bitcoin
.networks
.helleniccoin
;
1930 name: "INSN - Insane",
1931 segwitAvailable: false,
1932 onSelect: function() {
1933 network
= bitcoinjs
.bitcoin
.networks
.insane
;
1939 segwitAvailable: true,
1940 onSelect: function() {
1941 network
= bitcoinjs
.bitcoin
.networks
.iop
;
1946 name: "IXC - Ixcoin",
1947 segwitAvailable: false,
1948 onSelect: function() {
1949 network
= bitcoinjs
.bitcoin
.networks
.ixcoin
;
1954 name: "JBS - Jumbucks",
1955 segwitAvailable: false,
1956 onSelect: function() {
1957 network
= bitcoinjs
.bitcoin
.networks
.jumbucks
;
1962 name: "KMD - Komodo",
1963 bip49available: false,
1964 onSelect: function() {
1965 network
= bitcoinjs
.bitcoin
.networks
.komodo
;
1970 name: "KOBO - Kobocoin",
1971 bip49available: false,
1972 onSelect: function() {
1973 network
= bitcoinjs
.bitcoin
.networks
.kobocoin
;
1978 name: "LBC - Library Credits",
1979 segwitAvailable: false,
1980 onSelect: function() {
1981 network
= bitcoinjs
.bitcoin
.networks
.lbry
;
1986 name: "LCC - Litecoincash",
1987 segwitAvailable: true,
1988 onSelect: function() {
1989 network
= bitcoinjs
.bitcoin
.networks
.litecoincash
;
1994 name: "LDCN - Landcoin",
1995 segwitAvailable: false,
1996 onSelect: function() {
1997 network
= bitcoinjs
.bitcoin
.networks
.landcoin
;
2002 name: "LINX - Linx",
2003 segwitAvailable: false,
2004 onSelect: function() {
2005 network
= bitcoinjs
.bitcoin
.networks
.linx
;
2010 name: "LTC - Litecoin",
2011 segwitAvailable: true,
2012 onSelect: function() {
2013 network
= bitcoinjs
.bitcoin
.networks
.litecoin
;
2015 DOM
.litecoinLtubContainer
.removeClass("hidden");
2019 name: "LYNX - Lynx",
2020 segwitAvailable: false,
2021 onSelect: function() {
2022 network
= bitcoinjs
.bitcoin
.networks
.lynx
;
2027 name: "MAZA - Maza",
2028 segwitAvailable: false,
2029 onSelect: function() {
2030 network
= bitcoinjs
.bitcoin
.networks
.maza
;
2035 name: "MNX - Minexcoin",
2036 segwitAvailable: true,
2037 onSelect: function() {
2038 network
= bitcoinjs
.bitcoin
.networks
.minexcoin
;
2043 name: "MONA - Monacoin",
2044 segwitAvailable: true,
2045 onSelect: function() {
2046 network
= bitcoinjs
.bitcoin
.networks
.monacoin
,
2051 name: "NAV - Navcoin",
2052 segwitAvailable: true,
2053 onSelect: function() {
2054 network
= bitcoinjs
.bitcoin
.networks
.navcoin
;
2059 name: "NEBL - Neblio",
2060 segwitAvailable: false,
2061 onSelect: function() {
2062 network
= bitcoinjs
.bitcoin
.networks
.neblio
;
2067 name: "NEOS - Neoscoin",
2068 segwitAvailable: false,
2069 onSelect: function() {
2070 network
= bitcoinjs
.bitcoin
.networks
.neoscoin
;
2075 name: "NLG - Gulden",
2076 segwitAvailable: false,
2077 onSelect: function() {
2078 network
= bitcoinjs
.bitcoin
.networks
.gulden
;
2083 name: "NMC - Namecoin",
2084 segwitAvailable: false,
2085 onSelect: function() {
2086 network
= bitcoinjs
.bitcoin
.networks
.namecoin
;
2091 name: "NRG - Energi",
2092 segwitAvailable: false,
2093 onSelect: function() {
2094 network
= bitcoinjs
.bitcoin
.networks
.energi
;
2099 name: "NRO - Neurocoin",
2100 segwitAvailable: false,
2101 onSelect: function() {
2102 network
= bitcoinjs
.bitcoin
.networks
.neurocoin
;
2107 name: "NSR - Nushares",
2108 segwitAvailable: false,
2109 onSelect: function() {
2110 network
= bitcoinjs
.bitcoin
.networks
.nushares
;
2115 name: "NYC - Newyorkc",
2116 segwitAvailable: false,
2117 onSelect: function() {
2118 network
= bitcoinjs
.bitcoin
.networks
.newyorkc
;
2123 name: "NVC - Novacoin",
2124 segwitAvailable: false,
2125 onSelect: function() {
2126 network
= bitcoinjs
.bitcoin
.networks
.novacoin
;
2131 name: "OK - Okcash",
2132 segwitAvailable: false,
2133 onSelect: function() {
2134 network
= bitcoinjs
.bitcoin
.networks
.okcash
;
2139 name: "OMNI - Omnicore",
2140 segwitAvailable: true,
2141 onSelect: function() {
2142 network
= bitcoinjs
.bitcoin
.networks
.omnicore
;
2147 name: "ONX - Onixcoin",
2148 segwitAvailable: false,
2149 onSelect: function() {
2150 network
= bitcoinjs
.bitcoin
.networks
.onixcoin
;
2155 name: "PINK - Pinkcoin",
2156 segwitAvailable: false,
2157 onSelect: function() {
2158 network
= bitcoinjs
.bitcoin
.networks
.pinkcoin
;
2163 name: "PIVX - PIVX",
2164 segwitAvailable: false,
2165 onSelect: function() {
2166 network
= bitcoinjs
.bitcoin
.networks
.pivx
;
2171 name: "PIVX - PIVX Testnet",
2172 segwitAvailable: false,
2173 onSelect: function() {
2174 network
= bitcoinjs
.bitcoin
.networks
.pivxtestnet
;
2179 name: "POSW - POSWcoin",
2180 segwitAvailable: false,
2181 onSelect: function() {
2182 network
= bitcoinjs
.bitcoin
.networks
.poswcoin
;
2187 name: "POT - Potcoin",
2188 segwitAvailable: false,
2189 onSelect: function() {
2190 network
= bitcoinjs
.bitcoin
.networks
.potcoin
;
2195 name: "PPC - Peercoin",
2196 segwitAvailable: false,
2197 onSelect: function() {
2198 network
= bitcoinjs
.bitcoin
.networks
.peercoin
;
2203 name: "PSB - Pesobit",
2204 segwitAvailable: false,
2205 onSelect: function() {
2206 network
= bitcoinjs
.bitcoin
.networks
.pesobit
;
2211 name: "PUT - Putincoin",
2212 segwitAvailable: false,
2213 onSelect: function() {
2214 network
= bitcoinjs
.bitcoin
.networks
.putincoin
;
2219 name: "RBY - Rubycoin",
2220 segwitAvailable: false,
2221 onSelect: function() {
2222 network
= bitcoinjs
.bitcoin
.networks
.rubycoin
;
2227 name: "RDD - Reddcoin",
2228 segwitAvailable: false,
2229 onSelect: function() {
2230 network
= bitcoinjs
.bitcoin
.networks
.reddoin
;
2235 name: "RVR - RevolutionVR",
2236 segwitAvailable: false,
2237 onSelect: function() {
2238 network
= bitcoinjs
.bitcoin
.networks
.revolutionvr
;
2243 name: "SDC - ShadowCash",
2244 segwitAvailable: false,
2245 onSelect: function() {
2246 network
= bitcoinjs
.bitcoin
.networks
.shadow
;
2251 name: "SDC - ShadowCash Testnet",
2252 segwitAvailable: false,
2253 onSelect: function() {
2254 network
= bitcoinjs
.bitcoin
.networks
.shadowtn
;
2259 name: "SLM - Slimcoin",
2260 segwitAvailable: false,
2261 onSelect: function() {
2262 network
= bitcoinjs
.bitcoin
.networks
.slimcoin
;
2267 name: "SLM - Slimcoin Testnet",
2268 segwitAvailable: false,
2269 onSelect: function() {
2270 network
= bitcoinjs
.bitcoin
.networks
.slimcointn
;
2275 name: "SLR - Solarcoin",
2276 segwitAvailable: false,
2277 onSelect: function() {
2278 network
= bitcoinjs
.bitcoin
.networks
.solarcoin
;
2283 name: "SMLY - Smileycoin",
2284 segwitAvailable: false,
2285 onSelect: function() {
2286 network
= bitcoinjs
.bitcoin
.networks
.smileycoin
;
2291 name: "STRAT - Stratis",
2292 segwitAvailable: false,
2293 onSelect: function() {
2294 network
= bitcoinjs
.bitcoin
.networks
.stratis
;
2299 name: "SYS - Syscoin",
2300 segwitAvailable: true,
2301 onSelect: function() {
2302 network
= bitcoinjs
.bitcoin
.networks
.syscoin
;
2307 name: "THC - Hempcoin",
2308 segwitAvailable: false,
2309 onSelect: function() {
2310 network
= bitcoinjs
.bitcoin
.networks
.hempcoin
;
2316 segwitAvailable: false,
2317 onSelect: function() {
2318 network
= bitcoinjs
.bitcoin
.networks
.toa
;
2323 name: "USC - Ultimatesecurecash",
2324 segwitAvailable: false,
2325 onSelect: function() {
2326 network
= bitcoinjs
.bitcoin
.networks
.ultimatesecurecash
;
2331 name: "USNBT - NuBits",
2332 segwitAvailable: false,
2333 onSelect: function() {
2334 network
= bitcoinjs
.bitcoin
.networks
.nubits
;
2339 name: "UNO - Unobtanium",
2340 segwitAvailable: false,
2341 onSelect: function() {
2342 network
= bitcoinjs
.bitcoin
.networks
.unobtanium
;
2347 name: "VASH - Vpncoin",
2348 segwitAvailable: false,
2349 onSelect: function() {
2350 network
= bitcoinjs
.bitcoin
.networks
.vpncoin
;
2355 name: "VIA - Viacoin",
2356 segwitAvailable: false,
2357 onSelect: function() {
2358 network
= bitcoinjs
.bitcoin
.networks
.viacoin
;
2363 name: "VIA - Viacoin Testnet",
2364 segwitAvailable: false,
2365 onSelect: function() {
2366 network
= bitcoinjs
.bitcoin
.networks
.viacointestnet
;
2371 name: "VIVO - Vivo",
2372 segwitAvailable: false,
2373 onSelect: function() {
2374 network
= bitcoinjs
.bitcoin
.networks
.vivo
;
2379 name: "VTC - Vertcoin",
2380 segwitAvailable: true,
2381 onSelect: function() {
2382 network
= bitcoinjs
.bitcoin
.networks
.vertcoin
;
2387 name: "WC - Wincoin",
2388 segwitAvailable: false,
2389 onSelect: function() {
2390 network
= bitcoinjs
.bitcoin
.networks
.wincoin
;
2395 name: "XBC - Bitcoinplus",
2396 segwitAvailable: false,
2397 onSelect: function() {
2398 network
= bitcoinjs
.bitcoin
.networks
.bitcoinplus
;
2403 name: "XMY - Myriadcoin",
2404 segwitAvailable: false,
2405 onSelect: function() {
2406 network
= bitcoinjs
.bitcoin
.networks
.myriadcoin
;
2411 name: "XRP - Ripple",
2412 segwitAvailable: false,
2413 onSelect: function() {
2414 network
= bitcoinjs
.bitcoin
.networks
.bitcoin
;
2419 name: "XVC - Vcash",
2420 segwitAvailable: false,
2421 onSelect: function() {
2422 network
= bitcoinjs
.bitcoin
.networks
.vcash
;
2427 name: "XVG - Verge",
2428 segwitAvailable: false,
2429 onSelect: function() {
2430 network
= bitcoinjs
.bitcoin
.networks
.verge
;
2435 name: "XWC - Whitecoin",
2436 segwitAvailable: false,
2437 onSelect: function() {
2438 network
= bitcoinjs
.bitcoin
.networks
.whitecoin
;
2443 name: "XZC - Zcoin",
2444 segwitAvailable: true,
2445 onSelect: function() {
2446 network
= bitcoinjs
.bitcoin
.networks
.zcoin
;
2451 name: "ZCL - Zclassic",
2452 segwitAvailable: false,
2453 onSelect: function() {
2454 network
= bitcoinjs
.bitcoin
.networks
.zclassic
;
2459 name: "ZEC - Zcash",
2460 segwitAvailable: false,
2461 onSelect: function() {
2462 network
= bitcoinjs
.bitcoin
.networks
.zcash
;
2467 name: "XUEZ - Xuez",
2468 segwitAvailable: false,
2469 onSelect: function() {
2470 network
= bitcoinjs
.bitcoin
.networks
.xuez
;
2475 name: "ZEN - Zencash",
2476 segwitAvailable: false,
2477 onSelect: function() {
2478 network
= bitcoinjs
.bitcoin
.networks
.zencash
;
2486 name: "Bitcoin Core",
2487 onSelect: function() {
2488 DOM
.bip32path
.val("m/0'/0'");
2489 DOM
.hardenedAddresses
.prop('checked', true);
2493 name: "blockchain.info",
2494 onSelect: function() {
2495 DOM
.bip32path
.val("m/44'/0'/0'");
2496 DOM
.hardenedAddresses
.prop('checked', false);
2500 name: "MultiBit HD",
2501 onSelect: function() {
2502 DOM
.bip32path
.val("m/0'/0");
2503 DOM
.hardenedAddresses
.prop('checked', false);