diff --git a/changelog.md b/changelog.md index f539fba..908f4d9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,28 @@ +# 0.3.11 + +* Add NIX network +* Fix coin parameters for NMC, XMY, CLAM, ONX, LKR +* Add DEXON network +* Add Nebulas network +* Add LSP network +* Fix Crown network address format +* Add Ellaism network +* Add Etheresocial network +* Add Bolivarcoin network +* Force spellcheck and autocomplete to be off + +# 0.3.10 + +* Add Phore network +* Add Blocknode network +* Add Ravencoin network +* Add Safecoin network +* Add LitecoinZ network +* Add LKRcoin network +* Update Peercoin scripthash parameter +* Add Blockstamp network +* Remove old info regarding use of private keys + # 0.3.9 * Update BTG signing message diff --git a/readme.md b/readme.md index 269743c..65235e0 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,8 @@ https://iancoleman.io/bip39/ ## Standalone offline version -Download `bip39-standalone.html` +Download `bip39-standalone.html` from +[the releases](https://github.com/iancoleman/bip39/releases). Open the file in a browser by double clicking it. diff --git a/src/index.html b/src/index.html index a3d6c0c..d64d27e 100644 --- a/src/index.html +++ b/src/index.html @@ -15,7 +15,7 @@
v0.3.9
+v0.3.11
- - Use private keys at - brainwallet.org. - - Be careful - it can be easy to make mistakes if you don't know what you're doing. -
Entropy values should not include the BIP39 checksum. This is automatically added by the tool.
@@ -935,6 +927,7 @@
+
diff --git a/src/js/bchaddrjs-0.2.1.js b/src/js/bchaddrjs-0.2.1.js
index 8356f10..28f67e9 100644
--- a/src/js/bchaddrjs-0.2.1.js
+++ b/src/js/bchaddrjs-0.2.1.js
@@ -3356,7 +3356,7 @@ var validate = validation.validate;
/**
* Encodes a hash from a given type into a Bitcoin Cash address with the given prefix.
- *
+ *
* @static
* @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
* @param {string} type Type of address to generate. Either 'P2PKH' or 'P2SH'.
@@ -3378,7 +3378,7 @@ function encode(prefix, type, hash) {
/**
* Decodes the given address into its constituting prefix, type and hash. See [#encode()]{@link encode}.
- *
+ *
* @static
* @param {string} address Address to decode. E.g.: 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'.
* @returns {object}
@@ -3416,14 +3416,14 @@ var ValidationError = validation.ValidationError;
*
* @private
*/
-var VALID_PREFIXES = ['bitcoincash', 'bchtest', 'bchreg'];
+var VALID_PREFIXES = ['bitcoincash', 'bchtest', 'bchreg', 'simpleledger', 'slptest'];
/**
* Checks whether a string is a valid prefix; ie., it has a single letter case
- * and is one of 'bitcoincash', 'bchtest', or 'bchreg'.
+ * and is one of 'bitcoincash', 'bchtest', or 'bchreg', 'simpleledger' or 'slptest'.
*
* @private
- * @param {string} prefix
+ * @param {string} prefix
* @returns {boolean}
*/
function isValidPrefix(prefix) {
@@ -3435,7 +3435,7 @@ function isValidPrefix(prefix) {
* of the address' checksum.
*
* @private
- * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
+ * @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
* @returns {Uint8Array}
*/
function prefixToUint5Array(prefix) {
@@ -3594,8 +3594,8 @@ function fromUint5Array(data) {
* Returns the concatenation a and b.
*
* @private
- * @param {Uint8Array} a
- * @param {Uint8Array} b
+ * @param {Uint8Array} a
+ * @param {Uint8Array} b
* @returns {Uint8Array}
* @throws {ValidationError}
*/
@@ -3633,7 +3633,7 @@ function polymod(data) {
/**
* Verify that the payload has not been corrupted by checking that the
* checksum is valid.
- *
+ *
* @private
* @param {string} prefix Network prefix. E.g.: 'bitcoincash'.
* @param {Uint8Array} payload Array of 5-bit integers containing the address' payload.
@@ -9011,6 +9011,21 @@ function toCashAddress (address) {
return encodeAsCashaddr(decoded)
}
+/**
+ * Translates the given address into SLP format.
+ * @static
+ * @param {string} address - A valid SLP address in any format.
+ * @return {string}
+ * @throws {InvalidAddressError}
+ */
+function toSlpAddress (address) {
+ var decoded = decodeAddress(address)
+ return encodeAsSlpaddr(decoded)
+}
+
+
+
+
/**
* Version byte table for base58 formats.
* @private
@@ -9125,7 +9140,7 @@ function decodeCashAddress (address) {
} catch (error) {
}
} else {
- var prefixes = ['bitcoincash', 'bchtest', 'regtest']
+ var prefixes = ['bitcoincash', 'bchtest', 'regtest', 'simpleledger', 'slptest']
for (var i = 0; i < prefixes.length; ++i) {
try {
var prefix = prefixes[i]
@@ -9151,6 +9166,7 @@ function decodeCashAddressWithPrefix (address) {
var type = decoded.type === 'P2PKH' ? Type.P2PKH : Type.P2SH
switch (decoded.prefix) {
case 'bitcoincash':
+ case 'simpleledger':
return {
hash: hash,
format: Format.Cashaddr,
@@ -9158,6 +9174,7 @@ function decodeCashAddressWithPrefix (address) {
type: type
}
case 'bchtest':
+ case 'slptest':
case 'regtest':
return {
hash: hash,
@@ -9212,6 +9229,19 @@ function encodeAsCashaddr (decoded) {
return cashaddr.encode(prefix, type, hash)
}
+ /**
+ * Encodes the given decoded address into slp addr format.
+ * @private
+ * @param {object} decoded
+ * @returns {string}
+ */
+ function encodeAsSlpaddr (decoded) {
+ var prefix = decoded.network === Network.Mainnet ? 'simpleledger' : 'slptest'
+ var type = decoded.type === Type.P2PKH ? 'P2PKH' : 'P2SH'
+ var hash = Uint8Array.from(decoded.hash)
+ return cashaddr.encode(prefix, type, hash)
+ }
+
/**
* Returns a boolean indicating whether the address is in legacy format.
* @static
@@ -9313,6 +9343,7 @@ module.exports = {
toLegacyAddress: toLegacyAddress,
toBitpayAddress: toBitpayAddress,
toCashAddress: toCashAddress,
+ toSlpAddress: toSlpAddress,
isLegacyAddress: isLegacyAddress,
isBitpayAddress: isBitpayAddress,
isCashAddress: isCashAddress,
@@ -9325,4 +9356,4 @@ module.exports = {
}).call(this,require("buffer").Buffer)
},{"bs58check":7,"buffer":8,"cashaddrjs":10}]},{},[52])(52)
-});
\ No newline at end of file
+});
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js
index 7ac8ed4..d0151db 100644
--- a/src/js/bitcoinjs-extensions.js
+++ b/src/js/bitcoinjs-extensions.js
@@ -27,7 +27,7 @@ bitcoinjs.bitcoin.networks.clam = {
private: 0xa8c17826
},
pubKeyHash: 0x89,
- scriptHash: 0x00, // TODO set this correctly
+ scriptHash: 0x0D,
wif: 0x85
};
@@ -39,7 +39,27 @@ bitcoinjs.bitcoin.networks.crown = {
},
pubKeyHash: 0x00,
scriptHash: 0x05,
- wif: 0x80
+ wif: 0x80,
+ toNewAddress: function(oldAddress)
+ {
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
+ var b58 = basex(ALPHABET);
+
+ var addrBytes = b58.decode(oldAddress);
+
+ var hash160 = new Uint16Array(23);
+ hash160[0]= 0x01; //C
+ hash160[1]= 0x75; //R
+ hash160[2]= 0x07; //W
+ addrBytes.copy(hash160, 3, 1, 21);
+
+ var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4);
+ var binaryAddr = new Uint16Array(27);
+ binaryAddr.set(hash160,0);
+ checksum.copy(binaryAddr, 23, 0, 4);
+ var newAddress = b58.encode(binaryAddr);
+ return newAddress;
+ }
};
bitcoinjs.bitcoin.networks.dash = {
@@ -93,7 +113,7 @@ bitcoinjs.bitcoin.networks.namecoin = {
private: 0x0488ade4
},
pubKeyHash: 0x34,
- scriptHash: 0x00, // TODO set this correctly
+ scriptHash: 0x0D,
wif: 0x80
};
@@ -104,7 +124,7 @@ bitcoinjs.bitcoin.networks.peercoin = {
private: 0x0488ade4
},
pubKeyHash: 0x37,
- scriptHash: 0x00, // TODO set this correctly
+ scriptHash: 0x75,
wif: 0xb7
};
@@ -236,20 +256,42 @@ bitcoinjs.bitcoin.networks.myriadcoin = {
private: 0x0488ade4
},
pubKeyHash: 0x32,
- scriptHash: 0x00, // TODO set this correctly
+ scriptHash: 0x09,
wif: 0xb2
};
+bitcoinjs.bitcoin.networks.bolivarcoin = {
+ messagePrefix: 'Bolivarcoin Signed Message:\n',
+ bip32: {
+ public: 0x0488b21e,
+ private: 0x0488ade4
+ },
+ pubKeyHash: 0x55,
+ scriptHash: 0x05,
+ wif: 0xD5
+};
bitcoinjs.bitcoin.networks.onixcoin = {
- messagePrefix: 'unused',
+ messagePrefix: 'ONIX Signed Message:\n',
bip32: {
- public: 0x049d7cb2,
- private: 0x049d7878
+ public: 0x0488b21e,
+ private: 0x0488ade4
},
pubKeyHash: 0x4B,
scriptHash: 0x05,
- wif: 0x80
+ wif: 0xCB
+};
+
+
+bitcoinjs.bitcoin.networks.lkrcoin = {
+ messagePrefix: '\x18LKRcoin Signed Message:\n',
+ bip32: {
+ public: 0x0488b21e,
+ private: 0x0488ade4,
+ },
+ pubKeyHash: 0x30,
+ scriptHash: 0x55,
+ wif: 0xB0
};
bitcoinjs.bitcoin.networks.pivx = {
@@ -902,6 +944,17 @@ bitcoinjs.bitcoin.networks.neoscoin = {
wif: 0xb1,
};
+bitcoinjs.bitcoin.networks.nix = {
+ messagePrefix: '\x18Nix Signed Message:\n',
+ bip32: {
+ public: 0x0488b21e,
+ private: 0x0488ade4,
+ },
+ pubKeyHash: 0x26,
+ scriptHash: 0x35,
+ wif: 0x80,
+};
+
bitcoinjs.bitcoin.networks.neurocoin = {
messagePrefix: '\x18PPCoin Signed Message:\n',
bip32: {
@@ -1473,4 +1526,15 @@ bitcoinjs.bitcoin.networks.litecoinz = {
pubKeyHash: 0x0AB3,
scriptHash: 0x0AB8,
wif: 0x80,
+};
+
+bitcoinjs.bitcoin.networks.blockstamp = {
+ messagePrefix: '\x18BlockStamp Signed Message:\n',
+ bip32: {
+ public: 0x0488B21E,
+ private: 0x0488ADE4,
+ },
+ pubKeyHash: 0x00,
+ scriptHash: 0x05,
+ wif: 0x80,
};
\ No newline at end of file
diff --git a/src/js/index.js b/src/js/index.js
index 353f40f..d822b55 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -917,7 +917,11 @@
|| (networks[DOM.network.val()].name == "MUSIC - Musicoin")
|| (networks[DOM.network.val()].name == "POA - Poa")
|| (networks[DOM.network.val()].name == "EXP - Expanse")
- || (networks[DOM.network.val()].name == "CLO - Callisto")) {
+ || (networks[DOM.network.val()].name == "CLO - Callisto")
+ || (networks[DOM.network.val()].name == "DXN - DEXON")
+ || (networks[DOM.network.val()].name == "ELLA - Ellaism")
+ || (networks[DOM.network.val()].name == "ESN - Ethersocial Network")
+ ) {
var privKeyBuffer = keyPair.d.toBuffer(32);
privkey = privKeyBuffer.toString('hex');
var addressBuffer = ethUtil.privateToAddress(privKeyBuffer);
@@ -927,6 +931,7 @@
privkey = ethUtil.addHexPrefix(privkey);
pubkey = ethUtil.addHexPrefix(pubkey);
}
+
// Stellar is different
if (networks[DOM.network.val()].name == "XLM - Stellar") {
var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
@@ -939,6 +944,15 @@
privkey = keypair.secret();
pubkey = address = keypair.publicKey();
}
+ if ((networks[DOM.network.val()].name == "NAS - Nebulas")) {
+ var NasAccount = require("nebulas-account");
+ var privKeyBuffer = keyPair.d.toBuffer(32);
+ var nebulasAccount = new NasAccount();
+ nebulasAccount.setPrivateKey(privKeyBuffer);
+ address = nebulasAccount.getAddressString();
+ privkey = nebulasAccount.getPrivateKeyString();
+ pubkey = nebulasAccount.getPublicKeyString();
+ }
// Ripple values are different
if (networks[DOM.network.val()].name == "XRP - Ripple") {
privkey = convertRipplePriv(privkey);
@@ -954,6 +968,13 @@
address = bchaddr.toBitpayAddress(address);
}
}
+ // Bitcoin Cash address format may vary
+ if (networks[DOM.network.val()].name == "SLP - Simple Ledger Protocol") {
+ var bchAddrType = DOM.bitcoinCashAddressType.filter(":checked").val();
+ if (bchAddrType == "cashaddr") {
+ address = bchaddr.toSlpAddress(address);
+ }
+ }
// Segwit addresses are different
if (isSegwit) {
if (!segwitAvailable) {
@@ -972,6 +993,11 @@
address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
}
}
+
+ if ((networks[DOM.network.val()].name == "CRW - Crown")) {
+ address = bitcoinjs.bitcoin.networks.crown.toNewAddress(address);
+ }
+
addAddressToList(indexText, address, pubkey, privkey);
if (isLast) {
hidePending();
@@ -1679,6 +1705,13 @@
setHdCoin(220);
},
},
+ {
+ name: "BOLI - Bolivarcoin",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.bolivarcoin;
+ setHdCoin(278);
+ },
+ },
{
name: "BCA - Bitcoin Atom",
onSelect: function() {
@@ -1720,7 +1753,7 @@
network = bitcoinjs.bitcoin.networks.blocknode;
setHdCoin(2941);
},
- },
+ },
{
name: "tBND - Blocknode Testnet",
onSelect: function() {
@@ -1741,6 +1774,13 @@
network = bitcoinjs.bitcoin.networks.bitsend;
setHdCoin(91);
},
+ },
+ {
+ name: "BST - BlockStamp",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.blockstamp;
+ setHdCoin(254);
+ },
},
{
name: "BTA - Bata",
@@ -1862,6 +1902,13 @@
setHdCoin(186);
},
},
+ {
+ name: "CRW - Crown (Legacy)",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.crown;
+ setHdCoin(72);
+ },
+ },
{
name: "CRW - Crown",
onSelect: function() {
@@ -1925,6 +1972,13 @@
setHdCoin(3);
},
},
+ {
+ name: "DXN - DEXON",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ setHdCoin(237);
+ },
+ },
{
name: "ECN - Ecoin",
onSelect: function() {
@@ -1946,6 +2000,14 @@
setHdCoin(78);
},
},
+ {
+ name: "ELLA - Ellaism",
+ segwitAvailable: false,
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ setHdCoin(163);
+ },
+ },
{
name: "EMC2 - Einsteinium",
onSelect: function() {
@@ -1960,6 +2022,14 @@
setHdCoin(151);
},
},
+ {
+ name: "ESN - Ethersocial Network",
+ segwitAvailable: false,
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ setHdCoin(31102);
+ },
+ },
{
name: "ETC - Ethereum Classic",
segwitAvailable: false,
@@ -2139,6 +2209,14 @@
setHdCoin(114);
},
},
+ {
+ name: "LKR - Lkrcoin",
+ segwitAvailable: false,
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.lkrcoin;
+ setHdCoin(557);
+ },
+ },
{
name: "LTC - Litecoin",
onSelect: function() {
@@ -2212,6 +2290,13 @@
setHdCoin(130);
},
},
+ {
+ name: "NAS - Nebulas",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ setHdCoin(2718);
+ },
+ },
{
name: "NEBL - Neblio",
onSelect: function() {
@@ -2226,6 +2311,13 @@
setHdCoin(25);
},
},
+ {
+ name: "NIX - NIX Platform",
+ onSelect: function() {
+ network = bitcoinjs.bitcoin.networks.nix;
+ setHdCoin(400);
+ },
+ },
{
name: "NLG - Gulden",
onSelect: function() {
@@ -2452,6 +2544,13 @@
setHdCoin(111);
},
},
+ {
+ name: "SLP - Simple Ledger Protocol",
+ onSelect: function() {
+ DOM.bitcoinCashAddressTypeContainer.removeClass("hidden");
+ setHdCoin(245);
+ },
+ },
{
name: "SLR - Solarcoin",
onSelect: function() {
diff --git a/src/js/nebulas-account.js b/src/js/nebulas-account.js
new file mode 100644
index 0000000..45d8724
--- /dev/null
+++ b/src/js/nebulas-account.js
@@ -0,0 +1,27697 @@
+require=(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