2 // cd /path/to/repo/tests
3 // jasmine spec/tests.js
9 // see https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode#Automated_testing_with_headless_mode
11 // USER SPECIFIED OPTIONS
12 var browser
= process
.env
.BROWSER
; //"firefox"; // or "chrome"
14 console
.log("Browser can be set via environment variable, eg");
15 console
.log("BROWSER=firefox jasmine spec/tests.js");
16 console
.log("Options for BROWSER are firefox chrome");
17 console
.log("Using default browser: chrome");
21 console
.log("Using browser: " + browser
);
26 var webdriver
= require('selenium-webdriver');
27 var By
= webdriver
.By
;
28 var Key
= webdriver
.Key
;
29 var until
= webdriver
.until
;
33 var generateDelay
= 1500;
34 var feedbackDelay
= 500;
35 var entropyFeedbackDelay
= 500;
36 var bip38delay
= 15000;
38 // url uses file:// scheme
39 var path
= require('path')
40 var parentDir
= path
.resolve(process
.cwd(), '..', 'src', 'index.html');
41 var url
= "file://" + parentDir
;
42 if (browser
== "firefox") {
43 // TODO loading local html in firefox is broken
44 console
.log("Loading local html in firefox is broken, see https://stackoverflow.com/q/46367054");
45 console
.log("You must run a server in this case, ie do this:");
46 console
.log("$ cd /path/to/bip39/src");
47 console
.log("$ python -m http.server");
48 url
= "http://localhost:8000";
51 // Variables dependent on specific browser selection
53 if (browser
== "firefox") {
54 var firefox
= require('selenium-webdriver/firefox');
55 var binary
= new firefox
.Binary(firefox
.Channel
.NIGHTLY
);
56 binary
.addArguments("-headless");
57 newDriver = function() {
58 return new webdriver
.Builder()
59 .forBrowser('firefox')
60 .setFirefoxOptions(new firefox
.Options().setBinary(binary
))
64 else if (browser
== "chrome") {
65 var chrome
= require('selenium-webdriver/chrome');
66 newDriver = function() {
67 return new webdriver
.Builder()
69 .setChromeOptions(new chrome
.Options().addArguments("headless"))
76 function testNetwork(done
, params
, comparePub
= false) {
77 var phrase
= params
.phrase
|| 'abandon abandon ability';
78 driver
.findElement(By
.css('.phrase'))
80 selectNetwork(params
.selectText
);
81 driver
.sleep(generateDelay
).then(function() {
83 getFirstAddress(function(address
) {
84 expect(address
).toBe(params
.firstAddress
);
88 getFirstPublicKey(function(pubkey
) {
89 expect(pubkey
).toBe(params
.firstPubKey
);
96 function getFirstRowValue(handler
, selector
) {
97 driver
.findElements(By
.css(selector
))
104 function getFirstAddress(handler
) {
105 getFirstRowValue(handler
, ".address");
108 function getFirstPublicKey(handler
) {
109 getFirstRowValue(handler
, ".pubkey");
112 function getFirstPath(handler
) {
113 getFirstRowValue(handler
, ".index");
116 function testColumnValuesAreInvisible(done
, columnClassName
) {
117 var selector
= "." + columnClassName
+ " span";
118 driver
.findElements(By
.css(selector
))
119 .then(function(els
) {
120 els
[0].getAttribute("class")
121 .then(function(classes
) {
122 expect(classes
).toContain("invisible");
128 function testRowsAreInCorrectOrder(done
) {
129 driver
.findElements(By
.css('.index'))
130 .then(function(els
) {
131 var testRowAtIndex = function(i
) {
132 if (i
>= els
.length
) {
137 .then(function(actualPath
) {
138 var noHardened
= actualPath
.replace(/'/g, "");
139 var pathBits = noHardened.split("/")
140 var lastBit = pathBits[pathBits.length-1];
141 var actualIndex = parseInt(lastBit);
142 expect(actualIndex).toBe(i);
151 function selectNetwork(name) {
152 driver.executeScript(function() {
153 var selectText = arguments[0];
154 $(".network option[selected]").removeAttr("selected");
155 $(".network option").filter(function(i,e) {
156 return $(e).html() == selectText;
157 }).prop("selected", true);
158 $(".network").trigger("change");
162 function testEntropyType(done, entropyText, entropyTypeUnsafe) {
163 // entropy type is compiled into regexp so needs escaping
164 // see https://stackoverflow.com/a/2593661
165 var entropyType = (entropyTypeUnsafe+'').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
166 driver.findElement(By.css('.use-entropy
'))
168 driver.findElement(By.css('.entropy
'))
169 .sendKeys(entropyText);
170 driver.sleep(generateDelay).then(function() {
171 driver.findElement(By.css('.entropy
-container
'))
173 .then(function(text) {
174 var re = new RegExp("Entropy Type\\s+" + entropyType);
175 expect(text).toMatch(re);
181 function testEntropyBits(done, entropyText, entropyBits) {
182 driver.findElement(By.css('.use-entropy
'))
184 driver.findElement(By.css('.entropy
'))
185 .sendKeys(entropyText);
186 driver.sleep(generateDelay).then(function() {
187 driver.findElement(By.css('.entropy
-container
'))
189 .then(function(text) {
190 var re = new RegExp("Total Bits\\s+" + entropyBits);
191 expect(text).toMatch(re);
197 function testEntropyFeedback(done, entropyDetail) {
198 // entropy type is compiled into regexp so needs escaping
199 // see https://stackoverflow.com/a/2593661
200 if ("type" in entropyDetail) {
201 entropyDetail.type = (entropyDetail.type+'').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
203 driver.findElement(By.css('.use-entropy
'))
205 driver.findElement(By.css('.entropy
'))
206 .sendKeys(entropyDetail.entropy);
207 driver.sleep(entropyFeedbackDelay).then(function() {
208 driver.findElement(By.css('.entropy
-container
'))
210 .then(function(text) {
211 driver.findElement(By.css('.phrase
'))
212 .getAttribute("value")
213 .then(function(phrase) {
214 if ("filtered" in entropyDetail) {
215 var key = "Filtered Entropy";
216 var value = entropyDetail.filtered;
217 var reText = key + "\\s+" + value;
218 var re = new RegExp(reText);
219 expect(text).toMatch(re);
221 if ("type" in entropyDetail) {
222 var key = "Entropy Type";
223 var value = entropyDetail.type;
224 var reText = key + "\\s+" + value;
225 var re = new RegExp(reText);
226 expect(text).toMatch(re);
228 if ("events" in entropyDetail) {
229 var key = "Event Count";
230 var value = entropyDetail.events;
231 var reText = key + "\\s+" + value;
232 var re = new RegExp(reText);
233 expect(text).toMatch(re);
235 if ("bits" in entropyDetail) {
236 var key = "Total Bits";
237 var value = entropyDetail.bits;
238 var reText = key + "\\s+" + value;
239 var re = new RegExp(reText);
240 expect(text).toMatch(re);
242 if ("bitsPerEvent" in entropyDetail) {
243 var key = "Bits Per Event";
244 var value = entropyDetail.bitsPerEvent;
245 var reText = key + "\\s+" + value;
246 var re = new RegExp(reText);
247 expect(text).toMatch(re);
249 if ("words" in entropyDetail) {
250 var actualWords = phrase.split(/\s+/)
251 .filter(function(w) { return w.length > 0 })
253 expect(actualWords).toBe(entropyDetail.words);
255 if ("strength" in entropyDetail) {
256 var key = "Time To Crack";
257 var value = entropyDetail.strength;
258 var reText = key + "\\s+" + value;
259 var re = new RegExp(reText);
260 expect(text).toMatch(re);
268 function testClientSelect(done, params) {
269 // set mnemonic and select bip32 tab
270 driver.findElement(By.css('#bip32
-tab a
'))
272 driver.findElement(By.css('.phrase
'))
273 .sendKeys("abandon abandon ability");
274 driver.sleep(generateDelay).then(function() {
276 // set bip32 client to bitcoin core
277 driver.executeScript(function() {
278 $("#bip32-client").val(arguments[0]).trigger("change");
279 }, params.selectValue);
280 driver.sleep(generateDelay).then(function() {
281 // check the derivation path is correct
282 driver.findElement(By.css("#bip32-path"))
283 .getAttribute("value")
284 .then(function(path) {
285 expect(path).toBe(params.bip32path);
286 // check hardened addresses is selected
287 driver.findElement(By.css(".hardened-addresses"))
288 .getAttribute("checked")
289 .then(function(isChecked) {
290 expect(isChecked).toBe(params.useHardenedAddresses);
291 // check input is readonly
292 driver.findElement(By.css("#bip32-path"))
293 .getAttribute("readonly")
294 .then(function(isReadonly) {
295 expect(isReadonly).toBe("true");
306 describe('BIP39 Tool Tests
', function() {
308 beforeEach(function(done) {
309 driver = newDriver();
310 driver.get(url).then(done);
313 // Close the website after each test is run (so that it is opened fresh each time)
314 afterEach(function(done) {
315 driver.quit().then(done);
320 // Page initially loads with blank phrase
321 it('Should load the page
', function(done) {
322 driver.findElement(By.css('.phrase
'))
323 .getAttribute('value
').then(function(value) {
324 expect(value).toBe('');
330 it('Should have text on the page
', function(done) {
331 driver.findElement(By.css('body
'))
333 .then(function(text) {
334 var textToFind = "You can enter an existing BIP39 mnemonic";
335 expect(text).toContain(textToFind);
340 // Entering mnemonic generates addresses
341 it('Should have a list
of addresses
', function(done) {
342 driver.findElement(By.css('.phrase
'))
343 .sendKeys('abandon abandon ability
');
344 driver.sleep(generateDelay).then(function() {
345 driver.findElements(By.css('.address
'))
346 .then(function(els) {
347 expect(els.length).toBe(20);
353 // Generate button generates random mnemonic
354 it('Should be able to generate a random mnemonic
', function(done) {
355 // initial phrase is blank
356 driver.findElement(By.css('.phrase
'))
357 .getAttribute("value")
358 .then(function(phrase) {
359 expect(phrase.length).toBe(0);
361 driver.findElement(By.css('.generate
')).click();
362 driver.sleep(generateDelay).then(function() {
363 // new phrase is not blank
364 driver.findElement(By.css('.phrase
'))
365 .getAttribute("value")
366 .then(function(phrase) {
367 expect(phrase.length).toBeGreaterThan(0);
374 // Mnemonic length can be customized
375 it('Should allow custom length mnemonics
', function(done) {
377 driver.executeScript(function() {
378 $(".strength option[selected]").removeAttr("selected");
379 $(".strength option[value=6]").prop("selected", true);
381 driver.findElement(By.css('.generate
')).click();
382 driver.sleep(generateDelay).then(function() {
383 driver.findElement(By.css('.phrase
'))
384 .getAttribute("value")
385 .then(function(phrase) {
386 var words = phrase.split(" ");
387 expect(words.length).toBe(6);
393 // Passphrase can be set
394 it('Allows a passphrase to be
set', function(done) {
395 driver.findElement(By.css('.phrase
'))
396 .sendKeys('abandon abandon ability
');
397 driver.findElement(By.css('.passphrase
'))
398 .sendKeys('secure_passphrase
');
399 driver.sleep(generateDelay).then(function() {
400 getFirstAddress(function(address) {
401 expect(address).toBe("15pJzUWPGzR7avffV9nY5by4PSgSKG9rba");
407 // Network can be set to networks other than bitcoin
408 it('Allows selection
of bitcoin testnet
', function(done) {
410 selectText: "BTC - Bitcoin Testnet",
411 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
413 testNetwork(done, params);
415 it('Allows selection
of bitcoin regtest
', function(done) {
417 selectText: "BTC - Bitcoin RegTest",
418 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
420 testNetwork(done, params);
422 it('Allows selection
of litecoin
', function(done) {
424 selectText: "LTC - Litecoin",
425 firstAddress: "LQ4XU8RX2ULPmPq9FcUHdVmPVchP9nwXdn",
427 testNetwork(done, params);
429 it('Allows selection
of litecoin testnet
', function(done) {
431 selectText: "LTCt - Litecoin Testnet",
432 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
434 testNetwork(done, params);
436 it('Allows selection
of ripple
', function(done) {
438 selectText: "XRP - Ripple",
439 firstAddress: "rLTFnqbmCVPGx6VfaygdtuKWJgcN4v1zRS",
440 phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
442 testNetwork(done, params);
444 it('Allows selection
of casinocoin
', function(done) {
446 selectText: "CSC - CasinoCoin",
447 firstAddress: "c3P5EUb27Pzk9dcGt4s7zQDQj4sC6Y81mT",
448 phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
450 testNetwork(done, params);
452 it('Allows selection
of dogecoin
', function(done) {
454 selectText: "DOGE - Dogecoin",
455 firstAddress: "DPQH2AtuzkVSG6ovjKk4jbUmZ6iXLpgbJA",
457 testNetwork(done, params);
459 it('Allows selection
of dogecoin testnet
', function(done) {
461 selectText: "DOGEt - Dogecoin Testnet",
462 firstAddress: "niHnSJKHdwDyDxRMLBJrtNqpvHEsAFWe6B",
464 testNetwork(done, params);
466 it('Allows selection
of denarius
', function(done) {
468 selectText: "DNR - Denarius",
469 firstAddress: "DFdFMVUMzU9xX88EywXvAGwjiwpxyh9vKb",
471 testNetwork(done, params);
473 it('Allows selection
of shadowcash
', function(done) {
475 selectText: "SDC - ShadowCash",
476 firstAddress: "SiSZtfYAXEFvMm3XM8hmtkGDyViRwErtCG",
478 testNetwork(done, params);
480 it('Allows selection
of shadowcash testnet
', function(done) {
482 selectText: "SDC - ShadowCash Testnet",
483 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
485 testNetwork(done, params);
487 it('Allows selection
of viacoin
', function(done) {
489 selectText: "VIA - Viacoin",
490 firstAddress: "Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT",
492 testNetwork(done, params);
494 it('Allows selection
of viacoin testnet
', function(done) {
496 selectText: "VIA - Viacoin Testnet",
497 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
499 testNetwork(done, params);
501 it('Allows selection
of jumbucks
', function(done) {
503 selectText: "JBS - Jumbucks",
504 firstAddress: "JLEXccwDXADK4RxBPkRez7mqsHVoJBEUew",
506 testNetwork(done, params);
508 it('Allows selection
of clam
', function(done) {
510 selectText: "CLAM - Clams",
511 firstAddress: "xCp4sakjVx4pUAZ6cBCtuin8Ddb6U1sk9y",
513 testNetwork(done, params);
515 it('Allows selection
of crown
', function(done) {
517 selectText: "CRW - Crown (Legacy)",
518 firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5",
520 testNetwork(done, params);
522 it('Allows selection
of crown
', function(done) {
524 selectText: "CRW - Crown",
525 firstAddress: "CRWKnVmVhvH1KWTYe6sq8xV4dFGcFpBEEkPQ",
527 testNetwork(done, params);
529 it('Allows selection
of dash
', function(done) {
531 selectText: "DASH - Dash",
532 firstAddress: "XdbhtMuGsPSkE6bPdNTHoFSszQKmK4S5LT",
534 testNetwork(done, params);
536 it('Allows selection
of dash testnet
', function(done) {
538 selectText: "DASH - Dash Testnet",
539 firstAddress: "yaR52EN4oojdJfBgzWJTymC4uuCLPT29Gw",
541 testNetwork(done, params);
543 it('Allows selection
of game
', function(done) {
545 selectText: "GAME - GameCredits",
546 firstAddress: "GSMY9bAp36cMR4zyT4uGVS7GFjpdXbao5Q",
548 testNetwork(done, params);
550 it('Allows selection
of komodo
', function(done) {
552 selectText: "KMD - Komodo",
553 firstAddress: "RMPPzJwAjPVZZAwJvXivHJGGjdCx6WBD2t",
555 testNetwork(done, params);
557 it('Allows selection
of namecoin
', function(done) {
559 selectText: "NMC - Namecoin",
560 firstAddress: "Mw2vK2Bvex1yYtYF6sfbEg2YGoUc98YUD2",
562 testNetwork(done, params);
564 it('Allows selection
of onixcoin
', function(done) {
566 selectText: "ONX - Onixcoin",
567 firstAddress: "XGwMqddeKjT3ddgX73QokjVbCL3aK6Yxfk",
569 testNetwork(done, params);
571 it('Allows selection
of lkrcoin
', function(done) {
573 selectText: "LKR - Lkrcoin",
574 firstAddress: "LfbT296e7AEEnn4bYDbL535Nd8P9g98CdJ",
576 testNetwork(done, params);
578 it('Allows selection
of bolivarcoin
', function(done) {
580 selectText: "BOLI - Bolivarcoin",
581 firstAddress: "bbKzCAUR7hZ3nqfffy7VgrSz8LmAP3S5mK",
583 testNetwork(done, params);
585 it('Allows selection
of peercoin
', function(done) {
587 selectText: "PPC - Peercoin",
588 firstAddress: "PVAiioTaK2eDHSEo3tppT9AVdBYqxRTBAm",
590 testNetwork(done, params);
592 it('Allows selection
of ethereum
', function(done) {
594 selectText: "ETH - Ethereum",
595 firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
597 testNetwork(done, params);
599 it('Allows selection
of slimcoin
', function(done) {
601 selectText: "SLM - Slimcoin",
602 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
604 testNetwork(done, params);
606 it('Allows selection
of slimcoin testnet
', function(done) {
608 selectText: "SLM - Slimcoin Testnet",
609 firstAddress: "n3nMgWufTek5QQAr6uwMhg5xbzj8xqc4Dq",
611 testNetwork(done, params);
613 it('Allows selection
of bitcoin cash
', function(done) {
615 selectText: "BCH - Bitcoin Cash",
616 firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps",
618 testNetwork(done, params);
621 it('Allows selection
of simpleledger(SLP
)', function(done) {
623 selectText: "SLP - Simple Ledger Protocol",
624 firstAddress: "simpleledger:qrtffz6ajfsn74gpur7y3epjquz42pvww5acewqmre",
626 testNetwork(done, params);
629 it('Allows selection
of myriadcoin
', function(done) {
631 selectText: "XMY - Myriadcoin",
632 firstAddress: "MJEswvRR46wh9BoiVj9DzKYMBkCramhoBV",
634 testNetwork(done, params);
636 it('Allows selection
of pivx
', function(done) {
638 selectText: "PIVX - PIVX",
639 firstAddress: "DBxgT7faCuno7jmtKuu6KWCiwqsVPqh1tS",
641 testNetwork(done, params);
643 it('Allows selection
of pivx testnet
', function(done) {
645 selectText: "PIVX - PIVX Testnet",
646 firstAddress: "yB5U384n6dGkVE3by5y9VdvHHPwPg68fQj",
648 testNetwork(done, params);
650 it('Allows selection
of maza
', function(done) {
652 selectText: "MAZA - Maza",
653 firstAddress: "MGW4Bmi2NEm4PxSjgeFwhP9vg18JHoRnfw",
655 testNetwork(done, params);
657 it('Allows selection
of FIX
', function(done) {
659 selectText: "FIX - FIX",
660 firstAddress: "FS5MEU8fs5dUvsaSCSusV8RQtC8j2h3JEh",
662 testNetwork(done, params);
664 it('Allows selection
of FIX testnet
', function(done) {
666 selectText: "FIX - FIX Testnet",
667 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
669 testNetwork(done, params);
671 it('Allows selection
of fujicoin
', function(done) {
673 selectText: "FJC - Fujicoin",
674 firstAddress: "FgiaLpG7C99DyR4WnPxXedRVHXSfKzUDhF",
676 testNetwork(done, params);
678 it('Allows selection
of nubits
', function(done) {
680 selectText: "USNBT - NuBits",
681 firstAddress: "BLxkabXuZSJSdesLD7KxZdqovd4YwyBTU6",
683 testNetwork(done, params);
685 it('Allows selection
of bitcoin gold
', function(done) {
687 selectText: "BTG - Bitcoin Gold",
688 firstAddress: "GdDqug4WUsn5syNbSTHatNn4XnuwZtzedx",
690 testNetwork(done, params);
692 it('Allows selection
of monacoin
', function(done) {
694 selectText: "MONA - Monacoin",
695 firstAddress: "MKMiMr7MyjDKjJbCBzgF6u4ByqTS4NkRB1",
697 testNetwork(done, params);
699 it('Allows selection
of AXE
', function(done) {
701 selectText: "AXE - Axe",
702 firstAddress: "PScwtLUyPiGrqtKXrHF37DGETLXLZdw4up",
704 testNetwork(done, params);
706 it('Allows selection
of BlackCoin
', function(done) {
708 selectText: "BLK - BlackCoin",
709 firstAddress: "B5MznAKwj7uQ42vDz3w4onhBXPcqhTwJ9z",
711 testNetwork(done, params);
713 it('Allows selection
of Neblio
', function(done) {
715 selectText: "NEBL - Neblio",
716 firstAddress: "NefkeEEvhusbHMmTRrxx7H9wFnUXd8qQsE",
718 testNetwork(done, params);
720 it('Allows selection
of Beetlecoin
', function(done) {
722 selectText: "BEET - Beetlecoin",
723 firstAddress: "BVmtbEsGrjpknprmpHFq26z4kYHJUFHE71",
725 testNetwork(done, params);
727 it('Allows selection
of Adcoin
', function(done) {
729 selectText: "ACC - Adcoin",
730 firstAddress: "AcEDM6V5sF4kFHC76MJjjfProtS5Sw2qcd",
732 testNetwork(done, params);
734 it('Allows selection
of Asiacoin
', function(done) {
736 selectText: "AC - Asiacoin",
737 firstAddress: "ALupuEEz7kJjQTAvmtcBMBVuEjPa7GqZzE",
739 testNetwork(done, params);
741 it('Allows selection
of Aryacoin
', function(done) {
743 selectText: "ARYA - Aryacoin",
744 firstAddress: "Abr6gX25KaU9BpwD34UfsL3A4n89NvYYSf",
746 testNetwork(done, params);
748 it('Allows selection
of Auroracoin
', function(done) {
750 selectText: "AUR - Auroracoin",
751 firstAddress: "ANuraS6F4Jpi413FEnavjYkKYJJRHkgYCm",
753 testNetwork(done, params);
755 it('Allows selection
of Bata
', function(done) {
757 selectText: "BTA - Bata",
758 firstAddress: "BGxBdNeYPtF3GCuTtZBPQdFxCkdBYSF3fj",
760 testNetwork(done, params);
762 it('Allows selection
of Belacoin
', function(done) {
764 selectText: "BELA - Belacoin",
765 firstAddress: "BEeetqpNffdzeknSpNmQp5KAFh2KK1Qx7S",
767 testNetwork(done, params);
769 it('Allows selection
of Bitcoin Atom
', function(done) {
771 selectText: "BCA - Bitcoin Atom",
772 firstAddress: "AMy6qMbJeC4zsGRL6iWszmeCdQH65fgfih",
774 testNetwork(done, params);
776 it('Allows selection
of Bitcoinplus
', function(done) {
778 selectText: "XBC - Bitcoinplus",
779 firstAddress: "B7FSynZoDbEwTCSgsXq9nJ5ue8owYLVL8r",
781 testNetwork(done, params);
783 it('Allows selection
of Bitcoin Private
', function(done) {
785 selectText: "BTCP - Bitcoin Private",
786 firstAddress: "b1M3PbiXXyN6Hdivdw5rJv5VKpLjPzhm4jM",
788 testNetwork(done, params);
790 it('Allows selection
of Bitcoin SV
', function(done) {
792 selectText: "BSV - BitcoinSV",
793 firstAddress: "1N4mgtE5yxifch9jWs7Sds6oVqxdy2t576",
795 testNetwork(done, params);
797 it('Allows selection
of Bitcoinz
', function(done) {
799 selectText: "BTCZ - Bitcoinz",
800 firstAddress: "t1X2YQoxs8cYRo2oaBYgVEwW5QNjCC59NYc",
802 testNetwork(done, params);
804 it('Allows selection
of BitCloud
', function(done) {
806 selectText: "BTDX - BitCloud",
807 firstAddress: "BHbWitXCNgTf1BhsRDNMP186EeibuzmrBi",
809 testNetwork(done, params);
811 it('Allows selection
of Bitcore
', function(done) {
813 selectText: "BTX - Bitcore",
814 firstAddress: "2Rgp5Znhpy34TK4QmPkfCiYs9r4KovfTH9",
816 testNetwork(done, params);
818 it('Allows selection
of Bitsend
', function(done) {
820 selectText: "BSD - Bitsend",
821 firstAddress: "iBPk7LYjDun3EPk7CRR8UUmnPoceVc1bp2",
823 testNetwork(done, params);
825 it('Allows selection
of Britcoin
', function(done) {
827 selectText: "BRIT - Britcoin",
828 firstAddress: "B6Aue4J2XLs1f1dtD4H1SHYFfh4XrmEbrw",
830 testNetwork(done, params);
832 it('Allows selection
of Canadaecoin
', function(done) {
834 selectText: "CDN - Canadaecoin",
835 firstAddress: "CanAyCfd5Rj2CQVfaoAmvDUZunPM5W1AEQ",
837 testNetwork(done, params);
839 it('Allows selection
of Cannacoin
', function(done) {
841 selectText: "CCN - Cannacoin",
842 firstAddress: "CYjW8xWB43g6krLJTmmrPk1PonoQX7h9Qd",
844 testNetwork(done, params);
846 it('Allows selection
of Clubcoin
', function(done) {
848 selectText: "CLUB - Clubcoin",
849 firstAddress: "CHMDEXN4sihpSVX4GyAa2hZ62shnby7uyN",
851 testNetwork(done, params);
853 it('Allows selection
of Compcoin
', function(done) {
855 selectText: "CMP - Compcoin",
856 firstAddress: "CLshtw3zhxkseBJS46UF12v3AFy9Dx7JVv",
858 testNetwork(done, params);
860 it('Allows selection
of CPUchain
', function(done) {
862 selectText: "CPU - CPUchain",
863 firstAddress: "CWSpLpW7jS4mBHJnkz3mmL5s3yQMg93zK8",
865 testNetwork(done, params);
867 it('Allows selection
of Crave
', function(done) {
869 selectText: "CRAVE - Crave",
870 firstAddress: "VCYJeti6uKMNBFKCL7eP96UwuFWYHM7c85",
872 testNetwork(done, params);
874 it('Allows selection
of Defcoin
', function(done) {
876 selectText: "DFC - Defcoin",
877 firstAddress: "D8swcgyaaFUrXZU3ATwbgy16buCpWqbG1M",
879 testNetwork(done, params);
881 it('Allows selection
of Diamond
', function(done) {
883 selectText: "DMD - Diamond",
884 firstAddress: "dJnrVbLL9UPjdaVRz2C8VpqHZknqAqjLek",
886 testNetwork(done, params);
888 it('Allows selection
of Digibyte
', function(done) {
890 selectText: "DGB - Digibyte",
891 firstAddress: "D85Rp9jwLtMdmP6wGjTiqHBdVQLST3YCEq",
893 testNetwork(done, params);
895 it('Allows selection
of Digitalcoin
', function(done) {
897 selectText: "DGC - Digitalcoin",
898 firstAddress: "DKw4UGKEAZWweDNEbBFNQx4EM8x1mpUdia",
900 testNetwork(done, params);
902 it('Allows selection
of Ecoin
', function(done) {
904 selectText: "ECN - Ecoin",
905 firstAddress: "e6WFPLG5gcXyF7cESFteH1hE2XSmowW5yB",
907 testNetwork(done, params);
909 it('Allows selection
of Edrcoin
', function(done) {
911 selectText: "EDRC - Edrcoin",
912 firstAddress: "eh1nUJsvgKPFv6ebMBfcwJ299GMCpjeZUG",
914 testNetwork(done, params);
916 it('Allows selection
of Egulden
', function(done) {
918 selectText: "EFL - Egulden",
919 firstAddress: "Lg66yt55R7edRM58cDhKzXik2kFme3viX7",
921 testNetwork(done, params);
923 it('Allows selection
of Einsteinium
', function(done) {
925 selectText: "EMC2 - Einsteinium",
926 firstAddress: "EVAABm9hXKHk2MpVMbwNakRubFnNha5m8m",
928 testNetwork(done, params);
930 it('Allows selection
of EOSIO
', function(done) {
932 selectText: "EOS - EOSIO",
933 firstPubKey: "EOS692VJTBK3Rmw93onNnpnZ8ZtmE9PdxjDStArvbyzoe11QUTNoy",
935 testNetwork(done, params, true);
937 it('Allows selection
of Europecoin
', function(done) {
939 selectText: "ERC - Europecoin",
940 firstAddress: "ESA2YwPYntAoaPrE8Fm5qkKRtkcwLcwD6R",
942 testNetwork(done, params);
944 it('Allows selection
of Exclusivecoin
', function(done) {
946 selectText: "EXCL - Exclusivecoin",
947 firstAddress: "EbUa6m8UZW6nTxsYZD2FsDjkadKbp5M6JT",
949 testNetwork(done, params);
951 it('Allows selection
of Feathercoin
', function(done) {
953 selectText: "FTC - Feathercoin",
954 firstAddress: "6gDdjAMoSgQaW8UhqK3oboHs6ftGAroKkM",
956 testNetwork(done, params);
958 it('Allows selection
of Firstcoin
', function(done) {
960 selectText: "FRST - Firstcoin",
961 firstAddress: "FJN9GzfMm7Q8R4DJwK1H9F6A1GTghvFiMJ",
963 testNetwork(done, params);
965 it('Allows selection
of Flashcoin
', function(done) {
967 selectText: "FLASH - Flashcoin",
968 firstAddress: "UWfpf5LfMmLxZYooEb2EyvWhZ8NG7EZDRt",
970 testNetwork(done, params);
972 it('Allows selection
of GCRCoin
', function(done) {
974 selectText: "GCR - GCRCoin",
975 firstAddress: "GJjF5cLwyXLacpuvXAVksxGxKvHDjx58d6",
977 testNetwork(done, params);
979 it('Allows selection
of Gobyte
', function(done) {
981 selectText: "GBX - Gobyte",
982 firstAddress: "GS813Ys2brkmvSUw1rUqGPm2HqQVDHJRyA",
984 testNetwork(done, params);
986 it('Allows selection
of Gridcoin
', function(done) {
988 selectText: "GRC - Gridcoin",
989 firstAddress: "SGrWbBPvobgqKRF8td1Kdc9vbRY7MJ78Y9",
991 testNetwork(done, params);
993 it('Allows selection
of Gulden
', function(done) {
995 selectText: "NLG - Gulden",
996 firstAddress: "GcDP7cNEc33MPPdTFNJ8pZc6VMZJ2CbKxY",
998 testNetwork(done, params);
1000 it('Allows selection
of Helleniccoin
', function(done) {
1002 selectText: "HNC - Helleniccoin",
1003 firstAddress: "LbHEKe5H72zp9G1fuWNiiNePTUfJb88915",
1005 testNetwork(done, params);
1007 it('Allows selection
of Hempcoin
', function(done) {
1009 selectText: "THC - Hempcoin",
1010 firstAddress: "H8sdWbZyJV4gyXyHtLXDaNnAuUDhK5mfTV",
1012 testNetwork(done, params);
1014 it('Allows selection
of Insane
', function(done) {
1016 selectText: "INSN - Insane",
1017 firstAddress: "iMPqEJMiXWuxC9U2NVinCCMr4t72h58EWx",
1019 testNetwork(done, params);
1021 it('Allows selection
of Iop
', function(done) {
1023 selectText: "IOP - Iop",
1024 firstAddress: "pGKQmcaPf95Ur5o6oHK4qdiZ52p1yaTvq1",
1026 testNetwork(done, params);
1028 it('Allows selection
of Ixcoin
', function(done) {
1030 selectText: "IXC - Ixcoin",
1031 firstAddress: "xgE9bTZ6YypT3E6ByzkTt31Hq68E9BqywH",
1033 testNetwork(done, params);
1035 it('Allows selection
of Kobocoin
', function(done) {
1037 selectText: "KOBO - Kobocoin",
1038 firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy",
1040 testNetwork(done, params);
1042 it('Allows selection
of Landcoin
', function(done) {
1044 selectText: "LDCN - Landcoin",
1045 firstAddress: "LLvLwNjG1aJcn1RS4W4GJUbv8fNaRATG7c",
1047 testNetwork(done, params);
1049 it('Allows selection
of Library Credits
', function(done) {
1051 selectText: "LBC - Library Credits",
1052 firstAddress: "bQJEQrHDJyHdqycB32uysh1SWn8Ln8LMdg",
1054 testNetwork(done, params);
1056 it('Allows selection
of Linx
', function(done) {
1058 selectText: "LINX - Linx",
1059 firstAddress: "XGWQ3cb3LGUB3VnHmj6xYSMgnokNbf6dyk",
1061 testNetwork(done, params);
1063 it('Allows selection
of Litecoincash
', function(done) {
1065 selectText: "LCC - Litecoincash",
1066 firstAddress: "Ce5n7fjUuQPLutJ4W5nCCfQLKdKLE1mv9A",
1068 testNetwork(done, params);
1070 it('Allows selection
of Lynx
', function(done) {
1072 selectText: "LYNX - Lynx",
1073 firstAddress: "KUeY3ZdZkg96p4W98pj1JjygCFU1XqWdw3",
1075 testNetwork(done, params);
1077 it('Allows selection
of Megacoin
', function(done) {
1079 selectText: "MEC - Megacoin",
1080 firstAddress: "MDfAj9CzkC1HpcUiVGnHp8yKTa7WXgu8AY",
1082 testNetwork(done, params);
1084 it('Allows selection
of Minexcoin
', function(done) {
1086 selectText: "MNX - Minexcoin",
1087 firstAddress: "XC1VnyJVfiMDwWgFtAHDp41cgY3AHk3dJT",
1089 testNetwork(done, params);
1091 it('Allows selection
of Navcoin
', function(done) {
1093 selectText: "NAV - Navcoin",
1094 firstAddress: "NTQVTPK3NWSQLKoffkiQw99T8PifkF1Y2U",
1096 testNetwork(done, params);
1098 it('Allows selection
of Nebulas
', function(done) {
1100 selectText: "NAS - Nebulas",
1101 firstAddress: "n1PbK61DGBfDoDusLw621G6sVSMfLLHdfnm",
1103 testNetwork(done, params);
1105 it('Allows selection
of Neoscoin
', function(done) {
1107 selectText: "NEOS - Neoscoin",
1108 firstAddress: "NgATz6QbQNXvayHQ4CpZayugb9HeaPDdby",
1110 testNetwork(done, params);
1112 it('Allows selection
of Nix
', function(done) {
1114 selectText: "NIX - NIX Platform",
1115 firstAddress: "GgcNW2SQQXB4LWHRQTHKkQF3GzXNSLqS8u",
1117 testNetwork(done, params);
1119 it('Allows selection
of Neurocoin
', function(done) {
1121 selectText: "NRO - Neurocoin",
1122 firstAddress: "NVdYErQ3mFpDuF5DquW9WMiT7sLc8ufFTn",
1124 testNetwork(done, params);
1126 it('Allows selection
of Newyorkc
', function(done) {
1128 selectText: "NYC - Newyorkc",
1129 firstAddress: "RSVMfyH1fKfy3puADJEhut2vfkRyon6imm",
1131 testNetwork(done, params);
1133 it('Allows selection
of Novacoin
', function(done) {
1135 selectText: "NVC - Novacoin",
1136 firstAddress: "4JRvUmxcKCJmaMXZyvRoSS1cmG2XvnZfHN",
1138 testNetwork(done, params);
1140 it('Allows selection
of Nushares
', function(done) {
1142 selectText: "NSR - Nushares",
1143 firstAddress: "SecjXzU3c7EecdT7EbC4vvmbdtBBokWh6J",
1145 testNetwork(done, params);
1147 it('Allows selection
of Okcash
', function(done) {
1149 selectText: "OK - Okcash",
1150 firstAddress: "PV4Qp1TUYuGv4TqVtLZtqvrsWWRycfx1Yi",
1152 testNetwork(done, params);
1154 it('Allows selection
of Omnicore
', function(done) {
1156 selectText: "OMNI - Omnicore",
1157 firstAddress: "1Q1t3gonjCT3rW38TsTsCvgSc3hh7zBGbi",
1159 testNetwork(done, params);
1161 it('Allows selection
of DeepOnion
', function(done) {
1163 selectText: "ONION - DeepOnion",
1164 firstAddress: "DYREY7XCFXVqJ3x5UuN43k2JwD2s1kif48",
1166 testNetwork(done, params);
1168 it('Allows selection
of Pesobit
', function(done) {
1170 selectText: "PSB - Pesobit",
1171 firstAddress: "PDePsF7ALyXP7JaywokdYiRTDtKa14MAr1",
1173 testNetwork(done, params);
1175 it('Allows selection
of Pinkcoin
', function(done) {
1177 selectText: "PINK - Pinkcoin",
1178 firstAddress: "2TgjYQffjbzUHJghNaVbdsjHbRwruC3yzC",
1180 testNetwork(done, params);
1182 it('Allows selection
of POSWcoin
', function(done) {
1184 selectText: "POSW - POSWcoin",
1185 firstAddress: "PNxewmZoPnGBvoEbH6hgQZCK1igDiBCdgC",
1187 testNetwork(done, params);
1189 it('Allows selection
of Potcoin
', function(done) {
1191 selectText: "POT - Potcoin",
1192 firstAddress: "PEo7Vg2ctXgpP4vuLPeY9aGJtZotyrmiHc",
1194 testNetwork(done, params);
1196 it('Allows selection
of Putincoin
', function(done) {
1198 selectText: "PUT - Putincoin",
1199 firstAddress: "PViWnfr2uFtovd6e7joM49C94CsGSnqJis",
1201 testNetwork(done, params);
1203 it('Allows selection
of Rapids
', function(done) {
1205 selectText: "RPD - Rapids",
1206 firstAddress: "Ri8XxUdZaXS5LqxmFJcFEjFinkaMbmhSUp",
1208 testNetwork(done, params);
1210 it('Allows selection
of Ravencoin
', function(done) {
1212 selectText: "RVN - Ravencoin",
1213 firstAddress: "RBuDoVNnzvFsEcX8XKPm8ic4mgiCzjUCNk",
1215 testNetwork(done, params);
1217 it('Allows selection
of Reddcoin
', function(done) {
1219 selectText: "RDD - Reddcoin",
1220 firstAddress: "RtgRvXMBng1y51ftteveFqwNfyRG18HpxQ",
1222 testNetwork(done, params);
1224 it('Allows selection
of RevolutionVR
', function(done) {
1226 selectText: "RVR - RevolutionVR",
1227 firstAddress: "VXeeoP2jkzZnMFxtc66ZBZK1NHN5QJnnjL",
1229 testNetwork(done, params);
1231 it('Allows selection
of Rubycoin
', function(done) {
1233 selectText: "RBY - Rubycoin",
1234 firstAddress: "RV76JDtjTs11JdMDRToYn6CHecMRPLnKS6",
1236 testNetwork(done, params);
1238 it('Allows selection
of Salus
', function(done) {
1240 selectText: "SLS - Salus",
1241 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
1243 testNetwork(done, params);
1245 it('Allows selection
of Smileycoin
', function(done) {
1247 selectText: "SMLY - Smileycoin",
1248 firstAddress: "BEZVnEBCAyFByrgKpwAgYgtvP4rKAd9Sj2",
1250 testNetwork(done, params);
1252 it('Allows selection
of Solarcoin
', function(done) {
1254 selectText: "SLR - Solarcoin",
1255 firstAddress: "8LZ13HbnjtaMJWSvvVFNTLf71zFfDrhwLu",
1257 testNetwork(done, params);
1259 it('Allows selection
of stash
', function(done) {
1261 selectText: "STASH - Stash",
1262 firstAddress: "XxwAsWB7REDKmAvHA85SbEZQQtpxeUDxS3",
1264 testNetwork(done, params);
1266 it('Allows selection
of stash testnet
', function(done) {
1268 selectText: "STASH - Stash Testnet",
1269 firstAddress: "yWQCTSkUst7ddYuebKsqa1kSoXEjpCkGKR",
1271 testNetwork(done, params);
1273 it('Allows selection
of Stratis
', function(done) {
1275 selectText: "STRAT - Stratis",
1276 firstAddress: "ScfJnq3QDhKgDMEds6sqUE1ot6ShfhmXXq",
1278 testNetwork(done, params);
1280 it('Allows selection
of Stratis Test
', function(done) {
1282 selectText: "TSTRAT - Stratis Testnet",
1283 firstAddress: "TRLWm3dye4FRrDWouwYUSUZP96xb76mBE3",
1285 testNetwork(done, params);
1287 it('Allows selection
of Syscoin
', function(done) {
1289 selectText: "SYS - Syscoin",
1290 firstAddress: "SZwJi42Pst3VAMomyK5DG4157WM5ofRmSj",
1292 testNetwork(done, params);
1294 it('Allows selection
of Toa
', function(done) {
1296 selectText: "TOA - Toa",
1297 firstAddress: "TSe1QAnUwQzUfbBusDzRJ9URttrRGKoNKF",
1299 testNetwork(done, params);
1301 it('Allows selection
of TWINS
', function(done) {
1303 selectText: "TWINS - TWINS",
1304 firstAddress: "WPpJnfLLubNmF7HLNxg8d8zH5haxn4wri8",
1306 testNetwork(done, params);
1308 it('Allows selection
of TWINS testnet
', function(done) {
1310 selectText: "TWINS - TWINS Testnet",
1311 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
1313 testNetwork(done, params);
1315 it('Allows selection
of Ultimatesecurecash
', function(done) {
1317 selectText: "USC - Ultimatesecurecash",
1318 firstAddress: "UPyLAZU2Che5fiy7Ed8xVJFmXAUhitA4ug",
1320 testNetwork(done, params);
1322 it('Allows selection
of Unobtanium
', function(done) {
1324 selectText: "UNO - Unobtanium",
1325 firstAddress: "uUBMPVMXrR6qhqornJqKTWgr8L69vihSL9",
1327 testNetwork(done, params);
1329 it('Allows selection
of Vcash
', function(done) {
1331 selectText: "XVC - Vcash",
1332 firstAddress: "VuL53MSY6KjvAjKSeRkh3NDnKykacDVeps",
1334 testNetwork(done, params);
1336 it('Allows selection
of Verge
', function(done) {
1338 selectText: "XVG - Verge",
1339 firstAddress: "DCrVuGkMjLJpTGgwAgv9AcMdeb1nkWbjZA",
1341 testNetwork(done, params);
1343 it('Allows selection
of Vertcoin
', function(done) {
1345 selectText: "VTC - Vertcoin",
1346 firstAddress: "Vf6koGuiWdXQfx8tNqxoNeEDxh4xh5cxsG",
1348 testNetwork(done, params);
1350 it('Allows selection
of Vivo
', function(done) {
1352 selectText: "VIVO - Vivo",
1353 firstAddress: "VFmBwuXXGhJe7MarQG2GfzHMFebRHgfSpB",
1355 testNetwork(done, params);
1357 it('Allows selection
of Vpncoin
', function(done) {
1359 selectText: "VASH - Vpncoin",
1360 firstAddress: "VoEmH1qXC4TsSgBAStR21QYetwnFqbqCx9",
1362 testNetwork(done, params);
1364 it('Allows selection
of VeChain
', function(done) {
1366 selectText: "VET - VeChain",
1367 firstAddress: "0xdba55B1B6070f3a733D5eDFf35F0da4A00E455F2",
1369 testNetwork(done, params);
1371 it('Allows selection
of Whitecoin
', function(done) {
1373 selectText: "XWC - Whitecoin",
1374 firstAddress: "WcSwCAUqrSgeSYbsaS3SSWWhsx8KRYTFDR",
1376 testNetwork(done, params);
1378 it('Allows selection
of Wincoin
', function(done) {
1380 selectText: "WC - Wincoin",
1381 firstAddress: "WaDVCESMGgyKgNESdn3u43NnwmGSkZED3Z",
1383 testNetwork(done, params);
1385 it('Allows selection
of Zcoin
', function(done) {
1387 selectText: "XZC - Zcoin",
1388 firstAddress: "a6VcMdP4XgAA9Tr7xNszmPG5FZpfRf17Cq",
1390 testNetwork(done, params);
1392 it('Allows selection
of Zcash
', function(done) {
1394 selectText: "ZEC - Zcash",
1395 firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9",
1397 testNetwork(done, params);
1399 it('Allows selection
of Zclassic
', function(done) {
1401 selectText: "ZCL - Zclassic",
1402 firstAddress: "t1TBMxTvVJRybUbMLGWq8H4A8F4VUL7czEc",
1404 testNetwork(done, params);
1406 it('Allows selection
of Horizen
', function(done) {
1408 selectText: "ZEN - Horizen",
1409 firstAddress: "znWh9XASyW2dZq5tck84wFjiwuqVysi7q3p",
1411 testNetwork(done, params);
1413 it('Allows selection
of Energi
', function(done) {
1415 selectText: "NRG - Energi",
1416 firstAddress: "EejRy4t4nidzhGGzkJUgFP3z4HYBjhTsRt",
1418 testNetwork(done, params);
1420 it('Allows selection
of Ethereum Classic
', function(done) {
1422 selectText: "ETC - Ethereum Classic",
1423 firstAddress: "0x3c05e5556693808367afB62eF3b63e35d6eD249A",
1425 testNetwork(done, params);
1427 it('Allows selection
of Pirl
', function(done) {
1429 selectText: "PIRL - Pirl",
1430 firstAddress: "0xe77FC0723dA122B5025CA79193c28563eB47e776",
1432 testNetwork(done, params);
1434 it('Allows selection
of MIX
', function(done) {
1436 selectText: "MIX - MIX",
1437 firstAddress: "0x98BC5e63aeb6A4e82d72850d20710F07E29A29F1",
1439 testNetwork(done, params);
1441 it('Allows selection
of Monkey Project
', function(done) {
1443 selectText: "MONK - Monkey Project",
1444 firstAddress: "MnLrcnnUzKnf7TzufjRe5DLZqQJz18oYyu",
1446 testNetwork(done, params);
1449 it('Allows selection
of Musicoin
', function(done) {
1451 selectText: "MUSIC - Musicoin",
1452 firstAddress: "0xDc060e4A0b0313ea83Cf6B3A39B9db2D29004897",
1454 testNetwork(done, params);
1456 it('Allows selection
of Poa
', function(done) {
1458 selectText: "POA - Poa",
1459 firstAddress: "0x53aF28d754e106210C3d0467Dd581eaf7e3C5e60",
1461 testNetwork(done, params);
1463 it('Allows selection
of Expanse
', function(done) {
1465 selectText: "EXP - Expanse",
1466 firstAddress: "0xf57FeAbf26582b6E3E666559d3B1Cc6fB2b2c5F6",
1468 testNetwork(done, params);
1470 it('Allows selection
of Callisto
', function(done) {
1472 selectText: "CLO - Callisto",
1473 firstAddress: "0x4f9364F7420B317266C51Dc8eB979717D4dE3f4E",
1475 testNetwork(done, params);
1477 it('Allows selection
of HUSH
', function(done) {
1479 selectText: "HUSH - Hush (Legacy)",
1480 firstAddress: "t1g6rLXUnJaiJuu4q4zmJjoa9Gk4fwKpiuA",
1482 testNetwork(done, params);
1484 it('Allows selection
of HUSH3
', function(done) {
1486 selectText: "HUSH - Hush3",
1487 firstAddress: "RXWSQhwvw5jHPGP8bjwJhWoRnMLBnuPDKD",
1489 testNetwork(done, params);
1491 it('Allows selection
of ExchangeCoin
', function(done) {
1493 selectText: "EXCC - ExchangeCoin",
1494 firstAddress: "22txYKpFN5fwGwdSs2UBf7ywewbLM92YqK7E",
1496 testNetwork(done, params);
1498 it('Allows selection
of Artax
', function(done) {
1500 selectText: "XAX - Artax",
1501 firstAddress: "AYxaQPY7XLidG31V7F3yNzwxPYpYzRqG4q",
1503 testNetwork(done, params);
1505 it('Allows selection
of BitcoinGreen
', function(done) {
1507 selectText: "BITG - Bitcoin Green",
1508 firstAddress: "GeNGm9SkEfwbsws3UrrUSE2sJeyWYjzraY",
1510 testNetwork(done, params);
1512 it('Allows selection
of ANON
', function(done) {
1514 selectText: "ANON - ANON",
1515 firstAddress: "AnU6pijpEeUZFWSTyM2qTqZQn996Zq1Xard",
1517 testNetwork(done, params);
1519 it('Allows selection
of ProjectCoin
', function(done) {
1521 selectText: "PRJ - ProjectCoin",
1522 firstAddress: "PXZG97saRseSCftfe1mcFmfAA7pf6qBbaz",
1524 testNetwork(done, params);
1526 it('Allows selection
of Phore
', function(done) {
1528 selectText: "PHR - Phore",
1529 firstAddress: "PJThxpoXAG6hqrmdeQQbVDX4TJtFTMMymC",
1531 testNetwork(done, params);
1533 it('Allows selection
of Safecoin
', function(done) {
1535 selectText: "SAFE - Safecoin",
1536 firstAddress: "RtxHpnhJz6RY8k9owP3ua5QWraunmewB1G",
1538 testNetwork(done, params);
1540 it('Allows selection
of Blocknode
', function(done) {
1542 selectText: "BND - Blocknode",
1543 firstAddress: "BG8xZSAur2jYLG9VXt8dYfkKxxeR7w9bSe",
1545 testNetwork(done, params);
1547 it('Allows selection
of Blocknode Testnet
', function(done) {
1549 selectText: "tBND - Blocknode Testnet",
1550 firstAddress: "bSptsFyDktFSKpWveRywJsDoJA2TC6qfHv",
1552 testNetwork(done, params);
1554 it('Allows selection
of LitecoinZ
', function(done) {
1556 selectText: "LTZ - LitecoinZ",
1557 firstAddress: "L1VTXju7hLgKV4T7fGXS9sKsnm2gmtRCmyw",
1559 testNetwork(done, params);
1561 it('Allows selection
of BlockStamp
', function(done) {
1563 selectText: "BST - BlockStamp",
1564 firstAddress: "15gypKtim4cVTj137ApfryG17RkvSbPazZ",
1566 testNetwork(done, params);
1568 it('Allows selection
of DEXON
', function(done) {
1570 selectText: "DXN - DEXON",
1571 firstAddress: "0x136a58788033E028CCd740FbDec6734358DB56Ec",
1573 testNetwork(done, params);
1575 it('Allows selection
of Ellaism
', function(done) {
1577 selectText: "ELLA - Ellaism",
1578 firstAddress: "0xa8B0BeA09eeBc41062308546a01d6E544277e2Ca",
1580 testNetwork(done, params);
1582 it('Allows selection
of Ethersocial Network
', function(done) {
1584 selectText: "ESN - Ethersocial Network",
1585 firstAddress: "0x6EE99Be2A0C7F887a71e21C8608ACF0aa0D2b767",
1587 testNetwork(done, params);
1589 it('Allows selection
of Stellar
', function(done) {
1591 selectText: "XLM - Stellar",
1592 firstAddress: "GCUK3NYYUXA2QGN6KU5RR36WAKN3Y5EANZV65XNAWN4XM4CHQ3G4DMO2",
1594 testNetwork(done, params);
1596 it('Allows selection
of Wagerr
', function(done) {
1598 selectText: "WGR - Wagerr",
1599 firstAddress: "WYiVgQU39VcQxcnacoCiaZHZZLjDCJoS95",
1601 testNetwork(done, params);
1603 it('Allows selection
of Groestlcoin
', function(done) {
1605 selectText: "GRS - Groestlcoin",
1606 firstAddress: "FZycsFvZ1eH1hbtyjBpAgJSukVw1bN6PBN",
1608 testNetwork(done, params);
1610 it('Allows selection
of Groestlcoin Testnet
', function(done) {
1612 selectText: "GRS - Groestlcoin Testnet",
1613 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiygRPne9",
1615 testNetwork(done, params);
1617 it('Allows selection
of Elastos
', function(done) {
1619 selectText: "ELA - Elastos",
1620 firstAddress: "EMccDcsn3SwPDcfeQMf3w7utqi8ioWYtkg",
1622 testNetwork(done, params);
1624 it('Allows selection
of Energyweb
', function(done) {
1626 selectText: "EWT - EnergyWeb",
1627 firstAddress: "0x22171474844Fc7E8E99A3A69CCf1eDb5574FdD4c",
1629 testNetwork(done, params);
1631 it('Allows selection
of Thought
', function(done) {
1633 selectText: "THT - Thought",
1634 firstAddress: "4B1Bh9GibDarFQrhtYU8krpc7WSjgGfYvo",
1636 testNetwork(done, params);
1639 // BIP39 seed is set from phrase
1640 it('Sets the bip39 seed
from the prhase
', function(done) {
1641 driver.findElement(By.css('.phrase
'))
1642 .sendKeys('abandon abandon ability
');
1643 driver.sleep(generateDelay).then(function() {
1644 driver.findElement(By.css('.seed
'))
1645 .getAttribute("value")
1646 .then(function(seed) {
1647 expect(seed).toBe("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3");
1653 // BIP32 root key is set from phrase
1654 it('Sets the bip39 root key
from the prhase
', function(done) {
1655 driver.findElement(By.css('.phrase
'))
1656 .sendKeys('abandon abandon ability
');
1657 driver.sleep(generateDelay).then(function() {
1658 driver.findElement(By.css('.root
-key
'))
1659 .getAttribute("value")
1660 .then(function(seed) {
1661 expect(seed).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
1667 // Tabs show correct addresses when changed
1668 it('Shows the correct address when tab is changed
', function(done) {
1669 driver.findElement(By.css('.phrase
'))
1670 .sendKeys('abandon abandon ability
');
1671 driver.sleep(generateDelay).then(function() {
1672 driver.findElement(By.css('#bip32
-tab a
'))
1674 driver.sleep(generateDelay).then(function() {
1675 getFirstAddress(function(address) {
1676 expect(address).toBe("17uQ7s2izWPwBmEVFikTmZUjbBKWYdJchz");
1683 // BIP44 derivation path is shown
1684 it('Shows the derivation path
for bip44 tab
', function(done) {
1685 driver.findElement(By.css('.phrase
'))
1686 .sendKeys('abandon abandon ability
');
1687 driver.sleep(generateDelay).then(function() {
1688 driver.findElement(By.css('#bip44
.path
'))
1689 .getAttribute("value")
1690 .then(function(path) {
1691 expect(path).toBe("m/44'/0'/0'/0");
1697 // BIP44 extended private key is shown
1698 it('Shows the extended private key for bip44 tab', function(done) {
1699 driver.findElement(By.css('.phrase'))
1700 .sendKeys('abandon abandon ability');
1701 driver.sleep(generateDelay).then(function() {
1702 driver.findElement(By.css('.extended-priv-key'))
1703 .getAttribute("value
")
1704 .then(function(path) {
1705 expect(path).toBe("xprvA2DxxvPZcyRvYgZMGS53nadR32mVDeCyqQYyFhrCVbJNjPoxMeVf7QT5g7mQASbTf9Kp4cryvcXnu2qurjWKcrdsr91jXymdCDNxKgLFKJG
");
1711 // BIP44 extended public key is shown
1712 it('Shows the extended public key for bip44 tab', function(done) {
1713 driver.findElement(By.css('.phrase'))
1714 .sendKeys('abandon abandon ability');
1715 driver.sleep(generateDelay).then(function() {
1716 driver.findElement(By.css('.extended-pub-key'))
1717 .getAttribute("value
")
1718 .then(function(path) {
1719 expect(path).toBe("xpub6FDKNRvTTLzDmAdpNTc49ia9b4byd6vqCdUa46Fp3vqMcC96uBoufCmZXQLiN5AK3iSCJMhf9gT2sxkpyaPepRuA7W3MujV5tGmF5VfbueM
");
1725 // BIP44 account field changes address list
1726 it('Changes the address list if bip44 account is changed', function(done) {
1727 driver.findElement(By.css('#bip44 .account'))
1729 driver.findElement(By.css('.phrase'))
1730 .sendKeys('abandon abandon ability');
1731 driver.sleep(generateDelay).then(function() {
1732 getFirstAddress(function(address) {
1733 expect(address).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H
");
1739 // BIP44 change field changes address list
1740 it('Changes the address list if bip44 change is changed', function(done) {
1741 driver.findElement(By.css('#bip44 .change'))
1743 driver.findElement(By.css('.phrase'))
1744 .sendKeys('abandon abandon ability');
1745 driver.sleep(generateDelay).then(function() {
1746 getFirstAddress(function(address) {
1747 expect(address).toBe("1KAGfWgqfVbSSXY56fNQ7YnhyKuoskHtYo
");
1753 // BIP32 derivation path can be set
1754 it('Can use a custom bip32 derivation path', function(done) {
1755 driver.findElement(By.css('#bip32-tab a'))
1757 driver.findElement(By.css('#bip32 .path'))
1759 driver.findElement(By.css('#bip32 .path'))
1761 driver.findElement(By.css('.phrase'))
1762 .sendKeys('abandon abandon ability');
1763 driver.sleep(generateDelay).then(function() {
1764 getFirstAddress(function(address) {
1765 expect(address).toBe("16pYQQdLD1hH4hwTGLXBaZ9Teboi1AGL8L
");
1771 // BIP32 can use hardened derivation paths
1772 it('Can use a hardened derivation paths', function(done) {
1773 driver.findElement(By.css('#bip32-tab a'))
1775 driver.findElement(By.css('#bip32 .path'))
1777 driver.findElement(By.css('#bip32 .path'))
1779 driver.findElement(By.css('.phrase
'))
1780 .sendKeys('abandon abandon ability
');
1781 driver.sleep(generateDelay).then(function() {
1782 getFirstAddress(function(address) {
1783 expect(address).toBe("14aXZeprXAE3UUKQc4ihvwBvww2LuEoHo4");
1789 // BIP32 extended private key is shown
1790 it('Shows the BIP32 extended
private key
', function(done) {
1791 driver.findElement(By.css('#bip32
-tab a
'))
1793 driver.findElement(By.css('.phrase
'))
1794 .sendKeys('abandon abandon ability
');
1795 driver.sleep(generateDelay).then(function() {
1796 driver.findElement(By.css('.extended
-priv
-key
'))
1797 .getAttribute("value")
1798 .then(function(privKey) {
1799 expect(privKey).toBe("xprv9va99uTVE5aLiutUVLTyfxfe8v8aaXjSQ1XxZbK6SezYVuikA9MnjQVTA8rQHpNA5LKvyQBpLiHbBQiiccKiBDs7eRmBogsvq3THFeLHYbe");
1805 // BIP32 extended public key is shown
1806 it('Shows the BIP32 extended
public key
', function(done) {
1807 driver.findElement(By.css('#bip32
-tab a
'))
1809 driver.findElement(By.css('.phrase
'))
1810 .sendKeys('abandon abandon ability
');
1811 driver.sleep(generateDelay).then(function() {
1812 driver.findElement(By.css('.extended
-pub
-key
'))
1813 .getAttribute("value")
1814 .then(function(pubKey) {
1815 expect(pubKey).toBe("xpub69ZVZQzP4T8dwPxwbMzz36cNgwy4yzTHmETZMyihzzXXNi3thgg3HCow1RtY252wdw5rS8369xKnraN5Q93y3FkFfJp2XEHWUrkyXsjS93P");
1821 // Derivation path is shown in table
1822 it('Shows the derivation path
in the table
', function(done) {
1823 driver.findElement(By.css('.phrase
'))
1824 .sendKeys('abandon abandon ability
');
1825 driver.sleep(generateDelay).then(function() {
1826 getFirstPath(function(path) {
1827 expect(path).toBe("m/44'/0'/0'/0/0");
1833 // Derivation path for address can be hardened
1834 it('Can derive hardened addresses', function(done) {
1835 driver.findElement(By.css('#bip32-tab a'))
1837 driver.executeScript(function() {
1838 $(".hardened
-addresses
").prop("checked
", true);
1840 driver.findElement(By.css('.phrase'))
1841 .sendKeys('abandon abandon ability');
1842 driver.sleep(generateDelay).then(function() {
1843 getFirstAddress(function(address) {
1844 expect(address).toBe("18exLzUv7kfpiXRzmCjFDoC9qwNLFyvwyd
");
1850 // Derivation path visibility can be toggled
1851 it('Can toggle visibility of the derivation path column', function(done) {
1852 driver.findElement(By.css('.phrase'))
1853 .sendKeys('abandon abandon ability');
1854 driver.sleep(generateDelay).then(function() {
1855 driver.findElement(By.css('.index-toggle'))
1857 testColumnValuesAreInvisible(done, "index
");
1862 it('Shows the address in the table', function(done) {
1863 driver.findElement(By.css('.phrase'))
1864 .sendKeys('abandon abandon ability');
1865 driver.sleep(generateDelay).then(function() {
1866 getFirstAddress(function(address) {
1867 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
1873 // Addresses are shown in order of derivation path
1874 it('Shows the address in order of derivation path', function(done) {
1875 driver.findElement(By.css('.phrase'))
1876 .sendKeys('abandon abandon ability');
1877 driver.sleep(generateDelay).then(function() {
1878 testRowsAreInCorrectOrder(done);
1882 // Address visibility can be toggled
1883 it('Can toggle visibility of the address column', function(done) {
1884 driver.findElement(By.css('.phrase'))
1885 .sendKeys('abandon abandon ability');
1886 driver.sleep(generateDelay).then(function() {
1887 driver.findElement(By.css('.address-toggle'))
1889 testColumnValuesAreInvisible(done, "address
");
1893 // Public key is shown in table
1894 it('Shows the public key in the table', function(done) {
1895 driver.findElement(By.css('.phrase'))
1896 .sendKeys('abandon abandon ability');
1897 driver.sleep(generateDelay).then(function() {
1898 driver.findElements(By.css('.pubkey'))
1899 .then(function(els) {
1901 .then(function(pubkey) {
1902 expect(pubkey).toBe("033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3
");
1909 // Public key visibility can be toggled
1910 it('Can toggle visibility of the public key column', function(done) {
1911 driver.findElement(By.css('.phrase'))
1912 .sendKeys('abandon abandon ability');
1913 driver.sleep(generateDelay).then(function() {
1914 driver.findElement(By.css('.public-key-toggle'))
1916 testColumnValuesAreInvisible(done, "pubkey
");
1920 // Private key is shown in table
1921 it('Shows the private key in the table', function(done) {
1922 driver.findElement(By.css('.phrase'))
1923 .sendKeys('abandon abandon ability');
1924 driver.sleep(generateDelay).then(function() {
1925 driver.findElements(By.css('.privkey'))
1926 .then(function(els) {
1928 .then(function(pubkey) {
1929 expect(pubkey).toBe("L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE
");
1936 // Private key visibility can be toggled
1937 it('Can toggle visibility of the private key column', function(done) {
1938 driver.findElement(By.css('.phrase'))
1939 .sendKeys('abandon abandon ability');
1940 driver.sleep(generateDelay).then(function() {
1941 driver.findElement(By.css('.private-key-toggle'))
1943 testColumnValuesAreInvisible(done, "privkey
");
1947 // More addresses can be generated
1948 it('Can generate more rows in the table', function(done) {
1949 driver.findElement(By.css('.phrase'))
1950 .sendKeys('abandon abandon ability');
1951 driver.sleep(generateDelay).then(function() {
1952 driver.findElement(By.css('.more'))
1954 driver.sleep(generateDelay).then(function() {
1955 driver.findElements(By.css('.address'))
1956 .then(function(els) {
1957 expect(els.length).toBe(40);
1964 // A custom number of additional addresses can be generated
1965 it('Can generate more rows in the table', function(done) {
1966 driver.findElement(By.css('.phrase'))
1967 .sendKeys('abandon abandon ability');
1968 driver.sleep(generateDelay).then(function() {
1969 driver.findElement(By.css('.rows-to-add'))
1971 driver.findElement(By.css('.rows-to-add'))
1973 driver.findElement(By.css('.more'))
1975 driver.sleep(generateDelay).then(function() {
1976 driver.findElements(By.css('.address'))
1977 .then(function(els) {
1978 expect(els.length).toBe(21);
1985 // Additional addresses are shown in order of derivation path
1986 it('Shows additional addresses in order of derivation path', function(done) {
1987 driver.findElement(By.css('.phrase'))
1988 .sendKeys('abandon abandon ability');
1989 driver.sleep(generateDelay).then(function() {
1990 driver.findElement(By.css('.more'))
1992 driver.sleep(generateDelay).then(function() {
1993 testRowsAreInCorrectOrder(done);
1998 // BIP32 root key can be set by the user
1999 it('Allows the user to set the BIP32 root key', function(done) {
2000 driver.findElement(By.css('.root-key'))
2001 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2002 driver.sleep(generateDelay).then(function() {
2003 getFirstAddress(function(address) {
2004 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
2010 // Setting BIP32 root key clears the existing phrase, passphrase and seed
2011 it('Confirms the existing phrase should be cleared', function(done) {
2012 driver.findElement(By.css('.phrase'))
2013 .sendKeys('A non-blank but invalid value');
2014 driver.findElement(By.css('.root-key'))
2015 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2016 driver.switchTo().alert().accept();
2017 driver.findElement(By.css('.phrase'))
2018 .getAttribute("value
").then(function(value) {
2019 expect(value).toBe("");
2024 // Clearing of phrase, passphrase and seed can be cancelled by user
2025 it('Allows the clearing of the phrase to be cancelled', function(done) {
2026 driver.findElement(By.css('.phrase'))
2027 .sendKeys('abandon abandon ability');
2028 driver.sleep(generateDelay).then(function() {
2029 driver.findElement(By.css('.root-key'))
2031 driver.findElement(By.css('.root-key'))
2033 driver.switchTo().alert().dismiss();
2034 driver.findElement(By.css('.phrase'))
2035 .getAttribute("value
").then(function(value) {
2036 expect(value).toBe("abandon abandon ability
");
2042 // Custom BIP32 root key is used when changing the derivation path
2043 it('Can set derivation path for root key instead of phrase', function(done) {
2044 driver.findElement(By.css('#bip44 .account'))
2046 driver.findElement(By.css('.root-key'))
2047 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2048 driver.sleep(generateDelay).then(function() {
2049 getFirstAddress(function(address) {
2050 expect(address).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H
");
2056 // Incorrect mnemonic shows error
2057 it('Shows an error for incorrect mnemonic', function(done) {
2058 driver.findElement(By.css('.phrase'))
2059 .sendKeys('abandon abandon abandon');
2060 driver.sleep(feedbackDelay).then(function() {
2061 driver.findElement(By.css('.feedback'))
2063 .then(function(feedback) {
2064 expect(feedback).toBe("Invalid mnemonic
");
2070 // Incorrect word shows suggested replacement
2071 it('Shows word suggestion for incorrect word', function(done) {
2072 driver.findElement(By.css('.phrase'))
2073 .sendKeys('abandon abandon abiliti');
2074 driver.sleep(feedbackDelay).then(function() {
2075 driver.findElement(By.css('.feedback'))
2077 .then(function(feedback) {
2078 var msg = "abiliti not
in wordlist
, did you mean ability
?";
2079 expect(feedback).toBe(msg);
2085 // Github pull request 48
2086 // First four letters of word shows that word, not closest
2087 // since first four letters gives unique word in BIP39 wordlist
2088 // eg ille should show illegal, not idle
2089 it('Shows word suggestion based on first four chars', function(done) {
2090 driver.findElement(By.css('.phrase'))
2092 driver.sleep(feedbackDelay).then(function() {
2093 driver.findElement(By.css('.feedback'))
2095 .then(function(feedback) {
2096 var msg = "ille not
in wordlist
, did you mean illegal
?";
2097 expect(feedback).toBe(msg);
2103 // Incorrect BIP32 root key shows error
2104 it('Shows error for incorrect root key', function(done) {
2105 driver.findElement(By.css('.root-key'))
2106 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpj');
2107 driver.sleep(feedbackDelay).then(function() {
2108 driver.findElement(By.css('.feedback'))
2110 .then(function(feedback) {
2111 var msg = "Invalid root key
";
2112 expect(feedback).toBe(msg);
2118 // Derivation path not starting with m shows error
2119 it('Shows error for derivation path not starting with m', function(done) {
2120 driver.findElement(By.css('#bip32-tab a'))
2122 driver.findElement(By.css('#bip32 .path'))
2124 driver.findElement(By.css('#bip32 .path'))
2126 driver.findElement(By.css('.phrase'))
2127 .sendKeys('abandon abandon ability');
2128 driver.sleep(feedbackDelay).then(function() {
2129 driver.findElement(By.css('.feedback'))
2131 .then(function(feedback) {
2132 var msg = "First character must be
'm'";
2133 expect(feedback).toBe(msg);
2139 // Derivation path containing invalid characters shows useful error
2140 it('Shows error for derivation path not starting with m', function(done) {
2141 driver.findElement(By.css('#bip32-tab a'))
2143 driver.findElement(By.css('#bip32 .path'))
2145 driver.findElement(By.css('#bip32 .path'))
2146 .sendKeys('m/1/0wrong1/1');
2147 driver.findElement(By.css('.phrase'))
2148 .sendKeys('abandon abandon ability');
2149 driver.sleep(feedbackDelay).then(function() {
2150 driver.findElement(By.css('.feedback'))
2152 .then(function(feedback) {
2153 var msg = "Invalid characters
0wrong1 found at depth
2";
2154 expect(feedback).toBe(msg);
2160 // Github Issue 11: Default word length is 15
2161 // https://github.com/iancoleman/bip39/issues/11
2162 it('Sets the default word length to 15', function(done) {
2163 driver.findElement(By.css('.strength'))
2164 .getAttribute("value
")
2165 .then(function(strength) {
2166 expect(strength).toBe("15");
2171 // Github Issue 12: Generate more rows with private keys hidden
2172 // https://github.com/iancoleman/bip39/issues/12
2173 it('Sets the correct hidden column state on new rows', function(done) {
2174 driver.findElement(By.css('.phrase'))
2175 .sendKeys("abandon abandon ability
");
2176 driver.sleep(generateDelay).then(function() {
2177 driver.findElement(By.css('.private-key-toggle'))
2179 driver.findElement(By.css('.more'))
2181 driver.sleep(generateDelay).then(function() {
2182 driver.findElements(By.css('.privkey'))
2183 .then(function(els) {
2184 expect(els.length).toBe(40);
2186 testColumnValuesAreInvisible(done, "privkey
");
2191 // Github Issue 19: Mnemonic is not sensitive to whitespace
2192 // https://github.com/iancoleman/bip39/issues/19
2193 it('Ignores excess whitespace in the mnemonic', function(done) {
2194 var doublespace = " ";
2195 var mnemonic = "urge cat
" + doublespace + "bid
";
2196 driver.findElement(By.css('.phrase'))
2197 .sendKeys(mnemonic);
2198 driver.sleep(generateDelay).then(function() {
2199 driver.findElement(By.css('.root-key'))
2200 .getAttribute("value
")
2201 .then(function(seed) {
2202 expect(seed).toBe("xprv9s21ZrQH143K3isaZsWbKVoTtbvd34Y1ZGRugGdMeBGbM3AgBVzTH159mj1cbbtYSJtQr65w6L5xy5L9SFC7c9VJZWHxgAzpj4mun5LhrbC
");
2208 // Github Issue 23: Part 1: Use correct derivation path when changing tabs
2209 // https://github.com/iancoleman/bip39/issues/23
2210 // This test was failing for default timeout of 5000ms so changed it to +10s
2211 it('Uses the correct derivation path when changing tabs', function(done) {
2212 // 1) and 2) set the phrase
2213 driver.findElement(By.css('.phrase'))
2214 .sendKeys("abandon abandon ability
");
2215 driver.sleep(generateDelay).then(function() {
2216 // 3) select bip32 tab
2217 driver.findElement(By.css('#bip32-tab a'))
2219 driver.sleep(generateDelay).then(function() {
2220 // 4) switch from bitcoin to litecoin
2221 selectNetwork("LTC
- Litecoin
");
2222 driver.sleep(generateDelay).then(function() {
2223 // 5) Check address is displayed correctly
2224 getFirstAddress(function(address) {
2225 expect(address).toBe("LS8MP5LZ5AdzSZveRrjm3aYVoPgnfFh5T5
");
2226 // 5) Check derivation path is displayed correctly
2227 getFirstPath(function(path) {
2228 expect(path).toBe("m
/0/0");
2235 }, generateDelay + 10000);
2237 // Github Issue 23 Part 2: Coin selection in derivation path
2238 // https://github.com/iancoleman/bip39/issues/23#issuecomment-238011920
2239 it('Uses the correct derivation path when changing coins', function(done) {
2241 driver.findElement(By.css('.phrase'))
2242 .sendKeys("abandon abandon ability
");
2243 driver.sleep(generateDelay).then(function() {
2244 // switch from bitcoin to clam
2245 selectNetwork("CLAM
- Clams
");
2246 driver.sleep(generateDelay).then(function() {
2247 // check derivation path is displayed correctly
2248 getFirstPath(function(path) {
2249 expect(path).toBe("m
/44'/23'/0'/0/0");
2256 // Github Issue 26: When using a Root key derrived altcoins are incorrect
2257 // https://github.com/iancoleman/bip39/issues/26
2258 it('Uses the correct derivation for altcoins with root keys', function(done) {
2259 // 1) 2) and 3) set the root key
2260 driver.findElement(By.css('.root-key'))
2261 .sendKeys("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi
");
2262 driver.sleep(generateDelay).then(function() {
2263 // 4) switch from bitcoin to viacoin
2264 selectNetwork("VIA
- Viacoin
");
2265 driver.sleep(generateDelay).then(function() {
2266 // 5) ensure the derived address is correct
2267 getFirstAddress(function(address) {
2268 expect(address).toBe("Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT
");
2275 // Selecting a language with no existing phrase should generate a phrase in
2277 it('Generate a random phrase when language is selected and no current phrase', function(done) {
2278 driver.findElement(By.css("a
[href
='#japanese']"))
2280 driver.sleep(generateDelay).then(function() {
2281 driver.findElement(By.css(".phrase
"))
2282 .getAttribute("value
").then(function(phrase) {
2283 expect(phrase.search(/[a-z]/)).toBe(-1);
2284 expect(phrase.length).toBeGreaterThan(0);
2290 // Selecting a language with existing phrase should update the phrase to use
2292 it('Updates existing phrases when the language is changed', function(done) {
2293 driver.findElement(By.css(".phrase
"))
2294 .sendKeys("abandon abandon ability
");
2295 driver.sleep(generateDelay).then(function() {
2296 driver.findElement(By.css("a
[href
='#italian']"))
2298 driver.sleep(generateDelay).then(function() {
2299 driver.findElement(By.css(".phrase
"))
2300 .getAttribute("value
").then(function(phrase) {
2301 // Check only the language changes, not the phrase
2302 expect(phrase).toBe("abaco abaco abbaglio
");
2303 getFirstAddress(function(address) {
2304 // Check the address is correct
2305 expect(address).toBe("1Dz5TgDhdki9spa6xbPFbBqv5sjMrx3xgV
");
2313 // Suggested replacement for erroneous word in non-English language
2314 it('Shows word suggestion for incorrect word in non-English language', function(done) {
2315 driver.findElement(By.css('.phrase'))
2316 .sendKeys('abaco abaco zbbaglio');
2317 driver.sleep(feedbackDelay).then(function() {
2318 driver.findElement(By.css('.feedback'))
2320 .then(function(feedback) {
2321 var msg = "zbbaglio not
in wordlist
, did you mean abbaglio
?";
2322 expect(feedback).toBe(msg);
2328 // Japanese word does not break across lines.
2330 // https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese
2331 it('Does not break Japanese words across lines', function(done) {
2332 driver.findElement(By.css('.phrase'))
2333 .getCssValue("word
-break")
2334 .then(function(value) {
2335 expect(value).toBe("keep
-all
");
2340 // Language can be specified at page load using hash value in url
2341 it('Can set the language from the url hash', function(done) {
2342 driver.get(url + "#japanese
").then(function() {
2343 driver.findElement(By.css('.generate')).click();
2344 driver.sleep(generateDelay).then(function() {
2345 driver.findElement(By.css(".phrase
"))
2346 .getAttribute("value
").then(function(phrase) {
2347 expect(phrase.search(/[a-z]/)).toBe(-1);
2348 expect(phrase.length).toBeGreaterThan(0);
2355 // Entropy can be entered by the user
2356 it('Allows entropy to be entered', function(done) {
2357 driver.findElement(By.css('.use-entropy'))
2359 driver.findElement(By.css('.entropy'))
2360 .sendKeys('00000000 00000000 00000000 00000000');
2361 driver.sleep(generateDelay).then(function() {
2362 driver.findElement(By.css(".phrase
"))
2363 .getAttribute("value
").then(function(phrase) {
2364 expect(phrase).toBe("abandon abandon ability
");
2365 getFirstAddress(function(address) {
2366 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
2373 // A warning about entropy is shown to the user, with additional information
2374 it('Shows a warning about using entropy', function(done) {
2375 driver.findElement(By.css('.use-entropy'))
2377 driver.findElement(By.css('.entropy-container'))
2379 .then(function(containerText) {
2380 var warning = "mnemonic may be insecure
";
2381 expect(containerText).toContain(warning);
2382 driver.findElement(By.css('#entropy-notes'))
2383 .findElement(By.xpath("parent::*"))
2385 .then(function(notesText) {
2386 var detail = "flipping a fair coin
, rolling a fair dice
, noise measurements etc
";
2387 expect(notesText).toContain(detail);
2393 // The types of entropy available are described to the user
2394 it('Shows the types of entropy available', function(done) {
2395 driver.findElement(By.css('.entropy'))
2396 .getAttribute("placeholder
")
2397 .then(function(placeholderText) {
2406 for (var i=0; i<options.length; i++) {
2407 var option = options[i];
2408 expect(placeholderText).toContain(option);
2414 // The actual entropy used is shown to the user
2415 it('Shows the actual entropy used', function(done) {
2416 driver.findElement(By.css('.use-entropy'))
2418 driver.findElement(By.css('.entropy'))
2419 .sendKeys('Not A Very Good Entropy Source At All');
2420 driver.sleep(generateDelay).then(function() {
2421 driver.findElement(By.css('.entropy-container'))
2423 .then(function(text) {
2424 expect(text).toMatch(/Filtered Entropy\s+AedEceAA/);
2430 // Binary entropy can be entered
2431 it('Allows binary entropy to be entered', function(done) {
2432 testEntropyType(done, "01", "binary
");
2435 // Base 6 entropy can be entered
2436 it('Allows base 6 entropy to be entered', function(done) {
2437 testEntropyType(done, "012345", "base
6");
2440 // Base 6 dice entropy can be entered
2441 it('Allows base 6 dice entropy to be entered', function(done) {
2442 testEntropyType(done, "123456", "base
6 (dice
)");
2445 // Base 10 entropy can be entered
2446 it('Allows base 10 entropy to be entered', function(done) {
2447 testEntropyType(done, "789", "base
10");
2450 // Hexadecimal entropy can be entered
2451 it('Allows hexadecimal entropy to be entered', function(done) {
2452 testEntropyType(done, "abcdef
", "hexadecimal
");
2455 // Dice entropy value is shown as the converted base 6 value
2456 // ie 123456 is converted to 123450
2457 it('Shows dice entropy as base 6', function(done) {
2458 driver.findElement(By.css('.use-entropy'))
2460 driver.findElement(By.css('.entropy'))
2461 .sendKeys("123456");
2462 driver.sleep(generateDelay).then(function() {
2463 driver.findElement(By.css('.entropy-container'))
2465 .then(function(text) {
2466 expect(text).toMatch(/Filtered Entropy\s+123450/);
2472 // The number of bits of entropy accumulated is shown
2473 it("Shows the number
of bits
of entropy
for 20 bits
of binary
", function(done) {
2474 testEntropyBits(done, "0000 0000 0000 0000 0000", "20");
2476 it("Shows the number
of bits
of entropy
for 1 bit
of binary
", function(done) {
2477 testEntropyBits(done, "0", "1");
2479 it("Shows the number
of bits
of entropy
for 4 bits
of binary
", function(done) {
2480 testEntropyBits(done, "0000", "4");
2482 it("Shows the number
of bits
of entropy
for 1 character
of base
6 (dice
)", function(done) {
2483 // 6 in card is 0 in base 6, 0 in base 6 is 2.6 bits (rounded down to 2 bits)
2484 testEntropyBits(done, "6", "2");
2486 it("Shows the number
of bits
of entropy
for 1 character
of base
10 with 3 bits
", function(done) {
2487 // 7 in base 10 is 111 in base 2, no leading zeros
2488 testEntropyBits(done, "7", "3");
2490 it("Shows the number
of bits
of entropy
for 1 character
of base
10 with 4 bis
", function(done) {
2491 testEntropyBits(done, "8", "4");
2493 it("Shows the number
of bits
of entropy
for 1 character
of hex
", function(done) {
2494 testEntropyBits(done, "F
", "4");
2496 it("Shows the number
of bits
of entropy
for 2 characters
of base
10", function(done) {
2497 testEntropyBits(done, "29", "6");
2499 it("Shows the number
of bits
of entropy
for 2 characters
of hex
", function(done) {
2500 testEntropyBits(done, "0A
", "8");
2502 it("Shows the number
of bits
of entropy
for 2 characters
of hex
with 3 leading zeros
", function(done) {
2503 // hex is always multiple of 4 bits of entropy
2504 testEntropyBits(done, "1A
", "8");
2506 it("Shows the number
of bits
of entropy
for 2 characters
of hex
with 2 leading zeros
", function(done) {
2507 testEntropyBits(done, "2A
", "8");
2509 it("Shows the number
of bits
of entropy
for 2 characters
of hex
with 1 leading zero
", function(done) {
2510 testEntropyBits(done, "4A
", "8");
2512 it("Shows the number
of bits
of entropy
for 2 characters
of hex
with no leading zeros
", function(done) {
2513 testEntropyBits(done, "8A
", "8");
2515 it("Shows the number
of bits
of entropy
for 2 characters
of hex starting
with F
", function(done) {
2516 testEntropyBits(done, "FA
", "8");
2518 it("Shows the number
of bits
of entropy
for 4 characters
of hex
with leading zeros
", function(done) {
2519 testEntropyBits(done, "000A
", "16");
2521 it("Shows the number
of bits
of entropy
for 4 characters
of base
6", function(done) {
2522 testEntropyBits(done, "5555", "11");
2524 it("Shows the number
of bits
of entropy
for 4 characters
of base
6 dice
", function(done) {
2525 // uses dice, so entropy is actually 0000 in base 6, which is 4 lots of
2526 // 2.58 bits, which is 10.32 bits (rounded down to 10 bits)
2527 testEntropyBits(done, "6666", "10");
2529 it("Shows the number
of bits
of entropy
for 4 charactes
of base
10", function(done) {
2530 // Uses base 10, which is 4 lots of 3.32 bits, which is 13.3 bits (rounded
2532 testEntropyBits(done, "2227", "13");
2534 it("Shows the number
of bits
of entropy
for 4 characters
of hex
with 2 leading zeros
", function(done) {
2535 testEntropyBits(done, "222F
", "16");
2537 it("Shows the number
of bits
of entropy
for 4 characters
of hex starting
with F
", function(done) {
2538 testEntropyBits(done, "FFFF
", "16");
2540 it("Shows the number
of bits
of entropy
for 10 characters
of base
10", function(done) {
2541 // 10 events at 3.32 bits per event
2542 testEntropyBits(done, "0000101017", "33");
2544 it("Shows the number
of bits
of entropy
for a full deck
of cards
", function(done) {
2545 // cards are not replaced, so a full deck is not 52^52 entropy which is 296
2546 // bits, it's 52!, which is 225 bits
2547 testEntropyBits(done, "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
", "225");
2550 it("Shows details about the entered entropy
", function(done) {
2551 testEntropyFeedback(done,
2555 type: "hexadecimal
",
2559 strength: "less than a second
",
2563 it("Shows details about the entered entropy
", function(done) {
2564 testEntropyFeedback(done,
2566 entropy: "AAAAAAAA
",
2567 filtered: "AAAAAAAA
",
2568 type: "hexadecimal
",
2572 strength: "less than a second
- Repeats like
\"aaa
\" are easy to guess
",
2576 it("Shows details about the entered entropy
", function(done) {
2577 testEntropyFeedback(done,
2579 entropy: "AAAAAAAA B
",
2580 filtered: "AAAAAAAAB
",
2581 type: "hexadecimal
",
2585 strength: "less than a second
- Repeats like
\"aaa
\" are easy to guess
",
2589 it("Shows details about the entered entropy
", function(done) {
2590 testEntropyFeedback(done,
2592 entropy: "AAAAAAAA BBBBBBBB
",
2593 filtered: "AAAAAAAABBBBBBBB
",
2594 type: "hexadecimal
",
2598 strength: "less than a second
- Repeats like
\"aaa
\" are easy to guess
",
2602 it("Shows details about the entered entropy
", function(done) {
2603 testEntropyFeedback(done,
2605 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC
",
2606 filtered: "AAAAAAAABBBBBBBBCCCCCCCC
",
2607 type: "hexadecimal
",
2611 strength: "less than a second
",
2615 it("Shows details about the entered entropy
", function(done) {
2616 testEntropyFeedback(done,
2618 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
",
2619 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD
",
2620 type: "hexadecimal
",
2624 strength: "2 minutes
",
2628 it("Shows details about the entered entropy
", function(done) {
2629 testEntropyFeedback(done,
2631 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA
",
2632 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDA
",
2633 type: "hexadecimal
",
2641 it("Shows details about the entered entropy
", function(done) {
2642 testEntropyFeedback(done,
2644 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE
",
2645 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEE
",
2646 type: "hexadecimal
",
2650 strength: "3 years
",
2654 it("Shows details about the entered entropy
", function(done) {
2655 testEntropyFeedback(done,
2657 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE FFFFFFFF
",
2658 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEEFFFFFFFF
",
2659 type: "hexadecimal
",
2663 strength: "centuries
",
2667 it("Shows details about the entered entropy
", function(done) {
2668 testEntropyFeedback(done,
2675 strength: "less than a second
",
2679 it("Shows details about the entered entropy
", function(done) {
2680 testEntropyFeedback(done,
2682 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
",
2683 type: "card (full deck
)",
2687 strength: "centuries
",
2691 it("Shows details about the entered entropy
", function(done) {
2692 testEntropyFeedback(done,
2694 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks3d
",
2695 type: "card (full deck
, 1 duplicate: 3d
)",
2699 strength: "centuries
",
2703 it("Shows details about the entered entropy
", function(done) {
2704 testEntropyFeedback(done,
2706 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d
",
2707 type: "card (2 duplicates: 3d
4d
, 1 missing: KS
)",
2711 strength: "centuries
",
2715 it("Shows details about the entered entropy
", function(done) {
2716 testEntropyFeedback(done,
2718 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d5d6d
",
2719 type: "card (4 duplicates: 3d
4d
5d
..., 1 missing: KS
)",
2723 strength: "centuries
",
2727 it("Shows details about the entered entropy
", function(done) {
2728 testEntropyFeedback(done,
2729 // Next test was throwing uncaught error in zxcvbn
2730 // Also tests 451 bits, ie Math.log2(52!)*2 = 225.58 * 2
2732 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsksac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
",
2733 type: "card (full deck
, 52 duplicates: ac
2c
3c
...)",
2737 strength: "centuries
",
2741 it("Shows details about the entered entropy
", function(done) {
2742 testEntropyFeedback(done,
2743 // Case insensitivity to duplicate cards
2746 type: "card (1 duplicate: AS
)",
2750 strength: "less than a second
",
2754 it("Shows details about the entered entropy
", function(done) {
2755 testEntropyFeedback(done,
2758 type: "card (1 duplicate: as
)",
2762 strength: "less than a second
",
2766 it("Shows details about the entered entropy
", function(done) {
2767 testEntropyFeedback(done,
2768 // Missing cards are detected
2770 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
",
2771 type: "card (1 missing: 9C
)",
2775 strength: "centuries
",
2779 it("Shows details about the entered entropy
", function(done) {
2780 testEntropyFeedback(done,
2782 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d
6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
",
2783 type: "card (2 missing: 9C
5D
)",
2787 strength: "centuries
",
2791 it("Shows details about the entered entropy
", function(done) {
2792 testEntropyFeedback(done,
2794 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d
6d7d8d9dtdjd kdah2h3h
5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks
",
2795 type: "card (4 missing: 9C
5D QD
...)",
2799 strength: "centuries
",
2803 it("Shows details about the entered entropy
", function(done) {
2804 testEntropyFeedback(done,
2805 // More than six missing cards does not show message
2807 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d
6d
8d9d jd kdah2h3h
5h6h7h8h9hthjhqhkh
2s3s4s5s6s7s8s9stsjsqsks
",
2812 strength: "centuries
",
2816 it("Shows details about the entered entropy
", function(done) {
2817 testEntropyFeedback(done,
2818 // Multiple decks of cards increases bits per event
2823 bitsPerEvent: "4.34",
2827 it("Shows details about the entered entropy
", function(done) {
2828 testEntropyFeedback(done,
2833 bitsPerEvent: "4.80",
2837 it("Shows details about the entered entropy
", function(done) {
2838 testEntropyFeedback(done,
2843 bitsPerEvent: "5.01",
2847 it("Shows details about the entered entropy
", function(done) {
2848 testEntropyFeedback(done,
2850 entropy: "3d3d3d3d
",
2853 bitsPerEvent: "5.14",
2857 it("Shows details about the entered entropy
", function(done) {
2858 testEntropyFeedback(done,
2860 entropy: "3d3d3d3d3d
",
2863 bitsPerEvent: "5.22",
2867 it("Shows details about the entered entropy
", function(done) {
2868 testEntropyFeedback(done,
2870 entropy: "3d3d3d3d3d3d
",
2873 bitsPerEvent: "5.28",
2877 it("Shows details about the entered entropy
", function(done) {
2878 testEntropyFeedback(done,
2880 entropy: "3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d
",
2883 bitsPerEvent: "5.59",
2884 strength: 'less than a second - Repeats like "abcabcabc
" are only slightly harder to guess than "abc
"',
2889 // Entropy is truncated from the left
2890 it('Truncates entropy from the left', function(done) {
2891 // Truncate from left means 0000 is removed from the start
2892 // which gives mnemonic 'avocado zoo zone'
2893 // not 1111 removed from the end
2894 // which gives the mnemonic 'abstract zoo zoo'
2895 var entropy = "00000000 00000000 00000000 00000000";
2896 entropy += "11111111 11111111 11111111 1111"; // Missing last byte
2897 driver.findElement(By.css('.use-entropy'))
2899 driver.findElement(By.css('.entropy'))
2901 driver.sleep(generateDelay).then(function() {
2902 driver.findElement(By.css(".phrase
"))
2903 .getAttribute("value
").then(function(phrase) {
2904 expect(phrase).toBe("avocado zoo zone
");
2910 // Very large entropy results in very long mnemonics
2911 it('Converts very long entropy to very long mnemonics', function(done) {
2913 for (var i=0; i<33; i++) {
2914 entropy += "AAAAAAAA
"; // 3 words * 33 iterations = 99 words
2916 driver.findElement(By.css('.use-entropy'))
2918 driver.findElement(By.css('.entropy'))
2920 driver.sleep(generateDelay).then(function() {
2921 driver.findElement(By.css(".phrase
"))
2922 .getAttribute("value
").then(function(phrase) {
2923 var wordCount = phrase.split(/\s+/g).length;
2924 expect(wordCount).toBe(99);
2930 // Is compatible with bip32jp entropy
2931 // https://bip32jp.github.io/english/index.html
2933 // Is incompatible with:
2935 it('Is compatible with bip32jp.github.io', function(done) {
2936 var entropy = "543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543";
2937 var expectedPhrase = "train then jungle barely whip fiber purpose puppy eagle cloud clump hospital robot brave balcony utility detect estate old green desk skill multiply virus
";
2938 driver.findElement(By.css('.use-entropy'))
2940 driver.findElement(By.css('.entropy'))
2942 driver.sleep(generateDelay).then(function() {
2943 driver.findElement(By.css(".phrase
"))
2944 .getAttribute("value
").then(function(phrase) {
2945 expect(phrase).toBe(expectedPhrase);
2951 // Blank entropy does not generate mnemonic or addresses
2952 it('Does not generate mnemonic for blank entropy', function(done) {
2953 driver.findElement(By.css('.use-entropy'))
2955 driver.findElement(By.css('.entropy'))
2957 // check there is no mnemonic
2958 driver.sleep(generateDelay).then(function() {
2959 driver.findElement(By.css(".phrase
"))
2960 .getAttribute("value
").then(function(phrase) {
2961 expect(phrase).toBe("");
2962 // check there is no mnemonic
2963 driver.findElements(By.css(".address
"))
2964 .then(function(addresses) {
2965 expect(addresses.length).toBe(0);
2966 // Check the feedback says 'blank entropy'
2967 driver.findElement(By.css(".feedback
"))
2969 .then(function(feedbackText) {
2970 expect(feedbackText).toBe("Blank entropy
");
2978 // Mnemonic length can be selected even for weak entropy
2979 it('Allows selection of mnemonic length even for weak entropy', function(done) {
2980 driver.findElement(By.css('.use-entropy'))
2982 driver.executeScript(function() {
2983 $(".mnemonic
-length
").val("18").trigger("change
");
2985 driver.findElement(By.css('.entropy'))
2986 .sendKeys("012345");
2987 driver.sleep(generateDelay).then(function() {
2988 driver.findElement(By.css(".phrase
"))
2989 .getAttribute("value
").then(function(phrase) {
2990 var wordCount = phrase.split(/\s+/g).length;
2991 expect(wordCount).toBe(18);
2998 // https://github.com/iancoleman/bip39/issues/33
2999 // Final cards should contribute entropy
3000 it('Uses as much entropy as possible for the mnemonic', function(done) {
3001 driver.findElement(By.css('.use-entropy'))
3003 driver.findElement(By.css('.entropy'))
3004 .sendKeys("7S
9H
9S QH
8C KS AS
7D
7C QD
4S
4D TC
2D
5S JS
3D
8S
8H
4C
3C AC
3S QC
9C JC
7H AD TD JD
6D KH
5C QS
2S
6S
6H JH KD
9D
-6C TS TH
4H KC
5H
2H AH
2C
8D
3H
5D
");
3005 driver.sleep(generateDelay).then(function() {
3007 driver.findElement(By.css(".phrase
"))
3008 .getAttribute("value
").then(function(originalPhrase) {
3009 // Set the last 12 cards to be AS
3010 driver.findElement(By.css('.entropy'))
3012 driver.findElement(By.css('.entropy'))
3013 .sendKeys("7S
9H
9S QH
8C KS AS
7D
7C QD
4S
4D TC
2D
5S JS
3D
8S
8H
4C
3C AC
3S QC
9C JC
7H AD TD JD
6D KH
5C QS
2S
6S
6H JH KD
9D
-AS AS AS AS AS AS AS AS AS AS AS AS
");
3014 driver.sleep(generateDelay).then(function() {
3016 driver.findElement(By.css(".phrase
"))
3017 .getAttribute("value
").then(function(newPhrase) {
3018 expect(originalPhrase).not.toEqual(newPhrase);
3027 // https://github.com/iancoleman/bip39/issues/35
3029 // TODO this doesn't work in selenium with firefox
3030 // see https://stackoverflow.com/q/40360223
3031 it('Shows a qr code on hover for the phrase', function(done) {
3032 if (browser == "firefox
") {
3033 pending("Selenium
+ Firefox bug
for mouseMove
, see
https://stackoverflow.com/q/40360223");
3035 // generate a random mnemonic
3036 var generateEl
= driver
.findElement(By
.css('.generate'));
3038 // toggle qr to show (hidden by default)
3039 var phraseEl
= driver
.findElement(By
.css(".phrase"));
3041 var rootKeyEl
= driver
.findElement(By
.css(".root-key"));
3042 driver
.sleep(generateDelay
).then(function() {
3043 // hover over the root key
3044 driver
.actions().mouseMove(rootKeyEl
).perform().then(function() {
3045 // check the qr code shows
3046 driver
.executeScript(function() {
3047 return $(".qr-container").find("canvas").length
> 0;
3049 .then(function(qrShowing
) {
3050 expect(qrShowing
).toBe(true);
3051 // hover away from the phrase
3052 driver
.actions().mouseMove(generateEl
).perform().then(function() {;
3053 // check the qr code hides
3054 driver
.executeScript(function() {
3055 return $(".qr-container").find("canvas").length
== 0;
3057 .then(function(qrHidden
) {
3058 expect(qrHidden
).toBe(true);
3067 // BIP44 account extendend private key is shown
3068 // github issue 37 - compatibility with electrum
3069 it('Shows the bip44 account extended private key', function(done
) {
3070 driver
.findElement(By
.css(".phrase"))
3071 .sendKeys("abandon abandon ability");
3072 driver
.sleep(generateDelay
).then(function() {
3073 driver
.findElement(By
.css("#bip44 .account-xprv"))
3074 .getAttribute("value")
3075 .then(function(xprv
) {
3076 expect(xprv
).toBe("xprv9yzrnt4zWVJUr1k2VxSPy9ettKz5PpeDMgaVG7UKedhqnw1tDkxP2UyYNhuNSumk2sLE5ctwKZs9vwjsq3e1vo9egCK6CzP87H2cVYXpfwQ");
3082 // BIP44 account extendend public key is shown
3083 // github issue 37 - compatibility with electrum
3084 it('Shows the bip44 account extended public key', function(done
) {
3085 driver
.findElement(By
.css(".phrase"))
3086 .sendKeys("abandon abandon ability");
3087 driver
.sleep(generateDelay
).then(function() {
3088 driver
.findElement(By
.css("#bip44 .account-xpub"))
3089 .getAttribute("value")
3090 .then(function(xprv
) {
3091 expect(xprv
).toBe("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3098 // BIP32 root key can be set as an xpub
3099 it('Generates addresses from xpub as bip32 root key', function(done
) {
3100 driver
.findElement(By
.css('#bip32-tab a'))
3102 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3103 driver
.findElement(By
.css("#root-key"))
3104 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3105 driver
.sleep(generateDelay
).then(function() {
3106 // check the addresses are generated
3107 getFirstAddress(function(address
) {
3108 expect(address
).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
3109 // check the xprv key is not set
3110 driver
.findElement(By
.css(".extended-priv-key"))
3111 .getAttribute("value")
3112 .then(function(xprv
) {
3113 expect(xprv
).toBe("NA");
3114 // check the private key is not set
3115 driver
.findElements(By
.css(".privkey"))
3116 .then(function(els
) {
3119 .then(function(privkey
) {
3120 expect(xprv
).toBe("NA");
3130 // xpub for bip32 root key will not work with hardened derivation paths
3131 it('Shows error for hardened derivation paths with xpub root key', function(done
) {
3132 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3133 driver
.findElement(By
.css("#root-key"))
3134 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3135 driver
.sleep(feedbackDelay
).then(function() {
3136 // Check feedback is correct
3137 driver
.findElement(By
.css('.feedback'))
3139 .then(function(feedback
) {
3140 var msg
= "Hardened derivation path is invalid with xpub key";
3141 expect(feedback
).toBe(msg
);
3142 // Check no addresses are shown
3143 driver
.findElements(By
.css('.addresses tr'))
3144 .then(function(rows
) {
3145 expect(rows
.length
).toBe(0);
3153 // no root key shows feedback
3154 it('Shows feedback for no root key', function(done
) {
3155 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3156 driver
.findElement(By
.css('#bip32-tab a'))
3158 driver
.sleep(feedbackDelay
).then(function() {
3159 // Check feedback is correct
3160 driver
.findElement(By
.css('.feedback'))
3162 .then(function(feedback
) {
3163 expect(feedback
).toBe("Invalid root key");
3170 // display error switching tabs while addresses are generating
3171 it('Can change details while old addresses are still being generated', function(done
) {
3172 // Set to generate 199 more addresses.
3173 // This will take a long time allowing a new set of addresses to be
3174 // generated midway through this lot.
3175 // The newly generated addresses should not include any from the old set.
3176 // Any more than 199 will show an alert which needs to be accepted.
3177 driver
.findElement(By
.css('.rows-to-add'))
3179 driver
.findElement(By
.css('.rows-to-add'))
3182 driver
.findElement(By
.css('.phrase'))
3183 .sendKeys("abandon abandon ability");
3184 driver
.sleep(generateDelay
).then(function() {
3185 // change tabs which should cancel the previous generating
3186 driver
.findElement(By
.css('.rows-to-add'))
3188 driver
.findElement(By
.css('.rows-to-add'))
3190 driver
.findElement(By
.css('#bip32-tab a'))
3192 driver
.sleep(generateDelay
).then(function() {
3193 driver
.findElements(By
.css('.index'))
3194 .then(function(els
) {
3195 // check the derivation paths have the right quantity
3196 expect(els
.length
).toBe(20);
3197 // check the derivation paths are in order
3198 testRowsAreInCorrectOrder(done
);
3202 }, generateDelay
+ 10000);
3205 // padding for binary should give length with multiple of 256
3206 // hashed entropy 1111 is length 252, so requires 4 leading zeros
3207 // prior to issue 49 it would only generate 2 leading zeros, ie missing 2
3208 it('Pads hashed entropy with leading zeros', function(done
) {
3209 driver
.findElement(By
.css('.use-entropy'))
3211 driver
.executeScript(function() {
3212 $(".mnemonic-length").val("15").trigger("change");
3214 driver
.findElement(By
.css('.entropy'))
3216 driver
.sleep(generateDelay
).then(function() {
3217 driver
.findElement(By
.css('.phrase'))
3218 .getAttribute("value")
3219 .then(function(phrase
) {
3220 expect(phrase
).toBe("avocado valid quantum cross link predict excuse edit street able flame large galaxy ginger nuclear");
3226 // Github pull request 55
3227 // https://github.com/iancoleman/bip39/pull/55
3229 it('Can set the derivation path on bip32 tab for bitcoincore', function(done
) {
3230 testClientSelect(done
, {
3232 bip32path: "m/0'/0'",
3233 useHardenedAddresses: "true",
3236 it('Can set the derivation path on bip32 tab for multibit', function(done
) {
3237 testClientSelect(done
, {
3239 bip32path: "m/0'/0",
3240 useHardenedAddresses: null,
3243 it('Can set the derivation path on bip32 tab for coinomi/ledger', function(done
) {
3244 testClientSelect(done
, {
3246 bip32path: "m/44'/0'/0'",
3247 useHardenedAddresses: null,
3252 // https://github.com/iancoleman/bip39/issues/58
3253 // bip32 derivation is correct, does not drop leading zeros
3255 // https://medium.com/@alexberegszaszi/why-do-my-bip32-wallets-disagree-6f3254cc5846
3256 it('Retains leading zeros for bip32 derivation', function(done
) {
3257 driver
.findElement(By
.css(".phrase"))
3258 .sendKeys("fruit wave dwarf banana earth journey tattoo true farm silk olive fence");
3259 driver
.findElement(By
.css(".passphrase"))
3260 .sendKeys("banana");
3261 driver
.sleep(generateDelay
).then(function() {
3262 getFirstAddress(function(address
) {
3263 // Note that bitcore generates an incorrect address
3264 // 13EuKhffWkBE2KUwcbkbELZb1MpzbimJ3Y
3265 // see the medium.com link above for more details
3266 expect(address
).toBe("17rxURoF96VhmkcEGCj5LNQkmN9HVhWb7F");
3273 // Japanese mnemonics generate incorrect bip32 seed
3274 // BIP39 seed is set from phrase
3275 it('Generates correct seed for Japanese mnemonics', function(done
) {
3276 driver
.findElement(By
.css(".phrase"))
3277 .sendKeys("あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら");
3278 driver
.findElement(By
.css(".passphrase"))
3279 .sendKeys("メートルガバヴァぱばぐゞちぢ十人十色");
3280 driver
.sleep(generateDelay
).then(function() {
3281 driver
.findElement(By
.css(".seed"))
3282 .getAttribute("value")
3283 .then(function(seed
) {
3284 expect(seed
).toBe("a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55");
3290 // BIP49 official test vectors
3291 // https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki#test-vectors
3292 it('Generates BIP49 addresses matching the official test vectors', function(done
) {
3293 driver
.findElement(By
.css('#bip49-tab a'))
3295 selectNetwork("BTC - Bitcoin Testnet");
3296 driver
.findElement(By
.css(".phrase"))
3297 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
3298 driver
.sleep(generateDelay
).then(function() {
3299 getFirstAddress(function(address
) {
3300 expect(address
).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2");
3306 // BIP49 derivation path is shown
3307 it('Shows the bip49 derivation path', function(done
) {
3308 driver
.findElement(By
.css('#bip49-tab a'))
3310 driver
.findElement(By
.css(".phrase"))
3311 .sendKeys("abandon abandon ability");
3312 driver
.sleep(generateDelay
).then(function() {
3313 driver
.findElement(By
.css('#bip49 .path'))
3314 .getAttribute("value")
3315 .then(function(path
) {
3316 expect(path
).toBe("m/49'/0'/0'/0");
3322 // BIP49 extended private key is shown
3323 it('Shows the bip49 extended private key', function(done
) {
3324 driver
.findElement(By
.css('#bip49-tab a'))
3326 driver
.findElement(By
.css(".phrase"))
3327 .sendKeys("abandon abandon ability");
3328 driver
.sleep(generateDelay
).then(function() {
3329 driver
.findElement(By
.css('.extended-priv-key'))
3330 .getAttribute("value")
3331 .then(function(xprv
) {
3332 expect(xprv
).toBe("yprvALYB4DYRG6CzzVgzQZwwqjAA2wjBGC3iEd7KYYScpoDdmf75qMRWZWxoFcRXBJjgEXdFqJ9vDRGRLJQsrL22Su5jMbNFeM9vetaGVqy9Qy2");
3338 // BIP49 extended public key is shown
3339 it('Shows the bip49 extended public key', function(done
) {
3340 driver
.findElement(By
.css('#bip49-tab a'))
3342 driver
.findElement(By
.css(".phrase"))
3343 .sendKeys("abandon abandon ability");
3344 driver
.sleep(generateDelay
).then(function() {
3345 driver
.findElement(By
.css('.extended-pub-key'))
3346 .getAttribute("value")
3347 .then(function(xprv
) {
3348 expect(xprv
).toBe("ypub6ZXXTj5K6TmJCymTWbUxCs6tayZffemZbr2vLvrEP8kceTSENtjm7KHH6thvAKxVar9fGe8rgsPEX369zURLZ68b4f7Vexz7RuXsjQ69YDt");
3354 // BIP49 account field changes address list
3355 it('Can set the bip49 account field', function(done
) {
3356 driver
.findElement(By
.css('#bip49-tab a'))
3358 driver
.findElement(By
.css('#bip49 .account'))
3360 driver
.findElement(By
.css('#bip49 .account'))
3362 driver
.findElement(By
.css(".phrase"))
3363 .sendKeys("abandon abandon ability");
3364 driver
.sleep(generateDelay
).then(function() {
3365 getFirstAddress(function(address
) {
3366 expect(address
).toBe("381wg1GGN4rP88rNC9v7QWsiww63yLVPsn");
3372 // BIP49 change field changes address list
3373 it('Can set the bip49 change field', function(done
) {
3374 driver
.findElement(By
.css('#bip49-tab a'))
3376 driver
.findElement(By
.css('#bip49 .change'))
3378 driver
.findElement(By
.css('#bip49 .change'))
3380 driver
.findElement(By
.css(".phrase"))
3381 .sendKeys("abandon abandon ability");
3382 driver
.sleep(generateDelay
).then(function() {
3383 getFirstAddress(function(address
) {
3384 expect(address
).toBe("3PEM7MiKed5konBoN66PQhK8r3hjGhy9dT");
3390 // BIP49 account extendend private key is shown
3391 it('Shows the bip49 account extended private key', function(done
) {
3392 driver
.findElement(By
.css('#bip49-tab a'))
3394 driver
.findElement(By
.css(".phrase"))
3395 .sendKeys("abandon abandon ability");
3396 driver
.sleep(generateDelay
).then(function() {
3397 driver
.findElement(By
.css('#bip49 .account-xprv'))
3398 .getAttribute("value")
3399 .then(function(xprv
) {
3400 expect(xprv
).toBe("yprvAHtB1M5Wp675aLzFy9TJYK2mSsLkg6mcBRh5DZTR7L4EnYSmYPaL63KFA4ycg1PngW5LfkmejxzosCs17TKZMpRFKc3z5SJar6QAKaFcaZL");
3406 // BIP49 account extendend public key is shown
3407 it('Shows the bip49 account extended public key', function(done
) {
3408 driver
.findElement(By
.css('#bip49-tab a'))
3410 driver
.findElement(By
.css(".phrase"))
3411 .sendKeys("abandon abandon ability");
3412 driver
.sleep(generateDelay
).then(function() {
3413 driver
.findElement(By
.css('#bip49 .account-xpub'))
3414 .getAttribute("value")
3415 .then(function(xprv
) {
3416 expect(xprv
).toBe("ypub6WsXQrcQeTfNnq4j5AzJuSyVzuBF5ZVTYecg1ws2ffbDfLmv5vtadqdj1NgR6C6gufMpMfJpHxvb6JEQKvETVNWCRanNedfJtnTchZiJtsL");
3422 // Test selecting coin where bip49 is unavailable (eg CLAM)
3423 it('Shows an error on bip49 tab for coins without bip49', function(done
) {
3424 driver
.findElement(By
.css('#bip49-tab a'))
3426 driver
.findElement(By
.css(".phrase"))
3427 .sendKeys("abandon abandon ability");
3428 driver
.sleep(generateDelay
).then(function() {
3429 selectNetwork("CLAM - Clams");
3430 // bip49 available is hidden
3431 driver
.findElement(By
.css('#bip49 .available'))
3432 .getAttribute("class")
3433 .then(function(classes
) {
3434 expect(classes
).toContain("hidden");
3435 // bip49 unavailable is shown
3436 driver
.findElement(By
.css('#bip49 .unavailable'))
3437 .getAttribute("class")
3438 .then(function(classes
) {
3439 expect(classes
).not
.toContain("hidden");
3440 // check there are no addresses shown
3441 driver
.findElements(By
.css('.addresses tr'))
3442 .then(function(rows
) {
3443 expect(rows
.length
).toBe(0);
3444 // check the derived private key is blank
3445 driver
.findElement(By
.css('.extended-priv-key'))
3446 .getAttribute("value")
3447 .then(function(xprv
) {
3448 expect(xprv
).toBe('');
3449 // check the derived public key is blank
3450 driver
.findElement(By
.css('.extended-pub-key'))
3451 .getAttribute("value")
3452 .then(function(xpub
) {
3453 expect(xpub
).toBe('');
3464 // Cleared mnemonic and root key still allows addresses to be generated
3465 // https://github.com/iancoleman/bip39/issues/43
3466 it('Clears old root keys from memory when mnemonic is cleared', function(done
) {
3468 driver
.findElement(By
.css(".phrase"))
3469 .sendKeys("abandon abandon ability");
3470 driver
.sleep(generateDelay
).then(function() {
3471 // clear the mnemonic and root key
3472 // using selenium .clear() doesn't seem to trigger the 'input' event
3473 // so clear it using keys instead
3474 driver
.findElement(By
.css('.phrase'))
3475 .sendKeys(Key
.CONTROL
,"a");
3476 driver
.findElement(By
.css('.phrase'))
3477 .sendKeys(Key
.DELETE
);
3478 driver
.findElement(By
.css('.root-key'))
3479 .sendKeys(Key
.CONTROL
,"a");
3480 driver
.findElement(By
.css('.root-key'))
3481 .sendKeys(Key
.DELETE
);
3482 driver
.sleep(generateDelay
).then(function() {
3483 // try to generate more addresses
3484 driver
.findElement(By
.css('.more'))
3486 driver
.sleep(generateDelay
).then(function() {
3487 driver
.findElements(By
.css(".addresses tr"))
3488 .then(function(els
) {
3489 // check there are no addresses shown
3490 expect(els
.length
).toBe(0);
3499 // error trying to generate addresses from xpub with hardened derivation
3500 it('Shows error for hardened addresses with xpub root key', function(done
) {
3501 driver
.findElement(By
.css('#bip32-tab a'))
3503 driver
.executeScript(function() {
3504 $(".hardened-addresses").prop("checked", true);
3506 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3507 driver
.findElement(By
.css("#root-key"))
3508 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3509 driver
.sleep(feedbackDelay
).then(function() {
3510 // Check feedback is correct
3511 driver
.findElement(By
.css('.feedback'))
3513 .then(function(feedback
) {
3514 var msg
= "Hardened derivation path is invalid with xpub key";
3515 expect(feedback
).toBe(msg
);
3521 // Litecoin uses ltub by default, and can optionally be set to xprv
3523 // https://github.com/iancoleman/bip39/issues/96
3524 // Issue with extended keys on Litecoin
3525 it('Uses ltub by default for litecoin, but can be set to xprv', function(done
) {
3526 driver
.findElement(By
.css('.phrase'))
3527 .sendKeys("abandon abandon ability");
3528 selectNetwork("LTC - Litecoin");
3529 driver
.sleep(generateDelay
).then(function() {
3530 // check the extended key is generated correctly
3531 driver
.findElement(By
.css('.root-key'))
3532 .getAttribute("value")
3533 .then(function(rootKey
) {
3534 expect(rootKey
).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU");
3535 // set litecoin to use ltub
3536 driver
.executeScript(function() {
3537 $(".litecoin-use-ltub").prop("checked", false);
3538 $(".litecoin-use-ltub").trigger("change");
3540 driver
.sleep(generateDelay
).then(function() {
3541 driver
.findElement(By
.css('.root-key'))
3542 .getAttribute("value")
3543 .then(function(rootKey
) {
3544 expect(rootKey
).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
3553 // https://github.com/iancoleman/bip39/issues/99#issuecomment-327094159
3554 // "warn me emphatically when they have detected invalid input" to the entropy field
3555 // A warning is shown when entropy is filtered and discarded
3556 it('Warns when entropy is filtered and discarded', function(done
) {
3557 driver
.findElement(By
.css('.use-entropy'))
3559 // set entropy to have no filtered content
3560 driver
.findElement(By
.css('.entropy'))
3561 .sendKeys("00000000 00000000 00000000 00000000");
3562 driver
.sleep(generateDelay
).then(function() {
3563 // check the filter warning does not show
3564 driver
.findElement(By
.css('.entropy-container .filter-warning'))
3565 .getAttribute("class")
3566 .then(function(classes
) {
3567 expect(classes
).toContain("hidden");
3568 // set entropy to have some filtered content
3569 driver
.findElement(By
.css('.entropy'))
3570 .sendKeys("10000000 zxcvbn 00000000 00000000 00000000");
3571 driver
.sleep(entropyFeedbackDelay
).then(function() {
3572 // check the filter warning shows
3573 driver
.findElement(By
.css('.entropy-container .filter-warning'))
3574 .getAttribute("class")
3575 .then(function(classes
) {
3576 expect(classes
).not
.toContain("hidden");
3584 // Bitcoin Cash address can be set to use cashaddr format
3585 it('Can use cashaddr format for bitcoin cash addresses', function(done
) {
3586 driver
.executeScript(function() {
3587 $(".use-bch-cashaddr-addresses").prop("checked", true);
3589 driver
.findElement(By
.css('.phrase'))
3590 .sendKeys("abandon abandon ability");
3591 selectNetwork("BCH - Bitcoin Cash");
3592 driver
.sleep(generateDelay
).then(function() {
3593 getFirstAddress(function(address
) {
3594 expect(address
).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps");
3600 // Bitcoin Cash address can be set to use bitpay format
3601 it('Can use bitpay format for bitcoin cash addresses', function(done
) {
3602 driver
.executeScript(function() {
3603 $(".use-bch-bitpay-addresses").prop("checked", true);
3605 driver
.findElement(By
.css('.phrase'))
3606 .sendKeys("abandon abandon ability");
3607 selectNetwork("BCH - Bitcoin Cash");
3608 driver
.sleep(generateDelay
).then(function() {
3609 getFirstAddress(function(address
) {
3610 expect(address
).toBe("CZnpA9HPmvhuhLLPWJP8rNDpLUYXy1LXFk");
3616 // Bitcoin Cash address can be set to use legacy format
3617 it('Can use legacy format for bitcoin cash addresses', function(done
) {
3618 driver
.executeScript(function() {
3619 $(".use-bch-legacy-addresses").prop("checked", true);
3621 driver
.findElement(By
.css('.phrase'))
3622 .sendKeys("abandon abandon ability");
3623 selectNetwork("BCH - Bitcoin Cash");
3624 driver
.sleep(generateDelay
).then(function() {
3625 getFirstAddress(function(address
) {
3626 expect(address
).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A");
3632 // End of tests ported from old suit, so no more comments above each test now
3634 it('Can generate more addresses from a custom index', function(done
) {
3635 var expectedIndexes
= [
3636 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
3637 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59
3639 driver
.findElement(By
.css('.phrase'))
3640 .sendKeys("abandon abandon ability");
3641 driver
.sleep(generateDelay
).then(function() {
3642 // Set start of next lot of rows to be from index 40
3643 // which means indexes 20-39 will not be in the table.
3644 driver
.findElement(By
.css('.more-rows-start-index'))
3646 driver
.findElement(By
.css('.more'))
3648 driver
.sleep(generateDelay
).then(function() {
3649 // Check actual indexes in the table match the expected pattern
3650 driver
.findElements(By
.css(".index"))
3651 .then(function(els
) {
3652 expect(els
.length
).toBe(expectedIndexes
.length
);
3653 var testRowAtIndex = function(i
) {
3654 if (i
>= expectedIndexes
.length
) {
3659 .then(function(actualPath
) {
3660 var noHardened
= actualPath
.replace(/'/g, "");
3661 var pathBits = noHardened.split("/")
3662 var lastBit = pathBits[pathBits.length-1];
3663 var actualIndex = parseInt(lastBit);
3664 var expectedIndex = expectedIndexes[i];
3665 expect(actualIndex).toBe(expectedIndex);
3666 testRowAtIndex(i+1);
3676 it('Can generate BIP141 addresses
with P2WPKH
-in-P2SH semanitcs
', function(done) {
3677 // Sourced from BIP49 official test specs
3678 driver.findElement(By.css('#bip141
-tab a
'))
3680 driver.findElement(By.css('.bip141
-path
'))
3682 driver.findElement(By.css('.bip141
-path
'))
3683 .sendKeys("m/49'/1'/0'/0");
3684 selectNetwork("BTC
- Bitcoin Testnet
");
3685 driver.findElement(By.css(".phrase
"))
3686 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
");
3687 driver.sleep(generateDelay).then(function() {
3688 getFirstAddress(function(address) {
3689 expect(address).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2
");
3695 it('Can generate BIP141 addresses with P2WSH semanitcs', function(done) {
3696 driver.findElement(By.css('#bip141-tab a'))
3699 driver.executeScript(function() {
3700 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3701 $(".bip141
-semantics option
").filter(function(i,e) {
3702 return $(e).html() == "P2WSH (1-of-1 multisig
)";
3703 }).prop("selected
", true);
3704 $(".bip141
-semantics
").trigger("change
");
3706 driver.findElement(By.css(".phrase
"))
3707 .sendKeys("abandon abandon ability
");
3708 driver.sleep(generateDelay).then(function() {
3709 driver.findElement(By.css("#root
-key
"))
3710 .getAttribute("value
")
3711 .then(function(rootKey) {
3712 expect(rootKey).toBe("ZprvAhadJRUYsNge9uHspaggavxU1BUQ8QwfT4Z9UGq5sKF2mSt1mVy8EckLAaoBdmLHyP5eYDJ3LxtmzMNnLg2MRFe7QN2ueF4NCH4s5PrCDR6
");
3713 getFirstAddress(function(address) {
3714 expect(address).toBe("bc1q2qhee847pv438tgg8hc7mjy38n8dklleshettn344l0tgs0kj5hskz9p9r
");
3721 it('Can generate BIP141 addresses with P2WSH-in-P2SH semanitcs', function(done) {
3722 driver.findElement(By.css('#bip141-tab a'))
3724 // Choose P2WSH-in-P2SH
3725 driver.executeScript(function() {
3726 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3727 $(".bip141
-semantics option
").filter(function(i,e) {
3728 return $(e).html() == "P2WSH nested
in P2SH (1-of-1 multisig
)";
3729 }).prop("selected
", true);
3730 $(".bip141
-semantics
").trigger("change
");
3732 driver.findElement(By.css(".phrase
"))
3733 .sendKeys("abandon abandon ability
");
3734 driver.sleep(generateDelay).then(function() {
3735 driver.findElement(By.css("#root
-key
"))
3736 .getAttribute("value
")
3737 .then(function(rootKey) {
3738 expect(rootKey).toBe("YprvANkMzkodih9AJc6kzDu4NqrxqDKxBnxAXx2vgswCVJs9iM4nWqoZcZ6C9NqbdrgNZjxqnjhUtJYE74mDcycLd1xWY2LV4LEsvZ1DgqxuAKe
");
3739 getFirstAddress(function(address) {
3740 expect(address).toBe("343DLC4vGDyHBbBr9myL8zzZA1MdN9TM1G
");
3747 it('Uses Vprv for bitcoin testnet p2wsh', function(done) {
3748 selectNetwork("BTC
- Bitcoin Testnet
");
3749 driver.findElement(By.css('#bip141-tab a'))
3752 driver.executeScript(function() {
3753 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3754 $(".bip141
-semantics option
").filter(function(i,e) {
3755 return $(e).html() == "P2WSH (1-of-1 multisig
)";
3756 }).prop("selected
", true);
3757 $(".bip141
-semantics
").trigger("change
");
3759 driver.findElement(By.css('.phrase'))
3760 .sendKeys('abandon abandon ability');
3761 driver.sleep(generateDelay).then(function() {
3762 driver.findElement(By.css('.root-key'))
3763 .getAttribute("value
")
3764 .then(function(path) {
3765 expect(path).toBe("Vprv16YtLrHXxePM5ja5hXQbiJs5JKDAc4WcaXo5rZcrVMU6bMhUg1oY7fpPku3i819gvMcHvq1h8aELDsyfCEs19vj1Q3iDHRrESWyJConkoT1
");
3771 it('Uses Uprv for bitcoin testnet p2wsh-in-p2sh', function(done) {
3772 selectNetwork("BTC
- Bitcoin Testnet
");
3773 driver.findElement(By.css('#bip141-tab a'))
3775 // Choose P2WSH-in-P2SH
3776 driver.executeScript(function() {
3777 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3778 $(".bip141
-semantics option
").filter(function(i,e) {
3779 return $(e).html() == "P2WSH nested
in P2SH (1-of-1 multisig
)";
3780 }).prop("selected
", true);
3781 $(".bip141
-semantics
").trigger("change
");
3783 driver.findElement(By.css('.phrase'))
3784 .sendKeys('abandon abandon ability');
3785 driver.sleep(generateDelay).then(function() {
3786 driver.findElement(By.css('.root-key'))
3787 .getAttribute("value
")
3788 .then(function(path) {
3789 expect(path).toBe("Uprv95RJn67y7xyEuRLHenkZYVUx9LkARJzAsVx3ZJMeyHMdVwosWD9K8JTe4Z1FeE4gwBVcnqKF3f82ZvJxkBxHS5E74fYnigxvqeke8ZV3Fp2
");
3795 it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) {
3796 // This result tested against bitcoinjs-lib test spec for segwit address
3797 // using the first private key of this mnemonic and default path m/0
3798 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/9c8503cab0c6c30a95127042703bc18e8d28c76d/test/integration/addresses.js#L50
3799 // so whilst not directly comparable, substituting the private key produces
3800 // identical results between this tool and the bitcoinjs-lib test.
3801 // Private key generated is:
3802 // L3L8Nu9whawPBNLGtFqDhKut9DKKfG3CQoysupT7BimqVCZsLFNP
3803 driver.findElement(By.css('#bip141-tab a'))
3806 driver.executeScript(function() {
3807 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3808 $(".bip141
-semantics option
").filter(function(i,e) {
3809 return $(e).html() == "P2WPKH
";
3810 }).prop("selected
", true);
3811 $(".bip141
-semantics
").trigger("change
");
3813 driver.findElement(By.css(".phrase
"))
3814 .sendKeys("abandon abandon ability
");
3815 driver.sleep(generateDelay).then(function() {
3816 getFirstAddress(function(address) {
3817 expect(address).toBe("bc1qfwu6a5a3evygrk8zvdxxvz4547lmpyx5vsfxe9
");
3823 it('Shows the entropy used by the PRNG when clicking generate', function(done) {
3824 driver.findElement(By.css('.generate')).click();
3825 driver.sleep(generateDelay).then(function() {
3826 driver.findElement(By.css('.entropy'))
3827 .getAttribute("value
")
3828 .then(function(entropy) {
3829 expect(entropy).not.toBe("");
3835 it('Shows the index of each word in the mnemonic', function(done) {
3836 driver.findElement(By.css('.phrase'))
3837 .sendKeys("abandon abandon ability
");
3838 driver.sleep(generateDelay).then(function() {
3839 driver.findElement(By.css('.use-entropy'))
3841 driver.findElement(By.css('.word-indexes'))
3843 .then(function(indexes) {
3844 expect(indexes).toBe("0, 0, 1");
3850 it('Shows the derivation path for bip84 tab', function(done) {
3851 driver.findElement(By.css('#bip84-tab a'))
3853 driver.findElement(By.css('.phrase'))
3854 .sendKeys('abandon abandon ability');
3855 driver.sleep(generateDelay).then(function() {
3856 driver.findElement(By.css('#bip84 .path'))
3857 .getAttribute("value
")
3858 .then(function(path) {
3859 expect(path).toBe("m
/84'/0'/0'/0");
3865 it('Shows the extended private key for bip84 tab', function(done) {
3866 driver.findElement(By.css('#bip84-tab a'))
3868 driver.findElement(By.css('.phrase'))
3869 .sendKeys('abandon abandon ability');
3870 driver.sleep(generateDelay).then(function() {
3871 driver.findElement(By.css('.extended-priv-key'))
3872 .getAttribute("value
")
3873 .then(function(path) {
3874 expect(path).toBe("zprvAev3RKrZ3QVKiUFCfdeMRen1BPDJgdNt1XpxiDy8acSs4kkAGTCvq7HeRYRNNpo8EtEjCFQBWavJwtCUR29y4TUCH4X5RXMcyq48uN8y9BP
");
3880 it('Shows the extended public key for bip84 tab', function(done) {
3881 driver.findElement(By.css('#bip84-tab a'))
3883 driver.findElement(By.css('.phrase'))
3884 .sendKeys('abandon abandon ability');
3885 driver.sleep(generateDelay).then(function() {
3886 driver.findElement(By.css('.extended-pub-key'))
3887 .getAttribute("value
")
3888 .then(function(path) {
3889 expect(path).toBe("zpub6suPpqPSsn3cvxKfmfBMnnijjR3o666jNkkZWcNk8wyqwZ5JozXBNuc8Gs7DB3uLwTDvGVTspVEAUQcEjKF3pZHgywVbubdTqbXTUg7usyx
");
3895 it('Changes the address list if bip84 account is changed', function(done) {
3896 driver.findElement(By.css('#bip84-tab a'))
3898 driver.findElement(By.css('#bip84 .account'))
3900 driver.findElement(By.css('.phrase'))
3901 .sendKeys('abandon abandon ability');
3902 driver.sleep(generateDelay).then(function() {
3903 getFirstAddress(function(address) {
3904 expect(address).toBe("bc1qp7vv669t2fy965jdzvqwrraana89ctd5ewc662
");
3910 it('Changes the address list if bip84 change is changed', function(done) {
3911 driver.findElement(By.css('#bip84-tab a'))
3913 driver.findElement(By.css('#bip84 .change'))
3915 driver.findElement(By.css('.phrase'))
3916 .sendKeys('abandon abandon ability');
3917 driver.sleep(generateDelay).then(function() {
3918 getFirstAddress(function(address) {
3919 expect(address).toBe("bc1qr39vj6rh06ff05m53uxq8uazehwhccswylhrs2
");
3925 it('Passes the official BIP84 test spec for rootpriv', function(done) {
3926 driver.findElement(By.css('#bip84-tab a'))
3928 driver.findElement(By.css('.phrase'))
3929 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3930 driver.sleep(generateDelay).then(function() {
3931 driver.findElement(By.css(".root
-key
"))
3932 .getAttribute("value
")
3933 .then(function(rootKey) {
3934 expect(rootKey).toBe("zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5
");
3940 it('Passes the official BIP84 test spec for account 0 xprv', function(done) {
3941 driver.findElement(By.css('#bip84-tab a'))
3943 driver.findElement(By.css('.phrase'))
3944 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3945 driver.sleep(generateDelay).then(function() {
3946 driver.findElement(By.css("#bip84
.account
-xprv
"))
3947 .getAttribute("value
")
3948 .then(function(rootKey) {
3949 expect(rootKey).toBe("zprvAdG4iTXWBoARxkkzNpNh8r6Qag3irQB8PzEMkAFeTRXxHpbF9z4QgEvBRmfvqWvGp42t42nvgGpNgYSJA9iefm1yYNZKEm7z6qUWCroSQnE
");
3955 it('Passes the official BIP84 test spec for account 0 xpub', function(done) {
3956 driver.findElement(By.css('#bip84-tab a'))
3958 driver.findElement(By.css('.phrase'))
3959 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3960 driver.sleep(generateDelay).then(function() {
3961 driver.findElement(By.css("#bip84
.account
-xpub
"))
3962 .getAttribute("value
")
3963 .then(function(rootKey) {
3964 expect(rootKey).toBe("zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs
");
3970 it('Passes the official BIP84 test spec for account 0 first address', function(done) {
3971 driver.findElement(By.css('#bip84-tab a'))
3973 driver.findElement(By.css('.phrase'))
3974 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3975 driver.sleep(generateDelay).then(function() {
3976 getFirstAddress(function(address) {
3977 expect(address).toBe("bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu
");
3983 it('Passes the official BIP84 test spec for account 0 first change address', function(done) {
3984 driver.findElement(By.css('#bip84-tab a'))
3986 driver.findElement(By.css('.phrase'))
3987 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3988 driver.findElement(By.css('#bip84 .change'))
3990 driver.sleep(generateDelay).then(function() {
3991 getFirstAddress(function(address) {
3992 expect(address).toBe("bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el
");
3998 it('Can display the table as csv', function(done) {
3999 var headings = "path
,address
,public key
,private key
";
4000 var row1 = "m
/44'/0'/0'/0/0,1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
,033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3
,L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE
";
4001 var row20 = "m
/44'/0'/0'/0/19,1KhBy28XLAciXnnRvm71PvQJaETyrxGV55
,02b4b3e396434d8cdd20c03ac4aaa07387784d5d867b75987f516f5705ee68cb3a
,L4GrDrjReMsCAu5DkLXn79jSb95qR7Zfx7eshybCQZ1qL32MXJab
";
4002 driver.findElement(By.css('.phrase'))
4003 .sendKeys('abandon abandon ability');
4004 driver.sleep(generateDelay).then(function() {
4005 driver.findElement(By.css('.csv'))
4006 .getAttribute("value
")
4007 .then(function(csv) {
4008 expect(csv).toContain(headings);
4009 expect(csv).toContain(row1);
4010 expect(csv).toContain(row20);
4016 it('LeftPads ethereum keys that are less than 32 bytes', function(done) {
4017 // see https://github.com/iancoleman/bip39/issues/155
4018 selectNetwork("ETH
- Ethereum
");
4019 driver.findElement(By.css('#bip32-tab a'))
4021 driver.findElement(By.css('#bip32-path'))
4023 driver.findElement(By.css('#bip32-path'))
4024 .sendKeys("m
/44'/60'/0'");
4025 driver.findElement(By.css('.phrase'))
4026 .sendKeys('scout sort custom elite radar rare vivid thing trophy gesture cover snake change narrow kite list nation sustain buffalo erode open balance system young');
4027 driver.sleep(generateDelay).then(function() {
4028 getFirstAddress(function(address) {
4029 expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118");
4035 it('Can encrypt private keys using BIP38', function(done) {
4036 // see https://github.com/iancoleman/bip39/issues/140
4037 driver.executeScript(function() {
4038 $(".use-bip38
").prop("checked
", true);
4040 driver.findElement(By.css('.bip38-password'))
4041 .sendKeys('bip38password');
4042 driver.findElement(By.css('.rows-to-add'))
4044 driver.findElement(By.css('.rows-to-add'))
4046 driver.findElement(By.css('.phrase'))
4047 .sendKeys('abandon abandon ability');
4048 driver.sleep(bip38delay).then(function() {
4050 getFirstRowValue(function(address) {
4051 expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB
");
4053 getFirstRowValue(function(pubkey) {
4054 expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1
");
4056 getFirstRowValue(function(privkey) {
4057 expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM
");
4063 }, bip38delay + 5000);
4065 it('Shows the checksum for the entropy', function(done) {
4066 driver.findElement(By.css('.use-entropy'))
4068 driver.findElement(By.css('.entropy'))
4069 .sendKeys("00000000000000000000000000000000");
4070 driver.sleep(generateDelay).then(function() {
4071 driver.findElement(By.css('.checksum'))
4073 .then(function(text) {
4074 expect(text).toBe("1");
4080 it('Shows the checksum for the entropy with the correct groupings', function(done) {
4081 driver.findElement(By.css('.use-entropy'))
4083 // create a checksum of 20 bits, which spans multiple words
4084 driver.findElement(By.css('.entropy'))
4085 .sendKeys("F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
");
4086 driver.sleep(generateDelay).then(function() {
4087 driver.findElement(By.css('.checksum'))
4089 .then(function(text) {
4090 // first group is 9 bits, second group is 11
4091 expect(text).toBe("011010111 01110000110");
4097 it('Uses vprv for bitcoin testnet p2wpkh', function(done) {
4098 selectNetwork("BTC
- Bitcoin Testnet
");
4099 driver.findElement(By.css('#bip84-tab a'))
4101 driver.findElement(By.css('.phrase'))
4102 .sendKeys('abandon abandon ability');
4103 driver.sleep(generateDelay).then(function() {
4104 driver.findElement(By.css('.root-key'))
4105 .getAttribute("value
")
4106 .then(function(path) {
4107 expect(path).toBe("vprv9DMUxX4ShgxML9N2YV5CvWEebWrM9aJ5ULpbRRyzyWu6vs4BzTvbfFFrH41N5hVi7MYSfiugd765L3JmAfDM5po36Y8ouCKRDeYQwByCmS7
");
4113 it('Shows a warning if generating weak mnemonics', function(done) {
4114 driver.executeScript(function() {
4115 $(".strength option
[selected
]").removeAttr("selected
");
4116 $(".strength option
[value
=6]").prop("selected
", true);
4117 $(".strength
").trigger("change
");
4119 driver.findElement(By.css(".generate
-container
.warning
"))
4120 .getAttribute("class")
4121 .then(function(classes) {
4122 expect(classes).not.toContain("hidden
");
4127 it('Does not show a warning if generating strong mnemonics', function(done) {
4128 driver.executeScript(function() {
4129 $(".strength option
[selected
]").removeAttr("selected
");
4130 $(".strength option
[value
=12]").prop("selected
", true);
4132 driver.findElement(By.css(".generate
-container
.warning
"))
4133 .getAttribute("class")
4134 .then(function(classes) {
4135 expect(classes).toContain("hidden
");
4140 it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) {
4141 driver.findElement(By.css('.use-entropy'))
4143 driver.findElement(By.css('.entropy'))
4144 .sendKeys("0123456789abcdef
"); // 6 words
4145 driver.executeScript(function() {
4146 $(".mnemonic
-length
").val("12").trigger("change
");
4148 driver.findElement(By.css(".weak
-entropy
-override
-warning
"))
4149 .getAttribute("class")
4150 .then(function(classes) {
4151 expect(classes).not.toContain("hidden
");
4156 it('Does not show a warning if entropy is stronger than mnemonic length', function(done) {
4157 driver.findElement(By.css('.use-entropy'))
4159 driver.findElement(By.css('.entropy'))
4160 .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef
"); // 18 words
4161 driver.executeScript(function() {
4162 $(".mnemonic
-length
").val("12").trigger("change
");
4164 driver.findElement(By.css(".weak
-entropy
-override
-warning
"))
4165 .getAttribute("class")
4166 .then(function(classes) {
4167 expect(classes).toContain("hidden
");
4172 it('Shows litecoin BIP49 addresses', function(done) {
4173 driver.findElement(By.css('.phrase'))
4174 .sendKeys('abandon abandon ability');
4175 selectNetwork("LTC
- Litecoin
");
4176 driver.findElement(By.css('#bip49-tab a'))
4178 // bip49 addresses are shown
4179 driver.sleep(generateDelay).then(function() {
4180 driver.findElement(By.css('#bip49 .available'))
4181 .getAttribute("class")
4182 .then(function(classes) {
4183 expect(classes).not.toContain("hidden
");
4184 // check first address
4185 getFirstAddress(function(address) {
4186 expect(address).toBe("MFwLPhsXoBuSLL8cLmW9uK6tChkzduV8qN
");
4193 it('Shows Groestlcoin BIP49 addresses', function(done) {
4194 driver.findElement(By.css('.phrase'))
4195 .sendKeys('abandon abandon ability');
4196 selectNetwork("GRS
- Groestlcoin
");
4197 driver.findElement(By.css('#bip49-tab a'))
4199 // bip49 addresses are shown
4200 driver.sleep(generateDelay).then(function() {
4201 driver.findElement(By.css('#bip49 .available'))
4202 .getAttribute("class")
4203 .then(function(classes) {
4204 expect(classes).not.toContain("hidden
");
4205 // check first address
4206 getFirstAddress(function(address) {
4207 expect(address).toBe("3HXSCZwCypLyixMsF4Z1sN49noJtrm8gnX
");
4214 it('Can use root keys to generate segwit table rows', function(done) {
4215 // segwit uses ypub / zpub instead of xpub but the root key should still
4216 // be valid regardless of the encoding used to import that key.
4217 // Maybe this breaks the reason for the different extended key prefixes, but
4218 // since the parsed root key is used behind the scenes anyhow this should be
4220 driver.findElement(By.css('#root-key'))
4221 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
4222 driver.findElement(By.css('#bip49-tab a'))
4224 // bip49 addresses are shown
4225 driver.sleep(generateDelay).then(function() {
4226 getFirstAddress(function(address) {
4227 expect(address).toBe("3QG2Y9AA4xZ846gKHZqNf7mvVKbLqMKxr2
");
4234 // Allow converting mnemonic back to raw entropy value
4235 it('Converts mnemonics into raw entropy', function(done) {
4236 driver.findElement(By.css('.phrase'))
4237 .sendKeys('abandon abandon about');
4238 driver.sleep(generateDelay).then(function() {
4239 driver.findElement(By.css('.use-entropy'))
4241 driver.findElement(By.css('.entropy'))
4242 .getAttribute("value
")
4243 .then(function(entropy) {
4244 expect(entropy).toBe("00000001");
4245 driver.findElement(By.css('.phrase'))
4246 .getAttribute("value
")
4247 .then(function(phrase) {
4248 expect(phrase).toBe("abandon abandon about
");
4256 // Added Split Phrase Card Output
4257 it('Shows split prase cards', function(done) {
4258 var originalPhrase = "ugly charge strong giant once anchor capable october thumb inject dwarf legal alley mixture shoot
";
4259 var originalWords = originalPhrase.split(' ');
4260 driver.findElement(By.css('.phrase'))
4261 .sendKeys(originalPhrase);
4262 driver.sleep(generateDelay).then(function() {
4263 driver.findElement(By.css('.phraseSplit'))
4264 .getAttribute("value
")
4265 .then(function(cardsStr) {
4266 var cards = cardsStr.split("\n");
4267 expect(cards.length).toBe(3);
4268 // test all 2-of-3 combos can be used to form full phrase
4269 var combos = [[0,1],[0,2],[1,2]];
4270 for (var i=0; i<combos.length; i++) {
4271 var combo = combos[i];
4274 var phrase = cards[a] + " " + cards[b];
4275 // check all original words are present
4276 for (var j=0; j<originalWords.length; j++) {
4277 var originalWord = originalWords[j];
4278 expect(phrase).toContain(originalWord);
4286 // It allows manually specifying the entropy type
4287 it('Allows entropy type to be manually selected', function(done) {
4288 driver.findElement(By.css('.use-entropy'))
4290 // use decimal entropy
4291 driver.findElement(By.css('.entropy'))
4293 // manually change to binary entropy
4294 driver.executeScript(function() {
4295 $(".entropy
-container input
[value
='binary']").click();
4297 driver.sleep(entropyFeedbackDelay).then(function() {
4298 driver.findElement(By.css('.entropy-container'))
4300 .then(function(text) {
4301 // overide 91 to be just 1
4302 var key = "Filtered Entropy
";
4304 var reText = key + "\\s
+" + value;
4305 var re = new RegExp(reText);
4306 expect(text).toMatch(re);
4307 // overide automatic decimal to binary
4308 var key = "Entropy Type
";
4309 var value = "binary
";
4310 var reText = key + "\\s
+" + value;
4311 var re = new RegExp(reText);
4312 expect(text).toMatch(re);
4313 // overide 2 events to 1
4314 var key = "Event Count
";
4316 var reText = key + "\\s
+" + value;
4317 var re = new RegExp(reText);
4318 expect(text).toMatch(re);
4319 // overide log2(10)*2 bits to 1 bit
4320 var key = "Total Bits
";
4322 var reText = key + "\\s
+" + value;
4323 var re = new RegExp(reText);
4324 expect(text).toMatch(re);
4330 // https://github.com/iancoleman/bip39/issues/388
4331 // Make field for bip39 seed editable
4332 it('Generates addresses when seed is set', function(done) {
4333 driver.findElement(By.css('.seed'))
4334 .sendKeys("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3
");
4335 driver.sleep(generateDelay).then(function() {
4336 getFirstAddress(function(address) {
4337 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
4343 // https://github.com/iancoleman/bip39/issues/169
4344 it('Generates ethereum addresses from a public key', function(done) {
4345 var pubkey = "xpub68UK3hrMEp2jLPxPASgXSiqiUsQsUWZHCeuu6NqcJLt259LMeWzwDyufXLN1QmjLeLRY5he4QfArDDLbsXiw3xN3kFcYtyDy74BY73RPhhW
";
4346 driver.findElement(By.css('.root-key'))
4348 driver.findElement(By.css('#bip32-tab a'))
4350 selectNetwork('ETH - Ethereum');
4351 driver.sleep(generateDelay).then(function() {
4352 getFirstAddress(function(address) {
4353 expect(address).toBe("0x1Bd54748903438C7E386b4a3fCbe16237A316a98");