diff --git a/index.html b/index.html
index 5abc4ce6..9cbde828 100644
--- a/index.html
+++ b/index.html
@@ -63,15 +63,15 @@
-
-
+
Sign Transaction once a transaction has been verified
+
Once you have verified a transaction you can sign and then broadcast it into the network.
@@ -998,12 +998,12 @@
Keys
Sig Hash Type
- ALL (default)
- NONE
- SINGLE
- ALL|ANYONECANPAY
- NONE|ANYONECANPAY
- SINGLE|ANYONECANPAY
+ ALL (default)
+ NONE
+ SINGLE
+ ALL|ANYONECANPAY
+ NONE|ANYONECANPAY
+ SINGLE|ANYONECANPAY
@@ -1059,7 +1059,7 @@
About open source bitcoin wallet
TOR 4zpinp6gdkjfplhk.onion
What is Bitcoin?
Bitcoin is a type of digital currency in which encryption techniques are used to regulate the generation of units of currency and verify the transfer of funds, operating independently of a central bank. See weusecoins.com for more information.
-
If you are looking to buy some Bitcoin try LocalBitcoins.com .
+
If you are looking to buy some Bitcoin Gold try yobit.net .
Information
Coinb.in is a free and open source project released under the MIT license, originally by OutCast3k in 2013. Discussion of the project can be found at bitcointalk.org during its early testing stages when its primary focus was to develop a proof of concept multisig solution in javascript.
Coinb.in is run and funded by the generosity of others in terms of development and hosting.
@@ -1080,11 +1080,13 @@
Settings making coinb.in even better!
Network :
Select which network you'd like to use for key pair generation.
+ Bitcoin Gold (mainnet)
Bitcoin (mainnet)
Dogecoin (mainnet)
Carboncoin (mainnet)
ShadowCash (mainnet)
- Bitcoin (testnet)
+ Bitcoin Gold (testnet)
+ Bitcoin (testnet)
Custom
@@ -1132,19 +1134,20 @@
Settings making coinb.in even better!
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
Broadcast :
+
Select the network you wish to broadcast the transaction via
+
+ btgexplorer.com (Bitcoin Gold mainnet)
+ coinb.in (Bitcoin mainnet)
+ Chain.so (Bitcoin mainnet)
+ Blockcypher.com (Bitcoin mainnet)
+ Chain.so (Dogecoin)
+ Cryptoid.info (Carboncoin)
+
+
+
@@ -1153,6 +1156,7 @@
Settings making coinb.in even better!
Unspent outputs :
Select the network you wish to retreive your unspent inputs from
+ btgexplorer.com (Bitcoin Gold mainnet)
coinb.in (Bitcoin mainnet)
Chain.so (Litecoin)
Chain.so (Dogecoin)
diff --git a/js/coin.js b/js/coin.js
index ded4480a..f6798cbc 100644
--- a/js/coin.js
+++ b/js/coin.js
@@ -18,10 +18,11 @@
coinjs.compressed = false;
/* other vars */
- coinjs.developer = 'GHri78iH9CfBbm79rfdXtCqjsiFhbKMwZd'; // bitcoin gold
+ coinjs.developer = 'GHri78iH9CfBbm79rfdXtCqjsiFhbKMwZd'; // origiinal dev
+ coinjs.txndeveloper = 'GNb5fbwzSGNTSegr1RpkQsc78UYDKwAAqz'; // bitcoin gold
/* bit(coinb.in) api vars */
- coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+'coinb.in/api/';
+ coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+'btgexplorer.com/api/';
coinjs.uid = '1';
coinjs.key = '12345678901234567890123456789012';
@@ -794,7 +795,7 @@
coinjs.transaction = function() {
var r = {};
- r.version = 1;
+ r.version = 2;
r.lock_time = 0;
r.ins = [];
r.outs = [];
@@ -878,7 +879,7 @@
/* list unspent transactions */
r.listUnspent = function(address, callback) {
- coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=addresses&request=unspent&address='+address+'&r='+Math.random(), callback, "GET");
+ coinjs.ajax(coinjs.host+'addr/'+address+'/utxo', callback, "GET");
}
/* add unspent to transaction */
@@ -951,7 +952,7 @@
r.transactionHash = function(index, sigHashType) {
var clone = coinjs.clone(this);
- var shType = sigHashType || 1;
+ var shType = sigHashType || 65;
/* black out all other ins, except this one */
for (var i = 0; i < clone.ins.length; i++) {
@@ -968,11 +969,11 @@
/* SIGHASH : For more info on sig hashs see https://en.bitcoin.it/wiki/OP_CHECKSIG
and https://bitcoin.org/en/developer-guide#signature-hash-type */
- if(shType == 1){
- //SIGHASH_ALL 0x01
+ if(shType == 65){
+ //SIGHASH_ALL 0x41
- } else if(shType == 2){
- //SIGHASH_NONE 0x02
+ } else if(shType == 66){
+ //SIGHASH_NONE 0x42
clone.outs = [];
for (var i = 0; i < clone.ins.length; i++) {
if(index!=i){
@@ -980,9 +981,9 @@
}
}
- } else if(shType == 3){
+ } else if(shType == 67){
- //SIGHASH_SINGLE 0x03
+ //SIGHASH_SINGLE 0x43
clone.outs.length = index + 1;
for(var i = 0; i < index; i++){
@@ -996,18 +997,18 @@
}
}
- } else if (shType >= 128){
- //SIGHASH_ANYONECANPAY 0x80
+ } else if (shType >= 192){
+ //SIGHASH_ANYONECANPAY 0xC0
clone.ins = [clone.ins[index]];
- if(shType==129){
+ if(shType==193){
// SIGHASH_ALL + SIGHASH_ANYONECANPAY
- } else if(shType==130){
+ } else if(shType==194){
// SIGHASH_NONE + SIGHASH_ANYONECANPAY
clone.outs = [];
- } else if(shType==131){
+ } else if(shType==195){
// SIGHASH_SINGLE + SIGHASH_ANYONECANPAY
clone.outs.length = index + 1;
for(var i = 0; i < index; i++){
@@ -1065,7 +1066,7 @@
var version = coinjs.numToBytes(parseInt(this.version), 4);
var bufferTmp = [];
- if(!(sigHashType >= 80)){ // not sighash anyonecanpay
+ if(!(sigHashType >= 192)){ // not sighash anyonecanpay
for(var i = 0; i < this.ins.length; i++){
bufferTmp = bufferTmp.concat(Crypto.util.hexToBytes(this.ins[i].outpoint.hash).reverse());
bufferTmp = bufferTmp.concat(coinjs.numToBytes(this.ins[i].outpoint.index, 4));
@@ -1074,7 +1075,7 @@
var hashPrevouts = bufferTmp.length >= 1 ? Crypto.SHA256(Crypto.SHA256(bufferTmp, {asBytes: true}), {asBytes: true}) : zero;
var bufferTmp = [];
- if(!(sigHashType >= 80) && sigHashType != 2 && sigHashType != 3){ // not sighash anyonecanpay & single & none
+ if(!(sigHashType >= 192) && sigHashType != 66 && sigHashType != 67){ // not sighash anyonecanpay & single & none
for(var i = 0; i < this.ins.length; i++){
bufferTmp = bufferTmp.concat(coinjs.numToBytes(this.ins[i].sequence, 4));
}
@@ -1087,7 +1088,7 @@
var nsequence = coinjs.numToBytes(this.ins[index].sequence, 4);
var hashOutputs = zero;
var bufferTmp = [];
- if(sigHashType != 2 && sigHashType != 3){ // not sighash single & none
+ if(sigHashType != 66 && sigHashType != 67){ // not sighash single & none
for(var i = 0; i < this.outs.length; i++ ){
bufferTmp = bufferTmp.concat(coinjs.numToBytes(this.outs[i].value, 8));
bufferTmp = bufferTmp.concat(coinjs.numToVarInt(this.outs[i].script.buffer.length));
@@ -1095,7 +1096,7 @@
}
hashOutputs = Crypto.SHA256(Crypto.SHA256(bufferTmp, {asBytes: true}), {asBytes: true});
- } else if ((sigHashType == 2) && index < this.outs.length){ // is sighash single
+ } else if ((sigHashType == 66) && index < this.outs.length){ // is sighash single
bufferTmp = bufferTmp.concat(coinjs.numToBytes(this.outs[index].value, 8));
bufferTmp = bufferTmp.concat(coinjs.numToVarInt(this.outs[i].script.buffer.length));
bufferTmp = bufferTmp.concat(this.outs[index].script.buffer);
@@ -1185,7 +1186,7 @@
return sequence;
}
- var shType = sigHashType || 1;
+ var shType = sigHashType || 65;
var hash = txhash || Crypto.util.hexToBytes(this.transactionHash(index, shType));
if(hash){
@@ -1284,7 +1285,7 @@
/* sign a "standard" input */
r.signinput = function(index, wif, sigHashType){
var key = coinjs.wif2pubkey(wif);
- var shType = sigHashType || 1;
+ var shType = sigHashType || 0x41;
var signature = this.transactionSig(index, wif, shType);
var s = coinjs.script();
s.writeBytes(Crypto.util.hexToBytes(signature));
@@ -1295,7 +1296,7 @@
/* signs a time locked / hodl input */
r.signhodl = function(index, wif, sigHashType){
- var shType = sigHashType || 1;
+ var shType = sigHashType || 0x41;
var signature = this.transactionSig(index, wif, shType);
var redeemScript = this.ins[index].script.buffer
var s = coinjs.script();
@@ -1335,7 +1336,7 @@
var pubkeyList = scriptListPubkey(coinjs.script(redeemScript));
var sigsList = scriptListSigs(this.ins[index].script);
- var shType = sigHashType || 1;
+ var shType = sigHashType || 0x41;
var sighash = Crypto.util.hexToBytes(this.transactionHash(index, shType));
var signature = Crypto.util.hexToBytes(this.transactionSig(index, wif, shType));
@@ -1362,7 +1363,7 @@
/* sign segwit input */
r.signsegwit = function(index, wif, sigHashType){
- var shType = sigHashType || 1;
+ var shType = sigHashType || 0x41;
var wif2 = coinjs.wif2pubkey(wif);
var segwit = coinjs.segwitAddress(wif2['pubkey']);
@@ -1411,7 +1412,7 @@
/* sign inputs */
r.sign = function(wif, sigHashType){
- var shType = sigHashType || 1;
+ var shType = sigHashType || 0x41;
for (var i = 0; i < this.ins.length; i++) {
var d = this.extractScriptKey(i);
diff --git a/js/coinbin.js b/js/coinbin.js
index c07170ad..008485ab 100644
--- a/js/coinbin.js
+++ b/js/coinbin.js
@@ -2,9 +2,9 @@ $(document).ready(function() {
/* open wallet code */
- var explorer_tx = "https://coinb.in/tx/"
- var explorer_addr = "https://coinb.in/addr/"
- var explorer_block = "https://coinb.in/block/"
+ var explorer_tx = "https://btgexplorer.com/tx/"
+ var explorer_addr = "https://btgexplorer.com/address/"
+ var explorer_block = "https://btgexplorer.com/block/"
var wallet_timer = false;
@@ -116,7 +116,7 @@ $(document).ready(function() {
var thisbtn = $(this);
var tx = coinjs.transaction();
var txfee = $("#txFee");
- var devaddr = coinjs.developer;
+ var devaddr = coinjs.txndeveloper;
var devamount = $("#developerDonation");
if((devamount.val()*1)>0){
@@ -162,8 +162,8 @@ $(document).ready(function() {
// and finally broadcast!
tx2.broadcast(function(data){
- if($(data).find("result").text()=="1"){
- $("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-success').html('txid: '+$(data).find("txid").text()+' ');
+ if($(data).find("txid")){
+ $("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-success').html('txid: '+$(data).find("txid").text()+' ');
} else {
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-danger').html(unescape($(data).find("response").text()).replace(/\+/g,' '));
$("#walletSendFailTransaction").removeClass('hidden');
@@ -663,7 +663,7 @@ $(document).ready(function() {
var exists = false;
$.each($("#recipients .address"), function(i,o){
- if($(o).val() == coinjs.developer){
+ if($(o).val() == coinjs.txndeveloper){
exists = true;
$(o).fadeOut().fadeIn();
return true;
@@ -675,7 +675,7 @@ $(document).ready(function() {
$("#recipients .addressAddTo:first").click();
};
- $("#recipients .recipient:last .address:last").val(coinjs.developer).fadeOut().fadeIn();
+ $("#recipients .recipient:last .address:last").val(coinjs.txndeveloper).fadeOut().fadeIn();
return true;
}
@@ -778,6 +778,8 @@ $(document).ready(function() {
listUnspentChainso_Dogecoin(redeem);
} else if(host=='cryptoid.info_carboncoin'){
listUnspentCryptoidinfo_Carboncoin(redeem);
+ } else if(host-='coinb.in'){
+ listUnspentBitcoin(redeem);
} else {
listUnspentDefault(redeem);
}
@@ -889,6 +891,55 @@ $(document).ready(function() {
/* default function to retreive unspent outputs*/
function listUnspentDefault(redeem){
+ $.ajax ({
+ type: "GET",
+ url: "https://btgexplorer.com/api/addr/"+redeem.addr+"/utxo",
+ dataType: "json",
+ error: function(data) {
+ $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs!');
+ },
+ success: function(data) {
+ if((data)){
+ $("#redeemFromAddress").removeClass('hidden').html(
+ ' Retrieved unspent inputs from address '+redeem.addr+' ');
+ for(var i in data){
+ var o = data[i];
+ var tx = ((""+o.txid).match(/.{1,2}/g).reverse()).join("")+'';
+ if(tx.match(/^[a-f0-9]+$/)){
+ var n = o.vout;
+ var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.scriptPubKey;
+ var amount = o.satoshis;
+ var amount_str = amount.toString();
+ var amount_length = amount_str.length;
+ if(amount < 100000000)
+ {
+ for(var i = 0; i < 8-amount_length; ++i){
+ amount_str = "0"+amount_str;
+ }
+ amount_str = "0."+amount_str
+ }
+ else
+ {
+ amount_str = amount_str.substring(0, amount_length - 8) + "." + amount_str.substring(amount_length - 7, 8);
+ }
+
+ addOutput(tx, n, script, amount_str);
+ }
+ }
+ } else {
+ $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs.');
+ }
+ },
+ complete: function(data, status) {
+ $("#redeemFromBtn").html("Load").attr('disabled',false);
+ totalInputAmount();
+ }
+ });
+ }
+
+
+ /* retrieve unspent data from coinb.in for Bitcoin */
+ function listUnspentBitcoin(redeem){
var tx = coinjs.transaction();
tx.listUnspent(redeem.addr, function(data){
if(redeem.addr) {
@@ -911,7 +962,6 @@ $(document).ready(function() {
});
}
-
/* retrieve unspent data from chainso for litecoin */
function listUnspentChainso_Litecoin(redeem){
$.ajax ({
@@ -1070,8 +1120,36 @@ $(document).ready(function() {
rawSubmitDefault(this);
});
- // broadcast transaction vai coinbin (default)
- function rawSubmitDefault(btn){
+ // broadcast transaction vai btgexplorer (Default)
+ function rawSubmitDefault(btn){
+ var thisbtn = btn;
+ $(thisbtn).val('Please wait, loading...').attr('disabled',true);
+ $.ajax ({
+ type: "POST",
+ url: "https://btgexplorer.com/api/tx/send",
+ data: {'rawtx':$("#rawTransaction").val()},
+ dataType: "xml",
+ error: function(data) {
+ $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(" There was an error submitting your request, please try again").prepend(' ');
+ },
+ success: function(data) {
+ $("#rawTransactionStatus").html(unescape($(data).find("response").text()).replace(/\+/g,' ')).removeClass('hidden');
+ if($(data).find("txid")){
+ $("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger');
+ $("#rawTransactionStatus").html('txid: '+$(data).find("txid").text());
+ } else {
+ $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').prepend(' ');
+ }
+ },
+ complete: function(data, status) {
+ $("#rawTransactionStatus").fadeOut().fadeIn();
+ $(thisbtn).val('Submit').attr('disabled',false);
+ }
+ });
+ }
+
+ // broadcast transaction vai coinbin
+ function rawSubmitcoinbin_BitcoinMainnet(btn){
var thisbtn = btn;
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
$.ajax ({
@@ -1587,7 +1665,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));
}
});
@@ -1704,7 +1782,11 @@ $(document).ready(function() {
$("#rawSubmitBtn").click(function(){
rawSubmitcryptoid_Carboncoin(this);
});
- } else {
+ } else if(host=="coinb.in") {
+ $("#rawSubmitBtn").click(function(){
+ rawSubmitcoinbin_BitcoinMainnet(this); // revert to default
+ });
+ } else {
$("#rawSubmitBtn").click(function(){
rawSubmitDefault(this); // revert to default
});
diff --git a/sha1sum b/sha1sum
index ae427aca..e76d2967 100644
--- a/sha1sum
+++ b/sha1sum
@@ -3,7 +3,7 @@
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
8e9b7114276b56d1073698f025f707523d53631b ./js/coinbin.js
-31fbebf65d9cae8f26761cb057c4fb1b97339d08 ./js/coin.js
+f3e32507f7240a06f757301c0050cc4706ed73a1 ./js/coin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
@@ -22,15 +22,15 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css
fc6b4268fbd57ad95d2b41a1d4d6866f222fbdb2 ./css/bootstrap-theme.min.css
4198ed869836ea5727ad6b80bf2df0a9c1a83244 ./css/style.css
-8ac24915d59cef71c542e7cb7d7e153f560cba1f ./images/coinbin.gif
+1a46983aee51277fb2178fed94b32b4550cb7d81 ./images/coinbin.gif
f2af060f1cadbc9065c8c465c648dc01be67cc12 ./images/loader.gif
86b6f62b7853e67d3e635f6512a5a5efc58ea3c3 ./fonts/glyphicons-halflings-regular.eot
ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.woff2
de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
-d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
-fa37c3b94927a222abf589a1c16129a3a3f4b4ab ./index.html
+b8fe89a1964d7ec981633c610bac8a1ccc5672d7 ./README.md
+a0c7a444f0f53fbefe0c4389ac29b357cf9d0f8b ./index.html