Compare commits

...

10 Commits

Author SHA1 Message Date
Ian Coleman ccdd300af3 Release v0.3.6 2018-05-08 10:32:56 +10:00
Ian Coleman e0f91e2029 Add cashaddr address format for bitcoin cash 2018-05-08 10:19:59 +10:00
Ian Coleman 956e44efd7 Korean uses ascii spaces, not ideographic spaces 2018-05-08 09:11:30 +10:00
iancoleman 65cef19412 Merge pull request #212 from Coinomi/zcash
Add zcash support
2018-05-08 09:06:07 +10:00
xarakas 0702ecd352 Add zcash support 2018-04-30 17:41:05 +03:00
iancoleman 584dbddd37 Merge pull request #210 from potatohodler/patch/vertcoin
Improve Vertcoin support
2018-04-20 09:45:39 +10:00
iancoleman b08caad07e Merge pull request #207 from Coinomi/kobocoin
Add Kobocoin support
2018-04-20 09:37:28 +10:00
Potato f150f0c03a Adds Segwit support for Vertcoin. 2018-04-18 15:28:31 +02:00
Potato e3bed0bfd0 Fixes the Vertcoin Mainnet version byte. 2018-04-18 15:03:36 +02:00
xarakas 0a5d28a7ad Add Kobocoin support 2018-04-18 14:58:17 +03:00
10 changed files with 18947 additions and 96 deletions
+9445 -47
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -1,3 +1,11 @@
# 0.3.6
* Add Kobocoin
* Update Vertcoin version byte and segwit support
* Add Zcash
* Korean mnemonics use ascii spaces
* Add CashAddr address format for bitcoin cash
# 0.3.5 # 0.3.5
* Fix typo * Fix typo
+17 -4
View File
@@ -15,7 +15,7 @@
<div class="container"> <div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1> <h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.3.5</p> <p class="version">v0.3.6</p>
<hr> <hr>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -608,13 +608,25 @@
<h2>Derived Addresses</h2> <h2>Derived Addresses</h2>
<p>Note these addresses are derived from the BIP32 Extended Key</p> <p>Note these addresses are derived from the BIP32 Extended Key</p>
</div> </div>
<div class="col-md-12 use-bitpay-addresses-container hidden"> <div class="col-md-12 bch-addr-type-container hidden">
<div class="checkbox"> <div class="radio">
<label> <label>
<input type="checkbox" class="use-bitpay-addresses"> <input type="radio" value="cashaddr" name="bch-addr-type" class="use-bch-cashaddr-addresses" checked="checked">
<span>Use CashAddr addresses for Bitcoin Cash (ie starting with 'q' instead of '1')</span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" value="bitpay" name="bch-addr-type" class="use-bch-bitpay-addresses">
<span>Use BitPay-style addresses for Bitcoin Cash (ie starting with 'C' instead of '1')</span> <span>Use BitPay-style addresses for Bitcoin Cash (ie starting with 'C' instead of '1')</span>
</label> </label>
</div> </div>
<div class="radio">
<label>
<input type="radio" value="legacy" name="bch-addr-type" class="use-bch-legacy-addresses">
<span>Use legacy addresses for Bitcoin Cash (ie starting with '1')</span>
</label>
</div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="checkbox"> <div class="checkbox">
@@ -903,6 +915,7 @@
<script src="js/segwit-parameters.js"></script> <script src="js/segwit-parameters.js"></script>
<script src="js/ethereumjs-util.js"></script> <script src="js/ethereumjs-util.js"></script>
<script src="js/ripple-util.js"></script> <script src="js/ripple-util.js"></script>
<script src="js/bchaddrjs-0.2.1.js"></script>
<script src="js/sjcl-bip39.js"></script> <script src="js/sjcl-bip39.js"></script>
<script src="js/wordlist_english.js"></script> <script src="js/wordlist_english.js"></script>
<script src="js/wordlist_japanese.js"></script> <script src="js/wordlist_japanese.js"></script>
File diff suppressed because it is too large Load Diff
+18 -7
View File
@@ -8662,13 +8662,24 @@ function fromBech32 (address) {
} }
function toBase58Check (hash, version) { function toBase58Check (hash, version) {
typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments) if (version < 256){
typeforce(types.tuple(types.Hash160bit, types.UInt8), arguments)
var payload = Buffer.allocUnsafe(21) var payload = Buffer.allocUnsafe(21)
payload.writeUInt8(version, 0) payload.writeUInt8(version, 0)
hash.copy(payload, 1) hash.copy(payload, 1)
return bs58check.encode(payload) return bs58check.encode(payload)
}
else{
typeforce(types.tuple(types.Hash160bit, types.UInt16), arguments)
var payload = Buffer.allocUnsafe(22)
payload.writeUInt16BE(version, 0)
hash.copy(payload, 2)
return bs58check.encode(payload)
}
} }
function toBech32 (data, version, prefix) { function toBech32 (data, version, prefix) {
@@ -12162,8 +12173,8 @@ var Network = typeforce.compile({
public: typeforce.UInt32, public: typeforce.UInt32,
private: typeforce.UInt32 private: typeforce.UInt32
}, },
pubKeyHash: typeforce.UInt8, pubKeyHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16),
scriptHash: typeforce.UInt8, scriptHash: typeforce.oneOf(typeforce.UInt8, typeforce.UInt16),
wif: typeforce.UInt8 wif: typeforce.UInt8
}) })
+23 -12
View File
@@ -307,17 +307,6 @@ bitcoinjs.bitcoin.networks.bgold = {
wif: 128 wif: 128
}; };
bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x1c,
scriptHash: 0x28,
wif: 0x80
};
bitcoinjs.bitcoin.networks.monacoin = { bitcoinjs.bitcoin.networks.monacoin = {
messagePrefix: '\x18Monacoin Signed Message:\n', messagePrefix: '\x18Monacoin Signed Message:\n',
bip32: { bip32: {
@@ -781,6 +770,17 @@ bitcoinjs.bitcoin.networks.ixcoin = {
wif: 0x80, wif: 0x80,
}; };
bitcoinjs.bitcoin.networks.kobocoin = {
messagePrefix: '\x18Kobocoin Signed Message:\n',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4,
},
pubKeyHash: 0x23,
scriptHash: 0x1c,
wif: 0xa3,
};
bitcoinjs.bitcoin.networks.landcoin = { bitcoinjs.bitcoin.networks.landcoin = {
messagePrefix: '\x18Landcoin Signed Message:\n', messagePrefix: '\x18Landcoin Signed Message:\n',
bip32: { bip32: {
@@ -1131,7 +1131,7 @@ bitcoinjs.bitcoin.networks.vertcoin = {
}, },
pubKeyHash: 0x47, pubKeyHash: 0x47,
scriptHash: 0x05, scriptHash: 0x05,
wif: 0xc7, wif: 0x80,
}; };
bitcoinjs.bitcoin.networks.vivo = { bitcoinjs.bitcoin.networks.vivo = {
@@ -1188,3 +1188,14 @@ bitcoinjs.bitcoin.networks.zcoin = {
scriptHash: 0x07, scriptHash: 0x07,
wif: 0xd2, wif: 0xd2,
}; };
bitcoinjs.bitcoin.networks.zcash = {
messagePrefix: '\x18Zcash Signed Message:\n',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4,
},
pubKeyHash: 0x1CB8,
scriptHash: 0x1CBD,
wif: 0x80,
};
+34 -23
View File
@@ -91,8 +91,8 @@
DOM.generatedStrength = $(".generate-container .strength"); DOM.generatedStrength = $(".generate-container .strength");
DOM.generatedStrengthWarning = $(".generate-container .warning"); DOM.generatedStrengthWarning = $(".generate-container .warning");
DOM.hardenedAddresses = $(".hardened-addresses"); DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container"); DOM.bitcoinCashAddressTypeContainer = $(".bch-addr-type-container");
DOM.useBitpayAddresses = $(".use-bitpay-addresses"); DOM.bitcoinCashAddressType = $("[name=bch-addr-type]")
DOM.useBip38 = $(".use-bip38"); DOM.useBip38 = $(".use-bip38");
DOM.bip38Password = $(".bip38-password"); DOM.bip38Password = $(".bip38-password");
DOM.addresses = $(".addresses"); DOM.addresses = $(".addresses");
@@ -147,7 +147,7 @@
DOM.privateKeyToggle.on("click", togglePrivateKeys); DOM.privateKeyToggle.on("click", togglePrivateKeys);
DOM.csvTab.on("click", updateCsv); DOM.csvTab.on("click", updateCsv);
DOM.languages.on("click", languageChanged); DOM.languages.on("click", languageChanged);
DOM.useBitpayAddresses.on("change", useBitpayAddressesChange); DOM.bitcoinCashAddressType.on("change", bitcoinCashAddressTypeChange);
setQrEvents(DOM.showQrEls); setQrEvents(DOM.showQrEls);
disableForms(); disableForms();
hidePending(); hidePending();
@@ -172,7 +172,7 @@
clearDerivedKeys(); clearDerivedKeys();
clearAddressesList(); clearAddressesList();
DOM.litecoinLtubContainer.addClass("hidden"); DOM.litecoinLtubContainer.addClass("hidden");
DOM.useBitpayAddressesContainer.addClass("hidden"); DOM.bitcoinCashAddressTypeContainer.addClass("hidden");
var networkIndex = e.target.value; var networkIndex = e.target.value;
var network = networks[networkIndex]; var network = networks[networkIndex];
network.onSelect(); network.onSelect();
@@ -424,8 +424,7 @@
}, 50); }, 50);
} }
function useBitpayAddressesChange() { function bitcoinCashAddressTypeChange() {
setBitcoinCashNetworkValues();
phraseChanged(); phraseChanged();
} }
@@ -852,6 +851,16 @@
privkey = convertRipplePriv(privkey); privkey = convertRipplePriv(privkey);
address = convertRippleAdrr(address); address = convertRippleAdrr(address);
} }
// Bitcoin Cash address format may vary
if (networks[DOM.network.val()].name == "BCH - Bitcoin Cash") {
var bchAddrType = DOM.bitcoinCashAddressType.filter(":checked").val();
if (bchAddrType == "cashaddr") {
address = bchaddr.toCashAddress(address);
}
else if (bchAddrType == "bitpay") {
address = bchaddr.toBitpayAddress(address);
}
}
// Segwit addresses are different // Segwit addresses are different
if (isSegwit) { if (isSegwit) {
if (!segwitAvailable) { if (!segwitAvailable) {
@@ -1155,7 +1164,7 @@
function wordArrayToPhrase(words) { function wordArrayToPhrase(words) {
var phrase = words.join(" "); var phrase = words.join(" ");
var language = getLanguageFromPhrase(phrase); var language = getLanguageFromPhrase(phrase);
if (language == "japanese" || language == "korean") { if (language == "japanese") {
phrase = words.join("\u3000"); phrase = words.join("\u3000");
} }
return phrase; return phrase;
@@ -1417,19 +1426,6 @@
DOM.bip141unavailable.removeClass("hidden"); DOM.bip141unavailable.removeClass("hidden");
} }
function useBitpayAddresses() {
return !(DOM.useBitpayAddresses.prop("checked"));
}
function setBitcoinCashNetworkValues() {
if (useBitpayAddresses()) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else {
network = bitcoinjs.bitcoin.networks.bitcoinCashBitbpay;
}
}
function adjustNetworkForSegwit() { function adjustNetworkForSegwit() {
// If segwit is selected the xpub/xprv prefixes need to be adjusted // If segwit is selected the xpub/xprv prefixes need to be adjusted
// to avoid accidentally importing BIP49 xpub to BIP44 watch only // to avoid accidentally importing BIP49 xpub to BIP44 watch only
@@ -1582,8 +1578,7 @@
name: "BCH - Bitcoin Cash", name: "BCH - Bitcoin Cash",
segwitAvailable: false, segwitAvailable: false,
onSelect: function() { onSelect: function() {
DOM.useBitpayAddressesContainer.removeClass("hidden"); DOM.bitcoinCashAddressTypeContainer.removeClass("hidden");
setBitcoinCashNetworkValues();
setHdCoin(145); setHdCoin(145);
}, },
}, },
@@ -1955,6 +1950,14 @@
setHdCoin(141); setHdCoin(141);
}, },
}, },
{
name: "KOBO - Kobocoin",
bip49available: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.kobocoin;
setHdCoin(196);
},
},
{ {
name: "LBC - Library Credits", name: "LBC - Library Credits",
segwitAvailable: false, segwitAvailable: false,
@@ -2350,7 +2353,7 @@
}, },
{ {
name: "VTC - Vertcoin", name: "VTC - Vertcoin",
segwitAvailable: false, segwitAvailable: true,
onSelect: function() { onSelect: function() {
network = bitcoinjs.bitcoin.networks.vertcoin; network = bitcoinjs.bitcoin.networks.vertcoin;
setHdCoin(28); setHdCoin(28);
@@ -2420,6 +2423,14 @@
setHdCoin(136); setHdCoin(136);
}, },
}, },
{
name: "ZEC - Zcash",
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.zcash;
setHdCoin(133);
},
},
] ]
var clients = [ var clients = [
+1 -1
View File
@@ -149,7 +149,7 @@ var Mnemonic = function(language) {
// Set space correctly depending on the language // Set space correctly depending on the language
// see https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese // see https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese
var space = " "; var space = " ";
if (language == "japanese" || language == "korean") { if (language == "japanese") {
space = "\u3000"; // ideographic space space = "\u3000"; // ideographic space
} }
return words.join(space); return words.join(space);
+25
View File
@@ -94,4 +94,29 @@ bitcoinjs.bitcoin.networks.fujicoin.p2wpkhInP2sh = {
wif: 0xa4 wif: 0xa4
}; };
bitcoinjs.bitcoin.networks.vertcoin.p2wpkh = {
baseNetwork: "vertcoin",
messagePrefix: '\x18Vertcoin Signed Message:\n',
bech32: 'vtc',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 71,
scriptHash: 5,
wif: 0x80
};
bitcoinjs.bitcoin.networks.vertcoin.p2wpkhInP2sh = {
baseNetwork: "vertcoin",
messagePrefix: '\x18Vertcoin Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 71,
scriptHash: 5,
wif: 0x80
};
})(); })();
+48 -2
View File
@@ -553,7 +553,7 @@ it('Allows selection of slimcoin testnet', function(done) {
it('Allows selection of bitcoin cash', function(done) { it('Allows selection of bitcoin cash', function(done) {
var params = { var params = {
selectText: "BCH - Bitcoin Cash", selectText: "BCH - Bitcoin Cash",
firstAddress: "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A", firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps",
}; };
testNetwork(done, params); testNetwork(done, params);
}); });
@@ -900,6 +900,13 @@ it('Allows selection of Ixcoin', function(done) {
}; };
testNetwork(done, params); testNetwork(done, params);
}); });
it('Allows selection of Kobocoin', function(done) {
var params = {
selectText: "KOBO - Kobocoin",
firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy",
};
testNetwork(done, params);
});
it('Allows selection of Landcoin', function(done) { it('Allows selection of Landcoin', function(done) {
var params = { var params = {
selectText: "LDCN - Landcoin", selectText: "LDCN - Landcoin",
@@ -1159,6 +1166,13 @@ it('Allows selection of Zcoin', function(done) {
}; };
testNetwork(done, params); testNetwork(done, params);
}); });
it('Allows selection of Zcash', function(done) {
var params = {
selectText: "ZEC - Zcash",
firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9",
};
testNetwork(done, params);
});
// BIP39 seed is set from phrase // BIP39 seed is set from phrase
@@ -3106,10 +3120,26 @@ it('Warns when entropy is filtered and discarded', function(done) {
}); });
}); });
// Bitcoin Cash address can be set to use cashaddr format
it('Can use cashaddr format for bitcoin cash addresses', function(done) {
driver.executeScript(function() {
$(".use-bch-cashaddr-addresses").prop("checked", true);
});
driver.findElement(By.css('.phrase'))
.sendKeys("abandon abandon ability");
selectNetwork("BCH - Bitcoin Cash");
driver.sleep(generateDelay).then(function() {
getFirstAddress(function(address) {
expect(address).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps");
done();
});
});
});
// Bitcoin Cash address can be set to use bitpay format // Bitcoin Cash address can be set to use bitpay format
it('Can use bitpay format for bitcoin cash addresses', function(done) { it('Can use bitpay format for bitcoin cash addresses', function(done) {
driver.executeScript(function() { driver.executeScript(function() {
$(".use-bitpay-addresses").prop("checked", true); $(".use-bch-bitpay-addresses").prop("checked", true);
}); });
driver.findElement(By.css('.phrase')) driver.findElement(By.css('.phrase'))
.sendKeys("abandon abandon ability"); .sendKeys("abandon abandon ability");
@@ -3122,6 +3152,22 @@ it('Can use bitpay format for bitcoin cash addresses', function(done) {
}); });
}); });
// Bitcoin Cash address can be set to use legacy format
it('Can use legacy format for bitcoin cash addresses', function(done) {
driver.executeScript(function() {
$(".use-bch-legacy-addresses").prop("checked", true);
});
driver.findElement(By.css('.phrase'))
.sendKeys("abandon abandon ability");
selectNetwork("BCH - Bitcoin Cash");
driver.sleep(generateDelay).then(function() {
getFirstAddress(function(address) {
expect(address).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A");
done();
});
});
});
// End of tests ported from old suit, so no more comments above each test now // End of tests ported from old suit, so no more comments above each test now
it('Can generate more addresses from a custom index', function(done) { it('Can generate more addresses from a custom index', function(done) {