mirror of
https://github.com/ok2/coinbin.git
synced 2026-05-09 18:15:23 +02:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44ba1b3d30 | |||
| 5583675390 | |||
| 56cb104ea4 | |||
| c6f70d000e | |||
| 4836b20fae | |||
| f364ae4b4a | |||
| 64cb387247 | |||
| b2a86006cf | |||
| b5ebaafed8 | |||
| d4f47fce28 | |||
| 5bd3786f94 | |||
| b77f3cf06a | |||
| b0c6c3a516 | |||
| a6f5dcf7f0 | |||
| cf2a8b01cb | |||
| 261c4ace40 | |||
| e18b634c4e | |||
| 1f3b878d63 | |||
| efc16c10fb | |||
| 477ca8890d | |||
| e73e8093b3 | |||
| 40ea3230fd | |||
| dc416c6521 | |||
| fc66bc9423 | |||
| 1c10bef510 | |||
| b22e79391f | |||
| 0be8fd9a97 | |||
| 1a364ff770 | |||
| bc0c72117e | |||
| 13c50cf4b6 | |||
| dea1d1b274 | |||
| e6c70d133b | |||
| 10aa011c6e | |||
| c7a0fda7e5 | |||
| c9cfeefc86 | |||
| cdf4aa105b | |||
| 2fc574dde0 | |||
| f088ec2e52 | |||
| 9ccd73808d | |||
| cb81362330 | |||
| fcbf25eaec | |||
| 2aca9ab28d | |||
| 5c581316fe | |||
| ebfb940dd5 | |||
| 3201550d40 | |||
| d88ec3db4b | |||
| 530453a701 | |||
| 194df37d56 | |||
| 87461b58b8 | |||
| 739aee3c0f | |||
| b997751791 | |||
| 9bccc5c512 |
@@ -1,7 +1,7 @@
|
||||
coinbin
|
||||
=======
|
||||
|
||||
A Open Source Browser Based Bitcoin Wallet. Version 1.4 beta by OutCast3k
|
||||
A Open Source Browser Based Bitcoin Wallet. Version 1.5 beta by OutCast3k
|
||||
|
||||
Live version available at http://coinb.in/ or http://4zpinp6gdkjfplhk.onion
|
||||
|
||||
|
||||
+52
-11
@@ -338,7 +338,16 @@
|
||||
|
||||
</div>
|
||||
|
||||
<input type="button" class="btn btn-primary" value="Generate" id="newKeysBtn">
|
||||
<div class="btn-group">
|
||||
<input type="button" class="btn btn-primary" value="Generate" id="newKeysBtn">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" id="newPaperwalletBtn">Print</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
@@ -383,7 +392,17 @@
|
||||
<input type="text" class="form-control hidden" id="brainwalletSegWit">
|
||||
</div>
|
||||
|
||||
<input type="button" class="btn btn-primary" value="Generate" id="newSegWitKeysBtn">
|
||||
<div class="btn-group">
|
||||
<input type="button" class="btn btn-primary" value="Generate" id="newSegWitKeysBtn">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" id="newSegwitPaperwalletBtn">Print</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
@@ -609,7 +628,7 @@
|
||||
|
||||
<label>Null Data</label> <span class="text-muted text-normal">(80 byte limit, <i>40 bytes recommended</i>)</span>
|
||||
<p class="checkbox">
|
||||
<label><input type="checkbox" id="opReturn" class="checkbox-inline"> Allow data to be sent within the transaction and stored in the blockchain by using <a href="https://bitcoin.org/en/developer-guide#null-data" target="_"blank">OP_RETURN</a>.</label>
|
||||
<label><input type="checkbox" id="opReturn" class="checkbox-inline"> Allow data to be sent within the transaction and stored in the blockchain by using <a href="https://bitcoin.org/en/developer-guide#null-data" target="_blank">OP_RETURN</a>.</label>
|
||||
<div class="text-muted">When using this option you may enter a hex string or address into the address field on the output tab.</div>
|
||||
</p>
|
||||
|
||||
@@ -1174,18 +1193,26 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<b>Path</b><br>
|
||||
<select class="form-control">
|
||||
<option>Simple: m/i</option>
|
||||
<select class="form-control" id="hdpathtype"">
|
||||
<option value="simple">Simple: m/i</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
|
||||
<div id="hdpath" class="hidden" style="margin-top:4px">
|
||||
<span class="input-group">
|
||||
<input type="text" class="form-control" value="m/0/1"> <br>
|
||||
<span class="input-group-addon"> / </span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<b>Index (Start)</b><br>
|
||||
<b><u>I</u>ndex (Start)</b><br>
|
||||
<input type="text" class="form-control derivation_index_start" value="0">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<b>Index (End)</b><br>
|
||||
<b><u>I</u>ndex (End)</b><br>
|
||||
<input type="text" class="form-control derivation_index_end" value="1">
|
||||
</div>
|
||||
|
||||
@@ -1306,7 +1333,7 @@
|
||||
|
||||
<div class="tab-pane tab-content" id="about">
|
||||
<h2>About <small>open source bitcoin wallet</small></h2>
|
||||
<p>Version 1.4</p>
|
||||
<p>Version 1.5</p>
|
||||
<p>Compatible with bitcoin core</p>
|
||||
<p>Github <a href="https://github.com/OutCast3k/coinbin/">https://github.com/OutCast3k/coinbin/</a></p>
|
||||
<p>TOR <a href="http://4zpinp6gdkjfplhk.onion">4zpinp6gdkjfplhk.onion</a></p>
|
||||
@@ -1334,7 +1361,8 @@
|
||||
<p class="text-muted">Select which network you'd like to use for key pair generation.</p>
|
||||
<select class="form-control" id="coinjs_coin">
|
||||
<option value="bitcoin_mainnet" rel="0x00;0x80;0x05;0x488b21e;0x488ade4;coinb.in;coinb.in">Bitcoin (mainnet)</option>
|
||||
<option value="dogecoin_mainnet" rel="0x1e;0x9e;0x16;0x0827421e;0x089944e4;chain.so_dogecoin;chain.so_dogecoin">Dogecoin (mainnet)</option>
|
||||
<option value="litecoin_mainnet" rel="0x30;0xb0;0x32;0x019da462;0x019d9cfe;blockcypher_litecoin;blockcypher_litecoin">Litecoin (mainnet)</option>
|
||||
<option value="dogecoin_mainnet" rel="0x1e;0x9e;0x16;0x0827421e;0x089944e4;blockcypher_dogecoin;blockcypher_dogecoin">Dogecoin (mainnet)</option>
|
||||
<option value="carboncoin_mainnet" rel="0x2f;0xaf;0x05;0x488b21e;0x488ade4;cryptoid.info_carboncoin;cryptoid.info_carboncoin">Carboncoin (mainnet)</option>
|
||||
<option value="shadowcash_mainnet" rel="0x3f;0xbf;0x7d;0xee80286a;0xee8031e8;false;false">ShadowCash (mainnet)</option>
|
||||
<option value="bitcoin_testnet" rel="0x6f;0xef;0xc4;0x043587cf;0x04358394;false;false">Bitcoin (testnet)</option>
|
||||
@@ -1391,8 +1419,14 @@
|
||||
<p class="text-muted">Select the network you wish to broadcast the transaction via</p>
|
||||
<select class="form-control" id="coinjs_broadcast">
|
||||
<option value="coinb.in">coinb.in (Bitcoin mainnet)</option>
|
||||
<option value="chain.so_bitcoinmainnet"> Chain.so (Bitcoin mainnet)</option>
|
||||
<option value="blockcypher_bitcoinmainnet"> Blockcypher.com (Bitcoin mainnet)</option>
|
||||
<option value="blockcypher_litecoin"> Blockcypher.com (Litecoin)</option>
|
||||
<option value="blockcypher_dogecoin"> Blockcypher.com (Dogecoin)</option>
|
||||
<option value="blockchair_bitcoinmainnet"> Blockchair.com (Bitcoin mainnet)</option>
|
||||
<option value="blockchair_litecoin"> Blockchair.com (Litecoin)</option>
|
||||
<option value="blockchair_dogecoin"> Blockchair.com (Dogecoin)</option>
|
||||
<option value="chain.so_bitcoinmainnet"> Chain.so (Bitcoin mainnet)</option>
|
||||
<option value="chain.so_litecoin"> Chain.so (Litecoin)</option>
|
||||
<option value="chain.so_dogecoin"> Chain.so (Dogecoin)</option>
|
||||
<option value="cryptoid.info_carboncoin"> Cryptoid.info (Carboncoin)</option>
|
||||
</select>
|
||||
@@ -1407,6 +1441,13 @@
|
||||
<p class="text-muted">Select the network you wish to retreive your unspent inputs from</p>
|
||||
<select class="form-control" id="coinjs_utxo">
|
||||
<option value="coinb.in">coinb.in (Bitcoin mainnet)</option>
|
||||
<option value="blockcypher_bitcoinmainnet"> Blockcypher.com (Bitcoin mainnet)</option>
|
||||
<option value="blockcypher_litecoin"> Blockcypher.com (Litecoin)</option>
|
||||
<option value="blockcypher_dogecoin"> Blockcypher.com (Dogecoin)</option>
|
||||
<option value="blockchair_bitcoinmainnet"> Blockchair.com (Bitcoin mainnet)</option>
|
||||
<option value="blockchair_litecoin"> Blockchair.com (Litecoin)</option>
|
||||
<option value="blockchair_dogecoin"> Blockchair.com (Dogecoin)</option>
|
||||
<option value="chain.so_bitcoinmainnet"> Chain.so (Bitcoin mainnet)</option>
|
||||
<option value="chain.so_litecoin"> Chain.so (Litecoin)</option>
|
||||
<option value="chain.so_dogecoin"> Chain.so (Dogecoin)</option>
|
||||
<option value="cryptoid.info_carboncoin"> Cryptoid.info (Carboncoin)</option>
|
||||
@@ -1433,7 +1474,7 @@
|
||||
|
||||
<div id="footer">
|
||||
<div class="container text-right">
|
||||
<p class="text-muted">Version 1.4</p>
|
||||
<p class="text-muted">Version 1.5</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+68
-10
@@ -22,7 +22,8 @@
|
||||
coinjs.developer = '3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN'; //bitcoin
|
||||
|
||||
/* bit(coinb.in) api vars */
|
||||
coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+'coinb.in/api/';
|
||||
coinjs.hostname = ((document.location.hostname.split(".")[(document.location.hostname.split(".")).length-1]) == 'onion') ? '4zpinp6gdkjfplhk.onion' : 'coinb.in';
|
||||
coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+coinjs.hostname+'/api/';
|
||||
coinjs.uid = '1';
|
||||
coinjs.key = '12345678901234567890123456789012';
|
||||
|
||||
@@ -155,7 +156,11 @@
|
||||
}
|
||||
|
||||
var s = coinjs.script();
|
||||
s.writeBytes(coinjs.numToByteArray(checklocktimeverify));
|
||||
if (checklocktimeverify <= 16 && checklocktimeverify >= 1) {
|
||||
s.writeOp(0x50 + checklocktimeverify);//OP_1 to OP_16 for minimal encoding
|
||||
} else {
|
||||
s.writeBytes(coinjs.numToScriptNumBytes(checklocktimeverify));
|
||||
}
|
||||
s.writeOp(177);//OP_CHECKLOCKTIMEVERIFY
|
||||
s.writeOp(117);//OP_DROP
|
||||
s.writeBytes(Crypto.util.hexToBytes(pubkey));
|
||||
@@ -633,6 +638,8 @@
|
||||
|
||||
coinjs.compressed = c; // reset to default
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// extend prv/pub key
|
||||
@@ -646,8 +653,37 @@
|
||||
'pubkey':this.keys.pubkey});
|
||||
}
|
||||
|
||||
// derive from path
|
||||
r.derive_path = function(path) {
|
||||
|
||||
if( path == 'm' || path == 'M' || path == 'm\'' || path == 'M\'' ) return this;
|
||||
|
||||
var p = path.split('/');
|
||||
var hdp = coinjs.clone(this); // clone hd path
|
||||
|
||||
for( var i in p ) {
|
||||
|
||||
if((( i == 0 ) && c != 'm') || i == 'remove'){
|
||||
continue;
|
||||
}
|
||||
|
||||
var c = p[i];
|
||||
|
||||
var use_private = (c.length > 1) && (c[c.length-1] == '\'');
|
||||
var child_index = parseInt(use_private ? c.slice(0, c.length - 1) : c) & 0x7fffffff;
|
||||
if(use_private)
|
||||
child_index += 0x80000000;
|
||||
|
||||
hdp = hdp.derive(child_index);
|
||||
var key = ((hdp.keys_extended.privkey) && hdp.keys_extended.privkey!='') ? hdp.keys_extended.privkey : hdp.keys_extended.pubkey;
|
||||
hdp = coinjs.hd(key);
|
||||
}
|
||||
return hdp;
|
||||
}
|
||||
|
||||
// derive key from index
|
||||
r.derive = function(i){
|
||||
|
||||
i = (i)?i:0;
|
||||
var blob = (Crypto.util.hexToBytes(this.keys.pubkey)).concat(coinjs.numToBytes(i,4).reverse());
|
||||
|
||||
@@ -702,7 +738,6 @@
|
||||
|
||||
o.parent_fingerprint = (ripemd160(Crypto.SHA256(Crypto.util.hexToBytes(r.keys.pubkey),{asBytes:true}),{asBytes:true})).slice(0,4);
|
||||
o.keys_extended = o.extend();
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -767,8 +802,7 @@
|
||||
return o;
|
||||
}
|
||||
|
||||
r.parse();
|
||||
return r;
|
||||
return r.parse();
|
||||
}
|
||||
|
||||
|
||||
@@ -846,6 +880,9 @@
|
||||
var multi = coinjs.pubkeys2MultisigAddress(pubkeys, r.signaturesRequired);
|
||||
r.address = multi['address'];
|
||||
r.type = 'multisig__'; // using __ for now to differentiat from the other object .type == "multisig"
|
||||
var rs = Crypto.util.bytesToHex(s.buffer);
|
||||
r.redeemscript = rs;
|
||||
|
||||
} else if((s.chunks.length==2) && (s.buffer[0] == 0 && s.buffer[1] == 20)){ // SEGWIT
|
||||
r = {};
|
||||
r.type = "segwit__";
|
||||
@@ -859,6 +896,8 @@
|
||||
r.pubkey = Crypto.util.bytesToHex(s.chunks[3]);
|
||||
r.checklocktimeverify = coinjs.bytesToNum(s.chunks[0].slice());
|
||||
r.address = coinjs.simpleHodlAddress(r.pubkey, r.checklocktimeverify).address;
|
||||
var rs = Crypto.util.bytesToHex(s.buffer);
|
||||
r.redeemscript = rs;
|
||||
r.type = "hodl__";
|
||||
}
|
||||
} catch(e) {
|
||||
@@ -1918,12 +1957,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
coinjs.numToByteArray = function(num) {
|
||||
if (num <= 256) {
|
||||
return [num];
|
||||
} else {
|
||||
return [num % 256].concat(coinjs.numToByteArray(Math.floor(num / 256)));
|
||||
function scriptNumSize(i) {
|
||||
return i > 0x7fffffff ? 5
|
||||
: i > 0x7fffff ? 4
|
||||
: i > 0x7fff ? 3
|
||||
: i > 0x7f ? 2
|
||||
: i > 0x00 ? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
coinjs.numToScriptNumBytes = function(_number) {
|
||||
var value = Math.abs(_number);
|
||||
var size = scriptNumSize(value);
|
||||
var result = [];
|
||||
for (var i = 0; i < size; ++i) {
|
||||
result.push(0);
|
||||
}
|
||||
var negative = _number < 0;
|
||||
for (i = 0; i < size; ++i) {
|
||||
result[i] = value & 0xff;
|
||||
value = Math.floor(value / 256);
|
||||
}
|
||||
if (negative) {
|
||||
result[size - 1] |= 0x80;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
coinjs.numToVarInt = function(num) {
|
||||
|
||||
+193
-56
@@ -171,7 +171,7 @@ $(document).ready(function() {
|
||||
script = sw.redeemscript;
|
||||
}
|
||||
|
||||
var sequence = false;
|
||||
var sequence = 0xffffffff-1;
|
||||
if($("#walletRBF").is(":checked")){
|
||||
sequence = 0xffffffff-2;
|
||||
}
|
||||
@@ -344,7 +344,22 @@ $(document).ready(function() {
|
||||
$("#aes256passStatus").removeClass("hidden");
|
||||
}
|
||||
$("#newPrivKeyEnc").val(CryptoJS.AES.encrypt(coin.wif, $("#aes256pass").val())+'');
|
||||
});
|
||||
|
||||
$("#newPaperwalletBtn").click(function(){
|
||||
if($("#newBitcoinAddress").val()==""){
|
||||
$("#newKeysBtn").click();
|
||||
}
|
||||
|
||||
var paperwallet = window.open();
|
||||
paperwallet.document.write('<h2>BTC PaperWallet</h2><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Address (Share)</h3></div><div style="text-align: center;"><div id="qraddress"></div><p>'+$("#newBitcoinAddress").val()+'</p></div></div><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Public Key</h3></div><div style="text-align: center;"><div id="qrpubkey"></div><p>'+$("#newPubKey").val()+'</p></div></div><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Private Key (KEEP SECRET!)</h3></div><div style="text-align: center;"><div id="qrprivkey"></div><p>'+$("#newPrivKey").val()+'</p></div></div>');
|
||||
paperwallet.document.close();
|
||||
paperwallet.focus();
|
||||
new QRCode(paperwallet.document.getElementById("qraddress"), {text: $("#newBitcoinAddress").val(), width: 125, height: 125});
|
||||
new QRCode(paperwallet.document.getElementById("qrpubkey"), {text: $("#newPubKey").val(), width: 125, height: 125});
|
||||
new QRCode(paperwallet.document.getElementById("qrprivkey"), {text: $("#newPrivKey").val(), width: 125, height: 125});
|
||||
paperwallet.print();
|
||||
paperwallet.close();
|
||||
});
|
||||
|
||||
$("#newBrainwallet").click(function(){
|
||||
@@ -392,6 +407,22 @@ $(document).ready(function() {
|
||||
coinjs.compressed = compressed;
|
||||
});
|
||||
|
||||
$("#newSegwitPaperwalletBtn").click(function(){
|
||||
if($("#newSegWitAddress").val()==""){
|
||||
$("#newSegWitKeysBtn").click();
|
||||
}
|
||||
|
||||
var paperwallet = window.open();
|
||||
paperwallet.document.write('<h2>BTC SegWit PaperWallet</h2><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Address (Share)</h3></div><div style="text-align: center;"><div id="qraddress"></div><p>'+$("#newSegWitAddress").val()+'</p></div></div><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Public Key</h3></div><div style="text-align: center;"><div id="qrpubkey"></div><p>'+$("#newSegWitPubKey").val()+'</p></div></div><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Redeem Script</h3></div><div style="text-align: center;"><div id="qrredeem"></div><p>'+$("#newSegWitRedeemScript").val()+'</p></div></div><hr><div style="margin-top: 5px; margin-bottom: 5px"><div><h3 style="margin-top: 0">Private Key (KEEP SECRET!)</h3></div><div style="text-align: center;"><div id="qrprivkey"></div><p>'+$("#newSegWitPrivKey").val()+'</p></div></div>');
|
||||
paperwallet.document.close();
|
||||
paperwallet.focus();
|
||||
new QRCode(paperwallet.document.getElementById("qraddress"), {text: $("#newSegWitAddress").val(), width: 110, height: 110});
|
||||
new QRCode(paperwallet.document.getElementById("qrpubkey"), {text: $("#newSegWitPubKey").val(), width: 110, height: 110});
|
||||
new QRCode(paperwallet.document.getElementById("qrredeem"), {text: $("#newSegWitRedeemScript").val(), width: 110, height: 110});
|
||||
new QRCode(paperwallet.document.getElementById("qrprivkey"), {text: $("#newSegWitPrivKey").val(), width: 110, height: 110});
|
||||
paperwallet.print();
|
||||
paperwallet.close();
|
||||
});
|
||||
|
||||
/* new -> multisig code */
|
||||
|
||||
@@ -625,7 +656,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
if(!$(o).hasClass("has-error")){
|
||||
var seq = null;
|
||||
var seq = 0xffffffff-1;
|
||||
if($("#txRBF").is(":checked")){
|
||||
seq = 0xffffffff-2;
|
||||
}
|
||||
@@ -854,7 +885,7 @@ $(document).ready(function() {
|
||||
/* redeem from button code */
|
||||
|
||||
$("#redeemFromBtn").click(function(){
|
||||
var redeem = redeemingFrom($("#redeemFrom").val());
|
||||
var redeem = redeemingFrom($("#redeemFrom").val());
|
||||
|
||||
$("#redeemFromStatus, #redeemFromAddress").addClass('hidden');
|
||||
|
||||
@@ -876,11 +907,32 @@ $(document).ready(function() {
|
||||
|
||||
var host = $(this).attr('rel');
|
||||
|
||||
// api: blockcypher blockchair chain.so
|
||||
// network name "btc" "bitcoin" "BTC"
|
||||
// network name "ltc" "litecoin" "LTC"
|
||||
// network name "doge" "dogecoin" "DOGE"
|
||||
|
||||
if(host=='chain.so_litecoin'){
|
||||
listUnspentChainso_Litecoin(redeem);
|
||||
if(host=='chain.so_bitcoinmainnet'){
|
||||
listUnspentChainso(redeem, "BTC");
|
||||
} else if(host=='chain.so_litecoin'){
|
||||
listUnspentChainso(redeem, "LTC");
|
||||
} else if(host=='chain.so_dogecoin'){
|
||||
listUnspentChainso_Dogecoin(redeem);
|
||||
listUnspentChainso(redeem, "DOGE");
|
||||
|
||||
} else if(host=='blockcypher_bitcoinmainnet'){
|
||||
listUnspentBlockcypher(redeem, "btc");
|
||||
} else if(host=='blockcypher_litecoin'){
|
||||
listUnspentBlockcypher(redeem, "ltc");
|
||||
} else if(host=='blockcypher_dogecoin'){
|
||||
listUnspentBlockcypher(redeem, "doge");
|
||||
|
||||
} else if(host=='blockchair_bitcoinmainnet'){
|
||||
listUnspentBlockchair(redeem, "bitcoin");
|
||||
} else if(host=='blockchair_litecoin'){
|
||||
listUnspentBlockchair(redeem, "litecoin");
|
||||
} else if(host=='blockchair_dogecoin'){
|
||||
listUnspentBlockchair(redeem, "dogecoin");
|
||||
|
||||
} else if(host=='cryptoid.info_carboncoin'){
|
||||
listUnspentCryptoidinfo_Carboncoin(redeem);
|
||||
} else {
|
||||
@@ -889,8 +941,8 @@ $(document).ready(function() {
|
||||
|
||||
if($("#redeemFromStatus").hasClass("hidden")) {
|
||||
// An ethical dilemma: Should we automatically set nLockTime?
|
||||
if(redeem.from == 'redeemScript' && redeem.decodedRs.type == "hodl__") {
|
||||
$("#nLockTime").val(redeem.decodedRs.checklocktimeverify);
|
||||
if(redeem.from == 'redeemScript' && redeem.type == "hodl__") {
|
||||
$("#nLockTime").val(redeem.decodescript.checklocktimeverify);
|
||||
} else {
|
||||
$("#nLockTime").val(0);
|
||||
}
|
||||
@@ -926,7 +978,9 @@ $(document).ready(function() {
|
||||
r.addr = decodeRs['address'];
|
||||
r.from = 'redeemScript';
|
||||
r.decodedRs = decodeRs.redeemscript;
|
||||
r.type = decodeRs['type'];
|
||||
r.redeemscript = true;
|
||||
r.decodescript = decodeRs;
|
||||
} else { // something else
|
||||
r.addr = '';
|
||||
r.from = 'other';
|
||||
@@ -1022,25 +1076,28 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
|
||||
/* retrieve unspent data from chainso for litecoin */
|
||||
function listUnspentChainso_Litecoin(redeem){
|
||||
/* retrieve unspent data from blockcypher */
|
||||
function listUnspentBlockcypher(redeem,network){
|
||||
$.ajax ({
|
||||
type: "GET",
|
||||
url: "https://chain.so/api/v2/get_tx_unspent/ltc/"+redeem.addr,
|
||||
url: "https://api.blockcypher.com/v1/"+network+"/main/addrs/"+redeem.addr+"?includeScript=true&unspentOnly=true",
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!');
|
||||
},
|
||||
success: function(data) {
|
||||
if((data.status && data.data) && data.status=='success'){
|
||||
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
for(var i in data.data.txs){
|
||||
var o = data.data.txs[i];
|
||||
var tx = ((o.txid).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
var n = o.output_no;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex;
|
||||
var amount = o.value;
|
||||
addOutput(tx, n, script, amount);
|
||||
if (data.address) { // address field will always be present, txrefs is only present if there are UTXOs
|
||||
$("#redeemFromAddress").removeClass('hidden').html(
|
||||
'<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
for(var i in data.txrefs){
|
||||
var o = data.txrefs[i]
|
||||
var tx = ((""+o.tx_hash).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
if(tx.match(/^[a-f0-9]+$/)){
|
||||
var n = o.tx_output_n;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script;
|
||||
var amount = ((o.value.toString()*1)/100000000).toFixed(8);
|
||||
addOutput(tx, n, script, amount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs.');
|
||||
@@ -1087,19 +1144,54 @@ $(document).ready(function() {
|
||||
|
||||
}
|
||||
|
||||
/* retrieve unspent data from chain.so for dogecoin */
|
||||
function listUnspentChainso_Dogecoin(redeem){
|
||||
|
||||
/* retrieve unspent data from blockchair */
|
||||
function listUnspentBlockchair(redeem,network){
|
||||
$.ajax ({
|
||||
type: "GET",
|
||||
url: "https://chain.so/api/v2/get_tx_unspent/doge/"+redeem.addr,
|
||||
url: "https://api.blockchair.com/"+network+"/dashboards/address/"+redeem.addr,
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!');
|
||||
},
|
||||
success: function(data) {
|
||||
if((data.context && data.data) && data.context.code =='200'){
|
||||
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
var all_info = data.data[redeem.addr];
|
||||
for(var i in all_info.utxo){
|
||||
var o = all_info.utxo[i];
|
||||
var tx = ((""+o.transaction_hash).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
if(tx.match(/^[a-f0-9]+$/)){
|
||||
var n = o.index;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : all_info.address.script_hex;
|
||||
var amount = ((o.value.toString()*1)/100000000).toFixed(8);
|
||||
addOutput(tx, n, script, amount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs.');
|
||||
}
|
||||
},
|
||||
complete: function(data, status) {
|
||||
$("#redeemFromBtn").html("Load").attr('disabled',false);
|
||||
totalInputAmount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* retrieve unspent data from chainso */
|
||||
function listUnspentChainso(redeem, network){
|
||||
$.ajax ({
|
||||
type: "GET",
|
||||
url: "https://chain.so/api/v2/get_tx_unspent/"+network+"/"+redeem.addr,
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!');
|
||||
},
|
||||
success: function(data) {
|
||||
if((data.status && data.data) && data.status=='success'){
|
||||
$("#redeemFromAddress").removeClass('hidden').html(
|
||||
'<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
|
||||
for(var i in data.data.txs){
|
||||
var o = data.data.txs[i];
|
||||
var tx = ((""+o.txid).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
@@ -1121,6 +1213,7 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* math to calculate the inputs and outputs */
|
||||
|
||||
function totalInputAmount(){
|
||||
@@ -1180,7 +1273,7 @@ $(document).ready(function() {
|
||||
rawSubmitDefault(this);
|
||||
});
|
||||
|
||||
// broadcast transaction vai coinbin (default)
|
||||
// broadcast transaction via coinbin (default)
|
||||
function rawSubmitDefault(btn){
|
||||
var thisbtn = btn;
|
||||
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
|
||||
@@ -1195,8 +1288,7 @@ $(document).ready(function() {
|
||||
success: function(data) {
|
||||
$("#rawTransactionStatus").html(unescape($(data).find("response").text()).replace(/\+/g,' ')).removeClass('hidden');
|
||||
if($(data).find("result").text()==1){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger');
|
||||
$("#rawTransactionStatus").html('txid: '+$(data).find("txid").text());
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' TXID: ' + $(data).find("txid").text() + '<br> <a href="https://coinb.in/tx/' + $(data).find("txid").text() + '" target="_blank">View on Blockchain</a>');
|
||||
} else {
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span> ');
|
||||
}
|
||||
@@ -1222,8 +1314,7 @@ $(document).ready(function() {
|
||||
success: function(data) {
|
||||
$("#rawTransactionStatus").html(unescape($(data).find("response").text()).replace(/\+/g,' ')).removeClass('hidden');
|
||||
if($(data).find("result").text()==1){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger');
|
||||
$("#rawTransactionStatus").html('txid: '+$(data).find("txid").text());
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' TXID: ' + $(data).find("txid").text() + '<br> <a href="https://chainz.cryptoid.info/carbon/tx.dws?' + $(data).find("txid").text() + '" target="_blank">View on Blockchain Explorer</a>');
|
||||
} else {
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span> ');
|
||||
}
|
||||
@@ -1236,11 +1327,11 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
// broadcast transaction via chain.so (mainnet)
|
||||
function rawSubmitChainso_BitcoinMainnet(thisbtn){
|
||||
function rawSubmitChainso(thisbtn, network){
|
||||
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
|
||||
$.ajax ({
|
||||
type: "POST",
|
||||
url: "https://chain.so/api/v2/send_tx/BTC/",
|
||||
url: "https://chain.so/api/v2/send_tx/"+network+"/",
|
||||
data: {"tx_hex":$("#rawTransaction").val()},
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
@@ -1252,7 +1343,7 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(data) {
|
||||
if(data.status && data.data.txid){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' Txid: '+data.data.txid);
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' TXID: ' + data.data.txid + '<br> <a href="https://chain.so/tx/'+network+'/' + data.data.txid + '" target="_blank">View on Blockchain Explorer</a>');
|
||||
} else {
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(' Unexpected error, please try again').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
}
|
||||
@@ -1265,22 +1356,20 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
// broadcast transaction via blockcypher.com (mainnet)
|
||||
function rawSubmitblockcypher_BitcoinMainnet(thisbtn){
|
||||
function rawSubmitblockcypher(thisbtn, network){
|
||||
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
|
||||
$.ajax ({
|
||||
type: "POST",
|
||||
url: "https://api.blockcypher.com/v1/btc/main/txs/push",
|
||||
url: "https://api.blockcypher.com/v1/"+network+"/main/txs/push",
|
||||
data: JSON.stringify({"tx":$("#rawTransaction").val()}),
|
||||
error: function(data) {
|
||||
var obj = $.parseJSON(data.responseText);
|
||||
var r = ' ';
|
||||
r += (obj.error) ? obj.error : '';
|
||||
r = (r!='') ? r : ' Failed to broadcast'; // build response
|
||||
var r = 'Failed to broadcast: error code=' + data.status.toString() + ' ' + data.statusText;
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
},
|
||||
success: function(data) {
|
||||
if((data.tx) && data.tx.hash){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' Txid: '+data.tx.hash);
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden")
|
||||
.html(' TXID: ' + data.tx.hash + '<br> <a href="https://live.blockcypher.com/'+network+'/tx/' + data.tx.hash + '" target="_blank">View on Blockchain Explorer</a>');
|
||||
} else {
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(' Unexpected error, please try again').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
}
|
||||
@@ -1292,27 +1381,24 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// broadcast transaction via chain.so for dogecoin
|
||||
function rawSubmitchainso_dogecoin(thisbtn){
|
||||
// broadcast transaction via blockchair
|
||||
function rawSubmitblockchair(thisbtn, network){
|
||||
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
|
||||
$.ajax ({
|
||||
type: "POST",
|
||||
url: "https://chain.so/api/v2/send_tx/DOGE",
|
||||
data: {"tx_hex":$("#rawTransaction").val()},
|
||||
url: "https://api.blockchair.com/"+network+"/push/transaction",
|
||||
data: {"data":$("#rawTransaction").val()},
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
var obj = $.parseJSON(data.responseText);
|
||||
var r = ' ';
|
||||
r += (obj.data.tx_hex) ? ' '+obj.data.tx_hex : '';
|
||||
r = (r!='') ? r : ' Failed to broadcast'; // build response
|
||||
var r = 'Failed to broadcast: error code=' + data.status.toString() + ' ' + data.statusText;
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
// console.error(JSON.stringify(data, null, 4));
|
||||
},
|
||||
success: function(data) {
|
||||
// console.info(JSON.stringify(data, null, 4));
|
||||
if((data.status && data.data) && data.status=='success'){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' Txid: ' + data.data.txid);
|
||||
if((data.context && data.data) && data.context.code=='200'){
|
||||
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden")
|
||||
.html(' TXID: ' + data.data.transaction_hash + '<br> <a href="https://blockchair.com/'+network+'/transaction/' + data.data.transaction_hash + '" target="_blank">View on Blockchain Explorer</a>');
|
||||
} else {
|
||||
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(' Unexpected error, please try again').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
}
|
||||
@@ -1574,7 +1660,11 @@ $(document).ready(function() {
|
||||
var html = '';
|
||||
$("#verifyHDaddress .derived_data table tbody").html("");
|
||||
for(var i=index_start;i<=index_end;i++){
|
||||
var derived = hd.derive(i);
|
||||
if($("#hdpathtype option:selected").val()=='simple'){
|
||||
var derived = hd.derive(i);
|
||||
} else {
|
||||
var derived = hd.derive_path(($("#hdpath input").val().replace(/\/+$/, ""))+'/'+i);
|
||||
}
|
||||
html += '<tr>';
|
||||
html += '<td>'+i+'</td>';
|
||||
html += '<td><input type="text" class="form-control" value="'+derived.keys.address+'" readonly></td>';
|
||||
@@ -1587,6 +1677,15 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
|
||||
$("#hdpathtype").change(function(){
|
||||
if($(this).val()=='simple'){
|
||||
$("#hdpath").removeClass().addClass("hidden");
|
||||
} else {
|
||||
$("#hdpath").removeClass();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* sign code */
|
||||
|
||||
$("#signBtn").click(function(){
|
||||
@@ -1717,7 +1816,7 @@ $(document).ready(function() {
|
||||
|
||||
$('a[data-toggle="tab"]').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
if(e.target){
|
||||
if(e.target && $(e.target).attr('href')) {
|
||||
history.pushState(null, null, '#'+$(e.target).attr('href').substr(1));
|
||||
}
|
||||
});
|
||||
@@ -1772,6 +1871,14 @@ $(document).ready(function() {
|
||||
configureBroadcast();
|
||||
configureGetUnspentTx();
|
||||
|
||||
if (coinjs.pub == 0x30){ // LTC
|
||||
explorer_addr = "https://chain.so/address/LTC/";
|
||||
coinjs.bech32.hrp = "ltc";
|
||||
}
|
||||
else if (coinjs.pub == 0x1e){ // DOGE
|
||||
explorer_addr = "https://chain.so/address/DOGE/";
|
||||
}
|
||||
|
||||
$("#statusSettings").addClass("alert-success").removeClass("hidden").html("<span class=\"glyphicon glyphicon-ok\"></span> Settings updates successfully").fadeOut().fadeIn();
|
||||
} else {
|
||||
$("#statusSettings").addClass("alert-danger").removeClass("hidden").html("There is an error with one or more of your settings");
|
||||
@@ -1817,18 +1924,48 @@ $(document).ready(function() {
|
||||
|
||||
function configureBroadcast(){
|
||||
var host = $("#coinjs_broadcast option:selected").val();
|
||||
|
||||
// api: blockcypher blockchair chain.so
|
||||
// network name "btc" "bitcoin" "BTC"
|
||||
// network name "ltc" "litecoin" "LTC"
|
||||
// network name "doge" "dogecoin" "DOGE"
|
||||
|
||||
$("#rawSubmitBtn").unbind("");
|
||||
if(host=="chain.so_bitcoinmainnet"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitChainso_BitcoinMainnet(this);
|
||||
rawSubmitChainso(this, "BTC");
|
||||
});
|
||||
} else if(host=="chain.so_litecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitchainso(this, "LTC");
|
||||
});
|
||||
} else if(host=="chain.so_dogecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitchainso_dogecoin(this);
|
||||
rawSubmitchainso(this, "DOGE");
|
||||
});
|
||||
} else if(host=="blockcypher_bitcoinmainnet"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockcypher_BitcoinMainnet(this);
|
||||
rawSubmitblockcypher(this, "btc");
|
||||
});
|
||||
} else if(host=="blockcypher_litecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockcypher(this, "ltc");
|
||||
});
|
||||
} else if(host=="blockcypher_dogecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockcypher(this, "doge");
|
||||
});
|
||||
} else if(host=="blockchair_bitcoinmainnet"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockchair(this, "bitcoin");
|
||||
});
|
||||
} else if(host=="blockchair_litecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockchair(this, "litecoin");
|
||||
});
|
||||
} else if(host=="blockchair_dogecoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
rawSubmitblockchair(this, "dogecoin");
|
||||
});
|
||||
} else if(host=="cryptoid.info_carboncoin"){
|
||||
$("#rawSubmitBtn").click(function(){
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---- Version 1.4 2018.06.19 ---
|
||||
---- Version 1.4 2019.12.25 ----
|
||||
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
|
||||
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
|
||||
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
|
||||
988f99187ab356bc5d12b61572f463e1785c15c2 ./js/coinbin.js
|
||||
8b4163122d907f9c363b9afd8809490f5ba202c8 ./js/coin.js
|
||||
17cc6a56ee601fbe3858563f26232f64ce12abcb ./js/coinbin.js
|
||||
dc83017470f3ced2b0d522781b3ccded0d3a8d28 ./js/coin.js
|
||||
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
|
||||
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
|
||||
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
|
||||
@@ -30,5 +30,5 @@ ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.w
|
||||
de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg
|
||||
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
|
||||
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
|
||||
c024021c71cba503979a859d23cbf7a88b570d82 ./README.md
|
||||
26552aac02a06e88b419539f93032de8a25e1edd ./index.html
|
||||
4665ee4d8ca96db25954f6f3587ac367386eb9e8 ./README.md
|
||||
9cf7084c331b7c536f5f6e34533300c3d9d3e038 ./index.html
|
||||
|
||||
Reference in New Issue
Block a user