added new #fee section to coinb.in
This commit is contained in:
parent
64af126bc5
commit
c843685662
4 changed files with 470 additions and 18 deletions
BIN
images/btc32x.png
Normal file
BIN
images/btc32x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
188
index.html
188
index.html
|
@ -74,6 +74,7 @@
|
||||||
<li><a href="#about" data-toggle="tab"><span class="glyphicon glyphicon-info-sign"></span> About</a></li>
|
<li><a href="#about" data-toggle="tab"><span class="glyphicon glyphicon-info-sign"></span> About</a></li>
|
||||||
|
|
||||||
<li class="hidden"><a href="#settings" data-toggle="tab"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
|
<li class="hidden"><a href="#settings" data-toggle="tab"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
|
||||||
|
<li class="hidden"><a href="#fees" data-toggle="tab"><span class="glyphicon glyphicon-tag"></span> Fees</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -119,7 +120,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<h3><span class="glyphicon glyphicon-piggy-bank"></span> Wallet</h3>
|
<h3><span class="glyphicon glyphicon-piggy-bank"></span> Wallet</h3>
|
||||||
<p>Quick access to an <a href="#wallet">online wallet</a> where only you have access to your own private keys!</p>
|
<p>Quick access to an <a href="#wallet">online wallet</a> where only you have access to your own private keys & can <a href="#fees">calculate your own fee</a>!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -199,6 +200,12 @@
|
||||||
<div id="walletKeys" class="hidden">
|
<div id="walletKeys" class="hidden">
|
||||||
<label>Public Key</label>
|
<label>Public Key</label>
|
||||||
<input class="form-control pubkey" type="text" readonly>
|
<input class="form-control pubkey" type="text" readonly>
|
||||||
|
|
||||||
|
<div class="walletSegWitRS hidden">
|
||||||
|
<label>Redeem Script <i>(SegWit)</i></label>
|
||||||
|
<input class="form-control" type="text" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label>Private key</label>
|
<label>Private key</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input class="form-control privkey" type="password" readonly>
|
<input class="form-control privkey" type="password" readonly>
|
||||||
|
@ -208,11 +215,6 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="walletSegWitRS hidden">
|
|
||||||
<label>Redeem Script <i>(SegWit)</i></label>
|
|
||||||
<input class="form-control" type="text" readonly>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label>Private Key (AES256 encrypted key)</label>
|
<label>Private Key (AES256 encrypted key)</label>
|
||||||
<input class="form-control privkeyaes" type="text" readonly>
|
<input class="form-control privkeyaes" type="text" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
@ -246,7 +248,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<label><abbr title="the amount to pay in network miner fees - 0.0004 or more recommended for a faster processing time">Transaction Fee</abbr> <a href="https://bitcoinfees.21.co/" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></label>
|
<label><abbr title="the amount to pay in network miner fee">Transaction Fee</abbr> <a href="javascript:;" id="feesestwallet"><span class="glyphicon glyphicon-question-sign"></span></a></label>
|
||||||
<input type="text" class="form-control" value="0.0004" id="txFee">
|
<input type="text" class="form-control" value="0.0004" id="txFee">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-5">
|
<div class="col-xs-5">
|
||||||
|
@ -708,7 +710,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<label><abbr title="What is not spent will be used as a transaction fee">Transaction Fee</abbr> <a href="https://bitcoinfees.21.co/" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></label>
|
<label><abbr title="What is not spent will be used as a transaction fee, so remember to add a "change address"">Transaction Fee</abbr> <a href="javascript:;" id="feesestnewtx"><span class="glyphicon glyphicon-question-sign"></span></a></label>
|
||||||
<input type="text" id="transactionFee" class="form-control" value="0.0000" readonly>
|
<input type="text" id="transactionFee" class="form-control" value="0.0000" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -733,6 +735,176 @@
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane tab-content" id="fees">
|
||||||
|
<h2>Bitcoin Fee Calculator</h2>
|
||||||
|
<p>This page will give you a guide on the lowest fee to use to get your transaction included within the next few blocks. It works by predicting the size of a transaction and comparing it to another transaction in a recent block to determine an appropriate fee.</p>
|
||||||
|
|
||||||
|
<div align="center" class="alert alert-info">
|
||||||
|
<h2><span class="glyphicon glyphicon-question-sign"></span> Recommended Fee: <span class="recommendedFee">0.00000000</span> BTC <small> <br> for a transaction of <span class="feeTxSize">0</span> bytes</small></h2>
|
||||||
|
<span class="text-muted"><i><span class="feeSatByte">?</span> Sat/Byte</i></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="txsliders" class="row">
|
||||||
|
<div class="col-md-6 txinputs">
|
||||||
|
|
||||||
|
<div align="center"><b><span class="txtotal total">0</span><br>Inputs</b></div>
|
||||||
|
<div id="txinputstype" align="center" class="small text-muted">
|
||||||
|
<br>
|
||||||
|
<span><span class="txsize">0</span> Bytes</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="regular"><abbr title="Spending from a compressed legacy address. p2pkh">Regular</abbr> <small>Compressed</small>
|
||||||
|
<span class="badge inputno" title="Number of Regular Inputs">1</span>
|
||||||
|
<small><span class="bytes">148</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="1" class="slider txinput txi_regular" rel="regular">
|
||||||
|
|
||||||
|
<h4 class="segwit"><abbr title="Spending from a segwit address. p2sh">SegWit</abbr>
|
||||||
|
<span class="badge inputno" title="Number of SegWit Inputs">0</span>
|
||||||
|
<small><span class="bytes">0</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="0" class="slider txinput txi_segwit" rel="segwit">
|
||||||
|
|
||||||
|
<h4 class="multisig"><abbr title="Spending from a multisig address. p2sh">MultiSig</abbr>
|
||||||
|
<span class="badge inputno" title="Number of MultiSig Inputs">0</span>
|
||||||
|
<small><span class="bytes">0</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="0" class="slider txinput txi_multisig" rel="multisig">
|
||||||
|
|
||||||
|
<h4 class="hodl"><abbr title="Spending from a time locked address. p2sh">Hodl</abbr> <small>Time Locked</small>
|
||||||
|
<span class="badge inputno" title="Number of Hodl Inputs">0</span>
|
||||||
|
<small><span class="bytes">0</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="0" class="slider txinput txi_hodl" rel="hodl">
|
||||||
|
|
||||||
|
<h4 class="unknown"><abbr title="Spending from an unrecognized input. p2sh">Unknown</abbr>
|
||||||
|
<span class="badge inputno" title="Number of Unknown Inputs">0</span>
|
||||||
|
<small><span class="bytes">0</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="0" class="slider txinput txi_unknown" rel="unknown">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 txoutputs">
|
||||||
|
|
||||||
|
<div align="center"><b><span class="txtotal total">0</span><br>Outputs</b></div>
|
||||||
|
<div id="txoutputtype" align="center" class="small text-muted">
|
||||||
|
<br>
|
||||||
|
<span><span class="txsize">0</span> Bytes</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="p2pkh"><abbr title="A pay 2 public key hash. Starts with 1. Used with legacy addresses">Regular</abbr> <small>p2pkh (1...)</small>
|
||||||
|
<span class="badge outputno" title="Number of p2pkh Outputs">2</span>
|
||||||
|
<small><span class="bytes">68</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="2" class="slider txoutput txo_p2pkh" rel="p2pkh">
|
||||||
|
|
||||||
|
<h4 class="p2sh"><abbr title="A pay 2 script hash address. Starts with a 3. For example a segwit or multisig address">Regular</abbr> <small>p2sh (3...)</small>
|
||||||
|
<span class="badge outputno" title="Number of p2sh Outputs">0</span>
|
||||||
|
<small><span class="bytes">0</span> bytes</small>
|
||||||
|
<small class="estimate hidden"><em> *estimate</em></small>
|
||||||
|
</h4>
|
||||||
|
<input type="range" min="0" max="100" value="0" class="slider txoutput txo_p2sh" rel="p2sh">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="text-muted">Chargable Transaction Size: <span class="feeTxSize">0</span> bytes</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 recommended">
|
||||||
|
|
||||||
|
<h3>Blockchain Data <span class="pull-right"><button type="button" id="feeStatsReload" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-refresh"></span></button></span></h3>
|
||||||
|
|
||||||
|
<p>This is based on us comparing your transaction agianst the last transaction found in the last block</p>
|
||||||
|
<p><b>Block Height</b>: <span class="blockHeight">?</span></p>
|
||||||
|
<p class="hideOverflow"><b>Block #</b>: <span class="blockHash">?</span></p>
|
||||||
|
<p><b>Block Time</b>: <span class="blockTime">?</span> <span class="blockDateTime text-muted"></span></p>
|
||||||
|
<p class="hideOverflow"><b>Transaction ID</b>: <span class="txId">?</span></p>
|
||||||
|
<p><b>Transaction Size</b>: <span class="txSize">0</span> bytes</p>
|
||||||
|
<p><b>Transaction Fee</b>: <span class="txFee">0.00000000</span></p>
|
||||||
|
<p><b>Satoshi per Byte</b>: <span class="feeSatByte">0</span></p>
|
||||||
|
|
||||||
|
<p>Based on your data and this recently mined transaction we recommend a fee of <b><span class="recommendedFee">0.00000000</span> BTC</b> to get it into the next few blocks</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<a href="javascript:;" id="advancedFeesCollapse">
|
||||||
|
<div class="well well-sm"><span class="glyphicon glyphicon-collapse-down"></span> Advanced Options & Raw Transaction</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row hidden" id="advancedFees">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p>Enter your unsigned or signed hex encoded transaction below:</p>
|
||||||
|
<textarea class="form-control txhex" style="height:160px"></textarea><br>
|
||||||
|
<button type="button" class="btn btn-primary" id="analyseBtn">Analyse Transaction</button>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h4>Estimate Input Size <small>in bytes</small></h4>
|
||||||
|
|
||||||
|
<div class="form-inline">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txi_regular">Regular</label>
|
||||||
|
<input type="number" class="form-control" id="est_txi_regular" value="107">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txi_segwit">SegWit</label>
|
||||||
|
<input type="number" class="form-control" id="est_txi_segwit" value="27">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txi_multisig">MultiSig</label>
|
||||||
|
<input type="number" class="form-control" id="est_txi_multisig" value="351">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txi_hodl">Hodl</label>
|
||||||
|
<input type="number" class="form-control" id="est_txi_hodl" value="78">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txi_unknown">Unknown</label>
|
||||||
|
<input type="number" class="form-control" id="est_txi_unknown" value="512">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4>Estimate Output Size <small> in bytes</small></h4>
|
||||||
|
<div class="form-inline">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txo_p2pkh">Regular P2PKH</label>
|
||||||
|
<input type="number" class="form-control" id="est_txo_p2pkh" value="25">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="est_txo_p2sh">Regular P2SH</label>
|
||||||
|
<input type="number" class="form-control" id="est_txo_p2sh" value="23">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane tab-content" id="verify">
|
<div class="tab-pane tab-content" id="verify">
|
||||||
<h2>Verify <small>transactions and other scripts</small></h2>
|
<h2>Verify <small>transactions and other scripts</small></h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
280
js/coinbin.js
280
js/coinbin.js
|
@ -635,9 +635,17 @@ $(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
if(!$("#recipients .row, #inputs .row").hasClass('has-error')){
|
if(!$("#recipients .row, #inputs .row").hasClass('has-error')){
|
||||||
|
|
||||||
$("#transactionCreate textarea").val(tx.serialize());
|
$("#transactionCreate textarea").val(tx.serialize());
|
||||||
$("#transactionCreate .txSize").html(tx.size());
|
$("#transactionCreate .txSize").html(tx.size());
|
||||||
|
|
||||||
|
if($("#feesestnewtx").attr('est')=='y'){
|
||||||
|
$("#fees .txhex").val($("#transactionCreate textarea").val());
|
||||||
|
$("#analyseBtn").click();
|
||||||
|
$("#fees .txhex").val("");
|
||||||
|
window.location = "#fees";
|
||||||
|
} else {
|
||||||
|
|
||||||
$("#transactionCreate").removeClass("hidden");
|
$("#transactionCreate").removeClass("hidden");
|
||||||
|
|
||||||
// Check fee against hard 0.01 as well as fluid 200 satoshis per byte calculation.
|
// Check fee against hard 0.01 as well as fluid 200 satoshis per byte calculation.
|
||||||
|
@ -645,11 +653,66 @@ $(document).ready(function() {
|
||||||
$("#modalWarningFeeAmount").html($("#transactionFee").val());
|
$("#modalWarningFeeAmount").html($("#transactionFee").val());
|
||||||
$("#modalWarningFee").modal("show");
|
$("#modalWarningFee").modal("show");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$("#feesestnewtx").attr('est','');
|
||||||
} else {
|
} else {
|
||||||
$("#transactionCreateStatus").removeClass("hidden").html("One or more input or output is invalid").fadeOut().fadeIn();
|
$("#transactionCreateStatus").removeClass("hidden").html("One or more input or output is invalid").fadeOut().fadeIn();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#feesestnewtx").click(function(){
|
||||||
|
$(this).attr('est','y');
|
||||||
|
$("#transactionBtn").click();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#feesestwallet").click(function(){
|
||||||
|
$(this).attr('est','y');
|
||||||
|
var outputs = $("#walletSpendTo .output").length;
|
||||||
|
|
||||||
|
$("#fees .inputno, #fees .outputno, #fees .bytes").html(0);
|
||||||
|
$("#fees .slider").val(0);
|
||||||
|
|
||||||
|
var tx = coinjs.transaction();
|
||||||
|
tx.listUnspent($("#walletAddress").html(), function(data){
|
||||||
|
var inputs = $(data).find("unspent").children().length;
|
||||||
|
if($("#walletSegwit").is(":checked")){
|
||||||
|
$("#fees .txi_segwit").val(inputs);
|
||||||
|
$("#fees .txi_segwit").change();
|
||||||
|
} else {
|
||||||
|
$("#fees .txi_regular").val(inputs);
|
||||||
|
$("#fees .txi_regular").change();
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each($("#walletSpendTo .output"), function(i,o){
|
||||||
|
var addr = $('.addressTo',o);
|
||||||
|
var ad = coinjs.addressDecode(addr.val());
|
||||||
|
if (ad.version == coinjs.multisig){ // p2sh
|
||||||
|
$("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1);
|
||||||
|
$("#fees .txo_p2sh").change();
|
||||||
|
} else { // p2pkh
|
||||||
|
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
|
||||||
|
$("#fees .txo_p2pkh").change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(($("#developerDonation").val()*1)>0){
|
||||||
|
var addr = coinjs.developer;
|
||||||
|
var ad = coinjs.addressDecode(addr);
|
||||||
|
if (ad.version == coinjs.multisig){ // p2sh
|
||||||
|
$("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1);
|
||||||
|
$("#fees .txo_p2sh").change();
|
||||||
|
} else { // p2pkh
|
||||||
|
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
|
||||||
|
$("#fees .txo_p2pkh").change();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//feeStats();
|
||||||
|
window.location = "#fees";
|
||||||
|
});
|
||||||
|
|
||||||
$(".txidClear").click(function(){
|
$(".txidClear").click(function(){
|
||||||
$("#inputs .row:first input").attr('disabled',false);
|
$("#inputs .row:first input").attr('disabled',false);
|
||||||
$("#inputs .row:first input").val("");
|
$("#inputs .row:first input").val("");
|
||||||
|
@ -1549,6 +1612,12 @@ $(document).ready(function() {
|
||||||
window.location.hash = "#verify";
|
window.location.hash = "#verify";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
if(e.target.hash == "#fees"){
|
||||||
|
feeStats();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
$(".qrcodeBtn").click(function(){
|
$(".qrcodeBtn").click(function(){
|
||||||
$("#qrcode").html("");
|
$("#qrcode").html("");
|
||||||
var thisbtn = $(this).parent().parent();
|
var thisbtn = $(this).parent().parent();
|
||||||
|
@ -1719,6 +1788,216 @@ $(document).ready(function() {
|
||||||
$("#redeemFromBtn").attr('rel',$("#coinjs_utxo option:selected").val());
|
$("#redeemFromBtn").attr('rel',$("#coinjs_utxo option:selected").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* fees page code */
|
||||||
|
|
||||||
|
$("#fees .slider").change(function(){
|
||||||
|
$('.'+$(this).attr('rel')+' .inputno, .'+$(this).attr('rel')+' .outputno',$(this).parent()).html($(this).val());
|
||||||
|
$('.'+$(this).attr('rel')+' .estimate',$(this).parent()).removeClass('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txo_p2pkh").change(function(){
|
||||||
|
var outputno = $('.'+$(this).attr('rel')+' .outputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((outputno*$("#est_txo_p2pkh").val())+(outputno*9));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txo_p2sh").change(function(){
|
||||||
|
var outputno = $('.'+$(this).attr('rel')+' .outputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((outputno*$("#est_txo_p2sh").val())+(outputno*9));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txi_regular").change(function(){
|
||||||
|
var inputno = $('.'+$(this).attr('rel')+' .inputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((inputno*$("#est_txi_regular").val())+(inputno*41));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txi_segwit").change(function(){
|
||||||
|
var inputno = $('.'+$(this).attr('rel')+' .inputno',$(this).parent()).html();
|
||||||
|
var bytes = 0;
|
||||||
|
if(inputno >= 1){
|
||||||
|
bytes = 2;
|
||||||
|
bytes += (inputno*32);
|
||||||
|
bytes += (inputno*$("#est_txi_segwit").val());
|
||||||
|
bytes += (inputno*(41))
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes = bytes.toFixed(0);
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html(bytes);
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txi_multisig").change(function(){
|
||||||
|
var inputno = $('.'+$(this).attr('rel')+' .inputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((inputno*$("#est_txi_multisig").val())+(inputno*41));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txi_hodl").change(function(){
|
||||||
|
var inputno = $('.'+$(this).attr('rel')+' .inputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((inputno*$("#est_txi_hodl").val())+(inputno*41));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txi_unknown").change(function(){
|
||||||
|
var inputno = $('.'+$(this).attr('rel')+' .inputno',$(this).parent()).html();
|
||||||
|
$('.'+$(this).attr('rel')+' .bytes',$(this).parent()).html((inputno*$("#est_txi_unknown").val())+(inputno*41));
|
||||||
|
mathFees();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#advancedFeesCollapse").click(function(){
|
||||||
|
if($("#advancedFees").hasClass('hidden')){
|
||||||
|
$("span",this).removeClass('glyphicon-collapse-down').addClass('glyphicon-collapse-up');
|
||||||
|
$("#advancedFees").removeClass("hidden");
|
||||||
|
} else {
|
||||||
|
$("span",this).removeClass('glyphicon-collapse-up').addClass('glyphicon-collapse-down');
|
||||||
|
$("#advancedFees").addClass("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#analyseBtn").click(function(){
|
||||||
|
if(!$("#fees .txhex").val().match(/^[a-f0-9]+$/ig)){
|
||||||
|
alert('You must provide a hex encoded transaction');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tx = coinjs.transaction();
|
||||||
|
var deserialized = tx.deserialize($("#fees .txhex").val());
|
||||||
|
|
||||||
|
$("#fees .txoutputs .outputno, #fees .txinputs .inputno").html("0");
|
||||||
|
$("#fees .txoutputs .bytes, #fees .txinputs .bytes").html("0");
|
||||||
|
$("#fees .slider").val(0);
|
||||||
|
|
||||||
|
for(var i = 0; i < deserialized.ins.length; i++){
|
||||||
|
var script = deserialized.extractScriptKey(i);
|
||||||
|
var size = 41;
|
||||||
|
if(script.type == 'segwit'){
|
||||||
|
if(deserialized.witness[i]){
|
||||||
|
size += deserialized.ins[i].script.buffer.length / 2;
|
||||||
|
for(w in deserialized.witness[i]){
|
||||||
|
size += (deserialized.witness[i][w].length / 2) /4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
size += $("#est_txi_segwit").val()*1;
|
||||||
|
}
|
||||||
|
size = size.toFixed(0);
|
||||||
|
$("#fees .segwit .inputno").html(($("#fees .segwit .inputno").html()*1)+1);
|
||||||
|
$("#fees .txi_segwit").val(($("#fees .txi_segwit").val()*1)+1);
|
||||||
|
$("#fees .segwit .bytes").html(size);
|
||||||
|
|
||||||
|
} else if(script.type == 'multisig'){
|
||||||
|
var s = coinjs.script();
|
||||||
|
var rs = s.decodeRedeemScript(script.script);
|
||||||
|
size += 4 + ((script.script.length / 2) + (73 * rs.signaturesRequired));
|
||||||
|
$("#fees .multisig .inputno").html(($("#fees .multisig .inputno").html()*1)+1);
|
||||||
|
$("#fees .txi_multisig").val(($("#fees .txi_multisig").val()*1)+1);
|
||||||
|
$("#fees .multisig .bytes").html(size);
|
||||||
|
|
||||||
|
} else if(script.type == 'hodl'){
|
||||||
|
size += 78;
|
||||||
|
$("#fees .hodl .inputno").html(($("#fees .hodl .inputno").html()*1)+1);
|
||||||
|
$("#fees .hodl .bytes").html(size);
|
||||||
|
$("#fees .txi_hodl").val(($("#fees .txi_hodl").val()*1)+1);
|
||||||
|
|
||||||
|
} else if(script.type == 'empty' || script.type == 'scriptpubkey'){
|
||||||
|
if(script.signatures == 1){
|
||||||
|
size += script.script.length / 2;
|
||||||
|
} else {
|
||||||
|
size += $("#est_txi_regular").val()*1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#fees .regular .inputno").html(($("#fees .regular .inputno").html()*1)+1);
|
||||||
|
$("#fees .txi_regular").val(($("#fees .txi_regular").val()*1)+1);
|
||||||
|
$("#fees .regular .bytes").html(($("#fees .regular .bytes").html()*1)+size);
|
||||||
|
|
||||||
|
} else if(script.type == 'unknown'){
|
||||||
|
size += script.script.length / 2;
|
||||||
|
$("#fees .unknown .inputno").html(($("#fees .unknown .inputno").html()*1)+1);
|
||||||
|
$("#fees .txi_unknown").val(($("#fees .txi_unknown").val()*1)+1);
|
||||||
|
$("#fees .unknown .bytes").html(($("#fees .unknown .bytes").html()*1)+size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i = 0; i < deserialized.outs.length; i++){
|
||||||
|
if(deserialized.outs[i].script.buffer[0]==118){
|
||||||
|
$("#fees .txoutputs .p2pkh .outputno").html(($("#fees .txoutputs .p2pkh .outputno").html()*1)+1);
|
||||||
|
$("#fees .txoutputs .p2pkh .bytes").html(($("#fees .txoutputs .p2pkh .bytes").html()*1)+34);
|
||||||
|
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
|
||||||
|
} else if (deserialized.outs[i].script.buffer[0]==169){
|
||||||
|
$("#fees .txoutputs .p2sh .outputno").html(($("#fees .txoutputs .p2sh .outputno").html()*1)+1);
|
||||||
|
$("#fees .txoutputs .p2sh .bytes").html(($("#fees .txoutputs .p2sh .bytes").html()*1)+32);
|
||||||
|
$("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//feeStats();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#feeStatsReload").click(function(){
|
||||||
|
feeStats();
|
||||||
|
});
|
||||||
|
|
||||||
|
function mathFees(){
|
||||||
|
|
||||||
|
var inputsTotal = 0;
|
||||||
|
var inputsBytes = 0;
|
||||||
|
$.each($(".inputno"), function(i,o){
|
||||||
|
inputsTotal += ($(o).html()*1);
|
||||||
|
inputsBytes += ($(".bytes",$(o).parent()).html()*1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txinputs .txsize").html(inputsBytes.toFixed(0));
|
||||||
|
$("#fees .txinputs .txtotal").html(inputsTotal.toFixed(0));
|
||||||
|
|
||||||
|
var outputsTotal = 0;
|
||||||
|
var outputsBytes = 0;
|
||||||
|
$.each($(".outputno"), function(i,o){
|
||||||
|
outputsTotal += ($(o).html()*1);
|
||||||
|
outputsBytes += ($(".bytes",$(o).parent()).html()*1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#fees .txoutputs .txsize").html(outputsBytes.toFixed(0));
|
||||||
|
$("#fees .txoutputs .txtotal").html(outputsTotal.toFixed(0));
|
||||||
|
|
||||||
|
var totalBytes = 10 + outputsBytes + inputsBytes;
|
||||||
|
if((!isNaN($("#fees .feeSatByte:first").html())) && totalBytes > 10){
|
||||||
|
var recommendedFee = ((totalBytes * $(".feeSatByte").html())/100000000).toFixed(8);
|
||||||
|
$(".recommendedFee").html(recommendedFee);
|
||||||
|
$(".feeTxSize").html(totalBytes);
|
||||||
|
} else {
|
||||||
|
$(".recommendedFee").html((0).toFixed(8));
|
||||||
|
$(".feeTxSize").html(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function feeStats(){
|
||||||
|
$("#feeStatsReload").attr('disabled',true);
|
||||||
|
$.ajax ({
|
||||||
|
type: "GET",
|
||||||
|
url: "https://coinb.in/api/?uid=1&key=12345678901234567890123456789012&setmodule=fees&request=stats",
|
||||||
|
dataType: "xml",
|
||||||
|
error: function(data) {
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$("#fees .recommended .blockHeight").html('<a href="https://coinb.in/height/'+$(data).find("height").text()+'" target="_blank">'+$(data).find("height").text()+'</a>');
|
||||||
|
$("#fees .recommended .blockHash").html($(data).find("block").text());
|
||||||
|
$("#fees .recommended .blockTime").html($(data).find("timestamp").text());
|
||||||
|
$("#fees .recommended .blockDateTime").html(unescape($(data).find("datetime").text()).replace(/\+/g,' '));
|
||||||
|
$("#fees .recommended .txId").html('<a href="https://coinb.in/tx/'+$(data).find("txid").text()+'" target="_blank">'+$(data).find("txid").text()+'</a>');
|
||||||
|
$("#fees .recommended .txSize").html($(data).find("txsize").text());
|
||||||
|
$("#fees .recommended .txFee").html($(data).find("txfee").text());
|
||||||
|
$("#fees .feeSatByte").html($(data).find("satbyte").text());
|
||||||
|
|
||||||
|
mathFees();
|
||||||
|
},
|
||||||
|
complete: function(data, status){
|
||||||
|
$("#feeStatsReload").attr('disabled', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* capture mouse movement to add entropy */
|
/* capture mouse movement to add entropy */
|
||||||
var IE = document.all?true:false // Boolean, is browser IE?
|
var IE = document.all?true:false // Boolean, is browser IE?
|
||||||
if (!IE) document.captureEvents(Event.MOUSEMOVE)
|
if (!IE) document.captureEvents(Event.MOUSEMOVE)
|
||||||
|
@ -1750,4 +2029,5 @@ $(document).ready(function() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
8
sha1sum
8
sha1sum
|
@ -1,8 +1,8 @@
|
||||||
---- Version 1.3 2017.12.09 ---
|
---- Version 1.3 2018.01.01 ---
|
||||||
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
|
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
|
||||||
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
|
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
|
||||||
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
|
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
|
||||||
934f5330156c159378c370f14b46862d54ff5b35 ./js/coinbin.js
|
acd94783bcf56758633af126fc6742fe08db9f93 ./js/coinbin.js
|
||||||
31fbebf65d9cae8f26761cb057c4fb1b97339d08 ./js/coin.js
|
31fbebf65d9cae8f26761cb057c4fb1b97339d08 ./js/coin.js
|
||||||
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
|
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
|
||||||
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
|
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
|
||||||
|
@ -22,6 +22,7 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js
|
||||||
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css
|
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css
|
||||||
fc6b4268fbd57ad95d2b41a1d4d6866f222fbdb2 ./css/bootstrap-theme.min.css
|
fc6b4268fbd57ad95d2b41a1d4d6866f222fbdb2 ./css/bootstrap-theme.min.css
|
||||||
4198ed869836ea5727ad6b80bf2df0a9c1a83244 ./css/style.css
|
4198ed869836ea5727ad6b80bf2df0a9c1a83244 ./css/style.css
|
||||||
|
2e3217a3f3b7c2fb30562ab9a4ef9a407ae81897 ./images/btc32x.png
|
||||||
8ac24915d59cef71c542e7cb7d7e153f560cba1f ./images/coinbin.gif
|
8ac24915d59cef71c542e7cb7d7e153f560cba1f ./images/coinbin.gif
|
||||||
f2af060f1cadbc9065c8c465c648dc01be67cc12 ./images/loader.gif
|
f2af060f1cadbc9065c8c465c648dc01be67cc12 ./images/loader.gif
|
||||||
86b6f62b7853e67d3e635f6512a5a5efc58ea3c3 ./fonts/glyphicons-halflings-regular.eot
|
86b6f62b7853e67d3e635f6512a5a5efc58ea3c3 ./fonts/glyphicons-halflings-regular.eot
|
||||||
|
@ -30,7 +31,6 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s
|
||||||
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
|
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
|
||||||
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
|
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
|
||||||
d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
|
d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
|
||||||
4b0ef8c0520f45540f142b562e9fbf00145f219c ./index.html
|
bb129ea3d4df64994fa40a143791304f5cc2fc74 ./index.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue