diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-10-31 13:34:53 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-10-31 13:34:53 +1100 |
commit | 0f6b34d68b26bfbc60bf19ce6b74b9e16d585d4e (patch) | |
tree | 2057c9294ad2e1a2d9438cb716d78a0c2e3293fd | |
parent | 2a01f39de7a447b69816f06d44f40be20b670850 (diff) | |
download | BIP39-0f6b34d68b26bfbc60bf19ce6b74b9e16d585d4e.tar.gz BIP39-0f6b34d68b26bfbc60bf19ce6b74b9e16d585d4e.tar.zst BIP39-0f6b34d68b26bfbc60bf19ce6b74b9e16d585d4e.zip |
Release v0.2.8
-rw-r--r-- | bip39-standalone.html | 168 | ||||
-rw-r--r-- | changelog.md | 7 | ||||
-rw-r--r-- | src/index.html | 2 |
3 files changed, 171 insertions, 6 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index 594824e..f287e13 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -118,7 +118,7 @@ | |||
118 | <div class="container"> | 118 | <div class="container"> |
119 | 119 | ||
120 | <h1 class="text-center">Mnemonic Code Converter</h1> | 120 | <h1 class="text-center">Mnemonic Code Converter</h1> |
121 | <p class="version">v0.2.7</p> | 121 | <p class="version">v0.2.8</p> |
122 | <hr> | 122 | <hr> |
123 | <div class="row"> | 123 | <div class="row"> |
124 | <div class="col-md-12"> | 124 | <div class="col-md-12"> |
@@ -579,6 +579,16 @@ | |||
579 | <div class="col-md-12"> | 579 | <div class="col-md-12"> |
580 | <h2>Derived Addresses</h2> | 580 | <h2>Derived Addresses</h2> |
581 | <p>Note these addreses are derived from the BIP32 Extended Key</p> | 581 | <p>Note these addreses are derived from the BIP32 Extended Key</p> |
582 | </div> | ||
583 | <div class="col-md-12 use-bitpay-addresses-container hidden"> | ||
584 | <div class="checkbox"> | ||
585 | <label> | ||
586 | <input type="checkbox" class="use-bitpay-addresses"> | ||
587 | <span>Use BitPay-style addresses for Bitcoin Cash (ie starting with 'C' instead of '1')</span> | ||
588 | </label> | ||
589 | </div> | ||
590 | </div> | ||
591 | <div class="col-md-12"> | ||
582 | <table class="table table-striped"> | 592 | <table class="table table-striped"> |
583 | <thead> | 593 | <thead> |
584 | <th> | 594 | <th> |
@@ -22400,6 +22410,61 @@ bitcoinjs.bitcoin.networks.fujicoin = { | |||
22400 | scriptHash: 0x10, | 22410 | scriptHash: 0x10, |
22401 | wif: 0xa4 | 22411 | wif: 0xa4 |
22402 | }; | 22412 | }; |
22413 | |||
22414 | bitcoinjs.bitcoin.networks.nubits = { | ||
22415 | messagePrefix: '\x18Nu Signed Message:\n', | ||
22416 | bip32: { | ||
22417 | public: 0x0488b21e, | ||
22418 | private: 0x0488ade4 | ||
22419 | }, | ||
22420 | pubKeyHash: 0x19, | ||
22421 | scriptHash: 0x1a, | ||
22422 | wif: 0x96, | ||
22423 | }; | ||
22424 | |||
22425 | bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = { | ||
22426 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
22427 | bip32: { | ||
22428 | public: 0x0488b21e, | ||
22429 | private: 0x0488ade4 | ||
22430 | }, | ||
22431 | pubKeyHash: 0x1c, | ||
22432 | scriptHash: 0x28, | ||
22433 | wif: 0x80 | ||
22434 | }; | ||
22435 | |||
22436 | bitcoinjs.bitcoin.networks.bitcoinBip49 = { | ||
22437 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
22438 | bip32: { | ||
22439 | public: 0x049d7cb2, | ||
22440 | private: 0x049d7878 | ||
22441 | }, | ||
22442 | pubKeyHash: 0x00, | ||
22443 | scriptHash: 0x05, | ||
22444 | wif: 0x80 | ||
22445 | }; | ||
22446 | |||
22447 | bitcoinjs.bitcoin.networks.testnetBip49 = { | ||
22448 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
22449 | bip32: { | ||
22450 | public: 0x044a5262, | ||
22451 | private: 0x044a4e28 | ||
22452 | }, | ||
22453 | pubKeyHash: 0x6f, | ||
22454 | scriptHash: 0xc4, | ||
22455 | wif: 0xef | ||
22456 | }; | ||
22457 | |||
22458 | bitcoinjs.bitcoin.networks.litecoinBip49 = { | ||
22459 | messagePrefix: '\x19Litecoin Signed Message:\n', | ||
22460 | bip32: { | ||
22461 | public: 0x01b26ef6, | ||
22462 | private: 0x01b26792 | ||
22463 | }, | ||
22464 | pubKeyHash: 0x30, | ||
22465 | scriptHash: 0x32, | ||
22466 | wif: 0xb0 | ||
22467 | }; | ||
22403 | </script> | 22468 | </script> |
22404 | <script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | 22469 | <script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
22405 | (function (global){ | 22470 | (function (global){ |
@@ -45988,6 +46053,8 @@ window.Entropy = new (function() { | |||
45988 | DOM.generatedStrength = $(".generate-container .strength"); | 46053 | DOM.generatedStrength = $(".generate-container .strength"); |
45989 | DOM.hardenedAddresses = $(".hardened-addresses"); | 46054 | DOM.hardenedAddresses = $(".hardened-addresses"); |
45990 | DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh"); | 46055 | DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh"); |
46056 | DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container"); | ||
46057 | DOM.useBitpayAddresses = $(".use-bitpay-addresses"); | ||
45991 | DOM.addresses = $(".addresses"); | 46058 | DOM.addresses = $(".addresses"); |
45992 | DOM.rowsToAdd = $(".rows-to-add"); | 46059 | DOM.rowsToAdd = $(".rows-to-add"); |
45993 | DOM.more = $(".more"); | 46060 | DOM.more = $(".more"); |
@@ -46022,7 +46089,7 @@ window.Entropy = new (function() { | |||
46022 | DOM.bip44change.on("input", calcForDerivationPath); | 46089 | DOM.bip44change.on("input", calcForDerivationPath); |
46023 | DOM.bip49account.on("input", calcForDerivationPath); | 46090 | DOM.bip49account.on("input", calcForDerivationPath); |
46024 | DOM.bip49change.on("input", calcForDerivationPath); | 46091 | DOM.bip49change.on("input", calcForDerivationPath); |
46025 | DOM.tab.on("shown.bs.tab", calcForDerivationPath); | 46092 | DOM.tab.on("shown.bs.tab", tabChanged); |
46026 | DOM.hardenedAddresses.on("change", calcForDerivationPath); | 46093 | DOM.hardenedAddresses.on("change", calcForDerivationPath); |
46027 | DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath); | 46094 | DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath); |
46028 | DOM.indexToggle.on("click", toggleIndexes); | 46095 | DOM.indexToggle.on("click", toggleIndexes); |
@@ -46030,6 +46097,7 @@ window.Entropy = new (function() { | |||
46030 | DOM.publicKeyToggle.on("click", togglePublicKeys); | 46097 | DOM.publicKeyToggle.on("click", togglePublicKeys); |
46031 | DOM.privateKeyToggle.on("click", togglePrivateKeys); | 46098 | DOM.privateKeyToggle.on("click", togglePrivateKeys); |
46032 | DOM.languages.on("click", languageChanged); | 46099 | DOM.languages.on("click", languageChanged); |
46100 | DOM.useBitpayAddresses.on("change", useBitpayAddressesChange); | ||
46033 | setQrEvents(DOM.showQrEls); | 46101 | setQrEvents(DOM.showQrEls); |
46034 | disableForms(); | 46102 | disableForms(); |
46035 | hidePending(); | 46103 | hidePending(); |
@@ -46044,6 +46112,7 @@ window.Entropy = new (function() { | |||
46044 | clearDerivedKeys(); | 46112 | clearDerivedKeys(); |
46045 | clearAddressesList(); | 46113 | clearAddressesList(); |
46046 | DOM.litecoinLtubContainer.addClass("hidden"); | 46114 | DOM.litecoinLtubContainer.addClass("hidden"); |
46115 | DOM.useBitpayAddressesContainer.addClass("hidden"); | ||
46047 | var networkIndex = e.target.value; | 46116 | var networkIndex = e.target.value; |
46048 | var network = networks[networkIndex]; | 46117 | var network = networks[networkIndex]; |
46049 | network.onSelect(); | 46118 | network.onSelect(); |
@@ -46123,6 +46192,35 @@ window.Entropy = new (function() { | |||
46123 | calcForDerivationPath(); | 46192 | calcForDerivationPath(); |
46124 | } | 46193 | } |
46125 | 46194 | ||
46195 | function tabChanged() { | ||
46196 | showPending(); | ||
46197 | adjustNetworkForBip49(); | ||
46198 | var phrase = DOM.phrase.val(); | ||
46199 | if (phrase != "") { | ||
46200 | // Calculate and display for mnemonic | ||
46201 | var errorText = findPhraseErrors(phrase); | ||
46202 | if (errorText) { | ||
46203 | showValidationError(errorText); | ||
46204 | return; | ||
46205 | } | ||
46206 | // Calculate and display | ||
46207 | var passphrase = DOM.passphrase.val(); | ||
46208 | calcBip32RootKeyFromSeed(phrase, passphrase); | ||
46209 | } | ||
46210 | else { | ||
46211 | // Calculate and display for root key | ||
46212 | var rootKeyBase58 = DOM.rootKey.val(); | ||
46213 | var errorText = validateRootKey(rootKeyBase58); | ||
46214 | if (errorText) { | ||
46215 | showValidationError(errorText); | ||
46216 | return; | ||
46217 | } | ||
46218 | // Calculate and display | ||
46219 | calcBip32RootKeyFromBase58(rootKeyBase58); | ||
46220 | } | ||
46221 | calcForDerivationPath(); | ||
46222 | } | ||
46223 | |||
46126 | function delayedEntropyChanged() { | 46224 | function delayedEntropyChanged() { |
46127 | hideValidationError(); | 46225 | hideValidationError(); |
46128 | showPending(); | 46226 | showPending(); |
@@ -46260,6 +46358,11 @@ window.Entropy = new (function() { | |||
46260 | }, 50); | 46358 | }, 50); |
46261 | } | 46359 | } |
46262 | 46360 | ||
46361 | function useBitpayAddressesChange() { | ||
46362 | setBitcoinCashNetworkValues(); | ||
46363 | phraseChanged(); | ||
46364 | } | ||
46365 | |||
46263 | function toggleIndexes() { | 46366 | function toggleIndexes() { |
46264 | showIndex = !showIndex; | 46367 | showIndex = !showIndex; |
46265 | $("td.index span").toggleClass("invisible"); | 46368 | $("td.index span").toggleClass("invisible"); |
@@ -46548,12 +46651,16 @@ window.Entropy = new (function() { | |||
46548 | })()); | 46651 | })()); |
46549 | } | 46652 | } |
46550 | 46653 | ||
46654 | function P2wpkhNestedInP2shSelected() { | ||
46655 | return bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh()); | ||
46656 | } | ||
46657 | |||
46551 | function TableRow(index, isLast) { | 46658 | function TableRow(index, isLast) { |
46552 | 46659 | ||
46553 | var self = this; | 46660 | var self = this; |
46554 | this.shouldGenerate = true; | 46661 | this.shouldGenerate = true; |
46555 | var useHardenedAddresses = DOM.hardenedAddresses.prop("checked"); | 46662 | var useHardenedAddresses = DOM.hardenedAddresses.prop("checked"); |
46556 | var isP2wpkhNestedInP2sh = bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh()); | 46663 | var isP2wpkhNestedInP2sh = P2wpkhNestedInP2shSelected(); |
46557 | var p2wpkhNestedInP2shAvailable = networkHasBip49(); | 46664 | var p2wpkhNestedInP2shAvailable = networkHasBip49(); |
46558 | 46665 | ||
46559 | function init() { | 46666 | function init() { |
@@ -47120,12 +47227,55 @@ window.Entropy = new (function() { | |||
47120 | DOM.useP2wpkhNestedInP2sh.prop("checked", false); | 47227 | DOM.useP2wpkhNestedInP2sh.prop("checked", false); |
47121 | } | 47228 | } |
47122 | 47229 | ||
47230 | function useBitpayAddresses() { | ||
47231 | return !(DOM.useBitpayAddresses.prop("checked")); | ||
47232 | } | ||
47233 | |||
47234 | function setBitcoinCashNetworkValues() { | ||
47235 | if (useBitpayAddresses()) { | ||
47236 | network = bitcoinjs.bitcoin.networks.bitcoin; | ||
47237 | } | ||
47238 | else { | ||
47239 | network = bitcoinjs.bitcoin.networks.bitcoinCashBitbpay; | ||
47240 | } | ||
47241 | } | ||
47242 | |||
47243 | function adjustNetworkForBip49() { | ||
47244 | // If bip49 is selected the xpub/xprv prefixes need to be adjusted | ||
47245 | // to avoid accidentally importing BIP49 xpub to BIP44 watch only | ||
47246 | // wallet. | ||
47247 | // See https://github.com/iancoleman/bip39/issues/125 | ||
47248 | if (P2wpkhNestedInP2shSelected()) { | ||
47249 | if (network == bitcoinjs.bitcoin.networks.bitcoin) { | ||
47250 | network = bitcoinjs.bitcoin.networks.bitcoinBip49; | ||
47251 | } | ||
47252 | else if (network == bitcoinjs.bitcoin.networks.testnet) { | ||
47253 | network = bitcoinjs.bitcoin.networks.testnetBip49; | ||
47254 | } | ||
47255 | else if (network == bitcoinjs.bitcoin.networks.litecoin) { | ||
47256 | network = bitcoinjs.bitcoin.networks.litecoinBip49; | ||
47257 | } | ||
47258 | } | ||
47259 | else { | ||
47260 | if (network == bitcoinjs.bitcoin.networks.bitcoinBip49) { | ||
47261 | network = bitcoinjs.bitcoin.networks.bitcoin; | ||
47262 | } | ||
47263 | else if (network == bitcoinjs.bitcoin.networks.testnetBip49) { | ||
47264 | network = bitcoinjs.bitcoin.networks.testnet; | ||
47265 | } | ||
47266 | else if (network == bitcoinjs.bitcoin.networks.litecoinBip49) { | ||
47267 | network = bitcoinjs.bitcoin.networks.litecoin; | ||
47268 | } | ||
47269 | } | ||
47270 | } | ||
47271 | |||
47123 | var networks = [ | 47272 | var networks = [ |
47124 | { | 47273 | { |
47125 | name: "BCH - Bitcoin Cash", | 47274 | name: "BCH - Bitcoin Cash", |
47126 | p2wpkhNestedInP2shAvailable: false, | 47275 | p2wpkhNestedInP2shAvailable: false, |
47127 | onSelect: function() { | 47276 | onSelect: function() { |
47128 | network = bitcoinjs.bitcoin.networks.bitcoin; | 47277 | DOM.useBitpayAddressesContainer.removeClass("hidden"); |
47278 | setBitcoinCashNetworkValues(); | ||
47129 | setHdCoin(145); | 47279 | setHdCoin(145); |
47130 | }, | 47280 | }, |
47131 | }, | 47281 | }, |
@@ -47219,7 +47369,7 @@ window.Entropy = new (function() { | |||
47219 | }, | 47369 | }, |
47220 | { | 47370 | { |
47221 | name: "LTC - Litecoin", | 47371 | name: "LTC - Litecoin", |
47222 | p2wpkhNestedInP2shAvailable: false, | 47372 | p2wpkhNestedInP2shAvailable: true, |
47223 | onSelect: function() { | 47373 | onSelect: function() { |
47224 | network = bitcoinjs.bitcoin.networks.litecoin; | 47374 | network = bitcoinjs.bitcoin.networks.litecoin; |
47225 | setHdCoin(2); | 47375 | setHdCoin(2); |
@@ -47300,6 +47450,14 @@ window.Entropy = new (function() { | |||
47300 | }, | 47450 | }, |
47301 | }, | 47451 | }, |
47302 | { | 47452 | { |
47453 | name: "USNBT - NuBits", | ||
47454 | p2wpkhNestedInP2shAvailable: false, | ||
47455 | onSelect: function() { | ||
47456 | network = bitcoinjs.bitcoin.networks.nubits; | ||
47457 | setHdCoin(12); | ||
47458 | }, | ||
47459 | }, | ||
47460 | { | ||
47303 | name: "VIA - Viacoin", | 47461 | name: "VIA - Viacoin", |
47304 | p2wpkhNestedInP2shAvailable: false, | 47462 | p2wpkhNestedInP2shAvailable: false, |
47305 | onSelect: function() { | 47463 | onSelect: function() { |
diff --git a/changelog.md b/changelog.md index 52bd10b..fa98802 100644 --- a/changelog.md +++ b/changelog.md | |||
@@ -1,3 +1,10 @@ | |||
1 | # 0.2.8 | ||
2 | |||
3 | * Enable segwit for Litecoin | ||
4 | * BitPay-style addresses for Bitcoin Cash | ||
5 | * Use new xpub/xprv prefixes for Segwit BIP49 | ||
6 | * Add nubits network | ||
7 | |||
1 | # 0.2.7 | 8 | # 0.2.7 |
2 | 9 | ||
3 | * Add Fujicoin | 10 | * Add Fujicoin |
diff --git a/src/index.html b/src/index.html index 9da3e25..cdd2ab2 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -114,7 +114,7 @@ | |||
114 | <div class="container"> | 114 | <div class="container"> |
115 | 115 | ||
116 | <h1 class="text-center">Mnemonic Code Converter</h1> | 116 | <h1 class="text-center">Mnemonic Code Converter</h1> |
117 | <p class="version">v0.2.7</p> | 117 | <p class="version">v0.2.8</p> |
118 | <hr> | 118 | <hr> |
119 | <div class="row"> | 119 | <div class="row"> |
120 | <div class="col-md-12"> | 120 | <div class="col-md-12"> |