forked from 0x1d00ffff/0xBTC-Stats
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
409 lines (379 loc) · 17.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!--
Attributions:
Milligram - https://github.com/milligram/milligram
ionicons - http://ionicons.com/
ethjs - https://github.com/ethjs/ethjs
Google Material Design Color Palatte - https://htmlcolorcodes.com/color-chart/material-design-color-chart/
Chart.js - http://www.chartjs.org/
jqMath - https://mathscribe.com/author/jqmath.html
TIPR tooltips - http://www.tipue.com/tipr/
-->
<html>
<head>
<meta charset='utf-8'>
<!-- favicon metadata - generated with https://realfavicongenerator.net -->
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="manifest" href="icons/site.webmanifest">
<link rel="mask-icon" href="icons/safari-pinned-tab.svg" color="#ff8024">
<link rel="shortcut icon" href="icons/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="icons/browserconfig.xml">
<meta name="theme-color" content="#ff8024">
<!-- end favicon metadata -->
<!-- jquery is here because scripts need it early on. may want to move other js imports here. -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!-- jqMath allows for real equation formatting. it's great! -->
<script src="js/jqmath-etc-0.4.6.min.js" charset="utf-8"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<!-- note: lodash is only used for _.debounce() -->
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
<script src="js/tipr.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.2.3/milligram.min.css">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" type="text/css" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
<link rel="stylesheet" type="text/css" href="css/jqmath-0.4.3.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/themes/dark1.css">
<link rel="stylesheet" type="text/css" href="css/ionicons.css">
<link rel="stylesheet" type="text/css" href="css/tipr-corso.css">
<title>0xBitcoin Statistics</title>
<meta name="descripton" content="Live statistics for 0xBitcoin - the mined bitcoin-like token for Ethereum.">
<meta name="viewport" content="width=600">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-117165354-1"></script>
<script type="text/javascript" src="js/gtag.js"></script>
</head>
<body>
<script type="text/javascript">
var el = function(id){ return document.querySelector(id); };
/* 'safe' version if el that returns a dummy for non-existent elements */
var el_safe = function(id) {
let e = el(id);
if (e) {
return e;
} else {
return {};
}
}
var log = function(){
// 1. Convert args to a normal array
var args = Array.prototype.slice.call(arguments);
// 2. Prepend log prefix log string
args.unshift(((Date.now()-globalTimerStart)/1000).toFixed(2) + 's ');
// 3. Pass along arguments to console.log
console.log.apply(console, args);
}
var globalTimerStart = Date.now();
let searchParams = new URLSearchParams(window.location.search)
</script>
<div class="container">
<div class="row">
<div class="column">
<img class="top-logo" alt="0xBitcoin Logo" src="img/0xBTC_Orange-40px.png" height=40 width=40 />
<h1>0xBitcoin Token Statistics</h1>
</div>
</div>
<div class="row">
<div class="column">
<ul id="navigation" class="nav">
<li class="nav"><a href="./?page=stats&#"><i class="icon ion-ios-pulse navicon"></i> stats</a></li>
<li class="nav"><a href="./?page=stats&#miners"><i class="icon ion-ios-people-outline navicon"></i> miners</a></li>
<li class="nav"><a href="./?page=stats&#blocks"><i class="icon ion-ios-browsers-outline navicon"></i> blocks</a></li>
<li class="nav"><a href="./?page=miningcalculator&#"><i class="icon ion-ios-calculator-outline navicon"></i> mining calculator<!-- <span style="color:#FF1744;">(new)</span>--></a></li>
<li class="nav"><a href="./?page=graphs&#"><i class="icon ion-ios-flame-outline navicon"></i> difficulty / hashrate</a></li>
<li class="nav"><a href="./?page=graphs&#reward-time"><i class="icon ion-ios-speedometer-outline navicon"></i> reward time / supply</a></li>
</ul>
</div>
</div>
<div style="display:none;" id="row-statistics">
<div class="row">
<div class="column"><h4 class="add-top-padding-5">Current Contract Status</h4></div>
</div>
<div class="row">
<div class="column">
<table>
<!--<thead> <tr> <th> </th> <th> </th> </tr> </thead>-->
<tbody id="statistics">
<tr><td colspan="2">Loading info from the blockchain...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="display:none;" id="row-miners">
<div class="row">
<div class="column"><h4 class="add-top-padding"><a name="miners"></a>Block distribution since last retarget</h4></div>
</div>
<div class="row">
<div class="column column-25" style="max-width:30rem;">
<div id="blockdistributionpiechart"></div>
</div>
<div class="column">
<table>
<!--<thead id="minerstats"> <tr> <th> </th> <th> </th> </tr> </thead>-->
<tbody id="minerstats">
<tr><td colspan="3">Loading info from the blockchain...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="display:none;" id="row-blocks">
<div class="row">
<div class="column"><h4 class="add-top-padding"><a name="blocks"></a>Blocks solved since last retarget</h4></div>
</div>
<div class="row">
<div class="column">
<table>
<!--<thead id="minerstats"> <tr> <th> </th> <th> </th> </tr> </thead>-->
<tbody id="blockstats">
<tr><td colspan="3">Loading info from the blockchain...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="display:none;" id="row-miningcalculator">
<div class="row">
<div class="column"><h4 class="add-top-padding"><a name="miningcalculator"></a>Mining calculator</h4></div>
</div>
<div id="editor">
<div class="row">
<div class="column">
<div class="container">
<div class="row">
<div class="column">
<label for="hashrateField">Your Hashrate:</label>
<input type="text" :value="hashrate" @input="updateHashrate" id="hashrateField" onfocus="this.select()" autofocus></input>
<select :value="units" @input="updateUnits" id="unitField">
<option value="1">H/s</option>
<option value="1e3">Kh/s</option>
<option value="1e6">Mh/s</option>
<option value="1e9">Gh/s</option>
<option value="1e12">Th/s</option>
<option value="1e15">Eh/s</option>
</select>
</div>
</div>
<div class="row">
<div class="column">
<label for="poolFeeField" class="add-top-padding-2">Pool Fee:</label>
<input type="text" :value="poolfee" @input="updatePoolFee" id="poolFeeField" onfocus="this.select()" autofocus></input><span style="margin-left:10px;line-height: 40px;">percent</span>
</div>
<div class="column">
<label for="mintFailureRateField" class="add-top-padding-2">Mint Failure Rate: <i class="icon ion-ios-help-outline helpicon tip" data-tip="Even a perfect setup will occasionally fail to mint a block. This is similar to 'stale blocks' in the Bitcoin blockchain. Failure rates can range from 1.5%-15% depending on network block rate, latency, connection type, and luck." ></i></label>
<input type="text" :value="mint_failure_rate" @input="updateMintFailureRate" id="mintFailureRateField" onfocus="this.select()" autofocus></input><span style="margin-left:10px;line-height: 40px;">percent</span>
</div>
</div>
<div class="row">
<div class="column">
<label for="difficultyField" class="add-top-padding-2">Difficulty:</label>
<input type="text" :value="difficulty" @input="updateDifficulty" id="difficultyField" onfocus="this.select()" autofocus></input>
</div>
</div>
<div class="row">
<div class="column" style="text-align: center;">
<a class="button button-outline" v-on:click="useCurrentDiff" id="currentDiffButton">Use Current Diff</a>
</div>
<div class="column" style="text-align: center;">
<a class="button button-outline tip" v-on:click="useNextDiff" id="nextDiffButton" data-tip="This is only an estimate, so don't be suprised when it changes.">Use Next Diff</a>
</div>
</div>
</div>
</div>
<div class="column">
<!--<label for="poolMiningTable">Pool Mining</label>-->
<table id="poolMiningTable">
<thead>
<tr>
<th>Pool Mining</th>
<th>Tokens</th>
</tr>
</thead>
<tbody>
<tr>
<td>Per Hour</td>
<td>{{ Number((calculatedTokensPerDay / 24).toFixed(2)).toLocaleString() }}</td>
</tr>
<tr>
<td>Per Day</td>
<td>{{ Number((calculatedTokensPerDay * 1).toFixed(2)).toLocaleString() }}</td>
</tr>
<tr>
<td>Per Week</td>
<td>{{ Number((calculatedTokensPerDay * 7).toFixed(2)).toLocaleString() }}</td>
</tr>
<tr>
<td>Per Month</td>
<td>{{ Number((calculatedTokensPerDay * 30.4167).toFixed(2)).toLocaleString() }}</td>
</tr>
</tbody>
</table>
<label for="soloMiningTimeSpan">Solo Mining</label>
<span id="soloMiningTimeSpan">{{ calculatedSoloTimePerBlock }} per block (average)</span>
<br /s>
<span id="soloMiningTimeSpan">{{ calculatedSoloTimePerTenBlocks }} per 10 blocks (more realistic)</span>
</div>
</div>
<div class="row">
<div class="column"><h5 class="add-top-padding">How Does The Calculator Work?</h5></div>
</div>
<div class="row">
<div class="column">
<p>
At its heart is the standard hashrate equation:
<blockquote>
time to solve a block in seconds $= {2^22⋅\difficulty}/\hashrate$
<br />
→ blocks per second $= \hashrate/{2^22⋅\difficulty}$
<br />
→ tokens per day $=({50\tokens}/\text"block")({60\seconds}/\text"minute")({60\minutes}/\text"hour")({24\hours}/\text"day")\hashrate/{2^22⋅\difficulty}$
<br />
→ tokens per day $={4320000⋅\hashrate}/{2^22⋅\difficulty}$
</blockquote>
</p>
<p>
For a more detailed calculator and individual GPU benchmarks, visit:
</p>
<ul>
<li><a href="https://docs.google.com/spreadsheets/d/1lpQufwMHeozyz2X5Xq9MhjLr_hVTkQfzpzXcdFQDRGg/edit#gid=826714715">
0xBTC Mining Calculator
</a> by minerjoe78, mikers, and others</li>
<!--
<li><a href="https://docs.google.com/spreadsheets/d/1lbNjXetgN0_CJP-jOVkVr4pvwn_sivbYjNyaU1KbnwQ/">
0xBitcoin GPU Speed/Benchmarks
</a> by the 0xBitcoin community </li>
-->
</ul>
</div>
</div>
</div>
</div>
<div style="display:none;" id="row-difficulty">
<div class="row">
<div class="column"><h4 class="add-top-padding"><a name="difficulty"></a>Hashrate and Difficulty over the last 60 days</h4></div>
</div>
<div class="row">
<div class="column">
<div id='difficultystats'>
Loading info from the blockchain...
</div>
</div>
</div>
</div>
<div style="display:none;" id="row-reward-time">
<div class="row">
<div class="column"><h4 class="add-top-padding"><a name="reward-time"></a>Average Reward Time and Supply over the last 60 days</h4></div>
</div>
<div class="row">
<div class="column">
<div id='blocktimestats'>
Loading info from the blockchain...
</div>
</div>
</div>
</div>
<div id="row-footer">
<div class="row add-top-padding add-bottom-padding-5">
<div class="column">
Data fetched at:
<span id="LastUpdatedTime">00:00:00</span>
<div style="font-size:0.875em;">
0xBitcoin Stats
<span id="footerversion">
v0.0.0
</span>
</div>
</div>
<div class="column"><a href="https://etherscan.io/address/0x1d00FFffB205CC0C5a51E7c77a7668A8B90BBb90"><font color="#C0392B">❤</font> 0x1d00FFffB205CC0C5a51E7c77a7668A8B90BBb90</a></div>
</div>
</div>
</div>
<script type="text/javascript" src="js/ethereumjs-testrpc.js"></script>
<script type="text/javascript" src="js/ethjs.js"></script>
<script type="text/javascript" src="js/abi.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/graphs.js"></script>
<script type="text/javascript" src="js/mining-calculator.js"></script>
<script type="text/javascript">
function initPage() {
let searchParams = new URLSearchParams(window.location.search)
if(searchParams.has('reload')) {
var time = searchParams.get('reload');
setTimeout(function(){
location.reload()
},time*60000)
}
/* hack; need to add to UI */
if(searchParams.has('downloadCsvHours')) {
var hours = searchParams.get('downloadCsvHours');
loadAllStats(stats);
function loadCSVWhenReady() {
if(areAllBlockchainStatsLoaded(stats)) {
getMinerInfoCSV(eth, stats, hours);
} else {
setTimeout(()=>{ loadCSVWhenReady() }, 100);
}
}
setTimeout(()=>{ loadCSVWhenReady() }, 0);
return;
}
/* end hack; need to add to UI */
if(!searchParams.has('page')
|| searchParams.get('page') == 'stats') {
if(!searchParams.has('page')){
addToURL('?page=stats&');
}
log('STATS selected');
$('#row-statistics').show(); // may not need this
$('#row-miners').show(); // may not need this
$('#row-blocks').show(); // may not need this
//$(document).attr("title", "0xBitcoin Statistics");
el('#statistics').innerHTML = '';
updateAndDisplayAllStats();
}else if(searchParams.get('page') == 'miningcalculator') {
log('MININGCALCULATOR selected');
$(document).attr("title", "Mining Calculator - 0xBitcoin Statistics");
$("#row-miningcalculator").show();
loadAllStats();
}else if(searchParams.get('page') == 'graphs') {
log('GRAPHS selected');
let days = 60;
let points = 60;
$(document).attr("title", "Graphs - 0xBitcoin Statistics");
if(searchParams.get('days')) {
days = searchParams.get('days');
}
if(searchParams.get('points')) {
points = searchParams.get('points');
}
$('#row-difficulty').show();
$('#row-reward-time').show();
updateGraphData(days, points);
}
updateLastUpdatedTime();
}
try {
$(document).ready(function() {
log("DOMready");
/* initialize tipr tooltips */
$('.tip').tipr({
'speed': 800,
//'mode': 'above',
//'space': 500
});
});
} catch (err) {
log('failed to set DOMready fn. Jquery load error?');
el('#statistics').innerHTML = "Sorry, failed to load jquery. Try again later.";
el('#difficultystats').innerHTML = "Sorry, failed to load jquery. Try again later.";
fail;
} finally {
initPage();
}
</script>
</body>
</html>