Compare commits

...

17 Commits
0.2.8 ... 0.3.0

Author SHA1 Message Date
Ian Coleman
cf6c204497 Release v0.3.0 2017-11-22 13:34:58 +11:00
Ian Coleman
c49e881294 Add BIP141 tab for full segwit compatibility 2017-11-22 13:03:47 +11:00
Ian Coleman
0fd67b5915 Remove segwit from bip32 tab
This option will be added in the future to a bip141 tab
2017-11-22 09:59:58 +11:00
Ian Coleman
1c2b8c6b2d Use ltub for litecoin by default instead of xprv
Introduced when upgrading from bitcoinjs-lib v3.3.0
2017-11-22 09:40:35 +11:00
Ian Coleman
9f59e99bec Update bitcoinjs from v3.1.1 to v3.3.0 2017-11-22 09:19:14 +11:00
Ian Coleman
924727ed26 Release v0.2.9 2017-11-21 12:17:28 +11:00
Ian Coleman
9183f9f658 Allow more rows to be generated at a custom index 2017-11-21 12:06:56 +11:00
Ian Coleman
f487fea9b8 Fix ordering of networks to be alphabetical 2017-11-16 15:11:01 +11:00
Ian Coleman
5a10834a36 Add test for monacoin 2017-11-16 15:09:56 +11:00
Ian Coleman
1f354b0390 Add test for Bitcoin Gold network 2017-11-16 15:09:37 +11:00
Ian Coleman
0460b53f3a Use selenium for tests instead of phantomjs 2017-11-16 14:37:17 +11:00
iancoleman
e8ee368f18 Merge pull request #129 from rsnel/bgold
add BTG (Bitcoin Gold/bgold)
2017-11-15 08:53:38 +11:00
iancoleman
107edb3454 Merge pull request #126 from monautils/master
add monacoin
2017-11-15 08:53:25 +11:00
Rik Snel
3960807353 add BTG (Bitcoin Gold/bgold) 2017-11-14 09:05:50 +01:00
you21979
214c584c40 fix new secret_key https://github.com/monacoinproject/monacoin/blob/master-0.14/src/chainparams.cpp#L135 2017-11-09 19:17:16 +09:00
you21979
c1396e87ed add monacoin 2017-11-09 17:21:07 +09:00
Ian Coleman
b57b721e2c Fix web link from github.io to iancoleman.io 2017-11-01 09:32:18 +11:00
13 changed files with 23840 additions and 7127 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,18 @@
# 0.3.0
* Update bitcoinjs from 3.1.1 to 3.3.0
* Litecoin defaults to ltub instead of xpub
* Segwit option removed from bip32 tab
* BIP141 tab added for full segwit compatibility
# 0.2.9
* Update links from old site to new site
* Add Monacoin
* Add Bitcoin Gold
* Port test suite to selenium
* Allow more rows to be generated starting from a custom index
# 0.2.8
* Enable segwit for Litecoin

View File

@@ -4,7 +4,7 @@ A tool for converting BIP39 mnemonic phrases to addresses and private keys.
## Online Version
https://iancoleman.github.io/bip39/
https://iancoleman.io/bip39/
## Standalone offline version
@@ -62,12 +62,25 @@ please do not commit changes to `bip39-standalone.html`
# Tests
Tests depend on [phantomjs](http://phantomjs.org/).
Tests depend on
* nodejs
* selenium webdriver - cd /path/to/bip39/tests; npm install
* selenium driver for firefox ([geckodriver](https://github.com/mozilla/geckodriver/releases)) and / or chrome ([chromedriver](https://sites.google.com/a/chromium.org/chromedriver/downloads))
* jasmine - npm install --global jasmine
Before running tests, the site must be served at http://localhost:8000.
```
$ cd /path/to/bip39/src
$ python -m http.server
```
Run tests from the command-line
```
$ phantomjs tests.js
$ cd /path/to/bip39/tests
$ jasmine spec/tests.js
```
# License

View File

@@ -114,7 +114,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.2.8</p>
<p class="version">v0.3.0</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -277,7 +277,7 @@
<label for="litecoin-use-ltub" class="col-sm-2 control-label">Prefixes</label>
<div class="col-sm-10 checkbox">
<label>
<input type="checkbox" id="litecoin-use-ltub" class="litecoin-use-ltub">
<input type="checkbox" id="litecoin-use-ltub" class="litecoin-use-ltub" checked="checked">
Use <code>Ltpv / Ltub</code> instead of <code>xprv / xpub</code>
</label>
</div>
@@ -301,6 +301,9 @@
<li id="bip49-tab">
<a href="#bip49" role="tab" data-toggle="tab">BIP49</a>
</li>
<li id="bip141-tab">
<a href="#bip141" role="tab" data-toggle="tab">BIP141</a>
</li>
</ul>
<div class="derivation-type tab-content">
<div id="bip44" class="tab-pane active">
@@ -415,13 +418,6 @@
<span>Use hardened addresses</span>
</label>
</div>
<div class="form-group">
<div class="col-sm-2"></div>
<label class="col-sm-10">
<input class="p2wpkh-nested-in-p2sh" type="checkbox">
<span>Use SegWit addresses (ie P2WPKH Nested In P2SH)</span>
</label>
</div>
<div class="form-group">
<label for="core-path" class="col-sm-2 control-label">Bitcoin Core</label>
<div class="col-sm-10">
@@ -551,6 +547,43 @@
</div>
</form>
</div>
<div id="bip141" class="tab-pane">
<form class="form-horizontal" role="form">
<br>
<div class="unavailable hidden">
<div class="form-group">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<p>BIP141 is unavailable for this coin.</p>
</div>
</div>
</div>
<div class="available">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<p>
For more info see the
<a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki" target="_blank">BIP141 spec</a>
</p>
</div>
<div class="form-group">
<label for="bip141-path" class="col-sm-2 control-label">BIP32 Derivation Path</label>
<div class="col-sm-10">
<input id="bip141-path" type="text" class="bip141-path form-control" value="m/0">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Script Semantics</label>
<div class="col-sm-10">
<select class="form-control bip141-semantics">
<option value="p2wpkh">P2WPKH</option>
<option value="p2wpkh-p2sh" selected>P2WPKH nested in P2SH</option>
</select>
</div>
</div>
</div>
</form>
</div>
</div>
<form class="form-horizontal" role="form">
<div class="form-group">
@@ -622,9 +655,12 @@
</table>
</div>
</div>
<span>Show more rows</span>:
<span>Show</span>
<input type="number" class="rows-to-add" value="20">
<button class="more">Show</button>
<button class="more">more rows</button>
<span>starting from index</span>
<input type="number" class="more-rows-start-index">
<span>(leave blank to generate from next index)</span>
<hr>
@@ -832,8 +868,9 @@
<script src="js/bootstrap.min.js"></script>
<script src="js/levenshtein.js"></script>
<script src="js/jquery.qrcode.min.js"></script>
<script src="js/bitcoinjs-3-1-1.js"></script>
<script src="js/bitcoinjs-3.3.0.js"></script>
<script src="js/bitcoinjs-extensions.js"></script>
<script src="js/segwit-parameters.js"></script>
<script src="js/ethereumjs-util.js"></script>
<script src="js/ripple-util.js"></script>
<script src="js/sjcl-bip39.js"></script>

File diff suppressed because it is too large Load Diff

View File

@@ -251,6 +251,17 @@ bitcoinjs.bitcoin.networks.nubits = {
wif: 0x96,
};
bitcoinjs.bitcoin.networks.bgold = {
messagePrefix: 'unused',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 38,
scriptHash: 23,
wif: 128
};
bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
@@ -262,33 +273,22 @@ bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = {
wif: 0x80
};
bitcoinjs.bitcoin.networks.bitcoinBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bitcoinjs.bitcoin.networks.monacoin = {
messagePrefix: '\x18Monacoin Signed Message:\n',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80
pubKeyHash: 0x32,
scriptHash: 0x37,
wif: 0xb0
};
bitcoinjs.bitcoin.networks.testnetBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
bitcoinjs.bitcoin.networks.litecoinBip49 = {
bitcoinjs.bitcoin.networks.litecoinXprv = {
messagePrefix: '\x19Litecoin Signed Message:\n',
bip32: {
public: 0x01b26ef6,
private: 0x01b26792
public: 0x0488b21e,
private: 0x0488ade4,
},
pubKeyHash: 0x30,
scriptHash: 0x32,

View File

@@ -14,7 +14,7 @@
var showPubKey = true;
var showPrivKey = true;
var showQr = false;
var litecoinUseLtub = false;
var litecoinUseLtub = true;
var entropyChangeTimeoutEvent = null;
var phraseChangeTimeoutEvent = null;
@@ -52,6 +52,7 @@
DOM.bip32tab = $("#bip32-tab");
DOM.bip44tab = $("#bip44-tab");
DOM.bip49tab = $("#bip49-tab");
DOM.bip141tab = $("#bip141-tab");
DOM.bip32panel = $("#bip32");
DOM.bip44panel = $("#bip44");
DOM.bip49panel = $("#bip49");
@@ -72,14 +73,18 @@
DOM.bip49accountXprv = $("#bip49 .account-xprv");
DOM.bip49accountXpub = $("#bip49 .account-xpub");
DOM.bip49change = $("#bip49 .change");
DOM.bip141unavailable = $("#bip141 .unavailable");
DOM.bip141available = $("#bip141 .available");
DOM.bip141path = $("#bip141-path");
DOM.bip141semantics = $(".bip141-semantics");
DOM.generatedStrength = $(".generate-container .strength");
DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh");
DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container");
DOM.useBitpayAddresses = $(".use-bitpay-addresses");
DOM.addresses = $(".addresses");
DOM.rowsToAdd = $(".rows-to-add");
DOM.more = $(".more");
DOM.moreRowsStartIndex = $(".more-rows-start-index");
DOM.feedback = $(".feedback");
DOM.tab = $(".derivation-type a");
DOM.indexToggle = $(".index-toggle");
@@ -111,9 +116,10 @@
DOM.bip44change.on("input", calcForDerivationPath);
DOM.bip49account.on("input", calcForDerivationPath);
DOM.bip49change.on("input", calcForDerivationPath);
DOM.bip141path.on("input", calcForDerivationPath);
DOM.bip141semantics.on("change", tabChanged);
DOM.tab.on("shown.bs.tab", tabChanged);
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
DOM.addressToggle.on("click", toggleAddresses);
DOM.publicKeyToggle.on("click", togglePublicKeys);
@@ -138,11 +144,12 @@
var networkIndex = e.target.value;
var network = networks[networkIndex];
network.onSelect();
if (network.p2wpkhNestedInP2shAvailable) {
showP2wpkhNestedInP2shAvailable();
if (network.segwitAvailable) {
adjustNetworkForSegwit();
showSegwitAvailable();
}
else {
showP2wpkhNestedInP2shUnavailable();
showSegwitUnavailable();
}
if (seed != null) {
phraseChanged();
@@ -216,7 +223,7 @@
function tabChanged() {
showPending();
adjustNetworkForBip49();
adjustNetworkForSegwit();
var phrase = DOM.phrase.val();
if (phrase != "") {
// Calculate and display for mnemonic
@@ -317,10 +324,10 @@
function litecoinUseLtubChanged() {
litecoinUseLtub = DOM.litecoinUseLtub.prop("checked");
if (litecoinUseLtub) {
network = bitcoinjs.bitcoin.networks.litecoinLtub;
network = bitcoinjs.bitcoin.networks.litecoin;
}
else {
network = bitcoinjs.bitcoin.networks.litecoin;
network = bitcoinjs.bitcoin.networks.litecoinXprv;
}
phraseChanged();
}
@@ -329,8 +336,8 @@
clearDerivedKeys();
clearAddressesList();
showPending();
// Don't show bip49 if it's selected but network doesn't support it
if (bip49TabSelected() && !networkHasBip49()) {
// Don't show segwit if it's selected but network doesn't support it
if (segwitSelected() && !networkHasSegwit()) {
return;
}
// Get the derivation path
@@ -344,7 +351,7 @@
if (bip44TabSelected()) {
displayBip44Info();
}
if (bip49TabSelected()) {
else if (bip49TabSelected()) {
displayBip49Info();
}
displayBip32Info();
@@ -524,7 +531,7 @@
console.log("Using derivation path from BIP44 tab: " + derivationPath);
return derivationPath;
}
if (bip49TabSelected()) {
else if (bip49TabSelected()) {
var purpose = parseIntNoNaN(DOM.bip49purpose.val(), 49);
var coin = parseIntNoNaN(DOM.bip49coin.val(), 0);
var account = parseIntNoNaN(DOM.bip49account.val(), 0);
@@ -544,6 +551,11 @@
console.log("Using derivation path from BIP32 tab: " + derivationPath);
return derivationPath;
}
else if (bip141TabSelected()) {
var derivationPath = DOM.bip141path.val();
console.log("Using derivation path from BIP141 tab: " + derivationPath);
return derivationPath;
}
else {
console.log("Unknown derivation path");
}
@@ -673,8 +685,17 @@
})());
}
function P2wpkhNestedInP2shSelected() {
return bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
function segwitSelected() {
return bip49TabSelected() || bip141TabSelected();
}
function p2wpkhSelected() {
return bip141TabSelected() && DOM.bip141semantics.val() == "p2wpkh";
}
function p2wpkhInP2shSelected() {
return bip49TabSelected() ||
(bip141TabSelected() && DOM.bip141semantics.val() == "p2wpkh-p2sh");
}
function TableRow(index, isLast) {
@@ -682,8 +703,10 @@
var self = this;
this.shouldGenerate = true;
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
var isP2wpkhNestedInP2sh = P2wpkhNestedInP2shSelected();
var p2wpkhNestedInP2shAvailable = networkHasBip49();
var isSegwit = segwitSelected();
var segwitAvailable = networkHasSegwit();
var isP2wpkh = p2wpkhSelected();
var isP2wpkhInP2sh = p2wpkhInP2shSelected();
function init() {
calculateValues();
@@ -727,16 +750,23 @@
privkey = convertRipplePriv(privkey);
address = convertRippleAdrr(address);
}
// BIP49 addresses are different
if (isP2wpkhNestedInP2sh) {
if (!p2wpkhNestedInP2shAvailable) {
// Segwit addresses are different
if (isSegwit) {
if (!segwitAvailable) {
return;
}
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
var scriptsig = bitcoinjs.bitcoin.script.witnessPubKeyHash.output.encode(keyhash);
var addressbytes = bitcoinjs.bitcoin.crypto.hash160(scriptsig);
var scriptpubkey = bitcoinjs.bitcoin.script.scriptHash.output.encode(addressbytes);
address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
if (isP2wpkh) {
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
var scriptpubkey = bitcoinjs.bitcoin.script.witnessPubKeyHash.output.encode(keyhash);
address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
}
else if (isP2wpkhInP2sh) {
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
var scriptsig = bitcoinjs.bitcoin.script.witnessPubKeyHash.output.encode(keyhash);
var addressbytes = bitcoinjs.bitcoin.crypto.hash160(scriptsig);
var scriptpubkey = bitcoinjs.bitcoin.script.scriptHash.output.encode(addressbytes);
address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
}
}
addAddressToList(indexText, address, pubkey, privkey);
if (isLast) {
@@ -750,12 +780,19 @@
}
function showMore() {
var start = DOM.addresses.children().length;
var rowsToAdd = parseInt(DOM.rowsToAdd.val());
if (isNaN(rowsToAdd)) {
rowsToAdd = 20;
DOM.rowsToAdd.val("20");
}
var start = parseInt(DOM.moreRowsStartIndex.val())
if (isNaN(start)) {
start = lastIndexInTable() + 1;
}
else {
var newStart = start + rowsToAdd;
DOM.moreRowsStartIndex.val(newStart);
}
if (rowsToAdd > 200) {
var msg = "Generating " + rowsToAdd + " rows could take a while. ";
msg += "Do you want to continue?";
@@ -1219,34 +1256,35 @@
return DOM.bip32tab.hasClass("active");
}
function useP2wpkhNestedInP2sh() {
return DOM.useP2wpkhNestedInP2sh.prop("checked");
}
function networkHasBip49() {
return networks[DOM.network.val()].p2wpkhNestedInP2shAvailable;
function networkHasSegwit() {
return networks[DOM.network.val()].segwitAvailable;
}
function bip49TabSelected() {
return DOM.bip49tab.hasClass("active");
}
function bip141TabSelected() {
return DOM.bip141tab.hasClass("active");
}
function setHdCoin(coinValue) {
DOM.bip44coin.val(coinValue);
DOM.bip49coin.val(coinValue);
}
function showP2wpkhNestedInP2shAvailable() {
function showSegwitAvailable() {
DOM.bip49unavailable.addClass("hidden");
DOM.bip49available.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", false);
DOM.bip141unavailable.addClass("hidden");
DOM.bip141available.removeClass("hidden");
}
function showP2wpkhNestedInP2shUnavailable() {
function showSegwitUnavailable() {
DOM.bip49available.addClass("hidden");
DOM.bip49unavailable.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", true);
DOM.useP2wpkhNestedInP2sh.prop("checked", false);
DOM.bip141available.addClass("hidden");
DOM.bip141unavailable.removeClass("hidden");
}
function useBitpayAddresses() {
@@ -1262,39 +1300,38 @@
}
}
function adjustNetworkForBip49() {
// If bip49 is selected the xpub/xprv prefixes need to be adjusted
function adjustNetworkForSegwit() {
// If segwit is selected the xpub/xprv prefixes need to be adjusted
// to avoid accidentally importing BIP49 xpub to BIP44 watch only
// wallet.
// See https://github.com/iancoleman/bip39/issues/125
if (P2wpkhNestedInP2shSelected()) {
if (network == bitcoinjs.bitcoin.networks.bitcoin) {
network = bitcoinjs.bitcoin.networks.bitcoinBip49;
}
else if (network == bitcoinjs.bitcoin.networks.testnet) {
network = bitcoinjs.bitcoin.networks.testnetBip49;
}
else if (network == bitcoinjs.bitcoin.networks.litecoin) {
network = bitcoinjs.bitcoin.networks.litecoinBip49;
}
var segwitNetworks = null;
// if a segwit network is alread selected, need to use base network to
// look up new parameters
if ("baseNetwork" in network) {
network = bitcoinjs.bitcoin.networks[network.baseNetwork];
}
else {
if (network == bitcoinjs.bitcoin.networks.bitcoinBip49) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else if (network == bitcoinjs.bitcoin.networks.testnetBip49) {
network = bitcoinjs.bitcoin.networks.testnet;
}
else if (network == bitcoinjs.bitcoin.networks.litecoinBip49) {
network = bitcoinjs.bitcoin.networks.litecoin;
}
// choose the right segwit params
if (p2wpkhSelected() && "p2wpkh" in network) {
network = network.p2wpkh;
}
else if (p2wpkhInP2shSelected() && "p2wpkhInP2sh" in network) {
network = network.p2wpkhInP2sh;
}
}
function lastIndexInTable() {
var pathText = DOM.addresses.find(".index").last().text();
var pathBits = pathText.split("/");
var lastBit = pathBits[pathBits.length-1];
var lastBitClean = lastBit.replace("'", "");
return parseInt(lastBitClean);
}
var networks = [
{
name: "BCH - Bitcoin Cash",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
DOM.useBitpayAddressesContainer.removeClass("hidden");
setBitcoinCashNetworkValues();
@@ -1303,7 +1340,7 @@
},
{
name: "BTC - Bitcoin",
p2wpkhNestedInP2shAvailable: true,
segwitAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(0);
@@ -1311,15 +1348,23 @@
},
{
name: "BTC - Bitcoin Testnet",
p2wpkhNestedInP2shAvailable: true,
segwitAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.testnet;
setHdCoin(1);
},
},
{
name: "BTG - Bitcoin Gold",
segwitAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bgold;
setHdCoin(0);
},
},
{
name: "CLAM - Clams",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.clam;
setHdCoin(23);
@@ -1327,7 +1372,7 @@
},
{
name: "CRW - Crown",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.crown;
setHdCoin(72);
@@ -1335,7 +1380,7 @@
},
{
name: "DASH - Dash",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dash;
setHdCoin(5);
@@ -1343,7 +1388,7 @@
},
{
name: "DASH - Dash Testnet",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dashtn;
setHdCoin(1);
@@ -1351,7 +1396,7 @@
},
{
name: "DOGE - Dogecoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dogecoin;
setHdCoin(3);
@@ -1359,7 +1404,7 @@
},
{
name: "ETH - Ethereum",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(60);
@@ -1367,7 +1412,7 @@
},
{
name: "FJC - Fujicoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.fujicoin;
setHdCoin(75);
@@ -1375,7 +1420,7 @@
},
{
name: "GAME - GameCredits",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.game;
setHdCoin(101);
@@ -1383,7 +1428,7 @@
},
{
name: "JBS - Jumbucks",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.jumbucks;
setHdCoin(26);
@@ -1391,7 +1436,7 @@
},
{
name: "LTC - Litecoin",
p2wpkhNestedInP2shAvailable: true,
segwitAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
@@ -1400,16 +1445,23 @@
},
{
name: "MAZA - Maza",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.maza;
setHdCoin(13);
},
},
{
name: "MONA - Monacoin",
segwitAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.monacoin,
setHdCoin(22);
},
},
{
name: "NMC - Namecoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.namecoin;
setHdCoin(7);
@@ -1417,7 +1469,7 @@
},
{
name: "PIVX - PIVX",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivx;
setHdCoin(119);
@@ -1425,7 +1477,7 @@
},
{
name: "PIVX - PIVX Testnet",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivxtestnet;
setHdCoin(1);
@@ -1433,7 +1485,7 @@
},
{
name: "PPC - Peercoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.peercoin;
setHdCoin(6);
@@ -1441,7 +1493,7 @@
},
{
name: "SDC - ShadowCash",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadow;
setHdCoin(35);
@@ -1449,7 +1501,7 @@
},
{
name: "SDC - ShadowCash Testnet",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadowtn;
setHdCoin(1);
@@ -1457,7 +1509,7 @@
},
{
name: "SLM - Slimcoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcoin;
setHdCoin(63);
@@ -1465,7 +1517,7 @@
},
{
name: "SLM - Slimcoin Testnet",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcointn;
setHdCoin(111);
@@ -1473,7 +1525,7 @@
},
{
name: "USNBT - NuBits",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.nubits;
setHdCoin(12);
@@ -1481,7 +1533,7 @@
},
{
name: "VIA - Viacoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacoin;
setHdCoin(14);
@@ -1489,7 +1541,7 @@
},
{
name: "VIA - Viacoin Testnet",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacointestnet;
setHdCoin(1);
@@ -1497,7 +1549,7 @@
},
{
name: "XMY - Myriadcoin",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.myriadcoin;
setHdCoin(90);
@@ -1505,7 +1557,7 @@
},
{
name: "XRP - Ripple",
p2wpkhNestedInP2shAvailable: false,
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(144);

View File

@@ -0,0 +1,58 @@
(function() {
// p2wpkh
bitcoinjs.bitcoin.networks.bitcoin.p2wpkh = {
baseNetwork: "bitcoin",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bc',
bip32: {
public: 0x04b24746,
private: 0x04b2430c
},
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80
};
// p2wpkh in p2sh
bitcoinjs.bitcoin.networks.bitcoin.p2wpkhInP2sh = {
baseNetwork: "bitcoin",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'bc',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
},
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80
};
bitcoinjs.bitcoin.networks.testnet.p2wpkhInP2sh = {
baseNetwork: "testnet",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'tb',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
bitcoinjs.bitcoin.networks.litecoin.p2wpkhInP2sh = {
baseNetwork: "litecoin",
messagePrefix: '\x19Litecoin Signed Message:\n',
bip32: {
public: 0x01b26ef6,
private: 0x01b26792
},
pubKeyHash: 0x30,
scriptHash: 0x32,
wif: 0xb0
};
})();

4473
tests.js

File diff suppressed because it is too large Load Diff

17
tests/package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "tests",
"version": "1.0.0",
"scripts": {
"test": "node tests.js"
},
"author": "Ian coleman",
"description": "Tests for BIP39 tool",
"repository": {
"type": "git",
"url": "git://github.com/iancoleman/bip39.git"
},
"dependencies": {
"selenium-webdriver": "^3.6.0"
},
"license": "MIT"
}

View File

@@ -0,0 +1,11 @@
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}

2646
tests/spec/tests.js Normal file

File diff suppressed because it is too large Load Diff