Skip to content

Commit

Permalink
added feature to rebuild a transaction from the txid, useful for RBF …
Browse files Browse the repository at this point in the history
…and double spending :o. Changed donation address. Released as version 1.6
  • Loading branch information
root committed Jul 6, 2020
1 parent f51be92 commit b4fd55a
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 25 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coinbin
=======

A Open Source Browser Based Bitcoin Wallet. Version 1.5 beta by OutCast3k
A Open Source Browser Based Bitcoin Wallet. Version 1.6 beta by OutCast3k

Live version available at http://coinb.in/ or http://4zpinp6gdkjfplhk.onion

Expand All @@ -24,12 +24,13 @@ Coinb.in supports a number of key features such as:
- Brain wallet support.
- Compatible with bitcoin-qt
- An offical .onion address for tor users.
- Offline qrcode creator and scanning tool
- HD (bip32) support
- Supports altcoins such as litecoin
- Replace by fee (RBF) Support
- Segwit Support
- Bech32 address support
- Offline qrcode creator and scanning tool.
- HD (bip32) support.
- Supports altcoins such as litecoin.
- Replace by fee (RBF) Support.
- Segwit Support.
- Bech32 address support.
- Fee calculator - https://coinb.in/#fees
- Transaction rebuild support for RBF and double spending.

Donate to 3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN to see more development!
Donate to 33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G to see more development!
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ <h2>Transaction <small>Create a new transaction</small></h2>

<label>Replace By Fee (RBF)</label>
<p class="checkbox">
<label><input type="checkbox" id="txRBF" class="checkbox-inline"> Make this a <a href="https://en.bitcoin.it/wiki/Transaction_replacement" target="_blank">RBF transaction</a>.</label>
<label><input type="checkbox" id="txRBF" class="checkbox-inline" checked> Make this a <a href="https://en.bitcoin.it/wiki/Transaction_replacement" target="_blank">RBF transaction</a>.</label>
</p>

<hr>
Expand Down Expand Up @@ -1333,7 +1333,7 @@ <h2>Development <small>Javascript framework, API and more</small></h2>

<div class="tab-pane tab-content" id="about">
<h2>About <small>open source bitcoin wallet</small></h2>
<p>Version 1.5</p>
<p>Version 1.6</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>
Expand All @@ -1349,7 +1349,7 @@ <h3>Privacy</h3>
<h3>Support</h3>
<p>We recommend that you first check our <a href="https://status.coinb.in/" target="_blank">service status</a> page and then <a href="https://blog.coinb.in/" target="_blank">blog</a> page which has multiple <a href="https://blog.coinb.in/guides" target="_blank">guides</a>. However if the problem persists you can contact us by emailing support{at}coinb.in.</p>
<h3>Donate</h3>
<p>Please donate to <a href="bitcoin:3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN">3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN</a> if you found this project useful or want to see more features!</p>
<p>Please donate to <a href="bitcoin:33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G">33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G</a> if you found this project useful or want to see more features!</p>
</div>

<div class="tab-pane tab-content" id="settings">
Expand Down Expand Up @@ -1475,7 +1475,7 @@ <h2>Settings <small> making coinb.in even better!</small></h2>

<div id="footer">
<div class="container text-right">
<p class="text-muted">Version 1.5</p>
<p class="text-muted">Version 1.6</p>
</div>
</div>

Expand Down
7 changes: 6 additions & 1 deletion js/coin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
coinjs.compressed = false;

/* other vars */
coinjs.developer = '3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN'; //bitcoin
coinjs.developer = '33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G'; //bitcoin

/* bit(coinb.in) api vars */
coinjs.hostname = ((document.location.hostname.split(".")[(document.location.hostname.split(".")).length-1]) == 'onion') ? '4zpinp6gdkjfplhk.onion' : 'coinb.in';
Expand Down Expand Up @@ -1067,6 +1067,11 @@
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=addresses&request=unspent&address='+address+'&r='+Math.random(), callback, "GET");
}

/* list transaction data */
r.getTransaction = function(txid, callback) {
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=gettransaction&txid='+txid+'&r='+Math.random(), callback, "GET");
}

/* add unspent to transaction */
r.addUnspent = function(address, callback, script, segwit, sequence){
var self = this;
Expand Down
71 changes: 64 additions & 7 deletions js/coinbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ $(document).ready(function() {
$("#redeemFromStatus, #redeemFromAddress").addClass('hidden');

if(redeem.from=='multisigAddress'){
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> You should use the redeem script, not the multisig address!');
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> You should use the redeem script, not its address!');
return false;
}

Expand Down Expand Up @@ -973,9 +973,15 @@ $(document).ready(function() {
r.redeemscript = true;
r.decodescript = decodeRs;
} else { // something else
r.addr = '';
r.from = 'other';
r.redeemscript = false;
if(string.match(/^[a-f0-9]{64}$/i)){
r.addr = string;
r.from = 'txid';
r.redeemscript = false;
} else {
r.addr = '';
r.from = 'other';
r.redeemscript = false;
}
}
}
return r;
Expand Down Expand Up @@ -1042,9 +1048,61 @@ $(document).ready(function() {
}
}

/* global function to add inputs to page */
function addInput(address, amount) {
if($("#recipients .recipient:last .address:last").val() != ""){
$("#recipients .addressAddTo:first").click();
};

$("#recipients .address:last").val(address);
$("#recipients .amount:last").val(amount);
}


/* default function to retreive unspent outputs*/
function listUnspentDefault(redeem){

var tx = coinjs.transaction();

// unspent from transaction; double spend and RBF.

if(redeem.from == 'txid'){
tx.getTransaction(redeem.addr, function(data){

$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Attempted to rebuild transaction id <a href="'+explorer_tx+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');

$.each($(data).find("inputs").children(), function(i,o){
var tx = $(o).find("txid").text();
var n = $(o).find("output_no").text();
var amount = (($(o).find("value").text()*1)).toFixed(8);

var script = coinjs.script();
var s = script.spendToScript($(o).find("address").text());
var scr = Crypto.util.bytesToHex(s.buffer);

addOutput(tx, n, scr, amount);

});

$("#recipients .addressRemoveTo").click();
$("#recipients .address").val("");
$("#recipients .amount").val("");

$.each($(data).find("outputs").children(), function(i,o){
addInput($(o).find("address").text(), $(o).find("value").text());
});

$("#redeemFromBtn").html("Load").attr('disabled',false);
totalInputAmount();
validateOutputAmount();

});

return;
}

// unspent from address

tx.listUnspent(redeem.addr, function(data){
if(redeem.addr) {
$("#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>');
Expand Down Expand Up @@ -1078,10 +1136,9 @@ $(document).ready(function() {
},
success: function(data) {
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>');
$("#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 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;
Expand Down
10 changes: 5 additions & 5 deletions sha1sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---- Version 1.5 2020.07.05 ----
---- Version 1.6 2020.07.06 ----
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
7708a3771dd2749807f2bfc41af407b68888ae5d ./js/coinbin.js
e8a374661d3e0636b9948d34adcd81f6d69684cc ./js/coin.js
7dd75e07389808d57261bca630a5bab55ce9faef ./js/coinbin.js
228cdcf29d33a5eadd360e85a6220e4853ee4590 ./js/coin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
Expand All @@ -30,6 +30,6 @@ ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.w
de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
4665ee4d8ca96db25954f6f3587ac367386eb9e8 ./README.md
e02815b3c834379e883b1e8b8bc6409654582695 ./index.html
ee481606d8d48f402d152fa632ba9e5f9da7f169 ./README.md
5054e03cff2cfcd1ce5296fe2659ca2d46d64fe4 ./index.html
7130b64e3ef4cf6f2f1550e902f081c58dc053de ./test.html

0 comments on commit b4fd55a

Please sign in to comment.