mirror of
https://github.com/ok2/coinbin.git
synced 2026-05-09 18:15:23 +02:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 734e6b2eeb | |||
| 90a309d4b4 | |||
| abd2191c50 | |||
| bb8abb4ded | |||
| 40d514e0f0 | |||
| c3b1a47199 | |||
| ed7d5d6411 | |||
| 10e083bd89 | |||
| 56fa7b5139 | |||
| e85276dd89 | |||
| c843685662 | |||
| 64af126bc5 | |||
| 217897285e | |||
| b1603821da | |||
| c2ef949dd0 | |||
| ecb18acb0f | |||
| 4a4f302fe6 | |||
| 4afee020b0 |
@@ -1,7 +1,7 @@
|
||||
coinbin
|
||||
=======
|
||||
|
||||
A Open Source Browser Based Bitcoin Wallet. Version 1.3 beta by OutCast3k
|
||||
A Open Source Browser Based Bitcoin Wallet. Version 1.4 beta by OutCast3k
|
||||
|
||||
Live version available at http://coinb.in/ or http://4zpinp6gdkjfplhk.onion
|
||||
|
||||
@@ -28,6 +28,8 @@ Coinb.in supports a number of key features such as:
|
||||
- HD (bip32) support
|
||||
- Supports altcoins such as litecoin
|
||||
- Replace by fee (RBF) Support
|
||||
- Segwit support
|
||||
- Segwit Support
|
||||
- Bech32 address support
|
||||
- Fee calculator - https://coinb.in/#fees
|
||||
|
||||
Donate to 1CWHWkTWaq1K5hevimJia3cyinQsrgXUvg to see more development!
|
||||
Donate to 3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN to see more development!
|
||||
|
||||
@@ -32,3 +32,89 @@ body {
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#fees .txi_regular {
|
||||
background: #d3d3d3;
|
||||
}
|
||||
|
||||
#fees .txi_segwit {
|
||||
background: #bae1ff;
|
||||
}
|
||||
|
||||
#fees .txi_multisig {
|
||||
background: #baffc9;
|
||||
}
|
||||
|
||||
#fees .txi_hodl {
|
||||
background: #ffdfba;
|
||||
}
|
||||
|
||||
#fees .txi_unknown {
|
||||
background: #ffb3ba;
|
||||
}
|
||||
|
||||
#fees .txo_p2pkh {
|
||||
background: #E679C8;
|
||||
}
|
||||
|
||||
#fees .txo_p2sh {
|
||||
background: #FAFE92;
|
||||
}
|
||||
|
||||
#fees .txinputs {
|
||||
}
|
||||
|
||||
#fees .txoutputs {
|
||||
}
|
||||
|
||||
.hideOverflow {
|
||||
overflow:hidden;
|
||||
white-space:nowrap;
|
||||
text-overflow:ellipsis;
|
||||
}
|
||||
|
||||
#fees .slider {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
outline: none;
|
||||
opacity: 0.7;
|
||||
-webkit-transition: .2s;
|
||||
transition: opacity .2s;
|
||||
border: 2px dotted #c3c3c3;
|
||||
}
|
||||
|
||||
#fees .sliderbtn {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
#fees .slider:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#fees .slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 0;
|
||||
background: url('https://coinb.in/images/btc32x.png');
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#fees .slider::-moz-range-thumb {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 0;
|
||||
background: url('https://coinb.in/images/btc32x.png');
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#fees .total {
|
||||
font-size: 100px;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
+282
-15
@@ -5,8 +5,8 @@
|
||||
<title>Bitcoin Wallet by Coinb.in</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||
<meta name="keywords" content="bitcoin, wallet, multisig, multisignature, address, browser, javascript, js, broadcast, transaction, verify, decode" />
|
||||
<meta name="description" content="A Bitcoin Wallet written in Javascript. Supports Multisig, Custom Transactions, nLockTime and more!" />
|
||||
<meta name="keywords" content="bitcoin, wallet, multisig, multisignature, address, browser, segwit, javascript, js, broadcast, transaction, verify, decode" />
|
||||
<meta name="description" content="A Bitcoin Wallet written in Javascript. Supports Multisig, SegWit, Custom Transactions, nLockTime and more!" />
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -74,6 +74,7 @@
|
||||
<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="#fees" data-toggle="tab"><span class="glyphicon glyphicon-tag"></span> Fees</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,12 +120,12 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<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 class="col-md-4">
|
||||
<h3><span class="glyphicon glyphicon-globe"></span> Addresses</h3>
|
||||
<p>We support <a href="#newAddress">regular addresses</a>, <a href="#newMultiSig">multisig</a>, <a href="#newSegWit">segwit</a> and stealth all with access to your own private keys!</p>
|
||||
<p>We support <a href="#newAddress">regular addresses</a>, <a href="#newMultiSig">multisig</a>, <a href="#newSegWit">segwit / bech32</a> and stealth all with access to your own private keys!</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
@@ -151,6 +152,22 @@
|
||||
<input id="openPass" type="password" class="form-control" placeholder="Password" required>
|
||||
<input id="openPassConfirm" type="password" class="form-control" placeholder="Password confirm" required>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<a href="javascript:;" class="optionsCollapse"><div class="well well-sm"><span class="glyphicon glyphicon-collapse-down" id="glyphcollapse"></span> Advanced Options</div></a>
|
||||
<div class="hidden optionsAdvanced">
|
||||
<label>Segregated Witness Address</label>
|
||||
<p class="checkbox">
|
||||
<label><input type="checkbox" id="walletSegwit" class="checkbox-inline" checked> Use a segwit address instead of a regular address. <span class="text-muted"><i>(recommended)</i></span></label></label>
|
||||
</p>
|
||||
|
||||
<label>Enable Replace by Fee (RBF)</label>
|
||||
<p class="checkbox">
|
||||
<label><input type="checkbox" id="walletRBF" class="checkbox-inline" checked> Enable RBF on all transactions, allowing you to manually raise the transaction fee later if required. <span class="text-muted"><i>(recommended)</i></span></label></label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="openLoginStatus" class="alert alert-danger hidden"></div>
|
||||
<button id="openBtn" class="btn btn-primary" type="submit">Submit</button>
|
||||
</form>
|
||||
@@ -166,6 +183,14 @@
|
||||
<div>
|
||||
<span id="walletLoader" class="hidden"><img src="images/loader.gif"></span>
|
||||
<span id="walletAddress"></span>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" id="walletToBtn">SegWit <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" id="walletToSegWit">SegWit</a></li>
|
||||
<li><a href="javascript:;" id="walletToLegacy">Legacy</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div style="text-align:center; width:350px;">
|
||||
@@ -182,6 +207,12 @@
|
||||
<div id="walletKeys" class="hidden">
|
||||
<label>Public Key</label>
|
||||
<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>
|
||||
<div class="input-group">
|
||||
<input class="form-control privkey" type="password" readonly>
|
||||
@@ -190,6 +221,7 @@
|
||||
<button class="showKey btn btn-default" type="button">Show</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<label>Private Key (AES256 encrypted key)</label>
|
||||
<input class="form-control privkeyaes" type="text" readonly>
|
||||
</div>
|
||||
@@ -223,7 +255,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<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">
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
@@ -339,6 +371,10 @@
|
||||
<h3>Address Options</h3>
|
||||
<p>You can use the advanced options below to generate different kind of keys and addresses.</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="newSegWitBech32addr" class="checkbox-inline" checked> Enable <a href="https://en.bitcoin.it/wiki/Bech32" target="_blank">Bech32</a>?</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="newSegWitBrainwallet" class="checkbox-inline"> Custom Seed or Brain Wallet</label>
|
||||
<input type="text" class="form-control hidden" id="brainwalletSegWit">
|
||||
@@ -557,9 +593,9 @@
|
||||
<div class="hidden alert alert-info" id="redeemFromAddress"></div>
|
||||
|
||||
<div>
|
||||
<a href="javascript:;" id="optionsCollapse"><div class="well well-sm"><span class="glyphicon glyphicon-collapse-down" id="glyphcollapse"></span> Advanced Options</div></a>
|
||||
<a href="javascript:;" class="optionsCollapse"><div class="well well-sm"><span class="glyphicon glyphicon-collapse-down" id="glyphcollapse"></span> Advanced Options</div></a>
|
||||
|
||||
<div class="hidden" id="optionsAdvanced">
|
||||
<div class="hidden optionsAdvanced">
|
||||
|
||||
<label>Clear Inputs</label>
|
||||
<p class="checkbox">
|
||||
@@ -685,7 +721,7 @@
|
||||
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -710,6 +746,211 @@
|
||||
<br>
|
||||
</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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="1" class="slider txinput txi_regular" rel="regular">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="0" class="slider txinput txi_segwit" rel="segwit">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="0" class="slider txinput txi_multisig" rel="multisig">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="0" class="slider txinput txi_hodl" rel="hodl">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="0" class="slider txinput txi_unknown" rel="unknown">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="2" class="slider txoutput txo_p2pkh" rel="p2pkh">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn down" type="button"><span class="glyphicon glyphicon-chevron-left"></span></button></span>
|
||||
<input type="range" min="0" max="100" value="0" class="slider txoutput txo_p2sh" rel="p2sh">
|
||||
<span class="input-group-btn"><button class="btn sliderbtn up" type="button"><span class="glyphicon glyphicon-chevron-right"></span></button></span>
|
||||
</div>
|
||||
|
||||
<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 against a very recent transaction found in a very recent 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="feesAnalyseBtn">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">
|
||||
<h2>Verify <small>transactions and other scripts</small></h2>
|
||||
<div class="row">
|
||||
@@ -847,7 +1088,33 @@
|
||||
<div class="hidden verifyData" id="verifyPubKey">
|
||||
<h4>Public key</h4>
|
||||
<p><span style="float:right"><a href="" target="_blank" class="verifyLink" title="Link to this page"><span class="glyphicon glyphicon-link"></span></a></span>The above public key has been encoded to its address</p>
|
||||
<p><b>Address</b>: <input type="text" class="form-control address" readonly></p>
|
||||
<p><b>Legacy Address</b>: <input type="text" class="form-control address" readonly></p>
|
||||
|
||||
<div class="hidden verifyDataSw">
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p><b>P2SH Segwit Address</b>: <input type="text" class="form-control addressSegWit" readonly></p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<p><b>P2SH Segwit Redeem Script</b>: <input type="text" class="form-control addressSegWitRedeemScript" readonly></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p><b>Bech32 Address</b>: <input type="text" class="form-control addressBech32" readonly></p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<p><b>Bech32 Redeem Script</b>: <input type="text" class="form-control addressBech32RedeemScript" readonly></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden verifyData" id="verifyHDaddress">
|
||||
@@ -1036,8 +1303,8 @@
|
||||
|
||||
<div class="tab-pane tab-content" id="about">
|
||||
<h2>About <small>open source bitcoin wallet</small></h2>
|
||||
<p>Version 1.3</p>
|
||||
<p>Compatible with bitcoin-qt</p>
|
||||
<p>Version 1.4</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>
|
||||
<h3>What is Bitcoin?</h3>
|
||||
@@ -1047,11 +1314,11 @@
|
||||
<p>Coinb.in is a free and open source project released under the MIT license, originally by <a href="https://bitcointalk.org/index.php?action=profile;u=34834" target="_blank">OutCast3k</a> in 2013. Discussion of the project can be found at <a href="https://bitcointalk.org/index.php?topic=390046" target="_blank">bitcointalk.org</a> during its early testing stages when its primary focus was to develop a proof of concept multisig solution in javascript.</p>
|
||||
<p>Coinb.in is run and funded by the generosity of others in terms of <a href="https://github.com/OutCast3k/coinbin/graphs/contributors" target="_blank">development</a> and hosting.</p>
|
||||
<h3>Privacy</h3>
|
||||
<p>Coinb.in beleives strongly in privacy, not only do we support the use of TOR, the site does not collect and store IP or transaction data via our servers nor do we store your bitcoins private key. We do route traffic via cloudflare using an SSL certificate.</p>
|
||||
<p>Coinb.in believes strongly in privacy, not only do we support the use of TOR, the site does not collect and store IP or transaction data via our servers nor do we store your bitcoins private key. We do route traffic via cloudflare using an SSL certificate.</p>
|
||||
<h3>Support</h3>
|
||||
<p>We recommend that you first check our <a href="https://status.coinb.in/" target="_blank">service status</a> page, if the problem persists you can contact us by emailing support{at}coinb.in.</p>
|
||||
<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:1CWHWkTWaq1K5hevimJia3cyinQsrgXUvg">1CWHWkTWaq1K5hevimJia3cyinQsrgXUvg</a> if you found this project useful or want to see more features!</p>
|
||||
<p>Please donate to <a href="bitcoin:3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN">3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN</a> if you found this project useful or want to see more features!</p>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane tab-content" id="settings">
|
||||
@@ -1163,7 +1430,7 @@
|
||||
|
||||
<div id="footer">
|
||||
<div class="container text-right">
|
||||
<p class="text-muted">Version 1.3</p>
|
||||
<p class="text-muted">Version 1.4</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+206
-19
@@ -14,11 +14,12 @@
|
||||
coinjs.priv = 0x80;
|
||||
coinjs.multisig = 0x05;
|
||||
coinjs.hdkey = {'prv':0x0488ade4, 'pub':0x0488b21e};
|
||||
coinjs.bech32 = {'charset':'qpzry9x8gf2tvdw0s3jn54khce6mua7l', 'version':0, 'hrp':'bc'};
|
||||
|
||||
coinjs.compressed = false;
|
||||
|
||||
/* other vars */
|
||||
coinjs.developer = '1CWHWkTWaq1K5hevimJia3cyinQsrgXUvg'; // bitcoin
|
||||
coinjs.developer = '3K1oFZMks41C7qDYBsr72SYjapLqDuSYuN'; //bitcoin
|
||||
|
||||
/* bit(coinb.in) api vars */
|
||||
coinjs.host = ('https:'==document.location.protocol?'https://':'http://')+'coinb.in/api/';
|
||||
@@ -132,7 +133,13 @@
|
||||
var checksum = r.slice(0,4);
|
||||
var redeemScript = Crypto.util.bytesToHex(s.buffer);
|
||||
var address = coinjs.base58encode(x.concat(checksum));
|
||||
return {'address':address, 'redeemScript':redeemScript};
|
||||
|
||||
if(s.buffer.length > 520){ // too large
|
||||
address = 'invalid';
|
||||
redeemScript = 'invalid';
|
||||
}
|
||||
|
||||
return {'address':address, 'redeemScript':redeemScript, 'size': s.buffer.length};
|
||||
}
|
||||
|
||||
/* new time locked address, provide the pubkey and time necessary to unlock the funds.
|
||||
@@ -178,6 +185,24 @@
|
||||
return {'address':address, 'type':'segwit', 'redeemscript':Crypto.util.bytesToHex(keyhash)};
|
||||
}
|
||||
|
||||
/* create a new segwit bech32 encoded address */
|
||||
coinjs.bech32Address = function(pubkey){
|
||||
var program = ripemd160(Crypto.SHA256(Crypto.util.hexToBytes(pubkey), {asBytes: true}), {asBytes: true});
|
||||
var address = coinjs.bech32_encode(coinjs.bech32.hrp, [coinjs.bech32.version].concat(coinjs.bech32_convert(program, 8, 5, true)));
|
||||
return {'address':address, 'type':'bech32', 'redeemscript':Crypto.util.bytesToHex(program)};
|
||||
}
|
||||
|
||||
/* extract the redeemscript from a bech32 address */
|
||||
coinjs.bech32redeemscript = function(address){
|
||||
var r = false;
|
||||
var decode = coinjs.bech32_decode(address);
|
||||
if(decode){
|
||||
decode.data.shift();
|
||||
return Crypto.util.bytesToHex(coinjs.bech32_convert(decode.data, 5, 8, true));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* provide a privkey and return an WIF */
|
||||
coinjs.privkey2wif = function(h){
|
||||
var r = Crypto.util.hexToBytes(h);
|
||||
@@ -280,9 +305,14 @@
|
||||
return false;
|
||||
}
|
||||
} catch(e) {
|
||||
bech32rs = coinjs.bech32redeemscript(addr);
|
||||
if(bech32rs){
|
||||
return {'type':'bech32', 'redeemscript':bech32rs};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* retreive the balance from a given address */
|
||||
coinjs.addressBalance = function(address, callback){
|
||||
@@ -310,6 +340,126 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
coinjs.bech32_polymod = function(values) {
|
||||
var chk = 1;
|
||||
var BECH32_GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];
|
||||
for (var p = 0; p < values.length; ++p) {
|
||||
var top = chk >> 25;
|
||||
chk = (chk & 0x1ffffff) << 5 ^ values[p];
|
||||
for (var i = 0; i < 5; ++i) {
|
||||
if ((top >> i) & 1) {
|
||||
chk ^= BECH32_GENERATOR[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return chk;
|
||||
}
|
||||
|
||||
coinjs.bech32_hrpExpand = function(hrp) {
|
||||
var ret = [];
|
||||
var p;
|
||||
for (p = 0; p < hrp.length; ++p) {
|
||||
ret.push(hrp.charCodeAt(p) >> 5);
|
||||
}
|
||||
ret.push(0);
|
||||
for (p = 0; p < hrp.length; ++p) {
|
||||
ret.push(hrp.charCodeAt(p) & 31);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
coinjs. bech32_verifyChecksum = function(hrp, data) {
|
||||
return coinjs.bech32_polymod(coinjs.bech32_hrpExpand(hrp).concat(data)) === 1;
|
||||
}
|
||||
|
||||
coinjs.bech32_createChecksum = function(hrp, data) {
|
||||
var values = coinjs.bech32_hrpExpand(hrp).concat(data).concat([0, 0, 0, 0, 0, 0]);
|
||||
var mod = coinjs.bech32_polymod(values) ^ 1;
|
||||
var ret = [];
|
||||
for (var p = 0; p < 6; ++p) {
|
||||
ret.push((mod >> 5 * (5 - p)) & 31);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
coinjs.bech32_encode = function(hrp, data) {
|
||||
var combined = data.concat(coinjs.bech32_createChecksum(hrp, data));
|
||||
var ret = hrp + '1';
|
||||
for (var p = 0; p < combined.length; ++p) {
|
||||
ret += coinjs.bech32.charset.charAt(combined[p]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
coinjs.bech32_decode = function(bechString) {
|
||||
var p;
|
||||
var has_lower = false;
|
||||
var has_upper = false;
|
||||
for (p = 0; p < bechString.length; ++p) {
|
||||
if (bechString.charCodeAt(p) < 33 || bechString.charCodeAt(p) > 126) {
|
||||
return null;
|
||||
}
|
||||
if (bechString.charCodeAt(p) >= 97 && bechString.charCodeAt(p) <= 122) {
|
||||
has_lower = true;
|
||||
}
|
||||
if (bechString.charCodeAt(p) >= 65 && bechString.charCodeAt(p) <= 90) {
|
||||
has_upper = true;
|
||||
}
|
||||
}
|
||||
if (has_lower && has_upper) {
|
||||
return null;
|
||||
}
|
||||
bechString = bechString.toLowerCase();
|
||||
var pos = bechString.lastIndexOf('1');
|
||||
if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) {
|
||||
return null;
|
||||
}
|
||||
var hrp = bechString.substring(0, pos);
|
||||
var data = [];
|
||||
for (p = pos + 1; p < bechString.length; ++p) {
|
||||
var d = coinjs.bech32.charset.indexOf(bechString.charAt(p));
|
||||
if (d === -1) {
|
||||
return null;
|
||||
}
|
||||
data.push(d);
|
||||
}
|
||||
if (!coinjs.bech32_verifyChecksum(hrp, data)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
hrp: hrp,
|
||||
data: data.slice(0, data.length - 6)
|
||||
};
|
||||
}
|
||||
|
||||
coinjs.bech32_convert = function(data, inBits, outBits, pad) {
|
||||
var value = 0;
|
||||
var bits = 0;
|
||||
var maxV = (1 << outBits) - 1;
|
||||
|
||||
var result = [];
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
value = (value << inBits) | data[i];
|
||||
bits += inBits;
|
||||
|
||||
while (bits >= outBits) {
|
||||
bits -= outBits;
|
||||
result.push((value >> bits) & maxV);
|
||||
}
|
||||
}
|
||||
|
||||
if (pad) {
|
||||
if (bits > 0) {
|
||||
result.push((value << (outBits - bits)) & maxV);
|
||||
}
|
||||
} else {
|
||||
if (bits >= inBits) throw new Error('Excess padding');
|
||||
if ((value << (outBits - bits)) & maxV) throw new Error('Non-zero padding');
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
coinjs.testdeterministicK = function() {
|
||||
// https://github.com/bitpay/bitcore/blob/9a5193d8e94b0bd5b8e7f00038e7c0b935405a03/test/crypto/ecdsa.js
|
||||
// Line 21 and 22 specify digest hash and privkey for the first 2 test vectors.
|
||||
@@ -722,7 +872,10 @@
|
||||
r.spendToScript = function(address){
|
||||
var addr = coinjs.addressDecode(address);
|
||||
var s = coinjs.script();
|
||||
if(addr.version==coinjs.multisig){ // multisig address
|
||||
if(addr.type == "bech32"){
|
||||
s.writeOp(0);
|
||||
s.writeBytes(Crypto.util.hexToBytes(addr.redeemscript));
|
||||
} else if(addr.version==coinjs.multisig){ // multisig address
|
||||
s.writeOp(169); //OP_HASH160
|
||||
s.writeBytes(addr.bytes);
|
||||
s.writeOp(135); //OP_EQUAL
|
||||
@@ -792,7 +945,7 @@
|
||||
r.lock_time = 0;
|
||||
r.ins = [];
|
||||
r.outs = [];
|
||||
r.witness = [];
|
||||
r.witness = false;
|
||||
r.timestamp = null;
|
||||
r.block = null;
|
||||
|
||||
@@ -876,7 +1029,7 @@
|
||||
}
|
||||
|
||||
/* add unspent to transaction */
|
||||
r.addUnspent = function(address, callback){
|
||||
r.addUnspent = function(address, callback, script, segwit, sequence){
|
||||
var self = this;
|
||||
this.listUnspent(address, function(data){
|
||||
var s = coinjs.script();
|
||||
@@ -900,10 +1053,21 @@
|
||||
var u = xmlDoc.getElementsByTagName("unspent_"+i)[0]
|
||||
var txhash = (u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue).match(/.{1,2}/g).reverse().join("")+'';
|
||||
var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue;
|
||||
var script = u.getElementsByTagName("script")[0].childNodes[0].nodeValue;
|
||||
var scr = script || u.getElementsByTagName("script")[0].childNodes[0].nodeValue;
|
||||
|
||||
self.addinput(txhash, n, script);
|
||||
if(segwit){
|
||||
/* this is a small hack to include the value with the redeemscript to make the signing procedure smoother.
|
||||
It is not standard and removed during the signing procedure. */
|
||||
|
||||
s = coinjs.script();
|
||||
s.writeBytes(Crypto.util.hexToBytes(script));
|
||||
s.writeOp(0);
|
||||
s.writeBytes(coinjs.numToBytes(u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1, 8));
|
||||
scr = Crypto.util.bytesToHex(s.buffer);
|
||||
}
|
||||
|
||||
var seq = sequence || false;
|
||||
self.addinput(txhash, n, scr, seq);
|
||||
value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;
|
||||
total++;
|
||||
}
|
||||
@@ -1026,20 +1190,24 @@
|
||||
return {'result':0, 'fail':'redeemscript', 'response':'redeemscript missing or not valid for segwit'};
|
||||
}
|
||||
|
||||
var scriptcode = Crypto.util.hexToBytes(extract['script']);
|
||||
if(scriptcode[0] != 0){
|
||||
return {'result':0, 'fail':'scriptcode', 'response':'redeemscript is not valid'};
|
||||
}
|
||||
|
||||
if(extract['value'] == -1){
|
||||
return {'result':0, 'fail':'value', 'response':'unable to generate a valid segwit hash without a value'};
|
||||
}
|
||||
|
||||
var scriptcode = Crypto.util.hexToBytes(extract['script']);
|
||||
|
||||
// end of redeem script check
|
||||
|
||||
/* P2WPKH */
|
||||
if(scriptcode.length == 20){
|
||||
scriptcode = [0x00,0x14].concat(scriptcode);
|
||||
}
|
||||
|
||||
if(scriptcode.length == 22){
|
||||
scriptcode = scriptcode.slice(1);
|
||||
scriptcode.unshift(25, 118, 169);
|
||||
scriptcode.push(136, 172);
|
||||
}
|
||||
|
||||
var value = coinjs.numToBytes(extract['value'], 8);
|
||||
|
||||
@@ -1120,8 +1288,7 @@
|
||||
} else if(this.ins[index].script.chunks.length == 5 && this.ins[index].script.chunks[1] == 177){//OP_CHECKLOCKTIMEVERIFY
|
||||
// hodl script (not signed)
|
||||
return {'type':'hodl', 'signed':'false', 'signatures': 0, 'script': Crypto.util.bytesToHex(this.ins[index].script.buffer)};
|
||||
} else if((this.ins[index].script.chunks.length <= 3 && this.ins[index].script.chunks.length > 0) && this.ins[index].script.chunks[0].length == 22 && this.ins[index].script.chunks[0][0] == 0){
|
||||
// segwit script
|
||||
} else if((this.ins[index].script.chunks.length <= 3 && this.ins[index].script.chunks.length > 0) && ((this.ins[index].script.chunks[0].length == 22 && this.ins[index].script.chunks[0][0] == 0) || (this.ins[index].script.chunks[0].length == 20 && this.ins[index].script.chunks[1] == 0))){
|
||||
var signed = ((this.witness[index]) && this.witness[index].length==2) ? 'true' : 'false';
|
||||
var sigs = (signed == 'true') ? 1 : 0;
|
||||
var value = -1; // no value found
|
||||
@@ -1350,10 +1517,13 @@
|
||||
|
||||
var wif2 = coinjs.wif2pubkey(wif);
|
||||
var segwit = coinjs.segwitAddress(wif2['pubkey']);
|
||||
var bech32 = coinjs.bech32Address(wif2['pubkey']);
|
||||
|
||||
if(segwit['redeemscript'] == Crypto.util.bytesToHex(this.ins[index].script.chunks[0])){
|
||||
if((segwit['redeemscript'] == Crypto.util.bytesToHex(this.ins[index].script.chunks[0])) || (bech32['redeemscript'] == Crypto.util.bytesToHex(this.ins[index].script.chunks[0]))){
|
||||
var txhash = this.transactionHashSegWitV0(index, shType);
|
||||
|
||||
if(txhash.result == 1){
|
||||
|
||||
var segwitHash = Crypto.util.hexToBytes(txhash.hash);
|
||||
var signature = this.transactionSig(index, wif, shType, segwitHash);
|
||||
|
||||
@@ -1362,15 +1532,32 @@
|
||||
script.writeBytes(this.ins[index].script.chunks[0]);
|
||||
this.ins[index].script = script;
|
||||
|
||||
if(!coinjs.isArray(this.witness)){
|
||||
this.witness = [];
|
||||
}
|
||||
|
||||
this.witness.push([signature, wif2['pubkey']]);
|
||||
|
||||
/* reorder witness data */
|
||||
/* attempt to reorder witness data as best as we can.
|
||||
data can't be easily validated at this stage as
|
||||
we dont have access to the inputs value and
|
||||
making a web call will be too slow. */
|
||||
|
||||
var witness_order = [];
|
||||
var witness_used = [];
|
||||
for(var i = 0; i < this.ins.length; i++){
|
||||
for(var y = 0; y < this.witness.length; y++){
|
||||
if(!witness_used.includes(y)){
|
||||
var sw = coinjs.segwitAddress(this.witness[y][1]);
|
||||
if(sw['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0])){
|
||||
var b32 = coinjs.bech32Address(this.witness[y][1]);
|
||||
if((sw['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0])) || (b32['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0]))){
|
||||
witness_order.push(this.witness[y]);
|
||||
witness_used.push(y);
|
||||
if(b32['redeemscript'] == Crypto.util.bytesToHex(this.ins[i].script.chunks[0])){
|
||||
this.ins[index].script = coinjs.script();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1414,7 +1601,7 @@
|
||||
var buffer = [];
|
||||
buffer = buffer.concat(coinjs.numToBytes(parseInt(this.version),4));
|
||||
|
||||
if(this.witness.length>=1){
|
||||
if(coinjs.isArray(this.witness)){
|
||||
buffer = buffer.concat([0x00, 0x01]);
|
||||
}
|
||||
|
||||
@@ -1438,7 +1625,7 @@
|
||||
buffer = buffer.concat(scriptBytes);
|
||||
}
|
||||
|
||||
if(this.witness.length>=1){
|
||||
if((coinjs.isArray(this.witness)) && this.witness.length>=1){
|
||||
for(var i = 0; i < this.witness.length; i++){
|
||||
buffer = buffer.concat(coinjs.numToVarInt(this.witness[i].length));
|
||||
for(var x = 0; x < this.witness[i].length; x++){
|
||||
|
||||
+398
-29
@@ -6,6 +6,8 @@ $(document).ready(function() {
|
||||
var explorer_addr = "https://coinb.in/addr/"
|
||||
var explorer_block = "https://coinb.in/block/"
|
||||
|
||||
var wallet_timer = false;
|
||||
|
||||
$("#openBtn").click(function(){
|
||||
var email = $("#openEmail").val().toLowerCase();
|
||||
if(email.match(/[\s\w\d]+@[\s\w\d]+/g)){
|
||||
@@ -28,17 +30,30 @@ $(document).ready(function() {
|
||||
|
||||
coinjs.compressed = true;
|
||||
var keys = coinjs.newKeys(s);
|
||||
var address = keys.address;
|
||||
var wif = keys.wif;
|
||||
var pubkey = keys.pubkey;
|
||||
var privkeyaes = CryptoJS.AES.encrypt(keys.wif, pass);
|
||||
|
||||
$("#walletAddress").html(keys.address);
|
||||
$("#walletHistory").attr('href',explorer_addr+keys.address);
|
||||
$("#walletKeys .walletSegWitRS").addClass("hidden");
|
||||
if($("#walletSegwit").is(":checked")){
|
||||
var sw = coinjs.segwitAddress(pubkey);
|
||||
address = sw.address;
|
||||
|
||||
$("#walletKeys .walletSegWitRS").removeClass("hidden");
|
||||
$("#walletKeys .walletSegWitRS input:text").val(sw.redeemscript);
|
||||
}
|
||||
|
||||
$("#walletAddress").html(address);
|
||||
$("#walletHistory").attr('href',explorer_addr+address);
|
||||
|
||||
$("#walletQrCode").html("");
|
||||
var qrcode = new QRCode("walletQrCode");
|
||||
qrcode.makeCode("bitcoin:"+keys.address);
|
||||
qrcode.makeCode("bitcoin:"+address);
|
||||
|
||||
$("#walletKeys .privkey").val(keys.wif);
|
||||
$("#walletKeys .pubkey").val(keys.pubkey);
|
||||
$("#walletKeys .privkeyaes").val(CryptoJS.AES.encrypt(keys.wif, pass));
|
||||
$("#walletKeys .privkey").val(wif);
|
||||
$("#walletKeys .pubkey").val(pubkey);
|
||||
$("#walletKeys .privkeyaes").val(privkeyaes);
|
||||
|
||||
$("#openLogin").hide();
|
||||
$("#openWallet").removeClass("hidden").show();
|
||||
@@ -76,8 +91,22 @@ $(document).ready(function() {
|
||||
$("#walletKeys .privkey").val("");
|
||||
$("#walletKeys .pubkey").val("");
|
||||
|
||||
$("#openLoginStatus").html("").hide();
|
||||
});
|
||||
|
||||
$("#walletToSegWit").click(function(){
|
||||
$("#walletToBtn").html('SegWit <span class="caret"></span>');
|
||||
$("#walletSegwit")[0].checked = true;
|
||||
$("#openBtn").click();
|
||||
});
|
||||
|
||||
$("#walletToLegacy").click(function(){
|
||||
$("#walletToBtn").html('Legacy <span class="caret"></span>');
|
||||
$("#walletSegwit")[0].checked = false;
|
||||
$("#openBtn").click();
|
||||
});
|
||||
|
||||
|
||||
$("#walletShowKeys").click(function(){
|
||||
$("#walletKeys").removeClass("hidden");
|
||||
$("#walletSpend").removeClass("hidden").addClass("hidden");
|
||||
@@ -111,6 +140,17 @@ $(document).ready(function() {
|
||||
|
||||
thisbtn.attr('disabled',true);
|
||||
|
||||
var script = false;
|
||||
if($("#walletSegwit").is(":checked")){
|
||||
var sw = coinjs.segwitAddress($("#walletKeys .pubkey").val());
|
||||
script = sw.redeemscript;
|
||||
}
|
||||
|
||||
var sequence = false;
|
||||
if($("#walletRBF").is(":checked")){
|
||||
sequence = 0xffffffff-2;
|
||||
}
|
||||
|
||||
tx.addUnspent($("#walletAddress").html(), function(data){
|
||||
|
||||
var dvalue = (data.value/100000000).toFixed(8) * 1;
|
||||
@@ -130,9 +170,10 @@ $(document).ready(function() {
|
||||
var signed = txunspent.sign($("#walletKeys .privkey").val());
|
||||
|
||||
// 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());
|
||||
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-success').html('txid: <a href="https://coinb.in/tx/'+$(data).find("txid").text()+'" target="_blank">'+$(data).find("txid").text()+'</a>');
|
||||
} else {
|
||||
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-danger').html(unescape($(data).find("response").text()).replace(/\+/g,' '));
|
||||
$("#walletSendFailTransaction").removeClass('hidden');
|
||||
@@ -150,7 +191,8 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
$("#walletLoader").addClass("hidden");
|
||||
});
|
||||
|
||||
}, script, script, sequence);
|
||||
});
|
||||
|
||||
$("#walletSendBtn").click(function(){
|
||||
@@ -245,8 +287,11 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
function checkBalanceLoop(){
|
||||
setTimeout(function(){
|
||||
clearTimeout(wallet_timer);
|
||||
wallet_timer = setTimeout(function(){
|
||||
if($("#walletLoader").hasClass("hidden")){
|
||||
walletBalance();
|
||||
}
|
||||
checkBalanceLoop();
|
||||
},45000);
|
||||
}
|
||||
@@ -305,9 +350,16 @@ $(document).ready(function() {
|
||||
$("#newSegWitKeysBtn").click(function(){
|
||||
var compressed = coinjs.compressed;
|
||||
coinjs.compressed = true;
|
||||
|
||||
var s = ($("#newSegWitBrainwallet").is(":checked")) ? $("#brainwalletSegWit").val() : null;
|
||||
var coin = coinjs.newKeys(s);
|
||||
|
||||
if($("#newSegWitBech32addr").is(":checked")){
|
||||
var sw = coinjs.bech32Address(coin.pubkey);
|
||||
} else {
|
||||
var sw = coinjs.segwitAddress(coin.pubkey);
|
||||
}
|
||||
|
||||
$("#newSegWitAddress").val(sw.address);
|
||||
$("#newSegWitRedeemScript").val(sw.redeemscript);
|
||||
$("#newSegWitPubKey").val(coin.pubkey);
|
||||
@@ -344,11 +396,15 @@ $(document).ready(function() {
|
||||
if(($("#multisigPubKeys .pubkey").parent().hasClass('has-error')==false) && $("#releaseCoins").parent().hasClass('has-error')==false){
|
||||
var sigsNeeded = $("#releaseCoins option:selected").html();
|
||||
var multisig = coinjs.pubkeys2MultisigAddress(keys, sigsNeeded);
|
||||
if(multisig.size <= 520){
|
||||
$("#multiSigData .address").val(multisig['address']);
|
||||
$("#multiSigData .script").val(multisig['redeemScript']);
|
||||
$("#multiSigData .scriptUrl").val(document.location.origin+''+document.location.pathname+'?verify='+multisig['redeemScript']+'#verify');
|
||||
$("#multiSigData").removeClass('hidden').addClass('show').fadeIn();
|
||||
$("#releaseCoins").removeClass('has-error');
|
||||
} else {
|
||||
$("#multiSigErrorMsg").html('<span class="glyphicon glyphicon-exclamation-sign"></span> Your generated redeemscript is too large (>520 bytes) it can not be used safely').fadeIn();
|
||||
}
|
||||
} else {
|
||||
$("#multiSigErrorMsg").html('<span class="glyphicon glyphicon-exclamation-sign"></span> One or more public key is invalid!').fadeIn();
|
||||
}
|
||||
@@ -573,7 +629,7 @@ $(document).ready(function() {
|
||||
$.each($("#recipients .row"), function(i,o){
|
||||
var a = ($(".address",o).val());
|
||||
var ad = coinjs.addressDecode(a);
|
||||
if(((a!="") && (ad.version == coinjs.pub || ad.version == coinjs.multisig)) && $(".amount",o).val()!=""){ // address
|
||||
if(((a!="") && (ad.version == coinjs.pub || ad.version == coinjs.multisig || ad.type=="bech32")) && $(".amount",o).val()!=""){ // address
|
||||
// P2SH output is 32, P2PKH is 34
|
||||
estimatedTxSize += (ad.version == coinjs.pub ? 34 : 32)
|
||||
tx.addoutput(a, $(".amount",o).val());
|
||||
@@ -592,9 +648,17 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
if(!$("#recipients .row, #inputs .row").hasClass('has-error')){
|
||||
|
||||
$("#transactionCreate textarea").val(tx.serialize());
|
||||
$("#transactionCreate .txSize").html(tx.size());
|
||||
|
||||
if($("#feesestnewtx").attr('est')=='y'){
|
||||
$("#fees .txhex").val($("#transactionCreate textarea").val());
|
||||
$("#feesAnalyseBtn").click();
|
||||
$("#fees .txhex").val("");
|
||||
window.location = "#fees";
|
||||
} else {
|
||||
|
||||
$("#transactionCreate").removeClass("hidden");
|
||||
|
||||
// Check fee against hard 0.01 as well as fluid 200 satoshis per byte calculation.
|
||||
@@ -602,11 +666,66 @@ $(document).ready(function() {
|
||||
$("#modalWarningFeeAmount").html($("#transactionFee").val());
|
||||
$("#modalWarningFee").modal("show");
|
||||
}
|
||||
}
|
||||
$("#feesestnewtx").attr('est','');
|
||||
} else {
|
||||
$("#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").trigger('input');
|
||||
} else {
|
||||
$("#fees .txi_regular").val(inputs);
|
||||
$("#fees .txi_regular").trigger('input');
|
||||
}
|
||||
|
||||
$.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").trigger('input');
|
||||
} else { // p2pkh
|
||||
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
|
||||
$("#fees .txo_p2pkh").trigger('input');
|
||||
}
|
||||
});
|
||||
|
||||
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").trigger('input');
|
||||
} else { // p2pkh
|
||||
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
|
||||
$("#fees .txo_p2pkh").trigger('input');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//feeStats();
|
||||
window.location = "#fees";
|
||||
});
|
||||
|
||||
$(".txidClear").click(function(){
|
||||
$("#inputs .row:first input").attr('disabled',false);
|
||||
$("#inputs .row:first input").val("");
|
||||
@@ -720,7 +839,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
if(redeem.from=='other'){
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> The address or multisig redeem script you have entered is invalid');
|
||||
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> The address or redeem script you have entered is invalid');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -760,28 +879,33 @@ $(document).ready(function() {
|
||||
if(decode.version == coinjs.pub){ // regular address
|
||||
r.addr = string;
|
||||
r.from = 'address';
|
||||
r.isMultisig = false;
|
||||
r.redeemscript = false;
|
||||
} else if (decode.version == coinjs.priv){ // wif key
|
||||
var a = coinjs.wif2address(string);
|
||||
r.addr = a['address'];
|
||||
r.from = 'wif';
|
||||
r.isMultisig = false;
|
||||
r.redeemscript = false;
|
||||
} else if (decode.version == coinjs.multisig){ // mulisig address
|
||||
r.addr = '';
|
||||
r.from = 'multisigAddress';
|
||||
r.isMultisig = false;
|
||||
r.redeemscript = false;
|
||||
} else if(decode.type == 'bech32'){
|
||||
r.addr = string;
|
||||
r.from = 'bech32';
|
||||
r.decodedRs = decode.redeemscript;
|
||||
r.redeemscript = true;
|
||||
} else {
|
||||
var script = coinjs.script();
|
||||
var decodeRs = script.decodeRedeemScript(string);
|
||||
if(decodeRs){ // redeem script
|
||||
r.addr = decodeRs['address'];
|
||||
r.from = 'redeemScript';
|
||||
r.decodedRs = decodeRs;
|
||||
r.isMultisig = true; // not quite, may be hodl
|
||||
r.decodedRs = decodeRs.redeemscript;
|
||||
r.redeemscript = true;
|
||||
} else { // something else
|
||||
r.addr = '';
|
||||
r.from = 'other';
|
||||
r.isMultisig = false;
|
||||
r.redeemscript = false;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
@@ -836,7 +960,7 @@ $(document).ready(function() {
|
||||
$("#inputs .txIdN:last").val(n);
|
||||
$("#inputs .txIdAmount:last").val(amount);
|
||||
|
||||
if(script.match(/^00/) && script.length==44){
|
||||
if(((script.match(/^00/) && script.length==44)) || (script.length==40 && script.match(/^[a-f0-9]+$/gi))){
|
||||
s = coinjs.script();
|
||||
s.writeBytes(Crypto.util.hexToBytes(script));
|
||||
s.writeOp(0);
|
||||
@@ -858,7 +982,7 @@ $(document).ready(function() {
|
||||
$.each($(data).find("unspent").children(), function(i,o){
|
||||
var tx = $(o).find("tx_hash").text();
|
||||
var n = $(o).find("tx_output_n").text();
|
||||
var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : $(o).find("script").text();
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : $(o).find("script").text();
|
||||
var amount = (($(o).find("value").text()*1)/100000000).toFixed(8);
|
||||
|
||||
addOutput(tx, n, script, amount);
|
||||
@@ -889,7 +1013,7 @@ $(document).ready(function() {
|
||||
var o = data.data.txs[i];
|
||||
var tx = ((o.txid).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
var n = o.output_no;
|
||||
var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex;
|
||||
var amount = o.value;
|
||||
addOutput(tx, n, script, amount);
|
||||
}
|
||||
@@ -922,7 +1046,7 @@ $(document).ready(function() {
|
||||
$.each($(data).find("unspent").children(), function(i,o){
|
||||
var tx = $(o).find("tx_hash").text();
|
||||
var n = $(o).find("tx_output_n").text();
|
||||
var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex;
|
||||
var amount = (($(o).find("value").text()*1)/100000000).toFixed(8);
|
||||
addOutput(tx, n, script, amount);
|
||||
});
|
||||
@@ -956,7 +1080,7 @@ $(document).ready(function() {
|
||||
var tx = ((""+o.txid).match(/.{1,2}/g).reverse()).join("")+'';
|
||||
if(tx.match(/^[a-f0-9]+$/)){
|
||||
var n = o.output_no;
|
||||
var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex;
|
||||
var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex;
|
||||
var amount = o.value;
|
||||
addOutput(tx, n, script, amount);
|
||||
}
|
||||
@@ -1015,13 +1139,13 @@ $(document).ready(function() {
|
||||
$("#transactionFee").val((fee>0)?fee:'0.00');
|
||||
}
|
||||
|
||||
$("#optionsCollapse").click(function(){
|
||||
if($("#optionsAdvanced").hasClass('hidden')){
|
||||
$("#glyphcollapse").removeClass('glyphicon-collapse-down').addClass('glyphicon-collapse-up');
|
||||
$("#optionsAdvanced").removeClass("hidden");
|
||||
$(".optionsCollapse").click(function(){
|
||||
if($(".optionsAdvanced",$(this).parent()).hasClass('hidden')){
|
||||
$(".glyphcollapse",$(this).parent()).removeClass('glyphicon-collapse-down').addClass('glyphicon-collapse-up');
|
||||
$(".optionsAdvanced",$(this).parent()).removeClass("hidden");
|
||||
} else {
|
||||
$("#glyphcollapse").removeClass('glyphicon-collapse-up').addClass('glyphicon-collapse-down');
|
||||
$("#optionsAdvanced").addClass("hidden");
|
||||
$(".glyphcollapse",$(this).parent()).removeClass('glyphicon-collapse-up').addClass('glyphicon-collapse-down');
|
||||
$(".optionsAdvanced",$(this).parent()).addClass("hidden");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1243,7 +1367,6 @@ $(document).ready(function() {
|
||||
var tx = coinjs.transaction();
|
||||
try {
|
||||
var decode = tx.deserialize($("#verifyScript").val());
|
||||
// console.log(decode);
|
||||
$("#verifyTransactionData .transactionVersion").html(decode['version']);
|
||||
$("#verifyTransactionData .transactionSize").html(decode.size()+' <i>bytes</i>');
|
||||
$("#verifyTransactionData .transactionLockTime").html(decode['lock_time']);
|
||||
@@ -1308,6 +1431,8 @@ $(document).ready(function() {
|
||||
var addr = '';
|
||||
if(o.script.chunks.length==5){
|
||||
addr = coinjs.scripthash2address(Crypto.util.bytesToHex(o.script.chunks[2]));
|
||||
} else if((o.script.chunks.length==2) && o.script.chunks[0]==0){
|
||||
addr = coinjs.bech32_encode(coinjs.bech32.hrp, [coinjs.bech32.version].concat(coinjs.bech32_convert(o.script.chunks[1], 8, 5, true)));
|
||||
} else {
|
||||
var pub = coinjs.pub;
|
||||
coinjs.pub = coinjs.multisig;
|
||||
@@ -1365,7 +1490,19 @@ $(document).ready(function() {
|
||||
var pubkey = $("#verifyScript").val();
|
||||
if(pubkey.length==66 || pubkey.length==130){
|
||||
try {
|
||||
$("#verifyPubKey .verifyDataSw").addClass('hidden');
|
||||
$("#verifyPubKey .address").val(coinjs.pubkey2address(pubkey));
|
||||
if(pubkey.length == 66){
|
||||
var sw = coinjs.segwitAddress(pubkey);
|
||||
$("#verifyPubKey .addressSegWit").val(sw.address);
|
||||
$("#verifyPubKey .addressSegWitRedeemScript").val(sw.redeemscript);
|
||||
|
||||
var b32 = coinjs.bech32Address(pubkey);
|
||||
$("#verifyPubKey .addressBech32").val(b32.address);
|
||||
$("#verifyPubKey .addressBech32RedeemScript").val(b32.redeemscript);
|
||||
|
||||
$("#verifyPubKey .verifyDataSw").removeClass('hidden');
|
||||
}
|
||||
$("#verifyPubKey").removeClass("hidden");
|
||||
$(".verifyLink").attr('href','?verify='+$("#verifyScript").val());
|
||||
return true;
|
||||
@@ -1507,6 +1644,12 @@ $(document).ready(function() {
|
||||
window.location.hash = "#verify";
|
||||
}
|
||||
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
if(e.target.hash == "#fees"){
|
||||
feeStats();
|
||||
}
|
||||
})
|
||||
|
||||
$(".qrcodeBtn").click(function(){
|
||||
$("#qrcode").html("");
|
||||
var thisbtn = $(this).parent().parent();
|
||||
@@ -1677,6 +1820,231 @@ $(document).ready(function() {
|
||||
$("#redeemFromBtn").attr('rel',$("#coinjs_utxo option:selected").val());
|
||||
}
|
||||
|
||||
|
||||
/* fees page code */
|
||||
|
||||
$("#fees .slider").on('input', function(){
|
||||
$('.'+$(this).attr('rel')+' .inputno, .'+$(this).attr('rel')+' .outputno',$("#fees")).html($(this).val());
|
||||
$('.'+$(this).attr('rel')+' .estimate',$("#fees")).removeClass('hidden');
|
||||
});
|
||||
|
||||
$("#fees .txo_p2pkh").on('input', function(){
|
||||
var outputno = $('.'+$(this).attr('rel')+' .outputno',$("#fees .txoutputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txoutputs")).html((outputno*$("#est_txo_p2pkh").val())+(outputno*9));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txo_p2sh").on('input', function(){
|
||||
var outputno = $('.'+$(this).attr('rel')+' .outputno',$("#fees .txoutputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txoutputs")).html((outputno*$("#est_txo_p2sh").val())+(outputno*9));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txi_regular").on('input', function(){
|
||||
var inputno = $('.'+$(this).attr('rel')+' .inputno',$("#fees .txinputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txinputs")).html((inputno*$("#est_txi_regular").val())+(inputno*41));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txi_segwit").on('input', function(){
|
||||
var inputno = $('.'+$(this).attr('rel')+' .inputno',$("#fees .txinputs")).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',$("#fees .txinputs")).html(bytes);
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txi_multisig").on('input', function(){
|
||||
var inputno = $('.'+$(this).attr('rel')+' .inputno',$("#fees .txinputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txinputs")).html((inputno*$("#est_txi_multisig").val())+(inputno*41));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txi_hodl").on('input', function(){
|
||||
var inputno = $('.'+$(this).attr('rel')+' .inputno',$("#fees .txinputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txinputs")).html((inputno*$("#est_txi_hodl").val())+(inputno*41));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .txi_unknown").on('input', function(){
|
||||
var inputno = $('.'+$(this).attr('rel')+' .inputno',$("#fees .txinputs")).html();
|
||||
$('.'+$(this).attr('rel')+' .bytes',$("#fees .txinputs")).html((inputno*$("#est_txi_unknown").val())+(inputno*41));
|
||||
mathFees();
|
||||
});
|
||||
|
||||
$("#fees .sliderbtn.down").click(function(){
|
||||
var val = $(".slider",$(this).parent().parent()).val()*1;
|
||||
if(val>($(".slider",$(this).parent().parent()).attr('min')*1)){
|
||||
$(".slider",$(this).parent().parent()).val(val-1);
|
||||
$(".slider",$(this).parent().parent()).trigger('input');
|
||||
}
|
||||
});
|
||||
|
||||
$("#fees .sliderbtn.up").click(function(){
|
||||
var val = $(".slider",$(this).parent().parent()).val()*1;
|
||||
if(val<($(".slider",$(this).parent().parent()).attr('max')*1)){
|
||||
$(".slider",$(this).parent().parent()).val(val+1);
|
||||
$(".slider",$(this).parent().parent()).trigger('input');
|
||||
}
|
||||
});
|
||||
|
||||
$("#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");
|
||||
}
|
||||
});
|
||||
|
||||
$("#feesAnalyseBtn").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;
|
||||
}
|
||||
$("#fees .segwit .inputno").html(($("#fees .segwit .inputno").html()*1)+1);
|
||||
$("#fees .txi_segwit").val(($("#fees .txi_segwit").val()*1)+1);
|
||||
$("#fees .segwit .bytes").html(($("#fees .segwit .bytes").html()*1)+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(($("#fees .multisig .bytes").html()*1)+size);
|
||||
|
||||
} else if(script.type == 'hodl'){
|
||||
size += 78;
|
||||
$("#fees .hodl .inputno").html(($("#fees .hodl .inputno").html()*1)+1);
|
||||
$("#fees .txi_hodl").val(($("#fees .txi_hodl").val()*1)+1);
|
||||
$("#fees .hodl .bytes").html(($("#fees .hodl .bytes").html()*1)+size);
|
||||
|
||||
} 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 */
|
||||
var IE = document.all?true:false // Boolean, is browser IE?
|
||||
if (!IE) document.captureEvents(Event.MOUSEMOVE)
|
||||
@@ -1708,4 +2076,5 @@ $(document).ready(function() {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---- Version 1.3 2017.09.10 ----
|
||||
---- Version 1.4 2018.05.27 ---
|
||||
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
|
||||
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
|
||||
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
|
||||
b98f718f0400fada4e0f15471031f92ce31e2b83 ./js/coinbin.js
|
||||
3e7b9b1a30412f827d4709a53014d0b6f06103f0 ./js/coin.js
|
||||
dda26795fcd22541612067d44cf72ecae62f092b ./js/coinbin.js
|
||||
eec3c5f1c5f69a34205613f6bf62ff9cc5a8d07a ./js/coin.js
|
||||
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
|
||||
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
|
||||
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
|
||||
@@ -21,7 +21,8 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js
|
||||
255c58c17e63eb54adb3cd02b5c06224c67fc364 ./css/bootstrap-datetimepicker.min.css
|
||||
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css
|
||||
fc6b4268fbd57ad95d2b41a1d4d6866f222fbdb2 ./css/bootstrap-theme.min.css
|
||||
4198ed869836ea5727ad6b80bf2df0a9c1a83244 ./css/style.css
|
||||
eb54f374256b75a17f274847b4ca9985fd046f9f ./css/style.css
|
||||
2e3217a3f3b7c2fb30562ab9a4ef9a407ae81897 ./images/btc32x.png
|
||||
8ac24915d59cef71c542e7cb7d7e153f560cba1f ./images/coinbin.gif
|
||||
f2af060f1cadbc9065c8c465c648dc01be67cc12 ./images/loader.gif
|
||||
86b6f62b7853e67d3e635f6512a5a5efc58ea3c3 ./fonts/glyphicons-halflings-regular.eot
|
||||
@@ -29,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
|
||||
d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
|
||||
da6e4cbb4a168a3583086e0997c8c678a7a80925 ./index.html
|
||||
c024021c71cba503979a859d23cbf7a88b570d82 ./README.md
|
||||
208b64a1ef61aaceec82f06515e4f7cf046793f6 ./index.html
|
||||
|
||||
Reference in New Issue
Block a user