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 litecoin
', function(done) {
417 selectText: "LTC - Litecoin",
418 firstAddress: "LQ4XU8RX2ULPmPq9FcUHdVmPVchP9nwXdn",
420 testNetwork(done, params);
422 it('Allows selection
of litecoin testnet
', function(done) {
424 selectText: "LTCt - Litecoin Testnet",
425 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
427 testNetwork(done, params);
429 it('Allows selection
of ripple
', function(done) {
431 selectText: "XRP - Ripple",
432 firstAddress: "rLTFnqbmCVPGx6VfaygdtuKWJgcN4v1zRS",
433 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",
435 testNetwork(done, params);
437 it('Allows selection
of dogecoin
', function(done) {
439 selectText: "DOGE - Dogecoin",
440 firstAddress: "DPQH2AtuzkVSG6ovjKk4jbUmZ6iXLpgbJA",
442 testNetwork(done, params);
444 it('Allows selection
of dogecoin testnet
', function(done) {
446 selectText: "DOGEt - Dogecoin Testnet",
447 firstAddress: "niHnSJKHdwDyDxRMLBJrtNqpvHEsAFWe6B",
449 testNetwork(done, params);
451 it('Allows selection
of denarius
', function(done) {
453 selectText: "DNR - Denarius",
454 firstAddress: "DFdFMVUMzU9xX88EywXvAGwjiwpxyh9vKb",
456 testNetwork(done, params);
458 it('Allows selection
of shadowcash
', function(done) {
460 selectText: "SDC - ShadowCash",
461 firstAddress: "SiSZtfYAXEFvMm3XM8hmtkGDyViRwErtCG",
463 testNetwork(done, params);
465 it('Allows selection
of shadowcash testnet
', function(done) {
467 selectText: "SDC - ShadowCash Testnet",
468 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
470 testNetwork(done, params);
472 it('Allows selection
of viacoin
', function(done) {
474 selectText: "VIA - Viacoin",
475 firstAddress: "Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT",
477 testNetwork(done, params);
479 it('Allows selection
of viacoin testnet
', function(done) {
481 selectText: "VIA - Viacoin Testnet",
482 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
484 testNetwork(done, params);
486 it('Allows selection
of jumbucks
', function(done) {
488 selectText: "JBS - Jumbucks",
489 firstAddress: "JLEXccwDXADK4RxBPkRez7mqsHVoJBEUew",
491 testNetwork(done, params);
493 it('Allows selection
of clam
', function(done) {
495 selectText: "CLAM - Clams",
496 firstAddress: "xCp4sakjVx4pUAZ6cBCtuin8Ddb6U1sk9y",
498 testNetwork(done, params);
500 it('Allows selection
of crown
', function(done) {
502 selectText: "CRW - Crown (Legacy)",
503 firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5",
505 testNetwork(done, params);
507 it('Allows selection
of crown
', function(done) {
509 selectText: "CRW - Crown",
510 firstAddress: "CRWKnVmVhvH1KWTYe6sq8xV4dFGcFpBEEkPQ",
512 testNetwork(done, params);
514 it('Allows selection
of dash
', function(done) {
516 selectText: "DASH - Dash",
517 firstAddress: "XdbhtMuGsPSkE6bPdNTHoFSszQKmK4S5LT",
519 testNetwork(done, params);
521 it('Allows selection
of dash testnet
', function(done) {
523 selectText: "DASH - Dash Testnet",
524 firstAddress: "yaR52EN4oojdJfBgzWJTymC4uuCLPT29Gw",
526 testNetwork(done, params);
528 it('Allows selection
of game
', function(done) {
530 selectText: "GAME - GameCredits",
531 firstAddress: "GSMY9bAp36cMR4zyT4uGVS7GFjpdXbao5Q",
533 testNetwork(done, params);
535 it('Allows selection
of komodo
', function(done) {
537 selectText: "KMD - Komodo",
538 firstAddress: "RMPPzJwAjPVZZAwJvXivHJGGjdCx6WBD2t",
540 testNetwork(done, params);
542 it('Allows selection
of namecoin
', function(done) {
544 selectText: "NMC - Namecoin",
545 firstAddress: "Mw2vK2Bvex1yYtYF6sfbEg2YGoUc98YUD2",
547 testNetwork(done, params);
549 it('Allows selection
of onixcoin
', function(done) {
551 selectText: "ONX - Onixcoin",
552 firstAddress: "XGwMqddeKjT3ddgX73QokjVbCL3aK6Yxfk",
554 testNetwork(done, params);
556 it('Allows selection
of lkrcoin
', function(done) {
558 selectText: "LKR - Lkrcoin",
559 firstAddress: "LfbT296e7AEEnn4bYDbL535Nd8P9g98CdJ",
561 testNetwork(done, params);
563 it('Allows selection
of bolivarcoin
', function(done) {
565 selectText: "BOLI - Bolivarcoin",
566 firstAddress: "bbKzCAUR7hZ3nqfffy7VgrSz8LmAP3S5mK",
568 testNetwork(done, params);
570 it('Allows selection
of peercoin
', function(done) {
572 selectText: "PPC - Peercoin",
573 firstAddress: "PVAiioTaK2eDHSEo3tppT9AVdBYqxRTBAm",
575 testNetwork(done, params);
577 it('Allows selection
of ethereum
', function(done) {
579 selectText: "ETH - Ethereum",
580 firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
582 testNetwork(done, params);
583 // TODO test private key and public key
585 it('Allows selection
of slimcoin
', function(done) {
587 selectText: "SLM - Slimcoin",
588 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
590 testNetwork(done, params);
592 it('Allows selection
of slimcoin testnet
', function(done) {
594 selectText: "SLM - Slimcoin Testnet",
595 firstAddress: "n3nMgWufTek5QQAr6uwMhg5xbzj8xqc4Dq",
597 testNetwork(done, params);
599 it('Allows selection
of bitcoin cash
', function(done) {
601 selectText: "BCH - Bitcoin Cash",
602 firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps",
604 testNetwork(done, params);
607 it('Allows selection
of simpleledger(SLP
)', function(done) {
609 selectText: "SLP - Simple Ledger Protocol",
610 firstAddress: "simpleledger:qrtffz6ajfsn74gpur7y3epjquz42pvww5acewqmre",
612 testNetwork(done, params);
615 it('Allows selection
of myriadcoin
', function(done) {
617 selectText: "XMY - Myriadcoin",
618 firstAddress: "MJEswvRR46wh9BoiVj9DzKYMBkCramhoBV",
620 testNetwork(done, params);
622 it('Allows selection
of pivx
', function(done) {
624 selectText: "PIVX - PIVX",
625 firstAddress: "DBxgT7faCuno7jmtKuu6KWCiwqsVPqh1tS",
627 testNetwork(done, params);
629 it('Allows selection
of pivx testnet
', function(done) {
631 selectText: "PIVX - PIVX Testnet",
632 firstAddress: "yB5U384n6dGkVE3by5y9VdvHHPwPg68fQj",
634 testNetwork(done, params);
636 it('Allows selection
of maza
', function(done) {
638 selectText: "MAZA - Maza",
639 firstAddress: "MGW4Bmi2NEm4PxSjgeFwhP9vg18JHoRnfw",
641 testNetwork(done, params);
643 it('Allows selection
of FIX
', function(done) {
645 selectText: "FIX - FIX",
646 firstAddress: "FS5MEU8fs5dUvsaSCSusV8RQtC8j2h3JEh",
648 testNetwork(done, params);
650 it('Allows selection
of FIX testnet
', function(done) {
652 selectText: "FIX - FIX Testnet",
653 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
655 testNetwork(done, params);
657 it('Allows selection
of fujicoin
', function(done) {
659 selectText: "FJC - Fujicoin",
660 firstAddress: "FgiaLpG7C99DyR4WnPxXedRVHXSfKzUDhF",
662 testNetwork(done, params);
664 it('Allows selection
of nubits
', function(done) {
666 selectText: "USNBT - NuBits",
667 firstAddress: "BLxkabXuZSJSdesLD7KxZdqovd4YwyBTU6",
669 testNetwork(done, params);
671 it('Allows selection
of bitcoin gold
', function(done) {
673 selectText: "BTG - Bitcoin Gold",
674 firstAddress: "GdDqug4WUsn5syNbSTHatNn4XnuwZtzedx",
676 testNetwork(done, params);
678 it('Allows selection
of monacoin
', function(done) {
680 selectText: "MONA - Monacoin",
681 firstAddress: "MKMiMr7MyjDKjJbCBzgF6u4ByqTS4NkRB1",
683 testNetwork(done, params);
685 it('Allows selection
of AXE
', function(done) {
687 selectText: "AXE - Axe",
688 firstAddress: "PScwtLUyPiGrqtKXrHF37DGETLXLZdw4up",
690 testNetwork(done, params);
692 it('Allows selection
of BlackCoin
', function(done) {
694 selectText: "BLK - BlackCoin",
695 firstAddress: "B5MznAKwj7uQ42vDz3w4onhBXPcqhTwJ9z",
697 testNetwork(done, params);
699 it('Allows selection
of Neblio
', function(done) {
701 selectText: "NEBL - Neblio",
702 firstAddress: "NefkeEEvhusbHMmTRrxx7H9wFnUXd8qQsE",
704 testNetwork(done, params);
706 it('Allows selection
of Beetlecoin
', function(done) {
708 selectText: "BEET - Beetlecoin",
709 firstAddress: "BVmtbEsGrjpknprmpHFq26z4kYHJUFHE71",
711 testNetwork(done, params);
713 it('Allows selection
of Adcoin
', function(done) {
715 selectText: "ACC - Adcoin",
716 firstAddress: "AcEDM6V5sF4kFHC76MJjjfProtS5Sw2qcd",
718 testNetwork(done, params);
720 it('Allows selection
of Asiacoin
', function(done) {
722 selectText: "AC - Asiacoin",
723 firstAddress: "ALupuEEz7kJjQTAvmtcBMBVuEjPa7GqZzE",
725 testNetwork(done, params);
727 it('Allows selection
of Auroracoin
', function(done) {
729 selectText: "AUR - Auroracoin",
730 firstAddress: "ANuraS6F4Jpi413FEnavjYkKYJJRHkgYCm",
732 testNetwork(done, params);
734 it('Allows selection
of Bata
', function(done) {
736 selectText: "BTA - Bata",
737 firstAddress: "BGxBdNeYPtF3GCuTtZBPQdFxCkdBYSF3fj",
739 testNetwork(done, params);
741 it('Allows selection
of Belacoin
', function(done) {
743 selectText: "BELA - Belacoin",
744 firstAddress: "BEeetqpNffdzeknSpNmQp5KAFh2KK1Qx7S",
746 testNetwork(done, params);
748 it('Allows selection
of Bitcoin Atom
', function(done) {
750 selectText: "BCA - Bitcoin Atom",
751 firstAddress: "AMy6qMbJeC4zsGRL6iWszmeCdQH65fgfih",
753 testNetwork(done, params);
755 it('Allows selection
of Bitcoinplus
', function(done) {
757 selectText: "XBC - Bitcoinplus",
758 firstAddress: "B7FSynZoDbEwTCSgsXq9nJ5ue8owYLVL8r",
760 testNetwork(done, params);
762 it('Allows selection
of Bitcoin Private
', function(done) {
764 selectText: "BTCP - Bitcoin Private",
765 firstAddress: "b1M3PbiXXyN6Hdivdw5rJv5VKpLjPzhm4jM",
767 testNetwork(done, params);
769 it('Allows selection
of Bitcoinz
', function(done) {
771 selectText: "BTCZ - Bitcoinz",
772 firstAddress: "t1X2YQoxs8cYRo2oaBYgVEwW5QNjCC59NYc",
774 testNetwork(done, params);
776 it('Allows selection
of BitCloud
', function(done) {
778 selectText: "BTDX - BitCloud",
779 firstAddress: "BHbWitXCNgTf1BhsRDNMP186EeibuzmrBi",
781 testNetwork(done, params);
783 it('Allows selection
of Bitcore
', function(done) {
785 selectText: "BTX - Bitcore",
786 firstAddress: "2Rgp5Znhpy34TK4QmPkfCiYs9r4KovfTH9",
788 testNetwork(done, params);
790 it('Allows selection
of Bitsend
', function(done) {
792 selectText: "BSD - Bitsend",
793 firstAddress: "iBPk7LYjDun3EPk7CRR8UUmnPoceVc1bp2",
795 testNetwork(done, params);
797 it('Allows selection
of Britcoin
', function(done) {
799 selectText: "BRIT - Britcoin",
800 firstAddress: "B6Aue4J2XLs1f1dtD4H1SHYFfh4XrmEbrw",
802 testNetwork(done, params);
804 it('Allows selection
of Canadaecoin
', function(done) {
806 selectText: "CDN - Canadaecoin",
807 firstAddress: "CanAyCfd5Rj2CQVfaoAmvDUZunPM5W1AEQ",
809 testNetwork(done, params);
811 it('Allows selection
of Cannacoin
', function(done) {
813 selectText: "CCN - Cannacoin",
814 firstAddress: "CYjW8xWB43g6krLJTmmrPk1PonoQX7h9Qd",
816 testNetwork(done, params);
818 it('Allows selection
of Clubcoin
', function(done) {
820 selectText: "CLUB - Clubcoin",
821 firstAddress: "CHMDEXN4sihpSVX4GyAa2hZ62shnby7uyN",
823 testNetwork(done, params);
825 it('Allows selection
of Compcoin
', function(done) {
827 selectText: "CMP - Compcoin",
828 firstAddress: "CLshtw3zhxkseBJS46UF12v3AFy9Dx7JVv",
830 testNetwork(done, params);
832 it('Allows selection
of Crave
', function(done) {
834 selectText: "CRAVE - Crave",
835 firstAddress: "VCYJeti6uKMNBFKCL7eP96UwuFWYHM7c85",
837 testNetwork(done, params);
839 it('Allows selection
of Defcoin
', function(done) {
841 selectText: "DFC - Defcoin",
842 firstAddress: "D8swcgyaaFUrXZU3ATwbgy16buCpWqbG1M",
844 testNetwork(done, params);
846 it('Allows selection
of Diamond
', function(done) {
848 selectText: "DMD - Diamond",
849 firstAddress: "dJnrVbLL9UPjdaVRz2C8VpqHZknqAqjLek",
851 testNetwork(done, params);
853 it('Allows selection
of Digibyte
', function(done) {
855 selectText: "DGB - Digibyte",
856 firstAddress: "D85Rp9jwLtMdmP6wGjTiqHBdVQLST3YCEq",
858 testNetwork(done, params);
860 it('Allows selection
of Digitalcoin
', function(done) {
862 selectText: "DGC - Digitalcoin",
863 firstAddress: "DKw4UGKEAZWweDNEbBFNQx4EM8x1mpUdia",
865 testNetwork(done, params);
867 it('Allows selection
of Ecoin
', function(done) {
869 selectText: "ECN - Ecoin",
870 firstAddress: "e6WFPLG5gcXyF7cESFteH1hE2XSmowW5yB",
872 testNetwork(done, params);
874 it('Allows selection
of Edrcoin
', function(done) {
876 selectText: "EDRC - Edrcoin",
877 firstAddress: "eh1nUJsvgKPFv6ebMBfcwJ299GMCpjeZUG",
879 testNetwork(done, params);
881 it('Allows selection
of Egulden
', function(done) {
883 selectText: "EFL - Egulden",
884 firstAddress: "Lg66yt55R7edRM58cDhKzXik2kFme3viX7",
886 testNetwork(done, params);
888 it('Allows selection
of Einsteinium
', function(done) {
890 selectText: "EMC2 - Einsteinium",
891 firstAddress: "EVAABm9hXKHk2MpVMbwNakRubFnNha5m8m",
893 testNetwork(done, params);
895 it('Allows selection
of EOSIO
', function(done) {
897 selectText: "EOS - EOSIO",
898 firstPubKey: "EOS692VJTBK3Rmw93onNnpnZ8ZtmE9PdxjDStArvbyzoe11QUTNoy",
900 testNetwork(done, params, true);
902 it('Allows selection
of Europecoin
', function(done) {
904 selectText: "ERC - Europecoin",
905 firstAddress: "ESA2YwPYntAoaPrE8Fm5qkKRtkcwLcwD6R",
907 testNetwork(done, params);
909 it('Allows selection
of Exclusivecoin
', function(done) {
911 selectText: "EXCL - Exclusivecoin",
912 firstAddress: "EbUa6m8UZW6nTxsYZD2FsDjkadKbp5M6JT",
914 testNetwork(done, params);
916 it('Allows selection
of Feathercoin
', function(done) {
918 selectText: "FTC - Feathercoin",
919 firstAddress: "6gDdjAMoSgQaW8UhqK3oboHs6ftGAroKkM",
921 testNetwork(done, params);
923 it('Allows selection
of Firstcoin
', function(done) {
925 selectText: "FRST - Firstcoin",
926 firstAddress: "FJN9GzfMm7Q8R4DJwK1H9F6A1GTghvFiMJ",
928 testNetwork(done, params);
930 it('Allows selection
of Flashcoin
', function(done) {
932 selectText: "FLASH - Flashcoin",
933 firstAddress: "UWfpf5LfMmLxZYooEb2EyvWhZ8NG7EZDRt",
935 testNetwork(done, params);
937 it('Allows selection
of GCRCoin
', function(done) {
939 selectText: "GCR - GCRCoin",
940 firstAddress: "GJjF5cLwyXLacpuvXAVksxGxKvHDjx58d6",
942 testNetwork(done, params);
944 it('Allows selection
of Gobyte
', function(done) {
946 selectText: "GBX - Gobyte",
947 firstAddress: "GS813Ys2brkmvSUw1rUqGPm2HqQVDHJRyA",
949 testNetwork(done, params);
951 it('Allows selection
of Gridcoin
', function(done) {
953 selectText: "GRC - Gridcoin",
954 firstAddress: "SGrWbBPvobgqKRF8td1Kdc9vbRY7MJ78Y9",
956 testNetwork(done, params);
958 it('Allows selection
of Gulden
', function(done) {
960 selectText: "NLG - Gulden",
961 firstAddress: "GcDP7cNEc33MPPdTFNJ8pZc6VMZJ2CbKxY",
963 testNetwork(done, params);
965 it('Allows selection
of Helleniccoin
', function(done) {
967 selectText: "HNC - Helleniccoin",
968 firstAddress: "LbHEKe5H72zp9G1fuWNiiNePTUfJb88915",
970 testNetwork(done, params);
972 it('Allows selection
of Hempcoin
', function(done) {
974 selectText: "THC - Hempcoin",
975 firstAddress: "H8sdWbZyJV4gyXyHtLXDaNnAuUDhK5mfTV",
977 testNetwork(done, params);
979 it('Allows selection
of Insane
', function(done) {
981 selectText: "INSN - Insane",
982 firstAddress: "iMPqEJMiXWuxC9U2NVinCCMr4t72h58EWx",
984 testNetwork(done, params);
986 it('Allows selection
of Iop
', function(done) {
988 selectText: "IOP - Iop",
989 firstAddress: "pGKQmcaPf95Ur5o6oHK4qdiZ52p1yaTvq1",
991 testNetwork(done, params);
993 it('Allows selection
of Ixcoin
', function(done) {
995 selectText: "IXC - Ixcoin",
996 firstAddress: "xgE9bTZ6YypT3E6ByzkTt31Hq68E9BqywH",
998 testNetwork(done, params);
1000 it('Allows selection
of Kobocoin
', function(done) {
1002 selectText: "KOBO - Kobocoin",
1003 firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy",
1005 testNetwork(done, params);
1007 it('Allows selection
of Landcoin
', function(done) {
1009 selectText: "LDCN - Landcoin",
1010 firstAddress: "LLvLwNjG1aJcn1RS4W4GJUbv8fNaRATG7c",
1012 testNetwork(done, params);
1014 it('Allows selection
of Library Credits
', function(done) {
1016 selectText: "LBC - Library Credits",
1017 firstAddress: "bQJEQrHDJyHdqycB32uysh1SWn8Ln8LMdg",
1019 testNetwork(done, params);
1021 it('Allows selection
of Linx
', function(done) {
1023 selectText: "LINX - Linx",
1024 firstAddress: "XGWQ3cb3LGUB3VnHmj6xYSMgnokNbf6dyk",
1026 testNetwork(done, params);
1028 it('Allows selection
of Litecoincash
', function(done) {
1030 selectText: "LCC - Litecoincash",
1031 firstAddress: "Ce5n7fjUuQPLutJ4W5nCCfQLKdKLE1mv9A",
1033 testNetwork(done, params);
1035 it('Allows selection
of Lynx
', function(done) {
1037 selectText: "LYNX - Lynx",
1038 firstAddress: "KUeY3ZdZkg96p4W98pj1JjygCFU1XqWdw3",
1040 testNetwork(done, params);
1042 it('Allows selection
of Megacoin
', function(done) {
1044 selectText: "MEC - Megacoin",
1045 firstAddress: "MDfAj9CzkC1HpcUiVGnHp8yKTa7WXgu8AY",
1047 testNetwork(done, params);
1049 it('Allows selection
of Minexcoin
', function(done) {
1051 selectText: "MNX - Minexcoin",
1052 firstAddress: "XC1VnyJVfiMDwWgFtAHDp41cgY3AHk3dJT",
1054 testNetwork(done, params);
1056 it('Allows selection
of Navcoin
', function(done) {
1058 selectText: "NAV - Navcoin",
1059 firstAddress: "NTQVTPK3NWSQLKoffkiQw99T8PifkF1Y2U",
1061 testNetwork(done, params);
1063 it('Allows selection
of Nebulas
', function(done) {
1065 selectText: "NAS - Nebulas",
1066 firstAddress: "n1PbK61DGBfDoDusLw621G6sVSMfLLHdfnm",
1068 testNetwork(done, params);
1070 it('Allows selection
of Neoscoin
', function(done) {
1072 selectText: "NEOS - Neoscoin",
1073 firstAddress: "NgATz6QbQNXvayHQ4CpZayugb9HeaPDdby",
1075 testNetwork(done, params);
1077 it('Allows selection
of Nix
', function(done) {
1079 selectText: "NIX - NIX Platform",
1080 firstAddress: "GgcNW2SQQXB4LWHRQTHKkQF3GzXNSLqS8u",
1082 testNetwork(done, params);
1084 it('Allows selection
of Neurocoin
', function(done) {
1086 selectText: "NRO - Neurocoin",
1087 firstAddress: "NVdYErQ3mFpDuF5DquW9WMiT7sLc8ufFTn",
1089 testNetwork(done, params);
1091 it('Allows selection
of Newyorkc
', function(done) {
1093 selectText: "NYC - Newyorkc",
1094 firstAddress: "RSVMfyH1fKfy3puADJEhut2vfkRyon6imm",
1096 testNetwork(done, params);
1098 it('Allows selection
of Novacoin
', function(done) {
1100 selectText: "NVC - Novacoin",
1101 firstAddress: "4JRvUmxcKCJmaMXZyvRoSS1cmG2XvnZfHN",
1103 testNetwork(done, params);
1105 it('Allows selection
of Nushares
', function(done) {
1107 selectText: "NSR - Nushares",
1108 firstAddress: "SecjXzU3c7EecdT7EbC4vvmbdtBBokWh6J",
1110 testNetwork(done, params);
1112 it('Allows selection
of Okcash
', function(done) {
1114 selectText: "OK - Okcash",
1115 firstAddress: "PV4Qp1TUYuGv4TqVtLZtqvrsWWRycfx1Yi",
1117 testNetwork(done, params);
1119 it('Allows selection
of Omnicore
', function(done) {
1121 selectText: "OMNI - Omnicore",
1122 firstAddress: "1Q1t3gonjCT3rW38TsTsCvgSc3hh7zBGbi",
1124 testNetwork(done, params);
1126 it('Allows selection
of DeepOnion
', function(done) {
1128 selectText: "ONION - DeepOnion",
1129 firstAddress: "DYREY7XCFXVqJ3x5UuN43k2JwD2s1kif48",
1131 testNetwork(done, params);
1133 it('Allows selection
of Pesobit
', function(done) {
1135 selectText: "PSB - Pesobit",
1136 firstAddress: "PDePsF7ALyXP7JaywokdYiRTDtKa14MAr1",
1138 testNetwork(done, params);
1140 it('Allows selection
of Pinkcoin
', function(done) {
1142 selectText: "PINK - Pinkcoin",
1143 firstAddress: "2TgjYQffjbzUHJghNaVbdsjHbRwruC3yzC",
1145 testNetwork(done, params);
1147 it('Allows selection
of POSWcoin
', function(done) {
1149 selectText: "POSW - POSWcoin",
1150 firstAddress: "PNxewmZoPnGBvoEbH6hgQZCK1igDiBCdgC",
1152 testNetwork(done, params);
1154 it('Allows selection
of Potcoin
', function(done) {
1156 selectText: "POT - Potcoin",
1157 firstAddress: "PEo7Vg2ctXgpP4vuLPeY9aGJtZotyrmiHc",
1159 testNetwork(done, params);
1161 it('Allows selection
of Putincoin
', function(done) {
1163 selectText: "PUT - Putincoin",
1164 firstAddress: "PViWnfr2uFtovd6e7joM49C94CsGSnqJis",
1166 testNetwork(done, params);
1168 it('Allows selection
of Ravencoin
', function(done) {
1170 selectText: "RVN - Ravencoin",
1171 firstAddress: "RBuDoVNnzvFsEcX8XKPm8ic4mgiCzjUCNk",
1173 testNetwork(done, params);
1175 it('Allows selection
of Reddcoin
', function(done) {
1177 selectText: "RDD - Reddcoin",
1178 firstAddress: "RtgRvXMBng1y51ftteveFqwNfyRG18HpxQ",
1180 testNetwork(done, params);
1182 it('Allows selection
of RevolutionVR
', function(done) {
1184 selectText: "RVR - RevolutionVR",
1185 firstAddress: "VXeeoP2jkzZnMFxtc66ZBZK1NHN5QJnnjL",
1187 testNetwork(done, params);
1189 it('Allows selection
of Rubycoin
', function(done) {
1191 selectText: "RBY - Rubycoin",
1192 firstAddress: "RV76JDtjTs11JdMDRToYn6CHecMRPLnKS6",
1194 testNetwork(done, params);
1196 it('Allows selection
of Salus
', function(done) {
1198 selectText: "SLS - Salus",
1199 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
1201 testNetwork(done, params);
1203 it('Allows selection
of Smileycoin
', function(done) {
1205 selectText: "SMLY - Smileycoin",
1206 firstAddress: "BEZVnEBCAyFByrgKpwAgYgtvP4rKAd9Sj2",
1208 testNetwork(done, params);
1210 it('Allows selection
of Solarcoin
', function(done) {
1212 selectText: "SLR - Solarcoin",
1213 firstAddress: "8LZ13HbnjtaMJWSvvVFNTLf71zFfDrhwLu",
1215 testNetwork(done, params);
1217 it('Allows selection
of stash
', function(done) {
1219 selectText: "STASH - Stash",
1220 firstAddress: "XxwAsWB7REDKmAvHA85SbEZQQtpxeUDxS3",
1222 testNetwork(done, params);
1224 it('Allows selection
of stash testnet
', function(done) {
1226 selectText: "STASH - Stash Testnet",
1227 firstAddress: "yWQCTSkUst7ddYuebKsqa1kSoXEjpCkGKR",
1229 testNetwork(done, params);
1231 it('Allows selection
of Stratis
', function(done) {
1233 selectText: "STRAT - Stratis",
1234 firstAddress: "ScfJnq3QDhKgDMEds6sqUE1ot6ShfhmXXq",
1236 testNetwork(done, params);
1238 it('Allows selection
of Stratis Test
', function(done) {
1240 selectText: "TSTRAT - Stratis Testnet",
1241 firstAddress: "TRLWm3dye4FRrDWouwYUSUZP96xb76mBE3",
1243 testNetwork(done, params);
1245 it('Allows selection
of Syscoin
', function(done) {
1247 selectText: "SYS - Syscoin",
1248 firstAddress: "SZwJi42Pst3VAMomyK5DG4157WM5ofRmSj",
1250 testNetwork(done, params);
1252 it('Allows selection
of Toa
', function(done) {
1254 selectText: "TOA - Toa",
1255 firstAddress: "TSe1QAnUwQzUfbBusDzRJ9URttrRGKoNKF",
1257 testNetwork(done, params);
1259 it('Allows selection
of TWINS
', function(done) {
1261 selectText: "TWINS - TWINS",
1262 firstAddress: "WPpJnfLLubNmF7HLNxg8d8zH5haxn4wri8",
1264 testNetwork(done, params);
1266 it('Allows selection
of TWINS testnet
', function(done) {
1268 selectText: "TWINS - TWINS Testnet",
1269 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
1271 testNetwork(done, params);
1273 it('Allows selection
of Ultimatesecurecash
', function(done) {
1275 selectText: "USC - Ultimatesecurecash",
1276 firstAddress: "UPyLAZU2Che5fiy7Ed8xVJFmXAUhitA4ug",
1278 testNetwork(done, params);
1280 it('Allows selection
of Unobtanium
', function(done) {
1282 selectText: "UNO - Unobtanium",
1283 firstAddress: "uUBMPVMXrR6qhqornJqKTWgr8L69vihSL9",
1285 testNetwork(done, params);
1287 it('Allows selection
of Vcash
', function(done) {
1289 selectText: "XVC - Vcash",
1290 firstAddress: "VuL53MSY6KjvAjKSeRkh3NDnKykacDVeps",
1292 testNetwork(done, params);
1294 it('Allows selection
of Verge
', function(done) {
1296 selectText: "XVG - Verge",
1297 firstAddress: "DCrVuGkMjLJpTGgwAgv9AcMdeb1nkWbjZA",
1299 testNetwork(done, params);
1301 it('Allows selection
of Vertcoin
', function(done) {
1303 selectText: "VTC - Vertcoin",
1304 firstAddress: "Vf6koGuiWdXQfx8tNqxoNeEDxh4xh5cxsG",
1306 testNetwork(done, params);
1308 it('Allows selection
of Vivo
', function(done) {
1310 selectText: "VIVO - Vivo",
1311 firstAddress: "VFmBwuXXGhJe7MarQG2GfzHMFebRHgfSpB",
1313 testNetwork(done, params);
1315 it('Allows selection
of Vpncoin
', function(done) {
1317 selectText: "VASH - Vpncoin",
1318 firstAddress: "VoEmH1qXC4TsSgBAStR21QYetwnFqbqCx9",
1320 testNetwork(done, params);
1322 it('Allows selection
of Whitecoin
', function(done) {
1324 selectText: "XWC - Whitecoin",
1325 firstAddress: "WcSwCAUqrSgeSYbsaS3SSWWhsx8KRYTFDR",
1327 testNetwork(done, params);
1329 it('Allows selection
of Wincoin
', function(done) {
1331 selectText: "WC - Wincoin",
1332 firstAddress: "WaDVCESMGgyKgNESdn3u43NnwmGSkZED3Z",
1334 testNetwork(done, params);
1336 it('Allows selection
of Zcoin
', function(done) {
1338 selectText: "XZC - Zcoin",
1339 firstAddress: "a6VcMdP4XgAA9Tr7xNszmPG5FZpfRf17Cq",
1341 testNetwork(done, params);
1343 it('Allows selection
of Zcash
', function(done) {
1345 selectText: "ZEC - Zcash",
1346 firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9",
1348 testNetwork(done, params);
1350 it('Allows selection
of Zclassic
', function(done) {
1352 selectText: "ZCL - Zclassic",
1353 firstAddress: "t1TBMxTvVJRybUbMLGWq8H4A8F4VUL7czEc",
1355 testNetwork(done, params);
1357 it('Allows selection
of Zencash
', function(done) {
1359 selectText: "ZEN - Zencash",
1360 firstAddress: "znWh9XASyW2dZq5tck84wFjiwuqVysi7q3p",
1362 testNetwork(done, params);
1364 it('Allows selection
of Energi
', function(done) {
1366 selectText: "NRG - Energi",
1367 firstAddress: "EejRy4t4nidzhGGzkJUgFP3z4HYBjhTsRt",
1369 testNetwork(done, params);
1371 it('Allows selection
of Ethereum Classic
', function(done) {
1373 selectText: "ETC - Ethereum Classic",
1374 firstAddress: "0x3c05e5556693808367afB62eF3b63e35d6eD249A",
1376 testNetwork(done, params);
1378 it('Allows selection
of Pirl
', function(done) {
1380 selectText: "PIRL - Pirl",
1381 firstAddress: "0xe77FC0723dA122B5025CA79193c28563eB47e776",
1383 testNetwork(done, params);
1385 it('Allows selection
of MIX
', function(done) {
1387 selectText: "MIX - MIX",
1388 firstAddress: "0x98BC5e63aeb6A4e82d72850d20710F07E29A29F1",
1390 testNetwork(done, params);
1392 it('Allows selection
of Musicoin
', function(done) {
1394 selectText: "MUSIC - Musicoin",
1395 firstAddress: "0xDc060e4A0b0313ea83Cf6B3A39B9db2D29004897",
1397 testNetwork(done, params);
1399 it('Allows selection
of Poa
', function(done) {
1401 selectText: "POA - Poa",
1402 firstAddress: "0x53aF28d754e106210C3d0467Dd581eaf7e3C5e60",
1404 testNetwork(done, params);
1406 it('Allows selection
of Expanse
', function(done) {
1408 selectText: "EXP - Expanse",
1409 firstAddress: "0xf57FeAbf26582b6E3E666559d3B1Cc6fB2b2c5F6",
1411 testNetwork(done, params);
1413 it('Allows selection
of Callisto
', function(done) {
1415 selectText: "CLO - Callisto",
1416 firstAddress: "0x4f9364F7420B317266C51Dc8eB979717D4dE3f4E",
1418 testNetwork(done, params);
1420 it('Allows selection
of HUSH
', function(done) {
1422 selectText: "HUSH - Hush",
1423 firstAddress: "t1g6rLXUnJaiJuu4q4zmJjoa9Gk4fwKpiuA",
1425 testNetwork(done, params);
1427 it('Allows selection
of ExchangeCoin
', function(done) {
1429 selectText: "EXCC - ExchangeCoin",
1430 firstAddress: "22txYKpFN5fwGwdSs2UBf7ywewbLM92YqK7E",
1432 testNetwork(done, params);
1434 it('Allows selection
of Artax
', function(done) {
1436 selectText: "XAX - Artax",
1437 firstAddress: "AYxaQPY7XLidG31V7F3yNzwxPYpYzRqG4q",
1439 testNetwork(done, params);
1441 it('Allows selection
of BitcoinGreen
', function(done) {
1443 selectText: "BITG - Bitcoin Green",
1444 firstAddress: "GeNGm9SkEfwbsws3UrrUSE2sJeyWYjzraY",
1446 testNetwork(done, params);
1448 it('Allows selection
of ANON
', function(done) {
1450 selectText: "ANON - ANON",
1451 firstAddress: "AnU6pijpEeUZFWSTyM2qTqZQn996Zq1Xard",
1453 testNetwork(done, params);
1455 it('Allows selection
of ProjectCoin
', function(done) {
1457 selectText: "PRJ - ProjectCoin",
1458 firstAddress: "PXZG97saRseSCftfe1mcFmfAA7pf6qBbaz",
1460 testNetwork(done, params);
1462 it('Allows selection
of Phore
', function(done) {
1464 selectText: "PHR - Phore",
1465 firstAddress: "PJThxpoXAG6hqrmdeQQbVDX4TJtFTMMymC",
1467 testNetwork(done, params);
1469 it('Allows selection
of Safecoin
', function(done) {
1471 selectText: "SAFE - Safecoin",
1472 firstAddress: "RtxHpnhJz6RY8k9owP3ua5QWraunmewB1G",
1474 testNetwork(done, params);
1476 it('Allows selection
of Blocknode
', function(done) {
1478 selectText: "BND - Blocknode",
1479 firstAddress: "BG8xZSAur2jYLG9VXt8dYfkKxxeR7w9bSe",
1481 testNetwork(done, params);
1483 it('Allows selection
of Blocknode Testnet
', function(done) {
1485 selectText: "tBND - Blocknode Testnet",
1486 firstAddress: "bSptsFyDktFSKpWveRywJsDoJA2TC6qfHv",
1488 testNetwork(done, params);
1490 it('Allows selection
of LitecoinZ
', function(done) {
1492 selectText: "LTZ - LitecoinZ",
1493 firstAddress: "L1VTXju7hLgKV4T7fGXS9sKsnm2gmtRCmyw",
1495 testNetwork(done, params);
1497 it('Allows selection
of BlockStamp
', function(done) {
1499 selectText: "BST - BlockStamp",
1500 firstAddress: "15gypKtim4cVTj137ApfryG17RkvSbPazZ",
1502 testNetwork(done, params);
1504 it('Allows selection
of DEXON
', function(done) {
1506 selectText: "DXN - DEXON",
1507 firstAddress: "0x136a58788033E028CCd740FbDec6734358DB56Ec",
1509 testNetwork(done, params);
1511 it('Allows selection
of Ellaism
', function(done) {
1513 selectText: "ELLA - Ellaism",
1514 firstAddress: "0xa8B0BeA09eeBc41062308546a01d6E544277e2Ca",
1516 testNetwork(done, params);
1518 it('Allows selection
of Ethersocial Network
', function(done) {
1520 selectText: "ESN - Ethersocial Network",
1521 firstAddress: "0x6EE99Be2A0C7F887a71e21C8608ACF0aa0D2b767",
1523 testNetwork(done, params);
1525 it('Allows selection
of Stellar
', function(done) {
1527 selectText: "XLM - Stellar",
1528 firstAddress: "GCUK3NYYUXA2QGN6KU5RR36WAKN3Y5EANZV65XNAWN4XM4CHQ3G4DMO2",
1530 testNetwork(done, params);
1533 // BIP39 seed is set from phrase
1534 it('Sets the bip39 seed
from the prhase
', function(done) {
1535 driver.findElement(By.css('.phrase
'))
1536 .sendKeys('abandon abandon ability
');
1537 driver.sleep(generateDelay).then(function() {
1538 driver.findElement(By.css('.seed
'))
1539 .getAttribute("value")
1540 .then(function(seed) {
1541 expect(seed).toBe("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3");
1547 // BIP32 root key is set from phrase
1548 it('Sets the bip39 root key
from the prhase
', function(done) {
1549 driver.findElement(By.css('.phrase
'))
1550 .sendKeys('abandon abandon ability
');
1551 driver.sleep(generateDelay).then(function() {
1552 driver.findElement(By.css('.root
-key
'))
1553 .getAttribute("value")
1554 .then(function(seed) {
1555 expect(seed).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
1561 // Tabs show correct addresses when changed
1562 it('Shows the correct address when tab is changed
', function(done) {
1563 driver.findElement(By.css('.phrase
'))
1564 .sendKeys('abandon abandon ability
');
1565 driver.sleep(generateDelay).then(function() {
1566 driver.findElement(By.css('#bip32
-tab a
'))
1568 driver.sleep(generateDelay).then(function() {
1569 getFirstAddress(function(address) {
1570 expect(address).toBe("17uQ7s2izWPwBmEVFikTmZUjbBKWYdJchz");
1577 // BIP44 derivation path is shown
1578 it('Shows the derivation path
for bip44 tab
', function(done) {
1579 driver.findElement(By.css('.phrase
'))
1580 .sendKeys('abandon abandon ability
');
1581 driver.sleep(generateDelay).then(function() {
1582 driver.findElement(By.css('#bip44
.path
'))
1583 .getAttribute("value")
1584 .then(function(path) {
1585 expect(path).toBe("m/44'/0'/0'/0");
1591 // BIP44 extended private key is shown
1592 it('Shows the extended private key for bip44 tab', function(done) {
1593 driver.findElement(By.css('.phrase'))
1594 .sendKeys('abandon abandon ability');
1595 driver.sleep(generateDelay).then(function() {
1596 driver.findElement(By.css('.extended-priv-key'))
1597 .getAttribute("value
")
1598 .then(function(path) {
1599 expect(path).toBe("xprvA2DxxvPZcyRvYgZMGS53nadR32mVDeCyqQYyFhrCVbJNjPoxMeVf7QT5g7mQASbTf9Kp4cryvcXnu2qurjWKcrdsr91jXymdCDNxKgLFKJG
");
1605 // BIP44 extended public key is shown
1606 it('Shows the extended public key for bip44 tab', function(done) {
1607 driver.findElement(By.css('.phrase'))
1608 .sendKeys('abandon abandon ability');
1609 driver.sleep(generateDelay).then(function() {
1610 driver.findElement(By.css('.extended-pub-key'))
1611 .getAttribute("value
")
1612 .then(function(path) {
1613 expect(path).toBe("xpub6FDKNRvTTLzDmAdpNTc49ia9b4byd6vqCdUa46Fp3vqMcC96uBoufCmZXQLiN5AK3iSCJMhf9gT2sxkpyaPepRuA7W3MujV5tGmF5VfbueM
");
1619 // BIP44 account field changes address list
1620 it('Changes the address list if bip44 account is changed', function(done) {
1621 driver.findElement(By.css('#bip44 .account'))
1623 driver.findElement(By.css('.phrase'))
1624 .sendKeys('abandon abandon ability');
1625 driver.sleep(generateDelay).then(function() {
1626 getFirstAddress(function(address) {
1627 expect(address).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H
");
1633 // BIP44 change field changes address list
1634 it('Changes the address list if bip44 change is changed', function(done) {
1635 driver.findElement(By.css('#bip44 .change'))
1637 driver.findElement(By.css('.phrase'))
1638 .sendKeys('abandon abandon ability');
1639 driver.sleep(generateDelay).then(function() {
1640 getFirstAddress(function(address) {
1641 expect(address).toBe("1KAGfWgqfVbSSXY56fNQ7YnhyKuoskHtYo
");
1647 // BIP32 derivation path can be set
1648 it('Can use a custom bip32 derivation path', function(done) {
1649 driver.findElement(By.css('#bip32-tab a'))
1651 driver.findElement(By.css('#bip32 .path'))
1653 driver.findElement(By.css('#bip32 .path'))
1655 driver.findElement(By.css('.phrase'))
1656 .sendKeys('abandon abandon ability');
1657 driver.sleep(generateDelay).then(function() {
1658 getFirstAddress(function(address) {
1659 expect(address).toBe("16pYQQdLD1hH4hwTGLXBaZ9Teboi1AGL8L
");
1665 // BIP32 can use hardened derivation paths
1666 it('Can use a hardened derivation paths', function(done) {
1667 driver.findElement(By.css('#bip32-tab a'))
1669 driver.findElement(By.css('#bip32 .path'))
1671 driver.findElement(By.css('#bip32 .path'))
1673 driver.findElement(By.css('.phrase
'))
1674 .sendKeys('abandon abandon ability
');
1675 driver.sleep(generateDelay).then(function() {
1676 getFirstAddress(function(address) {
1677 expect(address).toBe("14aXZeprXAE3UUKQc4ihvwBvww2LuEoHo4");
1683 // BIP32 extended private key is shown
1684 it('Shows the BIP32 extended
private key
', function(done) {
1685 driver.findElement(By.css('#bip32
-tab a
'))
1687 driver.findElement(By.css('.phrase
'))
1688 .sendKeys('abandon abandon ability
');
1689 driver.sleep(generateDelay).then(function() {
1690 driver.findElement(By.css('.extended
-priv
-key
'))
1691 .getAttribute("value")
1692 .then(function(privKey) {
1693 expect(privKey).toBe("xprv9va99uTVE5aLiutUVLTyfxfe8v8aaXjSQ1XxZbK6SezYVuikA9MnjQVTA8rQHpNA5LKvyQBpLiHbBQiiccKiBDs7eRmBogsvq3THFeLHYbe");
1699 // BIP32 extended public key is shown
1700 it('Shows the BIP32 extended
public key
', function(done) {
1701 driver.findElement(By.css('#bip32
-tab a
'))
1703 driver.findElement(By.css('.phrase
'))
1704 .sendKeys('abandon abandon ability
');
1705 driver.sleep(generateDelay).then(function() {
1706 driver.findElement(By.css('.extended
-pub
-key
'))
1707 .getAttribute("value")
1708 .then(function(pubKey) {
1709 expect(pubKey).toBe("xpub69ZVZQzP4T8dwPxwbMzz36cNgwy4yzTHmETZMyihzzXXNi3thgg3HCow1RtY252wdw5rS8369xKnraN5Q93y3FkFfJp2XEHWUrkyXsjS93P");
1715 // Derivation path is shown in table
1716 it('Shows the derivation path
in the table
', function(done) {
1717 driver.findElement(By.css('.phrase
'))
1718 .sendKeys('abandon abandon ability
');
1719 driver.sleep(generateDelay).then(function() {
1720 getFirstPath(function(path) {
1721 expect(path).toBe("m/44'/0'/0'/0/0");
1727 // Derivation path for address can be hardened
1728 it('Can derive hardened addresses', function(done) {
1729 driver.findElement(By.css('#bip32-tab a'))
1731 driver.executeScript(function() {
1732 $(".hardened
-addresses
").prop("checked
", true);
1734 driver.findElement(By.css('.phrase'))
1735 .sendKeys('abandon abandon ability');
1736 driver.sleep(generateDelay).then(function() {
1737 getFirstAddress(function(address) {
1738 expect(address).toBe("18exLzUv7kfpiXRzmCjFDoC9qwNLFyvwyd
");
1744 // Derivation path visibility can be toggled
1745 it('Can toggle visibility of the derivation path column', function(done) {
1746 driver.findElement(By.css('.phrase'))
1747 .sendKeys('abandon abandon ability');
1748 driver.sleep(generateDelay).then(function() {
1749 driver.findElement(By.css('.index-toggle'))
1751 testColumnValuesAreInvisible(done, "index
");
1756 it('Shows the address in the table', function(done) {
1757 driver.findElement(By.css('.phrase'))
1758 .sendKeys('abandon abandon ability');
1759 driver.sleep(generateDelay).then(function() {
1760 getFirstAddress(function(address) {
1761 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
1767 // Addresses are shown in order of derivation path
1768 it('Shows the address in order of derivation path', function(done) {
1769 driver.findElement(By.css('.phrase'))
1770 .sendKeys('abandon abandon ability');
1771 driver.sleep(generateDelay).then(function() {
1772 testRowsAreInCorrectOrder(done);
1776 // Address visibility can be toggled
1777 it('Can toggle visibility of the address column', function(done) {
1778 driver.findElement(By.css('.phrase'))
1779 .sendKeys('abandon abandon ability');
1780 driver.sleep(generateDelay).then(function() {
1781 driver.findElement(By.css('.address-toggle'))
1783 testColumnValuesAreInvisible(done, "address
");
1787 // Public key is shown in table
1788 it('Shows the public key in the table', function(done) {
1789 driver.findElement(By.css('.phrase'))
1790 .sendKeys('abandon abandon ability');
1791 driver.sleep(generateDelay).then(function() {
1792 driver.findElements(By.css('.pubkey'))
1793 .then(function(els) {
1795 .then(function(pubkey) {
1796 expect(pubkey).toBe("033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3
");
1803 // Public key visibility can be toggled
1804 it('Can toggle visibility of the public key column', function(done) {
1805 driver.findElement(By.css('.phrase'))
1806 .sendKeys('abandon abandon ability');
1807 driver.sleep(generateDelay).then(function() {
1808 driver.findElement(By.css('.public-key-toggle'))
1810 testColumnValuesAreInvisible(done, "pubkey
");
1814 // Private key is shown in table
1815 it('Shows the private key in the table', function(done) {
1816 driver.findElement(By.css('.phrase'))
1817 .sendKeys('abandon abandon ability');
1818 driver.sleep(generateDelay).then(function() {
1819 driver.findElements(By.css('.privkey'))
1820 .then(function(els) {
1822 .then(function(pubkey) {
1823 expect(pubkey).toBe("L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE
");
1830 // Private key visibility can be toggled
1831 it('Can toggle visibility of the private key column', function(done) {
1832 driver.findElement(By.css('.phrase'))
1833 .sendKeys('abandon abandon ability');
1834 driver.sleep(generateDelay).then(function() {
1835 driver.findElement(By.css('.private-key-toggle'))
1837 testColumnValuesAreInvisible(done, "privkey
");
1841 // More addresses can be generated
1842 it('Can generate more rows in the table', function(done) {
1843 driver.findElement(By.css('.phrase'))
1844 .sendKeys('abandon abandon ability');
1845 driver.sleep(generateDelay).then(function() {
1846 driver.findElement(By.css('.more'))
1848 driver.sleep(generateDelay).then(function() {
1849 driver.findElements(By.css('.address'))
1850 .then(function(els) {
1851 expect(els.length).toBe(40);
1858 // A custom number of additional addresses can be generated
1859 it('Can generate more rows in the table', function(done) {
1860 driver.findElement(By.css('.phrase'))
1861 .sendKeys('abandon abandon ability');
1862 driver.sleep(generateDelay).then(function() {
1863 driver.findElement(By.css('.rows-to-add'))
1865 driver.findElement(By.css('.rows-to-add'))
1867 driver.findElement(By.css('.more'))
1869 driver.sleep(generateDelay).then(function() {
1870 driver.findElements(By.css('.address'))
1871 .then(function(els) {
1872 expect(els.length).toBe(21);
1879 // Additional addresses are shown in order of derivation path
1880 it('Shows additional addresses in order of derivation path', function(done) {
1881 driver.findElement(By.css('.phrase'))
1882 .sendKeys('abandon abandon ability');
1883 driver.sleep(generateDelay).then(function() {
1884 driver.findElement(By.css('.more'))
1886 driver.sleep(generateDelay).then(function() {
1887 testRowsAreInCorrectOrder(done);
1892 // BIP32 root key can be set by the user
1893 it('Allows the user to set the BIP32 root key', function(done) {
1894 driver.findElement(By.css('.root-key'))
1895 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
1896 driver.sleep(generateDelay).then(function() {
1897 getFirstAddress(function(address) {
1898 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
");
1904 // Setting BIP32 root key clears the existing phrase, passphrase and seed
1905 // TODO this doesn't work in selenium with chrome
1906 it('Confirms the existing phrase should be cleared', function(done) {
1907 if (browser == "chrome
") {
1908 pending("Selenium
+ Chrome headless bug
for alert
, see
https://stackoverflow.com/q/45242264");
1910 driver
.findElement(By
.css('.phrase'))
1911 .sendKeys('A non-blank but invalid value');
1912 driver
.findElement(By
.css('.root-key'))
1913 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
1914 driver
.switchTo().alert().accept();
1915 driver
.findElement(By
.css('.phrase'))
1916 .getAttribute("value").then(function(value
) {
1917 expect(value
).toBe("");
1922 // Clearing of phrase, passphrase and seed can be cancelled by user
1923 // TODO this doesn't work in selenium with chrome
1924 it('Allows the clearing of the phrase to be cancelled', function(done
) {
1925 if (browser
== "chrome") {
1926 pending("Selenium + Chrome headless bug for alert, see https://stackoverflow.com/q/45242264");
1928 driver
.findElement(By
.css('.phrase'))
1929 .sendKeys('abandon abandon ability');
1930 driver
.sleep(generateDelay
).then(function() {
1931 driver
.findElement(By
.css('.root-key'))
1933 driver
.findElement(By
.css('.root-key'))
1935 driver
.switchTo().alert().dismiss();
1936 driver
.findElement(By
.css('.phrase'))
1937 .getAttribute("value").then(function(value
) {
1938 expect(value
).toBe("abandon abandon ability");
1944 // Custom BIP32 root key is used when changing the derivation path
1945 it('Can set derivation path for root key instead of phrase', function(done
) {
1946 driver
.findElement(By
.css('#bip44 .account'))
1948 driver
.findElement(By
.css('.root-key'))
1949 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
1950 driver
.sleep(generateDelay
).then(function() {
1951 getFirstAddress(function(address
) {
1952 expect(address
).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H");
1958 // Incorrect mnemonic shows error
1959 it('Shows an error for incorrect mnemonic', function(done
) {
1960 driver
.findElement(By
.css('.phrase'))
1961 .sendKeys('abandon abandon abandon');
1962 driver
.sleep(feedbackDelay
).then(function() {
1963 driver
.findElement(By
.css('.feedback'))
1965 .then(function(feedback
) {
1966 expect(feedback
).toBe("Invalid mnemonic");
1972 // Incorrect word shows suggested replacement
1973 it('Shows word suggestion for incorrect word', function(done
) {
1974 driver
.findElement(By
.css('.phrase'))
1975 .sendKeys('abandon abandon abiliti');
1976 driver
.sleep(feedbackDelay
).then(function() {
1977 driver
.findElement(By
.css('.feedback'))
1979 .then(function(feedback
) {
1980 var msg
= "abiliti not in wordlist, did you mean ability?";
1981 expect(feedback
).toBe(msg
);
1987 // Github pull request 48
1988 // First four letters of word shows that word, not closest
1989 // since first four letters gives unique word in BIP39 wordlist
1990 // eg ille should show illegal, not idle
1991 it('Shows word suggestion based on first four chars', function(done
) {
1992 driver
.findElement(By
.css('.phrase'))
1994 driver
.sleep(feedbackDelay
).then(function() {
1995 driver
.findElement(By
.css('.feedback'))
1997 .then(function(feedback
) {
1998 var msg
= "ille not in wordlist, did you mean illegal?";
1999 expect(feedback
).toBe(msg
);
2005 // Incorrect BIP32 root key shows error
2006 it('Shows error for incorrect root key', function(done
) {
2007 driver
.findElement(By
.css('.root-key'))
2008 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpj');
2009 driver
.sleep(feedbackDelay
).then(function() {
2010 driver
.findElement(By
.css('.feedback'))
2012 .then(function(feedback
) {
2013 var msg
= "Invalid root key";
2014 expect(feedback
).toBe(msg
);
2020 // Derivation path not starting with m shows error
2021 it('Shows error for derivation path not starting with m', function(done
) {
2022 driver
.findElement(By
.css('#bip32-tab a'))
2024 driver
.findElement(By
.css('#bip32 .path'))
2026 driver
.findElement(By
.css('#bip32 .path'))
2028 driver
.findElement(By
.css('.phrase'))
2029 .sendKeys('abandon abandon ability');
2030 driver
.sleep(feedbackDelay
).then(function() {
2031 driver
.findElement(By
.css('.feedback'))
2033 .then(function(feedback
) {
2034 var msg
= "First character must be 'm'";
2035 expect(feedback
).toBe(msg
);
2041 // Derivation path containing invalid characters shows useful error
2042 it('Shows error for derivation path not starting with m', function(done
) {
2043 driver
.findElement(By
.css('#bip32-tab a'))
2045 driver
.findElement(By
.css('#bip32 .path'))
2047 driver
.findElement(By
.css('#bip32 .path'))
2048 .sendKeys('m/1/0wrong1/1');
2049 driver
.findElement(By
.css('.phrase'))
2050 .sendKeys('abandon abandon ability');
2051 driver
.sleep(feedbackDelay
).then(function() {
2052 driver
.findElement(By
.css('.feedback'))
2054 .then(function(feedback
) {
2055 var msg
= "Invalid characters 0wrong1 found at depth 2";
2056 expect(feedback
).toBe(msg
);
2062 // Github Issue 11: Default word length is 15
2063 // https://github.com/iancoleman/bip39/issues/11
2064 it('Sets the default word length to 15', function(done
) {
2065 driver
.findElement(By
.css('.strength'))
2066 .getAttribute("value")
2067 .then(function(strength
) {
2068 expect(strength
).toBe("15");
2073 // Github Issue 12: Generate more rows with private keys hidden
2074 // https://github.com/iancoleman/bip39/issues/12
2075 it('Sets the correct hidden column state on new rows', function(done
) {
2076 driver
.findElement(By
.css('.phrase'))
2077 .sendKeys("abandon abandon ability");
2078 driver
.sleep(generateDelay
).then(function() {
2079 driver
.findElement(By
.css('.private-key-toggle'))
2081 driver
.findElement(By
.css('.more'))
2083 driver
.sleep(generateDelay
).then(function() {
2084 driver
.findElements(By
.css('.privkey'))
2085 .then(function(els
) {
2086 expect(els
.length
).toBe(40);
2088 testColumnValuesAreInvisible(done
, "privkey");
2093 // Github Issue 19: Mnemonic is not sensitive to whitespace
2094 // https://github.com/iancoleman/bip39/issues/19
2095 it('Ignores excess whitespace in the mnemonic', function(done
) {
2096 var doublespace
= " ";
2097 var mnemonic
= "urge cat" + doublespace
+ "bid";
2098 driver
.findElement(By
.css('.phrase'))
2099 .sendKeys(mnemonic
);
2100 driver
.sleep(generateDelay
).then(function() {
2101 driver
.findElement(By
.css('.root-key'))
2102 .getAttribute("value")
2103 .then(function(seed
) {
2104 expect(seed
).toBe("xprv9s21ZrQH143K3isaZsWbKVoTtbvd34Y1ZGRugGdMeBGbM3AgBVzTH159mj1cbbtYSJtQr65w6L5xy5L9SFC7c9VJZWHxgAzpj4mun5LhrbC");
2110 // Github Issue 23: Part 1: Use correct derivation path when changing tabs
2111 // https://github.com/iancoleman/bip39/issues/23
2112 it('Uses the correct derivation path when changing tabs', function(done
) {
2113 // 1) and 2) set the phrase
2114 driver
.findElement(By
.css('.phrase'))
2115 .sendKeys("abandon abandon ability");
2116 driver
.sleep(generateDelay
).then(function() {
2117 // 3) select bip32 tab
2118 driver
.findElement(By
.css('#bip32-tab a'))
2120 driver
.sleep(generateDelay
).then(function() {
2121 // 4) switch from bitcoin to litecoin
2122 selectNetwork("LTC - Litecoin");
2123 driver
.sleep(generateDelay
).then(function() {
2124 // 5) Check address is displayed correctly
2125 getFirstAddress(function(address
) {
2126 expect(address
).toBe("LS8MP5LZ5AdzSZveRrjm3aYVoPgnfFh5T5");
2127 // 5) Check derivation path is displayed correctly
2128 getFirstPath(function(path
) {
2129 expect(path
).toBe("m/0/0");
2138 // Github Issue 23 Part 2: Coin selection in derivation path
2139 // https://github.com/iancoleman/bip39/issues/23#issuecomment-238011920
2140 it('Uses the correct derivation path when changing coins', function(done
) {
2142 driver
.findElement(By
.css('.phrase'))
2143 .sendKeys("abandon abandon ability");
2144 driver
.sleep(generateDelay
).then(function() {
2145 // switch from bitcoin to clam
2146 selectNetwork("CLAM - Clams");
2147 driver
.sleep(generateDelay
).then(function() {
2148 // check derivation path is displayed correctly
2149 getFirstPath(function(path
) {
2150 expect(path
).toBe("m/44'/23'/0'/0/0");
2157 // Github Issue 26: When using a Root key derrived altcoins are incorrect
2158 // https://github.com/iancoleman/bip39/issues/26
2159 it('Uses the correct derivation for altcoins with root keys', function(done
) {
2160 // 1) 2) and 3) set the root key
2161 driver
.findElement(By
.css('.root-key'))
2162 .sendKeys("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
2163 driver
.sleep(generateDelay
).then(function() {
2164 // 4) switch from bitcoin to viacoin
2165 selectNetwork("VIA - Viacoin");
2166 driver
.sleep(generateDelay
).then(function() {
2167 // 5) ensure the derived address is correct
2168 getFirstAddress(function(address
) {
2169 expect(address
).toBe("Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT");
2176 // Selecting a language with no existing phrase should generate a phrase in
2178 it('Generate a random phrase when language is selected and no current phrase', function(done
) {
2179 driver
.findElement(By
.css("a[href='#japanese']"))
2181 driver
.sleep(generateDelay
).then(function() {
2182 driver
.findElement(By
.css(".phrase"))
2183 .getAttribute("value").then(function(phrase
) {
2184 expect(phrase
.search(/[a-z]/)).toBe(-1);
2185 expect(phrase
.length
).toBeGreaterThan(0);
2191 // Selecting a language with existing phrase should update the phrase to use
2193 it('Updates existing phrases when the language is changed', function(done
) {
2194 driver
.findElement(By
.css(".phrase"))
2195 .sendKeys("abandon abandon ability");
2196 driver
.sleep(generateDelay
).then(function() {
2197 driver
.findElement(By
.css("a[href='#italian']"))
2199 driver
.sleep(generateDelay
).then(function() {
2200 driver
.findElement(By
.css(".phrase"))
2201 .getAttribute("value").then(function(phrase
) {
2202 // Check only the language changes, not the phrase
2203 expect(phrase
).toBe("abaco abaco abbaglio");
2204 getFirstAddress(function(address
) {
2205 // Check the address is correct
2206 expect(address
).toBe("1Dz5TgDhdki9spa6xbPFbBqv5sjMrx3xgV");
2214 // Suggested replacement for erroneous word in non-English language
2215 it('Shows word suggestion for incorrect word in non-English language', function(done
) {
2216 driver
.findElement(By
.css('.phrase'))
2217 .sendKeys('abaco abaco zbbaglio');
2218 driver
.sleep(feedbackDelay
).then(function() {
2219 driver
.findElement(By
.css('.feedback'))
2221 .then(function(feedback
) {
2222 var msg
= "zbbaglio not in wordlist, did you mean abbaglio?";
2223 expect(feedback
).toBe(msg
);
2229 // Japanese word does not break across lines.
2231 // https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese
2232 it('Does not break Japanese words across lines', function(done
) {
2233 driver
.findElement(By
.css('.phrase'))
2234 .getCssValue("word-break")
2235 .then(function(value
) {
2236 expect(value
).toBe("keep-all");
2241 // Language can be specified at page load using hash value in url
2242 it('Can set the language from the url hash', function(done
) {
2243 driver
.get(url
+ "#japanese").then(function() {
2244 driver
.findElement(By
.css('.generate')).click();
2245 driver
.sleep(generateDelay
).then(function() {
2246 driver
.findElement(By
.css(".phrase"))
2247 .getAttribute("value").then(function(phrase
) {
2248 expect(phrase
.search(/[a-z]/)).toBe(-1);
2249 expect(phrase
.length
).toBeGreaterThan(0);
2256 // Entropy can be entered by the user
2257 it('Allows entropy to be entered', function(done
) {
2258 driver
.findElement(By
.css('.use-entropy'))
2260 driver
.findElement(By
.css('.entropy'))
2261 .sendKeys('00000000 00000000 00000000 00000000');
2262 driver
.sleep(generateDelay
).then(function() {
2263 driver
.findElement(By
.css(".phrase"))
2264 .getAttribute("value").then(function(phrase
) {
2265 expect(phrase
).toBe("abandon abandon ability");
2266 getFirstAddress(function(address
) {
2267 expect(address
).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
2274 // A warning about entropy is shown to the user, with additional information
2275 it('Shows a warning about using entropy', function(done
) {
2276 driver
.findElement(By
.css('.use-entropy'))
2278 driver
.findElement(By
.css('.entropy-container'))
2280 .then(function(containerText
) {
2281 var warning
= "mnemonic may be insecure";
2282 expect(containerText
).toContain(warning
);
2283 driver
.findElement(By
.css('#entropy-notes'))
2284 .findElement(By
.xpath("parent::*"))
2286 .then(function(notesText
) {
2287 var detail
= "flipping a fair coin, rolling a fair dice, noise measurements etc";
2288 expect(notesText
).toContain(detail
);
2294 // The types of entropy available are described to the user
2295 it('Shows the types of entropy available', function(done
) {
2296 driver
.findElement(By
.css('.entropy'))
2297 .getAttribute("placeholder")
2298 .then(function(placeholderText
) {
2307 for (var i
=0; i
<options
.length
; i
++) {
2308 var option
= options
[i
];
2309 expect(placeholderText
).toContain(option
);
2315 // The actual entropy used is shown to the user
2316 it('Shows the actual entropy used', function(done
) {
2317 driver
.findElement(By
.css('.use-entropy'))
2319 driver
.findElement(By
.css('.entropy'))
2320 .sendKeys('Not A Very Good Entropy Source At All');
2321 driver
.sleep(generateDelay
).then(function() {
2322 driver
.findElement(By
.css('.entropy-container'))
2324 .then(function(text
) {
2325 expect(text
).toMatch(/Filtered Entropy
\s
+AedEceAA
/);
2331 // Binary entropy can be entered
2332 it('Allows binary entropy to be entered', function(done
) {
2333 testEntropyType(done
, "01", "binary");
2336 // Base 6 entropy can be entered
2337 it('Allows base 6 entropy to be entered', function(done
) {
2338 testEntropyType(done
, "012345", "base 6");
2341 // Base 6 dice entropy can be entered
2342 it('Allows base 6 dice entropy to be entered', function(done
) {
2343 testEntropyType(done
, "123456", "base 6 (dice)");
2346 // Base 10 entropy can be entered
2347 it('Allows base 10 entropy to be entered', function(done
) {
2348 testEntropyType(done
, "789", "base 10");
2351 // Hexadecimal entropy can be entered
2352 it('Allows hexadecimal entropy to be entered', function(done
) {
2353 testEntropyType(done
, "abcdef", "hexadecimal");
2356 // Dice entropy value is shown as the converted base 6 value
2357 // ie 123456 is converted to 123450
2358 it('Shows dice entropy as base 6', function(done
) {
2359 driver
.findElement(By
.css('.use-entropy'))
2361 driver
.findElement(By
.css('.entropy'))
2362 .sendKeys("123456");
2363 driver
.sleep(generateDelay
).then(function() {
2364 driver
.findElement(By
.css('.entropy-container'))
2366 .then(function(text
) {
2367 expect(text
).toMatch(/Filtered Entropy
\s
+123450/);
2373 // The number of bits of entropy accumulated is shown
2374 it("Shows the number of bits of entropy for 20 bits of binary", function(done
) {
2375 testEntropyBits(done
, "0000 0000 0000 0000 0000", "20");
2377 it("Shows the number of bits of entropy for 1 bit of binary", function(done
) {
2378 testEntropyBits(done
, "0", "1");
2380 it("Shows the number of bits of entropy for 4 bits of binary", function(done
) {
2381 testEntropyBits(done
, "0000", "4");
2383 it("Shows the number of bits of entropy for 1 character of base 6 (dice)", function(done
) {
2384 // 6 in card is 0 in base 6, 0 in base 6 is 2.6 bits (rounded down to 2 bits)
2385 testEntropyBits(done
, "6", "2");
2387 it("Shows the number of bits of entropy for 1 character of base 10 with 3 bits", function(done
) {
2388 // 7 in base 10 is 111 in base 2, no leading zeros
2389 testEntropyBits(done
, "7", "3");
2391 it("Shows the number of bits of entropy for 1 character of base 10 with 4 bis", function(done
) {
2392 testEntropyBits(done
, "8", "4");
2394 it("Shows the number of bits of entropy for 1 character of hex", function(done
) {
2395 testEntropyBits(done
, "F", "4");
2397 it("Shows the number of bits of entropy for 2 characters of base 10", function(done
) {
2398 testEntropyBits(done
, "29", "6");
2400 it("Shows the number of bits of entropy for 2 characters of hex", function(done
) {
2401 testEntropyBits(done
, "0A", "8");
2403 it("Shows the number of bits of entropy for 2 characters of hex with 3 leading zeros", function(done
) {
2404 // hex is always multiple of 4 bits of entropy
2405 testEntropyBits(done
, "1A", "8");
2407 it("Shows the number of bits of entropy for 2 characters of hex with 2 leading zeros", function(done
) {
2408 testEntropyBits(done
, "2A", "8");
2410 it("Shows the number of bits of entropy for 2 characters of hex with 1 leading zero", function(done
) {
2411 testEntropyBits(done
, "4A", "8");
2413 it("Shows the number of bits of entropy for 2 characters of hex with no leading zeros", function(done
) {
2414 testEntropyBits(done
, "8A", "8");
2416 it("Shows the number of bits of entropy for 2 characters of hex starting with F", function(done
) {
2417 testEntropyBits(done
, "FA", "8");
2419 it("Shows the number of bits of entropy for 4 characters of hex with leading zeros", function(done
) {
2420 testEntropyBits(done
, "000A", "16");
2422 it("Shows the number of bits of entropy for 4 characters of base 6", function(done
) {
2423 testEntropyBits(done
, "5555", "11");
2425 it("Shows the number of bits of entropy for 4 characters of base 6 dice", function(done
) {
2426 // uses dice, so entropy is actually 0000 in base 6, which is 4 lots of
2427 // 2.58 bits, which is 10.32 bits (rounded down to 10 bits)
2428 testEntropyBits(done
, "6666", "10");
2430 it("Shows the number of bits of entropy for 4 charactes of base 10", function(done
) {
2431 // Uses base 10, which is 4 lots of 3.32 bits, which is 13.3 bits (rounded
2433 testEntropyBits(done
, "2227", "13");
2435 it("Shows the number of bits of entropy for 4 characters of hex with 2 leading zeros", function(done
) {
2436 testEntropyBits(done
, "222F", "16");
2438 it("Shows the number of bits of entropy for 4 characters of hex starting with F", function(done
) {
2439 testEntropyBits(done
, "FFFF", "16");
2441 it("Shows the number of bits of entropy for 10 characters of base 10", function(done
) {
2442 // 10 events at 3.32 bits per event
2443 testEntropyBits(done
, "0000101017", "33");
2445 it("Shows the number of bits of entropy for a full deck of cards", function(done
) {
2446 // cards are not replaced, so a full deck is not 52^52 entropy which is 296
2447 // bits, it's 52!, which is 225 bits
2448 testEntropyBits(done
, "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks", "225");
2451 it("Shows details about the entered entropy", function(done
) {
2452 testEntropyFeedback(done
,
2456 type: "hexadecimal",
2460 strength: "less than a second",
2464 it("Shows details about the entered entropy", function(done
) {
2465 testEntropyFeedback(done
,
2467 entropy: "AAAAAAAA",
2468 filtered: "AAAAAAAA",
2469 type: "hexadecimal",
2473 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2477 it("Shows details about the entered entropy", function(done
) {
2478 testEntropyFeedback(done
,
2480 entropy: "AAAAAAAA B",
2481 filtered: "AAAAAAAAB",
2482 type: "hexadecimal",
2486 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2490 it("Shows details about the entered entropy", function(done
) {
2491 testEntropyFeedback(done
,
2493 entropy: "AAAAAAAA BBBBBBBB",
2494 filtered: "AAAAAAAABBBBBBBB",
2495 type: "hexadecimal",
2499 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2503 it("Shows details about the entered entropy", function(done
) {
2504 testEntropyFeedback(done
,
2506 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC",
2507 filtered: "AAAAAAAABBBBBBBBCCCCCCCC",
2508 type: "hexadecimal",
2512 strength: "less than a second",
2516 it("Shows details about the entered entropy", function(done
) {
2517 testEntropyFeedback(done
,
2519 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD",
2520 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD",
2521 type: "hexadecimal",
2525 strength: "2 minutes",
2529 it("Shows details about the entered entropy", function(done
) {
2530 testEntropyFeedback(done
,
2532 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA",
2533 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDA",
2534 type: "hexadecimal",
2542 it("Shows details about the entered entropy", function(done
) {
2543 testEntropyFeedback(done
,
2545 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE",
2546 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEE",
2547 type: "hexadecimal",
2551 strength: "3 years",
2555 it("Shows details about the entered entropy", function(done
) {
2556 testEntropyFeedback(done
,
2558 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE FFFFFFFF",
2559 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEEFFFFFFFF",
2560 type: "hexadecimal",
2564 strength: "centuries",
2568 it("Shows details about the entered entropy", function(done
) {
2569 testEntropyFeedback(done
,
2576 strength: "less than a second",
2580 it("Shows details about the entered entropy", function(done
) {
2581 testEntropyFeedback(done
,
2583 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2584 type: "card (full deck)",
2588 strength: "centuries",
2592 it("Shows details about the entered entropy", function(done
) {
2593 testEntropyFeedback(done
,
2595 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks3d",
2596 type: "card (full deck, 1 duplicate: 3d)",
2600 strength: "centuries",
2604 it("Shows details about the entered entropy", function(done
) {
2605 testEntropyFeedback(done
,
2607 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d",
2608 type: "card (2 duplicates: 3d 4d, 1 missing: KS)",
2612 strength: "centuries",
2616 it("Shows details about the entered entropy", function(done
) {
2617 testEntropyFeedback(done
,
2619 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d5d6d",
2620 type: "card (4 duplicates: 3d 4d 5d..., 1 missing: KS)",
2624 strength: "centuries",
2628 it("Shows details about the entered entropy", function(done
) {
2629 testEntropyFeedback(done
,
2630 // Next test was throwing uncaught error in zxcvbn
2631 // Also tests 451 bits, ie Math.log2(52!)*2 = 225.58 * 2
2633 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsksac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2634 type: "card (full deck, 52 duplicates: ac 2c 3c...)",
2638 strength: "centuries",
2642 it("Shows details about the entered entropy", function(done
) {
2643 testEntropyFeedback(done
,
2644 // Case insensitivity to duplicate cards
2647 type: "card (1 duplicate: AS)",
2651 strength: "less than a second",
2655 it("Shows details about the entered entropy", function(done
) {
2656 testEntropyFeedback(done
,
2659 type: "card (1 duplicate: as)",
2663 strength: "less than a second",
2667 it("Shows details about the entered entropy", function(done
) {
2668 testEntropyFeedback(done
,
2669 // Missing cards are detected
2671 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2672 type: "card (1 missing: 9C)",
2676 strength: "centuries",
2680 it("Shows details about the entered entropy", function(done
) {
2681 testEntropyFeedback(done
,
2683 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2684 type: "card (2 missing: 9C 5D)",
2688 strength: "centuries",
2692 it("Shows details about the entered entropy", function(done
) {
2693 testEntropyFeedback(done
,
2695 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjd kdah2h3h 5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2696 type: "card (4 missing: 9C 5D QD...)",
2700 strength: "centuries",
2704 it("Shows details about the entered entropy", function(done
) {
2705 testEntropyFeedback(done
,
2706 // More than six missing cards does not show message
2708 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d 8d9d jd kdah2h3h 5h6h7h8h9hthjhqhkh 2s3s4s5s6s7s8s9stsjsqsks",
2713 strength: "centuries",
2717 it("Shows details about the entered entropy", function(done
) {
2718 testEntropyFeedback(done
,
2719 // Multiple decks of cards increases bits per event
2724 bitsPerEvent: "4.34",
2728 it("Shows details about the entered entropy", function(done
) {
2729 testEntropyFeedback(done
,
2734 bitsPerEvent: "4.80",
2738 it("Shows details about the entered entropy", function(done
) {
2739 testEntropyFeedback(done
,
2744 bitsPerEvent: "5.01",
2748 it("Shows details about the entered entropy", function(done
) {
2749 testEntropyFeedback(done
,
2751 entropy: "3d3d3d3d",
2754 bitsPerEvent: "5.14",
2758 it("Shows details about the entered entropy", function(done
) {
2759 testEntropyFeedback(done
,
2761 entropy: "3d3d3d3d3d",
2764 bitsPerEvent: "5.22",
2768 it("Shows details about the entered entropy", function(done
) {
2769 testEntropyFeedback(done
,
2771 entropy: "3d3d3d3d3d3d",
2774 bitsPerEvent: "5.28",
2778 it("Shows details about the entered entropy", function(done
) {
2779 testEntropyFeedback(done
,
2781 entropy: "3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d",
2784 bitsPerEvent: "5.59",
2785 strength: 'less than a second - Repeats like "abcabcabc" are only slightly harder to guess than "abc"',
2790 // Entropy is truncated from the left
2791 it('Truncates entropy from the left', function(done
) {
2792 // Truncate from left means 0000 is removed from the start
2793 // which gives mnemonic 'avocado zoo zone'
2794 // not 1111 removed from the end
2795 // which gives the mnemonic 'abstract zoo zoo'
2796 var entropy
= "00000000 00000000 00000000 00000000";
2797 entropy
+= "11111111 11111111 11111111 1111"; // Missing last byte
2798 driver
.findElement(By
.css('.use-entropy'))
2800 driver
.findElement(By
.css('.entropy'))
2802 driver
.sleep(generateDelay
).then(function() {
2803 driver
.findElement(By
.css(".phrase"))
2804 .getAttribute("value").then(function(phrase
) {
2805 expect(phrase
).toBe("avocado zoo zone");
2811 // Very large entropy results in very long mnemonics
2812 it('Converts very long entropy to very long mnemonics', function(done
) {
2814 for (var i
=0; i
<33; i
++) {
2815 entropy
+= "AAAAAAAA"; // 3 words * 33 iterations = 99 words
2817 driver
.findElement(By
.css('.use-entropy'))
2819 driver
.findElement(By
.css('.entropy'))
2821 driver
.sleep(generateDelay
).then(function() {
2822 driver
.findElement(By
.css(".phrase"))
2823 .getAttribute("value").then(function(phrase
) {
2824 var wordCount
= phrase
.split(/\s+/g).length
;
2825 expect(wordCount
).toBe(99);
2831 // Is compatible with bip32jp entropy
2832 // https://bip32jp.github.io/english/index.html
2834 // Is incompatible with:
2836 it('Is compatible with bip32jp.github.io', function(done
) {
2837 var entropy
= "543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543";
2838 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";
2839 driver
.findElement(By
.css('.use-entropy'))
2841 driver
.findElement(By
.css('.entropy'))
2843 driver
.sleep(generateDelay
).then(function() {
2844 driver
.findElement(By
.css(".phrase"))
2845 .getAttribute("value").then(function(phrase
) {
2846 expect(phrase
).toBe(expectedPhrase
);
2852 // Blank entropy does not generate mnemonic or addresses
2853 it('Does not generate mnemonic for blank entropy', function(done
) {
2854 driver
.findElement(By
.css('.use-entropy'))
2856 driver
.findElement(By
.css('.entropy'))
2858 // check there is no mnemonic
2859 driver
.sleep(generateDelay
).then(function() {
2860 driver
.findElement(By
.css(".phrase"))
2861 .getAttribute("value").then(function(phrase
) {
2862 expect(phrase
).toBe("");
2863 // check there is no mnemonic
2864 driver
.findElements(By
.css(".address"))
2865 .then(function(addresses
) {
2866 expect(addresses
.length
).toBe(0);
2867 // Check the feedback says 'blank entropy'
2868 driver
.findElement(By
.css(".feedback"))
2870 .then(function(feedbackText
) {
2871 expect(feedbackText
).toBe("Blank entropy");
2879 // Mnemonic length can be selected even for weak entropy
2880 it('Allows selection of mnemonic length even for weak entropy', function(done
) {
2881 driver
.findElement(By
.css('.use-entropy'))
2883 driver
.executeScript(function() {
2884 $(".mnemonic-length").val("18").trigger("change");
2886 driver
.findElement(By
.css('.entropy'))
2887 .sendKeys("012345");
2888 driver
.sleep(generateDelay
).then(function() {
2889 driver
.findElement(By
.css(".phrase"))
2890 .getAttribute("value").then(function(phrase
) {
2891 var wordCount
= phrase
.split(/\s+/g).length
;
2892 expect(wordCount
).toBe(18);
2899 // https://github.com/iancoleman/bip39/issues/33
2900 // Final cards should contribute entropy
2901 it('Uses as much entropy as possible for the mnemonic', function(done
) {
2902 driver
.findElement(By
.css('.use-entropy'))
2904 driver
.findElement(By
.css('.entropy'))
2905 .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");
2906 driver
.sleep(generateDelay
).then(function() {
2908 driver
.findElement(By
.css(".phrase"))
2909 .getAttribute("value").then(function(originalPhrase
) {
2910 // Set the last 12 cards to be AS
2911 driver
.findElement(By
.css('.entropy'))
2913 driver
.findElement(By
.css('.entropy'))
2914 .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");
2915 driver
.sleep(generateDelay
).then(function() {
2917 driver
.findElement(By
.css(".phrase"))
2918 .getAttribute("value").then(function(newPhrase
) {
2919 expect(originalPhrase
).not
.toEqual(newPhrase
);
2928 // https://github.com/iancoleman/bip39/issues/35
2930 // TODO this doesn't work in selenium with firefox
2931 // see https://stackoverflow.com/q/40360223
2932 it('Shows a qr code on hover for the phrase', function(done
) {
2933 if (browser
== "firefox") {
2934 pending("Selenium + Firefox bug for mouseMove, see https://stackoverflow.com/q/40360223");
2936 // generate a random mnemonic
2937 var generateEl
= driver
.findElement(By
.css('.generate'));
2939 // toggle qr to show (hidden by default)
2940 var phraseEl
= driver
.findElement(By
.css(".phrase"));
2942 var rootKeyEl
= driver
.findElement(By
.css(".root-key"));
2943 driver
.sleep(generateDelay
).then(function() {
2944 // hover over the root key
2945 driver
.actions().mouseMove(rootKeyEl
).perform().then(function() {
2946 // check the qr code shows
2947 driver
.executeScript(function() {
2948 return $(".qr-container").find("canvas").length
> 0;
2950 .then(function(qrShowing
) {
2951 expect(qrShowing
).toBe(true);
2952 // hover away from the phrase
2953 driver
.actions().mouseMove(generateEl
).perform().then(function() {;
2954 // check the qr code hides
2955 driver
.executeScript(function() {
2956 return $(".qr-container").find("canvas").length
== 0;
2958 .then(function(qrHidden
) {
2959 expect(qrHidden
).toBe(true);
2968 // BIP44 account extendend private key is shown
2969 // github issue 37 - compatibility with electrum
2970 it('Shows the bip44 account extended private key', function(done
) {
2971 driver
.findElement(By
.css(".phrase"))
2972 .sendKeys("abandon abandon ability");
2973 driver
.sleep(generateDelay
).then(function() {
2974 driver
.findElement(By
.css("#bip44 .account-xprv"))
2975 .getAttribute("value")
2976 .then(function(xprv
) {
2977 expect(xprv
).toBe("xprv9yzrnt4zWVJUr1k2VxSPy9ettKz5PpeDMgaVG7UKedhqnw1tDkxP2UyYNhuNSumk2sLE5ctwKZs9vwjsq3e1vo9egCK6CzP87H2cVYXpfwQ");
2983 // BIP44 account extendend public key is shown
2984 // github issue 37 - compatibility with electrum
2985 it('Shows the bip44 account extended public key', function(done
) {
2986 driver
.findElement(By
.css(".phrase"))
2987 .sendKeys("abandon abandon ability");
2988 driver
.sleep(generateDelay
).then(function() {
2989 driver
.findElement(By
.css("#bip44 .account-xpub"))
2990 .getAttribute("value")
2991 .then(function(xprv
) {
2992 expect(xprv
).toBe("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
2999 // BIP32 root key can be set as an xpub
3000 it('Generates addresses from xpub as bip32 root key', function(done
) {
3001 driver
.findElement(By
.css('#bip32-tab a'))
3003 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3004 driver
.findElement(By
.css("#root-key"))
3005 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3006 driver
.sleep(generateDelay
).then(function() {
3007 // check the addresses are generated
3008 getFirstAddress(function(address
) {
3009 expect(address
).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
3010 // check the xprv key is not set
3011 driver
.findElement(By
.css(".extended-priv-key"))
3012 .getAttribute("value")
3013 .then(function(xprv
) {
3014 expect(xprv
).toBe("NA");
3015 // check the private key is not set
3016 driver
.findElements(By
.css(".privkey"))
3017 .then(function(els
) {
3020 .then(function(privkey
) {
3021 expect(xprv
).toBe("NA");
3031 // xpub for bip32 root key will not work with hardened derivation paths
3032 it('Shows error for hardened derivation paths with xpub root key', function(done
) {
3033 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3034 driver
.findElement(By
.css("#root-key"))
3035 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3036 driver
.sleep(feedbackDelay
).then(function() {
3037 // Check feedback is correct
3038 driver
.findElement(By
.css('.feedback'))
3040 .then(function(feedback
) {
3041 var msg
= "Hardened derivation path is invalid with xpub key";
3042 expect(feedback
).toBe(msg
);
3043 // Check no addresses are shown
3044 driver
.findElements(By
.css('.addresses tr'))
3045 .then(function(rows
) {
3046 expect(rows
.length
).toBe(0);
3054 // no root key shows feedback
3055 it('Shows feedback for no root key', function(done
) {
3056 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3057 driver
.findElement(By
.css('#bip32-tab a'))
3059 driver
.sleep(feedbackDelay
).then(function() {
3060 // Check feedback is correct
3061 driver
.findElement(By
.css('.feedback'))
3063 .then(function(feedback
) {
3064 expect(feedback
).toBe("Invalid root key");
3071 // display error switching tabs while addresses are generating
3072 it('Can change details while old addresses are still being generated', function(done
) {
3073 // Set to generate 199 more addresses.
3074 // This will take a long time allowing a new set of addresses to be
3075 // generated midway through this lot.
3076 // The newly generated addresses should not include any from the old set.
3077 // Any more than 199 will show an alert which needs to be accepted.
3078 driver
.findElement(By
.css('.rows-to-add'))
3080 driver
.findElement(By
.css('.rows-to-add'))
3083 driver
.findElement(By
.css('.phrase'))
3084 .sendKeys("abandon abandon ability");
3085 driver
.sleep(generateDelay
).then(function() {
3086 // change tabs which should cancel the previous generating
3087 driver
.findElement(By
.css('.rows-to-add'))
3089 driver
.findElement(By
.css('.rows-to-add'))
3091 driver
.findElement(By
.css('#bip32-tab a'))
3093 driver
.sleep(generateDelay
).then(function() {
3094 driver
.findElements(By
.css('.index'))
3095 .then(function(els
) {
3096 // check the derivation paths have the right quantity
3097 expect(els
.length
).toBe(20);
3098 // check the derivation paths are in order
3099 testRowsAreInCorrectOrder(done
);
3103 }, generateDelay
+ 10000);
3106 // padding for binary should give length with multiple of 256
3107 // hashed entropy 1111 is length 252, so requires 4 leading zeros
3108 // prior to issue 49 it would only generate 2 leading zeros, ie missing 2
3109 it('Pads hashed entropy with leading zeros', function(done
) {
3110 driver
.findElement(By
.css('.use-entropy'))
3112 driver
.executeScript(function() {
3113 $(".mnemonic-length").val("15").trigger("change");
3115 driver
.findElement(By
.css('.entropy'))
3117 driver
.sleep(generateDelay
).then(function() {
3118 driver
.findElement(By
.css('.phrase'))
3119 .getAttribute("value")
3120 .then(function(phrase
) {
3121 expect(phrase
).toBe("avocado valid quantum cross link predict excuse edit street able flame large galaxy ginger nuclear");
3127 // Github pull request 55
3128 // https://github.com/iancoleman/bip39/pull/55
3130 it('Can set the derivation path on bip32 tab for bitcoincore', function(done
) {
3131 testClientSelect(done
, {
3133 bip32path: "m/0'/0'",
3134 useHardenedAddresses: "true",
3137 it('Can set the derivation path on bip32 tab for multibit', function(done
) {
3138 testClientSelect(done
, {
3140 bip32path: "m/0'/0",
3141 useHardenedAddresses: null,
3144 it('Can set the derivation path on bip32 tab for coinomi/ledger', function(done
) {
3145 testClientSelect(done
, {
3147 bip32path: "m/44'/0'/0'",
3148 useHardenedAddresses: null,
3153 // https://github.com/iancoleman/bip39/issues/58
3154 // bip32 derivation is correct, does not drop leading zeros
3156 // https://medium.com/@alexberegszaszi/why-do-my-bip32-wallets-disagree-6f3254cc5846
3157 it('Retains leading zeros for bip32 derivation', function(done
) {
3158 driver
.findElement(By
.css(".phrase"))
3159 .sendKeys("fruit wave dwarf banana earth journey tattoo true farm silk olive fence");
3160 driver
.findElement(By
.css(".passphrase"))
3161 .sendKeys("banana");
3162 driver
.sleep(generateDelay
).then(function() {
3163 getFirstAddress(function(address
) {
3164 // Note that bitcore generates an incorrect address
3165 // 13EuKhffWkBE2KUwcbkbELZb1MpzbimJ3Y
3166 // see the medium.com link above for more details
3167 expect(address
).toBe("17rxURoF96VhmkcEGCj5LNQkmN9HVhWb7F");
3174 // Japanese mnemonics generate incorrect bip32 seed
3175 // BIP39 seed is set from phrase
3176 it('Generates correct seed for Japanese mnemonics', function(done
) {
3177 driver
.findElement(By
.css(".phrase"))
3178 .sendKeys("あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら");
3179 driver
.findElement(By
.css(".passphrase"))
3180 .sendKeys("メートルガバヴァぱばぐゞちぢ十人十色");
3181 driver
.sleep(generateDelay
).then(function() {
3182 driver
.findElement(By
.css(".seed"))
3183 .getAttribute("value")
3184 .then(function(seed
) {
3185 expect(seed
).toBe("a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55");
3191 // BIP49 official test vectors
3192 // https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki#test-vectors
3193 it('Generates BIP49 addresses matching the official test vectors', function(done
) {
3194 driver
.findElement(By
.css('#bip49-tab a'))
3196 selectNetwork("BTC - Bitcoin Testnet");
3197 driver
.findElement(By
.css(".phrase"))
3198 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
3199 driver
.sleep(generateDelay
).then(function() {
3200 getFirstAddress(function(address
) {
3201 expect(address
).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2");
3207 // BIP49 derivation path is shown
3208 it('Shows the bip49 derivation path', function(done
) {
3209 driver
.findElement(By
.css('#bip49-tab a'))
3211 driver
.findElement(By
.css(".phrase"))
3212 .sendKeys("abandon abandon ability");
3213 driver
.sleep(generateDelay
).then(function() {
3214 driver
.findElement(By
.css('#bip49 .path'))
3215 .getAttribute("value")
3216 .then(function(path
) {
3217 expect(path
).toBe("m/49'/0'/0'/0");
3223 // BIP49 extended private key is shown
3224 it('Shows the bip49 extended private key', function(done
) {
3225 driver
.findElement(By
.css('#bip49-tab a'))
3227 driver
.findElement(By
.css(".phrase"))
3228 .sendKeys("abandon abandon ability");
3229 driver
.sleep(generateDelay
).then(function() {
3230 driver
.findElement(By
.css('.extended-priv-key'))
3231 .getAttribute("value")
3232 .then(function(xprv
) {
3233 expect(xprv
).toBe("yprvALYB4DYRG6CzzVgzQZwwqjAA2wjBGC3iEd7KYYScpoDdmf75qMRWZWxoFcRXBJjgEXdFqJ9vDRGRLJQsrL22Su5jMbNFeM9vetaGVqy9Qy2");
3239 // BIP49 extended public key is shown
3240 it('Shows the bip49 extended public key', function(done
) {
3241 driver
.findElement(By
.css('#bip49-tab a'))
3243 driver
.findElement(By
.css(".phrase"))
3244 .sendKeys("abandon abandon ability");
3245 driver
.sleep(generateDelay
).then(function() {
3246 driver
.findElement(By
.css('.extended-pub-key'))
3247 .getAttribute("value")
3248 .then(function(xprv
) {
3249 expect(xprv
).toBe("ypub6ZXXTj5K6TmJCymTWbUxCs6tayZffemZbr2vLvrEP8kceTSENtjm7KHH6thvAKxVar9fGe8rgsPEX369zURLZ68b4f7Vexz7RuXsjQ69YDt");
3255 // BIP49 account field changes address list
3256 it('Can set the bip49 account field', function(done
) {
3257 driver
.findElement(By
.css('#bip49-tab a'))
3259 driver
.findElement(By
.css('#bip49 .account'))
3261 driver
.findElement(By
.css('#bip49 .account'))
3263 driver
.findElement(By
.css(".phrase"))
3264 .sendKeys("abandon abandon ability");
3265 driver
.sleep(generateDelay
).then(function() {
3266 getFirstAddress(function(address
) {
3267 expect(address
).toBe("381wg1GGN4rP88rNC9v7QWsiww63yLVPsn");
3273 // BIP49 change field changes address list
3274 it('Can set the bip49 change field', function(done
) {
3275 driver
.findElement(By
.css('#bip49-tab a'))
3277 driver
.findElement(By
.css('#bip49 .change'))
3279 driver
.findElement(By
.css('#bip49 .change'))
3281 driver
.findElement(By
.css(".phrase"))
3282 .sendKeys("abandon abandon ability");
3283 driver
.sleep(generateDelay
).then(function() {
3284 getFirstAddress(function(address
) {
3285 expect(address
).toBe("3PEM7MiKed5konBoN66PQhK8r3hjGhy9dT");
3291 // BIP49 account extendend private key is shown
3292 it('Shows the bip49 account extended private key', function(done
) {
3293 driver
.findElement(By
.css('#bip49-tab a'))
3295 driver
.findElement(By
.css(".phrase"))
3296 .sendKeys("abandon abandon ability");
3297 driver
.sleep(generateDelay
).then(function() {
3298 driver
.findElement(By
.css('#bip49 .account-xprv'))
3299 .getAttribute("value")
3300 .then(function(xprv
) {
3301 expect(xprv
).toBe("yprvAHtB1M5Wp675aLzFy9TJYK2mSsLkg6mcBRh5DZTR7L4EnYSmYPaL63KFA4ycg1PngW5LfkmejxzosCs17TKZMpRFKc3z5SJar6QAKaFcaZL");
3307 // BIP49 account extendend public key is shown
3308 it('Shows the bip49 account extended public key', function(done
) {
3309 driver
.findElement(By
.css('#bip49-tab a'))
3311 driver
.findElement(By
.css(".phrase"))
3312 .sendKeys("abandon abandon ability");
3313 driver
.sleep(generateDelay
).then(function() {
3314 driver
.findElement(By
.css('#bip49 .account-xpub'))
3315 .getAttribute("value")
3316 .then(function(xprv
) {
3317 expect(xprv
).toBe("ypub6WsXQrcQeTfNnq4j5AzJuSyVzuBF5ZVTYecg1ws2ffbDfLmv5vtadqdj1NgR6C6gufMpMfJpHxvb6JEQKvETVNWCRanNedfJtnTchZiJtsL");
3323 // Test selecting coin where bip49 is unavailable (eg CLAM)
3324 it('Shows an error on bip49 tab for coins without bip49', function(done
) {
3325 driver
.findElement(By
.css('#bip49-tab a'))
3327 driver
.findElement(By
.css(".phrase"))
3328 .sendKeys("abandon abandon ability");
3329 driver
.sleep(generateDelay
).then(function() {
3330 selectNetwork("CLAM - Clams");
3331 // bip49 available is hidden
3332 driver
.findElement(By
.css('#bip49 .available'))
3333 .getAttribute("class")
3334 .then(function(classes
) {
3335 expect(classes
).toContain("hidden");
3336 // bip49 unavailable is shown
3337 driver
.findElement(By
.css('#bip49 .unavailable'))
3338 .getAttribute("class")
3339 .then(function(classes
) {
3340 expect(classes
).not
.toContain("hidden");
3341 // check there are no addresses shown
3342 driver
.findElements(By
.css('.addresses tr'))
3343 .then(function(rows
) {
3344 expect(rows
.length
).toBe(0);
3345 // check the derived private key is blank
3346 driver
.findElement(By
.css('.extended-priv-key'))
3347 .getAttribute("value")
3348 .then(function(xprv
) {
3349 expect(xprv
).toBe('');
3350 // check the derived public key is blank
3351 driver
.findElement(By
.css('.extended-pub-key'))
3352 .getAttribute("value")
3353 .then(function(xpub
) {
3354 expect(xpub
).toBe('');
3365 // Cleared mnemonic and root key still allows addresses to be generated
3366 // https://github.com/iancoleman/bip39/issues/43
3367 it('Clears old root keys from memory when mnemonic is cleared', function(done
) {
3369 driver
.findElement(By
.css(".phrase"))
3370 .sendKeys("abandon abandon ability");
3371 driver
.sleep(generateDelay
).then(function() {
3372 // clear the mnemonic and root key
3373 // using selenium .clear() doesn't seem to trigger the 'input' event
3374 // so clear it using keys instead
3375 driver
.findElement(By
.css('.phrase'))
3376 .sendKeys(Key
.CONTROL
,"a");
3377 driver
.findElement(By
.css('.phrase'))
3378 .sendKeys(Key
.DELETE
);
3379 driver
.findElement(By
.css('.root-key'))
3380 .sendKeys(Key
.CONTROL
,"a");
3381 driver
.findElement(By
.css('.root-key'))
3382 .sendKeys(Key
.DELETE
);
3383 driver
.sleep(generateDelay
).then(function() {
3384 // try to generate more addresses
3385 driver
.findElement(By
.css('.more'))
3387 driver
.sleep(generateDelay
).then(function() {
3388 driver
.findElements(By
.css(".addresses tr"))
3389 .then(function(els
) {
3390 // check there are no addresses shown
3391 expect(els
.length
).toBe(0);
3400 // error trying to generate addresses from xpub with hardened derivation
3401 it('Shows error for hardened addresses with xpub root key', function(done
) {
3402 driver
.findElement(By
.css('#bip32-tab a'))
3404 driver
.executeScript(function() {
3405 $(".hardened-addresses").prop("checked", true);
3407 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3408 driver
.findElement(By
.css("#root-key"))
3409 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3410 driver
.sleep(feedbackDelay
).then(function() {
3411 // Check feedback is correct
3412 driver
.findElement(By
.css('.feedback'))
3414 .then(function(feedback
) {
3415 var msg
= "Hardened derivation path is invalid with xpub key";
3416 expect(feedback
).toBe(msg
);
3422 // Litecoin uses ltub by default, and can optionally be set to xprv
3424 // https://github.com/iancoleman/bip39/issues/96
3425 // Issue with extended keys on Litecoin
3426 it('Uses ltub by default for litecoin, but can be set to xprv', function(done
) {
3427 driver
.findElement(By
.css('.phrase'))
3428 .sendKeys("abandon abandon ability");
3429 selectNetwork("LTC - Litecoin");
3430 driver
.sleep(generateDelay
).then(function() {
3431 // check the extended key is generated correctly
3432 driver
.findElement(By
.css('.root-key'))
3433 .getAttribute("value")
3434 .then(function(rootKey
) {
3435 expect(rootKey
).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU");
3436 // set litecoin to use ltub
3437 driver
.executeScript(function() {
3438 $(".litecoin-use-ltub").prop("checked", false);
3439 $(".litecoin-use-ltub").trigger("change");
3441 driver
.sleep(generateDelay
).then(function() {
3442 driver
.findElement(By
.css('.root-key'))
3443 .getAttribute("value")
3444 .then(function(rootKey
) {
3445 expect(rootKey
).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
3454 // https://github.com/iancoleman/bip39/issues/99#issuecomment-327094159
3455 // "warn me emphatically when they have detected invalid input" to the entropy field
3456 // A warning is shown when entropy is filtered and discarded
3457 it('Warns when entropy is filtered and discarded', function(done
) {
3458 driver
.findElement(By
.css('.use-entropy'))
3460 // set entropy to have no filtered content
3461 driver
.findElement(By
.css('.entropy'))
3462 .sendKeys("00000000 00000000 00000000 00000000");
3463 driver
.sleep(generateDelay
).then(function() {
3464 // check the filter warning does not show
3465 driver
.findElement(By
.css('.entropy-container .filter-warning'))
3466 .getAttribute("class")
3467 .then(function(classes
) {
3468 expect(classes
).toContain("hidden");
3469 // set entropy to have some filtered content
3470 driver
.findElement(By
.css('.entropy'))
3471 .sendKeys("10000000 zxcvbn 00000000 00000000 00000000");
3472 driver
.sleep(entropyFeedbackDelay
).then(function() {
3473 // check the filter warning shows
3474 driver
.findElement(By
.css('.entropy-container .filter-warning'))
3475 .getAttribute("class")
3476 .then(function(classes
) {
3477 expect(classes
).not
.toContain("hidden");
3485 // Bitcoin Cash address can be set to use cashaddr format
3486 it('Can use cashaddr format for bitcoin cash addresses', function(done
) {
3487 driver
.executeScript(function() {
3488 $(".use-bch-cashaddr-addresses").prop("checked", true);
3490 driver
.findElement(By
.css('.phrase'))
3491 .sendKeys("abandon abandon ability");
3492 selectNetwork("BCH - Bitcoin Cash");
3493 driver
.sleep(generateDelay
).then(function() {
3494 getFirstAddress(function(address
) {
3495 expect(address
).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps");
3501 // Bitcoin Cash address can be set to use bitpay format
3502 it('Can use bitpay format for bitcoin cash addresses', function(done
) {
3503 driver
.executeScript(function() {
3504 $(".use-bch-bitpay-addresses").prop("checked", true);
3506 driver
.findElement(By
.css('.phrase'))
3507 .sendKeys("abandon abandon ability");
3508 selectNetwork("BCH - Bitcoin Cash");
3509 driver
.sleep(generateDelay
).then(function() {
3510 getFirstAddress(function(address
) {
3511 expect(address
).toBe("CZnpA9HPmvhuhLLPWJP8rNDpLUYXy1LXFk");
3517 // Bitcoin Cash address can be set to use legacy format
3518 it('Can use legacy format for bitcoin cash addresses', function(done
) {
3519 driver
.executeScript(function() {
3520 $(".use-bch-legacy-addresses").prop("checked", true);
3522 driver
.findElement(By
.css('.phrase'))
3523 .sendKeys("abandon abandon ability");
3524 selectNetwork("BCH - Bitcoin Cash");
3525 driver
.sleep(generateDelay
).then(function() {
3526 getFirstAddress(function(address
) {
3527 expect(address
).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A");
3533 // End of tests ported from old suit, so no more comments above each test now
3535 it('Can generate more addresses from a custom index', function(done
) {
3536 var expectedIndexes
= [
3537 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
3538 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59
3540 driver
.findElement(By
.css('.phrase'))
3541 .sendKeys("abandon abandon ability");
3542 driver
.sleep(generateDelay
).then(function() {
3543 // Set start of next lot of rows to be from index 40
3544 // which means indexes 20-39 will not be in the table.
3545 driver
.findElement(By
.css('.more-rows-start-index'))
3547 driver
.findElement(By
.css('.more'))
3549 driver
.sleep(generateDelay
).then(function() {
3550 // Check actual indexes in the table match the expected pattern
3551 driver
.findElements(By
.css(".index"))
3552 .then(function(els
) {
3553 expect(els
.length
).toBe(expectedIndexes
.length
);
3554 var testRowAtIndex = function(i
) {
3555 if (i
>= expectedIndexes
.length
) {
3560 .then(function(actualPath
) {
3561 var noHardened
= actualPath
.replace(/'/g, "");
3562 var pathBits = noHardened.split("/")
3563 var lastBit = pathBits[pathBits.length-1];
3564 var actualIndex = parseInt(lastBit);
3565 var expectedIndex = expectedIndexes[i];
3566 expect(actualIndex).toBe(expectedIndex);
3567 testRowAtIndex(i+1);
3577 it('Can generate BIP141 addresses
with P2WPKH
-in-P2SH semanitcs
', function(done) {
3578 // Sourced from BIP49 official test specs
3579 driver.findElement(By.css('#bip141
-tab a
'))
3581 driver.findElement(By.css('.bip141
-path
'))
3583 driver.findElement(By.css('.bip141
-path
'))
3584 .sendKeys("m/49'/1'/0'/0");
3585 selectNetwork("BTC
- Bitcoin Testnet
");
3586 driver.findElement(By.css(".phrase
"))
3587 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
");
3588 driver.sleep(generateDelay).then(function() {
3589 getFirstAddress(function(address) {
3590 expect(address).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2
");
3596 it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) {
3597 // This result tested against bitcoinjs-lib test spec for segwit address
3598 // using the first private key of this mnemonic and default path m/0
3599 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/9c8503cab0c6c30a95127042703bc18e8d28c76d/test/integration/addresses.js#L50
3600 // so whilst not directly comparable, substituting the private key produces
3601 // identical results between this tool and the bitcoinjs-lib test.
3602 // Private key generated is:
3603 // L3L8Nu9whawPBNLGtFqDhKut9DKKfG3CQoysupT7BimqVCZsLFNP
3604 driver.findElement(By.css('#bip141-tab a'))
3607 driver.executeScript(function() {
3608 $(".bip141
-semantics option
[selected
]").removeAttr("selected
");
3609 $(".bip141
-semantics option
").filter(function(i,e) {
3610 return $(e).html() == "P2WPKH
";
3611 }).prop("selected
", true);
3612 $(".bip141
-semantics
").trigger("change
");
3614 driver.findElement(By.css(".phrase
"))
3615 .sendKeys("abandon abandon ability
");
3616 driver.sleep(generateDelay).then(function() {
3617 getFirstAddress(function(address) {
3618 expect(address).toBe("bc1qfwu6a5a3evygrk8zvdxxvz4547lmpyx5vsfxe9
");
3624 it('Shows the entropy used by the PRNG when clicking generate', function(done) {
3625 driver.findElement(By.css('.generate')).click();
3626 driver.sleep(generateDelay).then(function() {
3627 driver.findElement(By.css('.entropy'))
3628 .getAttribute("value
")
3629 .then(function(entropy) {
3630 expect(entropy).not.toBe("");
3636 it('Shows the index of each word in the mnemonic', function(done) {
3637 driver.findElement(By.css('.phrase'))
3638 .sendKeys("abandon abandon ability
");
3639 driver.sleep(generateDelay).then(function() {
3640 driver.findElement(By.css('.use-entropy'))
3642 driver.findElement(By.css('.word-indexes'))
3644 .then(function(indexes) {
3645 expect(indexes).toBe("0, 0, 1");
3651 it('Shows the derivation path for bip84 tab', function(done) {
3652 driver.findElement(By.css('#bip84-tab a'))
3654 driver.findElement(By.css('.phrase'))
3655 .sendKeys('abandon abandon ability');
3656 driver.sleep(generateDelay).then(function() {
3657 driver.findElement(By.css('#bip84 .path'))
3658 .getAttribute("value
")
3659 .then(function(path) {
3660 expect(path).toBe("m
/84'/0'/0'/0");
3666 it('Shows the extended private key for bip84 tab', function(done) {
3667 driver.findElement(By.css('#bip84-tab a'))
3669 driver.findElement(By.css('.phrase'))
3670 .sendKeys('abandon abandon ability');
3671 driver.sleep(generateDelay).then(function() {
3672 driver.findElement(By.css('.extended-priv-key'))
3673 .getAttribute("value
")
3674 .then(function(path) {
3675 expect(path).toBe("zprvAev3RKrZ3QVKiUFCfdeMRen1BPDJgdNt1XpxiDy8acSs4kkAGTCvq7HeRYRNNpo8EtEjCFQBWavJwtCUR29y4TUCH4X5RXMcyq48uN8y9BP
");
3681 it('Shows the extended public key for bip84 tab', function(done) {
3682 driver.findElement(By.css('#bip84-tab a'))
3684 driver.findElement(By.css('.phrase'))
3685 .sendKeys('abandon abandon ability');
3686 driver.sleep(generateDelay).then(function() {
3687 driver.findElement(By.css('.extended-pub-key'))
3688 .getAttribute("value
")
3689 .then(function(path) {
3690 expect(path).toBe("zpub6suPpqPSsn3cvxKfmfBMnnijjR3o666jNkkZWcNk8wyqwZ5JozXBNuc8Gs7DB3uLwTDvGVTspVEAUQcEjKF3pZHgywVbubdTqbXTUg7usyx
");
3696 it('Changes the address list if bip84 account is changed', function(done) {
3697 driver.findElement(By.css('#bip84-tab a'))
3699 driver.findElement(By.css('#bip84 .account'))
3701 driver.findElement(By.css('.phrase'))
3702 .sendKeys('abandon abandon ability');
3703 driver.sleep(generateDelay).then(function() {
3704 getFirstAddress(function(address) {
3705 expect(address).toBe("bc1qp7vv669t2fy965jdzvqwrraana89ctd5ewc662
");
3711 it('Changes the address list if bip84 change is changed', function(done) {
3712 driver.findElement(By.css('#bip84-tab a'))
3714 driver.findElement(By.css('#bip84 .change'))
3716 driver.findElement(By.css('.phrase'))
3717 .sendKeys('abandon abandon ability');
3718 driver.sleep(generateDelay).then(function() {
3719 getFirstAddress(function(address) {
3720 expect(address).toBe("bc1qr39vj6rh06ff05m53uxq8uazehwhccswylhrs2
");
3726 it('Passes the official BIP84 test spec for rootpriv', function(done) {
3727 driver.findElement(By.css('#bip84-tab a'))
3729 driver.findElement(By.css('.phrase'))
3730 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3731 driver.sleep(generateDelay).then(function() {
3732 driver.findElement(By.css(".root
-key
"))
3733 .getAttribute("value
")
3734 .then(function(rootKey) {
3735 expect(rootKey).toBe("zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5
");
3741 it('Passes the official BIP84 test spec for account 0 xprv', function(done) {
3742 driver.findElement(By.css('#bip84-tab a'))
3744 driver.findElement(By.css('.phrase'))
3745 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3746 driver.sleep(generateDelay).then(function() {
3747 driver.findElement(By.css("#bip84
.account
-xprv
"))
3748 .getAttribute("value
")
3749 .then(function(rootKey) {
3750 expect(rootKey).toBe("zprvAdG4iTXWBoARxkkzNpNh8r6Qag3irQB8PzEMkAFeTRXxHpbF9z4QgEvBRmfvqWvGp42t42nvgGpNgYSJA9iefm1yYNZKEm7z6qUWCroSQnE
");
3756 it('Passes the official BIP84 test spec for account 0 xpub', function(done) {
3757 driver.findElement(By.css('#bip84-tab a'))
3759 driver.findElement(By.css('.phrase'))
3760 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3761 driver.sleep(generateDelay).then(function() {
3762 driver.findElement(By.css("#bip84
.account
-xpub
"))
3763 .getAttribute("value
")
3764 .then(function(rootKey) {
3765 expect(rootKey).toBe("zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs
");
3771 it('Passes the official BIP84 test spec for account 0 first address', function(done) {
3772 driver.findElement(By.css('#bip84-tab a'))
3774 driver.findElement(By.css('.phrase'))
3775 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3776 driver.sleep(generateDelay).then(function() {
3777 getFirstAddress(function(address) {
3778 expect(address).toBe("bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu
");
3784 it('Passes the official BIP84 test spec for account 0 first change address', function(done) {
3785 driver.findElement(By.css('#bip84-tab a'))
3787 driver.findElement(By.css('.phrase'))
3788 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3789 driver.findElement(By.css('#bip84 .change'))
3791 driver.sleep(generateDelay).then(function() {
3792 getFirstAddress(function(address) {
3793 expect(address).toBe("bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el
");
3799 it('Can display the table as csv', function(done) {
3800 var headings = "path
,address
,public key
,private key
";
3801 var row1 = "m
/44'/0'/0'/0/0,1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug
,033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3
,L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE
";
3802 var row20 = "m
/44'/0'/0'/0/19,1KhBy28XLAciXnnRvm71PvQJaETyrxGV55
,02b4b3e396434d8cdd20c03ac4aaa07387784d5d867b75987f516f5705ee68cb3a
,L4GrDrjReMsCAu5DkLXn79jSb95qR7Zfx7eshybCQZ1qL32MXJab
";
3803 driver.findElement(By.css('.phrase'))
3804 .sendKeys('abandon abandon ability');
3805 driver.sleep(generateDelay).then(function() {
3806 driver.findElement(By.css('.csv'))
3807 .getAttribute("value
")
3808 .then(function(csv) {
3809 expect(csv).toContain(headings);
3810 expect(csv).toContain(row1);
3811 expect(csv).toContain(row20);
3817 it('LeftPads ethereum keys that are less than 32 bytes', function(done) {
3818 // see https://github.com/iancoleman/bip39/issues/155
3819 selectNetwork("ETH
- Ethereum
");
3820 driver.findElement(By.css('#bip32-tab a'))
3822 driver.findElement(By.css('#bip32-path'))
3824 driver.findElement(By.css('#bip32-path'))
3825 .sendKeys("m
/44'/60'/0'");
3826 driver.findElement(By.css('.phrase'))
3827 .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');
3828 driver.sleep(generateDelay).then(function() {
3829 getFirstAddress(function(address) {
3830 expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118");
3836 it('Can encrypt private keys using BIP38', function(done) {
3837 // see https://github.com/iancoleman/bip39/issues/140
3838 driver.executeScript(function() {
3839 $(".use-bip38
").prop("checked
", true);
3841 driver.findElement(By.css('.bip38-password'))
3842 .sendKeys('bip38password');
3843 driver.findElement(By.css('.rows-to-add'))
3845 driver.findElement(By.css('.rows-to-add'))
3847 driver.findElement(By.css('.phrase'))
3848 .sendKeys('abandon abandon ability');
3849 driver.sleep(bip38delay).then(function() {
3851 getFirstRowValue(function(address) {
3852 expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB
");
3854 getFirstRowValue(function(pubkey) {
3855 expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1
");
3857 getFirstRowValue(function(privkey) {
3858 expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM
");
3864 }, bip38delay + 5000);
3866 it('Shows the checksum for the entropy', function(done) {
3867 driver.findElement(By.css('.use-entropy'))
3869 driver.findElement(By.css('.entropy'))
3870 .sendKeys("00000000000000000000000000000000");
3871 driver.sleep(generateDelay).then(function() {
3872 driver.findElement(By.css('.checksum'))
3874 .then(function(text) {
3875 expect(text).toBe("1");
3881 it('Shows the checksum for the entropy with the correct groupings', function(done) {
3882 driver.findElement(By.css('.use-entropy'))
3884 // create a checksum of 20 bits, which spans multiple words
3885 driver.findElement(By.css('.entropy'))
3886 .sendKeys("F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
");
3887 driver.sleep(generateDelay).then(function() {
3888 driver.findElement(By.css('.checksum'))
3890 .then(function(text) {
3891 // first group is 9 bits, second group is 11
3892 expect(text).toBe("011010111 01110000110");
3898 it('Uses vprv for bitcoin testnet p2wpkh', function(done) {
3899 selectNetwork("BTC
- Bitcoin Testnet
");
3900 driver.findElement(By.css('#bip84-tab a'))
3902 driver.findElement(By.css('.phrase'))
3903 .sendKeys('abandon abandon ability');
3904 driver.sleep(generateDelay).then(function() {
3905 driver.findElement(By.css('.root-key'))
3906 .getAttribute("value
")
3907 .then(function(path) {
3908 expect(path).toBe("vprv9DMUxX4ShgxML9N2YV5CvWEebWrM9aJ5ULpbRRyzyWu6vs4BzTvbfFFrH41N5hVi7MYSfiugd765L3JmAfDM5po36Y8ouCKRDeYQwByCmS7
");
3914 it('Shows a warning if generating weak mnemonics', function(done) {
3915 driver.executeScript(function() {
3916 $(".strength option
[selected
]").removeAttr("selected
");
3917 $(".strength option
[value
=6]").prop("selected
", true);
3918 $(".strength
").trigger("change
");
3920 driver.findElement(By.css(".generate
-container
.warning
"))
3921 .getAttribute("class")
3922 .then(function(classes) {
3923 expect(classes).not.toContain("hidden
");
3928 it('Does not show a warning if generating strong mnemonics', function(done) {
3929 driver.executeScript(function() {
3930 $(".strength option
[selected
]").removeAttr("selected
");
3931 $(".strength option
[value
=12]").prop("selected
", true);
3933 driver.findElement(By.css(".generate
-container
.warning
"))
3934 .getAttribute("class")
3935 .then(function(classes) {
3936 expect(classes).toContain("hidden
");
3941 it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) {
3942 driver.findElement(By.css('.use-entropy'))
3944 driver.findElement(By.css('.entropy'))
3945 .sendKeys("0123456789abcdef
"); // 6 words
3946 driver.executeScript(function() {
3947 $(".mnemonic
-length
").val("12").trigger("change
");
3949 driver.findElement(By.css(".weak
-entropy
-override
-warning
"))
3950 .getAttribute("class")
3951 .then(function(classes) {
3952 expect(classes).not.toContain("hidden
");
3957 it('Does not show a warning if entropy is stronger than mnemonic length', function(done) {
3958 driver.findElement(By.css('.use-entropy'))
3960 driver.findElement(By.css('.entropy'))
3961 .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef
"); // 18 words
3962 driver.executeScript(function() {
3963 $(".mnemonic
-length
").val("12").trigger("change
");
3965 driver.findElement(By.css(".weak
-entropy
-override
-warning
"))
3966 .getAttribute("class")
3967 .then(function(classes) {
3968 expect(classes).toContain("hidden
");
3973 it('Shows litecoin BIP49 addresses', function(done) {
3974 driver.findElement(By.css('.phrase'))
3975 .sendKeys('abandon abandon ability');
3976 selectNetwork("LTC
- Litecoin
");
3977 driver.findElement(By.css('#bip49-tab a'))
3979 // bip49 addresses are shown
3980 driver.sleep(generateDelay).then(function() {
3981 driver.findElement(By.css('#bip49 .available'))
3982 .getAttribute("class")
3983 .then(function(classes) {
3984 expect(classes).not.toContain("hidden
");
3985 // check first address
3986 getFirstAddress(function(address) {
3987 expect(address).toBe("MFwLPhsXoBuSLL8cLmW9uK6tChkzduV8qN
");
3994 it('Can use root keys to generate segwit table rows', function(done) {
3995 // segwit uses ypub / zpub instead of xpub but the root key should still
3996 // be valid regardless of the encoding used to import that key.
3997 // Maybe this breaks the reason for the different extended key prefixes, but
3998 // since the parsed root key is used behind the scenes anyhow this should be
4000 driver.findElement(By.css('#root-key'))
4001 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
4002 driver.findElement(By.css('#bip49-tab a'))
4004 // bip49 addresses are shown
4005 driver.sleep(generateDelay).then(function() {
4006 getFirstAddress(function(address) {
4007 expect(address).toBe("3QG2Y9AA4xZ846gKHZqNf7mvVKbLqMKxr2
");