Skip to content

Commit b4fd55a

Browse files
author
root
committed
added feature to rebuild a transaction from the txid, useful for RBF and double spending :o. Changed donation address. Released as version 1.6
1 parent f51be92 commit b4fd55a

5 files changed

Lines changed: 88 additions & 25 deletions

File tree

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
coinbin
22
=======
33

4-
A Open Source Browser Based Bitcoin Wallet. Version 1.5 beta by OutCast3k
4+
A Open Source Browser Based Bitcoin Wallet. Version 1.6 beta by OutCast3k
55

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

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

35-
Donate to 3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN to see more development!
36+
Donate to 33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G to see more development!

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ <h2>Transaction <small>Create a new transaction</small></h2>
643643

644644
<label>Replace By Fee (RBF)</label>
645645
<p class="checkbox">
646-
<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>
646+
<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>
647647
</p>
648648

649649
<hr>
@@ -1333,7 +1333,7 @@ <h2>Development <small>Javascript framework, API and more</small></h2>
13331333

13341334
<div class="tab-pane tab-content" id="about">
13351335
<h2>About <small>open source bitcoin wallet</small></h2>
1336-
<p>Version 1.5</p>
1336+
<p>Version 1.6</p>
13371337
<p>Compatible with bitcoin core</p>
13381338
<p>Github <a href="https://github.com/OutCast3k/coinbin/">https://github.com/OutCast3k/coinbin/</a></p>
13391339
<p>TOR <a href="http://4zpinp6gdkjfplhk.onion">4zpinp6gdkjfplhk.onion</a></p>
@@ -1349,7 +1349,7 @@ <h3>Privacy</h3>
13491349
<h3>Support</h3>
13501350
<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>
13511351
<h3>Donate</h3>
1352-
<p>Please donate to <a href="bitcoin:3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN">3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN</a> if you found this project useful or want to see more features!</p>
1352+
<p>Please donate to <a href="bitcoin:33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G">33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G</a> if you found this project useful or want to see more features!</p>
13531353
</div>
13541354

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

14761476
<div id="footer">
14771477
<div class="container text-right">
1478-
<p class="text-muted">Version 1.5</p>
1478+
<p class="text-muted">Version 1.6</p>
14791479
</div>
14801480
</div>
14811481

js/coin.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
coinjs.compressed = false;
2020

2121
/* other vars */
22-
coinjs.developer = '3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN'; //bitcoin
22+
coinjs.developer = '33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G'; //bitcoin
2323

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

1070+
/* list transaction data */
1071+
r.getTransaction = function(txid, callback) {
1072+
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=gettransaction&txid='+txid+'&r='+Math.random(), callback, "GET");
1073+
}
1074+
10701075
/* add unspent to transaction */
10711076
r.addUnspent = function(address, callback, script, segwit, sequence){
10721077
var self = this;

js/coinbin.js

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ $(document).ready(function() {
881881
$("#redeemFromStatus, #redeemFromAddress").addClass('hidden');
882882

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

@@ -973,9 +973,15 @@ $(document).ready(function() {
973973
r.redeemscript = true;
974974
r.decodescript = decodeRs;
975975
} else { // something else
976-
r.addr = '';
977-
r.from = 'other';
978-
r.redeemscript = false;
976+
if(string.match(/^[a-f0-9]{64}$/i)){
977+
r.addr = string;
978+
r.from = 'txid';
979+
r.redeemscript = false;
980+
} else {
981+
r.addr = '';
982+
r.from = 'other';
983+
r.redeemscript = false;
984+
}
979985
}
980986
}
981987
return r;
@@ -1042,9 +1048,61 @@ $(document).ready(function() {
10421048
}
10431049
}
10441050

1051+
/* global function to add inputs to page */
1052+
function addInput(address, amount) {
1053+
if($("#recipients .recipient:last .address:last").val() != ""){
1054+
$("#recipients .addressAddTo:first").click();
1055+
};
1056+
1057+
$("#recipients .address:last").val(address);
1058+
$("#recipients .amount:last").val(amount);
1059+
}
1060+
1061+
10451062
/* default function to retreive unspent outputs*/
10461063
function listUnspentDefault(redeem){
1064+
10471065
var tx = coinjs.transaction();
1066+
1067+
// unspent from transaction; double spend and RBF.
1068+
1069+
if(redeem.from == 'txid'){
1070+
tx.getTransaction(redeem.addr, function(data){
1071+
1072+
$("#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>');
1073+
1074+
$.each($(data).find("inputs").children(), function(i,o){
1075+
var tx = $(o).find("txid").text();
1076+
var n = $(o).find("output_no").text();
1077+
var amount = (($(o).find("value").text()*1)).toFixed(8);
1078+
1079+
var script = coinjs.script();
1080+
var s = script.spendToScript($(o).find("address").text());
1081+
var scr = Crypto.util.bytesToHex(s.buffer);
1082+
1083+
addOutput(tx, n, scr, amount);
1084+
1085+
});
1086+
1087+
$("#recipients .addressRemoveTo").click();
1088+
$("#recipients .address").val("");
1089+
$("#recipients .amount").val("");
1090+
1091+
$.each($(data).find("outputs").children(), function(i,o){
1092+
addInput($(o).find("address").text(), $(o).find("value").text());
1093+
});
1094+
1095+
$("#redeemFromBtn").html("Load").attr('disabled',false);
1096+
totalInputAmount();
1097+
validateOutputAmount();
1098+
1099+
});
1100+
1101+
return;
1102+
}
1103+
1104+
// unspent from address
1105+
10481106
tx.listUnspent(redeem.addr, function(data){
10491107
if(redeem.addr) {
10501108
$("#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>');
@@ -1078,10 +1136,9 @@ $(document).ready(function() {
10781136
},
10791137
success: function(data) {
10801138
if (data.address) { // address field will always be present, txrefs is only present if there are UTXOs
1081-
$("#redeemFromAddress").removeClass('hidden').html(
1082-
'<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="'+explorer_addr+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
1139+
$("#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>');
10831140
for(var i in data.txrefs){
1084-
var o = data.txrefs[i]
1141+
var o = data.txrefs[i];
10851142
var tx = ((""+o.tx_hash).match(/.{1,2}/g).reverse()).join("")+'';
10861143
if(tx.match(/^[a-f0-9]+$/)){
10871144
var n = o.tx_output_n;

sha1sum

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
---- Version 1.5 2020.07.05 ----
1+
---- Version 1.6 2020.07.06 ----
22
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
33
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
44
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
5-
7708a3771dd2749807f2bfc41af407b68888ae5d ./js/coinbin.js
6-
e8a374661d3e0636b9948d34adcd81f6d69684cc ./js/coin.js
5+
7dd75e07389808d57261bca630a5bab55ce9faef ./js/coinbin.js
6+
228cdcf29d33a5eadd360e85a6220e4853ee4590 ./js/coin.js
77
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
88
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
99
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
@@ -30,6 +30,6 @@ ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.w
3030
de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg
3131
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
3232
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
33-
4665ee4d8ca96db25954f6f3587ac367386eb9e8 ./README.md
34-
e02815b3c834379e883b1e8b8bc6409654582695 ./index.html
33+
ee481606d8d48f402d152fa632ba9e5f9da7f169 ./README.md
34+
5054e03cff2cfcd1ce5296fe2659ca2d46d64fe4 ./index.html
3535
7130b64e3ef4cf6f2f1550e902f081c58dc053de ./test.html

0 commit comments

Comments
 (0)