-
Notifications
You must be signed in to change notification settings - Fork 5
/
current_payouts.html
76 lines (69 loc) · 1.91 KB
/
current_payouts.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
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
// PUT YOUR P2POOL SERVER'S ADDRESS HERE:
var servaddr = 'http://p2pool.forre.st:9332';
$(document).ajaxError(function(event, request, settings, err) {
alert("error: " + settings.url + ": " + err.message);
});
$.get(servaddr + '/rate', function(data) {
$('#hashrate').html(data / 1000000000);
});
$.getJSON(servaddr + '/current_payouts', function(pays) {
var arr = new Array;
var total = 0;
for(var i in pays) {
arr.push(i);
}
arr.sort(function(a, b) { return (pays[b] - pays[a]); });
for(var j in arr) {
var addr = arr[j];
addr = addr.replace(/^.*: /, "");
$('#payouts tr:last').after('<tr><td><a href="http://blockexplorer.com/address/' + addr + '">' + arr[j] + '</a></td><td>' +
pays[arr[j]] + '</td></tr>');
total += pays[arr[j]];
}
$('#payouts tr:last').after('<tr><td><b>Total:</b></td><td><b>' + total.toFixed(8) + '</b></td></tr>');
});
$.getJSON(servaddr + '/recent_blocks', function(blocks) {
for(var i in blocks) {
var ts = new Date(1000 * blocks[i]['ts']);
var padded_hash = blocks[i]['hash'];
while(padded_hash.length < 64) {
padded_hash = '0' + padded_hash;
}
$('#blocks tr:last').after('<tr><td>' + ts.toString() +
'</td><td><a href="http://blockexplorer.com/block/'
+ padded_hash + '">' + padded_hash + '</a></td></tr>');
}
});
</script>
</head>
<body>
<h1>p2pool payouts if block found <em>now</em></h1>
<ul>
<li>
Total pool Ghash/sec: <span id="hashrate"></span>
</li>
<li>
Payouts if block was found NOW:
<table border="1" id="payouts">
<tr>
<th>address</th>
<th>amount in BTC</th>
</tr>
</table>
</li>
<li>
Recently found blocks (that this node still remembers): <br />
<table border="1" id="blocks">
<tr>
<th>time</th>
<th>hash</th>
</tr>
</table>
</li>
</ul>
</body>
</html>