Updates to website, different fee levels

This commit is contained in:
Jochen Hoenicke 2017-12-05 01:10:56 +01:00
parent 6bdd20b8f8
commit be023f2bd2
14 changed files with 94 additions and 212 deletions

View File

@ -43,12 +43,12 @@ webinterface won't work.
password=<secret password>
EOF
cd mempool
mysql btc_mempool < mempool-create.sql
perl mempool-create.pl | mysql btc_mempool
./mempool.sh
You are almost ready now. Check that everything works. There should be a
file `mempool.log` containing one line of statistics. There should be
newly created files in `/dev/shm/mempool` that contain the dynamic data the
newly created files in `/dev/shm/mempool-btc` that contain the dynamic data the
webserver should serve. If everything looks fine add the following crontab
entry (using `crontab -e`):
@ -58,8 +58,8 @@ entry (using `crontab -e`):
Install a web server of your choice. For refreshing/zooming you need
php and php-mysql. Then link/copy the web subdirectory to the web
root. Finally link to the dynamic js files in `/dev/shm/mempool`.
root. Finally link to the dynamic js files in `/dev/shm/mempool-btc`.
cd $HOME/mempool/web/queue
sudo ln -s $HOME/mempool/web/* /var/www/html
ln -s /dev/shm/mempool/*.js $HOME/mempool/web/queue/
ln -s /dev/shm/mempool-btc/*.js $HOME/mempool/web/queue/

18
mempool-create.pl Normal file
View File

@ -0,0 +1,18 @@
$feelevels = 46;
print <<"EOF";
CREATE TABLE mempool (
time BIGINT NOT NULL PRIMARY KEY,
EOF
for $i (0..($feelevels - 1)) {
print " cnt$i INTEGER,\n";
}
for $i (0..($feelevels - 1)) {
print " size$i INTEGER,\n";
}
for $i (0..($feelevels - 1)) {
$comma = $i < $feelevels - 1 ? "," : "";
print " fee$i BIGINT$comma\n";
}
print ");\n";

View File

@ -1,135 +0,0 @@
CREATE TABLE mempool (
time BIGINT NOT NULL PRIMARY KEY,
cnt0 INTEGER,
cnt1 INTEGER,
cnt2 INTEGER,
cnt3 INTEGER,
cnt4 INTEGER,
cnt5 INTEGER,
cnt6 INTEGER,
cnt7 INTEGER,
cnt8 INTEGER,
cnt9 INTEGER,
cnt10 INTEGER,
cnt11 INTEGER,
cnt12 INTEGER,
cnt13 INTEGER,
cnt14 INTEGER,
cnt15 INTEGER,
cnt16 INTEGER,
cnt17 INTEGER,
cnt18 INTEGER,
cnt19 INTEGER,
cnt20 INTEGER,
cnt21 INTEGER,
cnt22 INTEGER,
cnt23 INTEGER,
cnt24 INTEGER,
cnt25 INTEGER,
cnt26 INTEGER,
cnt27 INTEGER,
cnt28 INTEGER,
cnt29 INTEGER,
cnt30 INTEGER,
cnt31 INTEGER,
cnt32 INTEGER,
cnt33 INTEGER,
cnt34 INTEGER,
cnt35 INTEGER,
cnt36 INTEGER,
cnt37 INTEGER,
cnt38 INTEGER,
cnt39 INTEGER,
cnt40 INTEGER,
cnt41 INTEGER,
cnt42 INTEGER,
cnt43 INTEGER,
size0 INTEGER,
size1 INTEGER,
size2 INTEGER,
size3 INTEGER,
size4 INTEGER,
size5 INTEGER,
size6 INTEGER,
size7 INTEGER,
size8 INTEGER,
size9 INTEGER,
size10 INTEGER,
size11 INTEGER,
size12 INTEGER,
size13 INTEGER,
size14 INTEGER,
size15 INTEGER,
size16 INTEGER,
size17 INTEGER,
size18 INTEGER,
size19 INTEGER,
size20 INTEGER,
size21 INTEGER,
size22 INTEGER,
size23 INTEGER,
size24 INTEGER,
size25 INTEGER,
size26 INTEGER,
size27 INTEGER,
size28 INTEGER,
size29 INTEGER,
size30 INTEGER,
size31 INTEGER,
size32 INTEGER,
size33 INTEGER,
size34 INTEGER,
size35 INTEGER,
size36 INTEGER,
size37 INTEGER,
size38 INTEGER,
size39 INTEGER,
size40 INTEGER,
size41 INTEGER,
size42 INTEGER,
size43 INTEGER,
fee0 BIGINT,
fee1 BIGINT,
fee2 BIGINT,
fee3 BIGINT,
fee4 BIGINT,
fee5 BIGINT,
fee6 BIGINT,
fee7 BIGINT,
fee8 BIGINT,
fee9 BIGINT,
fee10 BIGINT,
fee11 BIGINT,
fee12 BIGINT,
fee13 BIGINT,
fee14 BIGINT,
fee15 BIGINT,
fee16 BIGINT,
fee17 BIGINT,
fee18 BIGINT,
fee19 BIGINT,
fee20 BIGINT,
fee21 BIGINT,
fee22 BIGINT,
fee23 BIGINT,
fee24 BIGINT,
fee25 BIGINT,
fee26 BIGINT,
fee27 BIGINT,
fee28 BIGINT,
fee29 BIGINT,
fee30 BIGINT,
fee31 BIGINT,
fee32 BIGINT,
fee33 BIGINT,
fee34 BIGINT,
fee35 BIGINT,
fee36 BIGINT,
fee37 BIGINT,
fee38 BIGINT,
fee39 BIGINT,
fee40 BIGINT,
fee41 BIGINT,
fee42 BIGINT,
fee43 BIGINT
);

View File

@ -5,19 +5,19 @@ use List::Util qw[min max];
my $SQLITE="sqlite3";
my $MYSQL="mysql";
my $MEMPOOLLOG="mempool.log";
my $MEMPOOLDB="mempool.s3db";
my $MYSQLMEMPOOLDB="btc_mempool";
my @feelimit=(0.0001,1,2,5,10,20,30,40,50,60,70,80,90,100,120,140,160,180,200,220,240,260,280,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000,1400,2000,3000,5000,7000,10000);
my @feelimit=(0.0001,1,2,3,4,5,6,7,8,10,12,14,17,20,25,30,40,50,60,70,80,100,120,140,170,200,250,300,400,500,600,700,800,1000,1200,1400,1700,2000,2500,3000,4000,5000,6000,7000,8000,10000,2100000000000000);
my @total=();
my @count=();
my @fees=();
my $time = time();
for ($i = 0; $i< @feelimit; $i++) {
for ($i = 0; $i< @feelimit - 1; $i++) {
$total[$i] = 0;
$count[$i] = 0;
$fees[$i] = 0;
}
my $found = 0;
while(<>) {
/"size": (\d+)/ and $size = $1;
/"ancestorsize": (\d+)/ and $asize = $1;
@ -31,16 +31,17 @@ while(<>) {
$tfpb = ($afees + $dfees - $fee) / ($asize + $dsize - $size);
$fpb = $fee / $size;
$feeperbyte = max($tfpb, min($fpb, $afpb));
for ($i = 0; $i< @feelimit; $i++) {
if ($feeperbyte >= $feelimit[$i]) {
for ($i = 0; $i< @feelimit-1; $i++) {
if ($feeperbyte >= $feelimit[$i] && $feeperbyte < $feelimit[$i+1]) {
$total[$i] += $size;
$count[$i]++;
$fees[$i] += $fee;
}
}
$found = 1;
}
}
if ($count[0]) {
if ($found) {
my $cnt = join(",", @count);
my $size = join(",", @total);
my $fee = join(",", @fees);

View File

@ -1,9 +1,9 @@
#!/bin/bash
BITCOINCLI=/home/bitcoind/bin/bitcoin-cli
MEMPOOLHOME=/home/hoenicke/mempool
TMPFILE=/dev/shm/mempool/rawdump.txt
mkdir -p /dev/shm/mempool
BITCOINCLI=/home/bitcoin/bin/bitcoin-cli
MEMPOOLHOME=/home/mempool/mempool
TMPFILE=/dev/shm/mempool-btc/rawdump.txt
mkdir -p /dev/shm/mempool-btc
cd $MEMPOOLHOME
rm -f $TMPFILE

View File

@ -1,7 +1,7 @@
#!/bin/bash
MEMPOOL=mempool.log
DESTDIR=/dev/shm/mempool
DESTDIR=/dev/shm/mempool-btc
mkdir -p $DESTDIR
createfile() {
@ -40,4 +40,6 @@ createfile_filtered 1w 10080 7
createfile_filtered 2w 20160 14
createfile_filtered 30d 43200 30
createfile_filtered 3m 131040 90
createfile_all 270
createfile_filtered 6m 262080 180
createfile_filtered 1y 524160 360
createfile_all 360

View File

@ -3,23 +3,12 @@
DB=$1
mysql btc_mempool <<EOF | perl -pe 'chomp;s/NULL/0/g;
my $feelevels=46
my @vals = map { $_ || 0 } (split "\t", $_, -1);
if ($vals[1] == 0 && $vals[2] == 0) {
$vals[1] = $vals[3];
$vals[2] = $vals[3];
}
if ($vals[1+44] == 0 && $vals[2+44] == 0) {
$vals[1+44] = $vals[3+44];
$vals[2+44] = $vals[3+44];
}
if ($vals[1+88] == 0 && $vals[2+88] == 0) {
$vals[1+88] = $vals[3+88];
$vals[2+88] = $vals[3+88];
}
my $time = shift @vals;
my $cnt = join(",", splice(@vals, 0, 44));
my $size = join(",", splice(@vals, 0, 44));
my $fee = join(",", splice(@vals, 0, 44));
my $cnt = join(",", splice(@vals, 0, $feelevels));
my $size = join(",", splice(@vals, 0, $feelevels));
my $fee = join(",", splice(@vals, 0, $feelevels));
$_ = "[$time,[$cnt],[$size],[$fee]],\n"'
select * from mempool order by time;
EOF

BIN
web/queue/bc-logo-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

BIN
web/queue/bch-logo-30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -24,6 +24,8 @@ $dbuser = "www";
$dbpass = "<redacted>";
$dboptions = array();
$feelevels = 46;
try {
$db = new PDO($dbdsn, $dbuser, $dbpass, $dboptions);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -47,23 +49,15 @@ try {
echo 'call([';
$comma="";
while ($row = $query->fetch(PDO::FETCH_NUM)) {
for ($i = 0; $i < 3*44+1; $i++) {
for ($i = 0; $i < 3*$feelevels+1; $i++) {
if (!isset($row[$i])) {
if ($i == 1 || $i == 2) {
$row[$i] = $row[3];
} else if ($i == 1+44 || $i == 2+44) {
$row[$i] = $row[3+44];
} else if ($i == 1+88 || $i == 2+88) {
$row[$i] = $row[3+88];
} else {
$row[$i] = 0;
}
$row[$i] = 0;
}
}
echo $comma.'['.$row[0].',['.
join(',', array_slice($row, 1, 44)).'],['.
join(',', array_slice($row, 45, 44)).'],['.
join(',', array_slice($row, 89, 44)).']]';
join(',', array_slice($row, 1, $feelevels)).'],['.
join(',', array_slice($row, 1 + $feelevels, $feelevels)).'],['.
join(',', array_slice($row, 1 + 2*$feelevels, $feelevels)).']]';
$comma = ",\n";
}
echo "]);\n";

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Johoe's Mempool Size Statistics</title>
<title>Johoe's Bitcoin Mempool Size Statistics</title>
<script type="text/javascript" src="../flot/jquery.min.js"></script>
<script type="text/javascript" src="../flot/jquery.flot.min.js"></script>
<script type="text/javascript" src="../flot/jquery.flot.time.min.js"></script>
@ -9,18 +9,18 @@
<script type="text/javascript" src="../flot/jquery.flot.resize.min.js"></script>
<script type="text/javascript" src="../flot/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="../flot/jquery.flot.navigate.min.js"></script>
<script type="text/javascript" src="mempool.js?v=1.12"></script>
<script type="text/javascript" src="mempool.js?v=1.13.1"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="Content-Language" content="en"/>
<meta name="author" content="Jochen Hoenicke"/>
<meta name="keywords" content="Jochen Hoenicke, Bitcoin, Mempool, Statistics"/>
<meta name="description" content="Johoe's Mempool Size Statistics"/>
<meta name="description" content="Johoe's Bitcoin Mempool Size Statistics"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="periods" class="header">
<b>Johoe's Mempool Statistics</b> &ndash; Period:
<b>Johoe's Bitcoin Mempool Statistics</b> &ndash; Period:
</div>
<div id="chartContainer1" style="width: 100%; height: 600px; margin-top: 15px;"></div>
<div id="chartContainer3" style="width: 100%; height: 600px; margin-top: 15px;"></div>
@ -34,22 +34,25 @@
This page displays the number and size of the unconfirmed bitcoin transactions, also known as the transactions in the <b>mempool</b>. It gives a real-time view and shows how the mempool evolves over the time. The transactions are colored by the amount of fee they pay per byte. The data is generated from my full node and is updated every minute. Note that in bitcoin there is no global mempool; every node keeps its own set of unconfirmed transactions that it has seen. The mempool is also cleared when I reboot my node.
The idea is based on the retired service bitcoinqueue.com.
</p>
<p>The data is separated into different fee levels given in satoshi per bytes. The lowest colored stripe is for transactions that pay the lowest fee. Higher fee transactions are stacked on top of it. Since miners prefer high fee transactions, a new block usually only removes the top 1000 kB from the queue. If a colored stripe persists over several hours without getting smaller, this means that transactions paying this amount of fee are not confirmed during this time, because there are higher paying transactions that take precedence. If a stripe on the bottom chart is much bigger than on the top chart, the transactions are larger than the average.</p>
<p>The data is separated into different fee levels given in satoshi per bytes. The lowest colored stripe is for transactions that pay the lowest fee. Higher fee transactions are stacked on top of it. Since miners prefer high fee transactions, a new block usually only removes the top 1 MB from the queue. If a colored stripe persists over several hours without getting smaller, this means that transactions paying this amount of fee are not confirmed during this time, because there are higher paying transactions that take precedence. If a stripe on the bottom chart is much bigger than on the top chart, the transactions are larger than the average.</p>
<p>You can click on some fee level in the legend to hide all fee levels below that level. This way you can better see how many transactions are competing with that fee level. You can also click in the legend to toggle the visibility of the total fee statistics.</p>
<p>You can click on some fee level in the legend to hide all fee levels below that level. This way you can better see how many transactions are competing with that fee level.</p>
<p>Note that sizes include the segwit discount. So for the core chain, a block will always take at most 1 MB from the mempool, even if it is bigger than 1 MB, because the lower diagram already shows the size minus three quarter of the witness size. The segwit discount is also included when computing the fee level for a transaction. In case a transaction pays exactly the fee that defines the boundary between stripes, it is included in the higher stripe. Free transactions are not included, even if they make it into the mempool.</p>
<p>Note that sizes include the segwit discount. So for the core chain, a block will always take at most 1 MB from the mempool, even if it is bigger than 1&nbsp;MB, because the lower diagram already shows the size minus three quarter of the witness size. The segwit discount is also included when computing the fee level for a transaction. In case a transaction pays exactly the fee that defines the boundary between stripes, it is included in the higher stripe. Free transactions are not included, even if they make it into the mempool.</p>
</div>
<div class="centered">
<p><span class="cover pixelated" style="width:148px; height:148px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlAQMAAAD/ULJAAAAABlBMVEX///8AAABVwtN+AAAApElEQVQI12PABfgfr9rfwMCh9mFBAwP3CoN1QHJdBZi0BZIc2mVAcf5XQDVApc1A9dyP6vYxMHBeOBjZwMCz98cxBgZ20S5VBgZGFcsmBgZmb245oK5EsTQGBo6Di3wYGFgM93Q3MPD6r/oNFDcxOQIU71+9F8j+ZPmbAcg51g80/1H4KiBTn7ETaO/anv8g2+O6QWyjaKC4suZOBqAb9vvh9AQAHus19/nAmMMAAAAASUVORK5CYII=); display: inline-block;"></span><br/>
Donation Bitcoin:
<a href="bitcoin:1FBjCXcLroP93uEZ4BfKi6Z6rw2PwvnAUJ">1FBjCXcLroP93uEZ4BfKi6Z6rw2PwvnAUJ</a><br/>
Litecoin: MCQXbDS5bPsycpg2LTVPQPLrB9NjoF4VJd (36CPHL27eH2YpKQ8EaW3ak6SrSnHqahkxz)<br/>
Ethereum: <span class="cover pixelated" style="width: 20px;height:20px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAgMAAAC5YVYYAAAACVBMVEWV5Xgyfg0qispl6+N0AAAAH0lEQVQI12NwYGRwdGQIDWVQkWBwEWSYwMagNgMoAgAqGwPVVzuqWQAAAABJRU5ErkJggg==); border-radius: 50%; display: inline-block;"></span>&nbsp;mempool.hoenicke.eth</p>
<div class="qrcontainer"><span class="cover pixelated qrcode" style="width:148px; height:148px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlAQMAAAD/ULJAAAAABlBMVEX///8AAABVwtN+AAAA1ElEQVQI12NABvZ9c84/YFCYX8qhwKC3YKH3Aga9nnurgeT+/NMLGBRWfNVQYLBftWr9AwYG5soFDAxCG122NTAoiTg4MDAIXzC64sCgYVMZ4MDAfOr1ewcG7jRTFwcGi69TTh9g0KuJz1FgEPtYOesBg25mLesCBoujv7wdGIwz9FkYGPhW2Pc5MJiKfos9wMDRtdnpAAOnYbSVAoPFPfX9QKPVZJIaGOwnKmsdYFDo+rvIgUFvl9k+oAubJLWBJjcuWtTAoLDz8ASg+7vffVNA9hAAKhdEcnLvcTYAAAAASUVORK5CYII=);"></span><img class="qrlogo" src="bc-logo-32x32.png"/></div>
<div class="qrcontainer"><span class="cover pixelated qrcode" style="width:148px; height:148px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlAQMAAAD/ULJAAAAABlBMVEX///8AAABVwtN+AAAA00lEQVQI12NABvYTMvsfMChsuHZCgUGv6/7qBQx6+xSygeSe00BSodsKKG6/atX6BwwMKt8cGBjEF/NJOzAwemu0MTCwPIzNd2Aw95l0ZgED6zbpiQ8YFEOPuiswcJ06qOzAYM+d+3cBA9Mds5MLGHiNT9YqMOj8EytKYOBg2xm1gEH7y/T6BgYTg0k3GBhU9xf6LWDQYRTkfsBgtivU7gADg57QogUM9tOfr3JgUFi/SgkosDS9PoFBb/cinQMMejN3PwG6ea2jJtCWvpftB5A9BAB0VkYyusTI4gAAAABJRU5ErkJggg==);"></span><img class="qrlogo" src="bch-logo-30.png"/></div>
<div class="qrcontainer"><span class="cover pixelated qrcode" style="width:148px; height:148px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlAQMAAAD/ULJAAAAABlBMVEX///8AAABVwtN+AAAA00lEQVQI12NABvb7a/sfMCjsy16hwKA3pTV7AYNejzaInKvMvYBBYbpqhwKD/apV6x8wMMgcc2BgEPir/iGBQYDl6rEEBraHExkPMIjbWzk3MGjMvF7lwGAlJRG7gEFludWuAwyceTnuCxiMWv3bHjAIWXfVHmCQvbTs5gIGdT6Z/AcMvHM6DzEw2HjfEWtg0H2k1HmAQS1sU+cDBrM5Mf+A1qifWtzAYL9l5uoDDAqNTMlA90x8vs+BQW/al09Ad7bul05gUNjyLQyoppOr1gHZQwBzTUeVN9V6gwAAAABJRU5ErkJggg==);"></span><img class="qrlogo" src="ltc-32px.png"/></div>
<p>Donation
bitcoin:<a href="bitcoin:3LrXizKejCGYyGUxYzGweyuxFVtfs3odEe">3LrXizKejCGYyGUxYzGweyuxFVtfs3odEe</a> (Segwit)<br/>
<a href="bitcoincash:qqc0a3s49uzj329rju4v27erlc6kx5paqs6t5l70n6">bitcoincash:qqc0a3s49uzj329rju4v27erlc6kx5paqs6t5l70n6</a><br/>
litecoin:<a href="litecoin:MK7jfGG48RTsETCXTAz1wP27uVoFhBUV5o">MK7jfGG48RTsETCXTAz1wP27uVoFhBUV5o</a><br/>
ethereum: <span class="cover pixelated" style="width: 20px;height:20px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAgMAAAC5YVYYAAAACVBMVEWV5Xgyfg0qispl6+N0AAAAH0lEQVQI12NwYGRwdGQIDWVQkWBwEWSYwMagNgMoAgAqGwPVVzuqWQAAAABJRU5ErkJggg==); border-radius: 50%; display: inline-block;"></span>&nbsp;mempool.hoenicke.eth</p>
</div>
<div class="centered" style="font-size: 13px; margin: 20px;">
Source code on github: <a href="https://github.com/jhoenicke/mempool">https://github.com/jhoenicke/mempool</a><br/>
© 2016-2017 <a href="https://jochen-hoenicke.de/">Jochen Hoenicke</a>
© 2016-2018 <a href="https://jochen-hoenicke.de/">Jochen Hoenicke</a>
</div>
</html>

BIN
web/queue/ltc-32px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

View File

@ -1,4 +1,4 @@
/*
/*
Bitcoin Mempool Visualization
Copyright (C) 2017 Jochen Hoenicke
@ -17,18 +17,17 @@
*/
var charts;
var ranges = [ 0, 1, 2, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1400, 2000, 3000, 5000, 7000, 10000 ];
var show = [ 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 15, 18, 23, 27, 31, 37];
var ranges = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 25, 30, 40, 50, 60, 70, 80, 100, 120, 140, 170, 200, 250, 300, 400, 500, 600, 700, 800, 1000, 1200, 1400, 1700, 2000, 2500, 3000, 4000, 5000, 6000, 7000, 8000, 10000 ];
var show = [ 0, 1, 2, 5, 9, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37 ];
var reloader;
var reloadInterval = 0;
var reloading;
var colors = [ "#535154", "#001080",
"#349dac", "#a21010", "#7e5e82", "#84b200", "#a0d0cd",
"#c7b52e", "#6cbbea", "#514f4c", "#4e7fbb", "#9f63a0",
"#f69445", "#349dac", "#c7b52e", "#514f4c", "#c14540",
"#7e2e82", "#54b200", "#1e7fbb", "#f67405", "#60e0cd",
"#e12000", "#123456", "#fe3dba", "#349d00", "#bd00ed",
"#001080"];
var colors = [ "#535154", "#001080", "#349dac", "#a21010", "#7e5e82",
"#84b200", "#a0d0cd", "#c7b52e", "#6cbbea", "#514f4c",
"#4e7fbb", "#9f63a0", "#f69445", "#349dac", "#c7b52e",
"#c14540", "#7e2e82", "#514f4c", "#54b200", "#1e7fbb",
"#f67405", "#60e0cd", "#e12000", "#123456", "#fe3dba",
"#349d00", "#bd00ed", "#001080"];
var units = [ "tx", "MB", "BTC" ];
var precisions = [ 0, 3, 3];
var feelevel = 0;
@ -89,7 +88,7 @@ function tooltip(dataidx, event, pos, item) {
rowcolor = ' style="background-color: ' + colors[i] + '"';
highlight = ' class="highlight"';
}
str = str + "<tr" + rowcolor + "><td" + highlight + ">" + (value == 0 ? "total" : value + "+") +
str = str + "<tr" + rowcolor + "><td" + highlight + ">" + (value == 0 ? "total" : value + "+") +
":&nbsp;</td><td" + highlight + ">" + sum.toFixed(prec).replace(/(\d)(?=(\d{3})+$)/g, '$1,') + "&nbsp;"+unit+"</td></tr>";
}
str = str + "</table>";
@ -148,9 +147,7 @@ function drawTitle(plot, cvs, title) {
}
function addData(raw, dataidx, unit) {
var feeidx = show.length;
for (i = 0; i < raw.length; i++) {
if (raw[i][dataidx+1][0] > 0) {
for (j = 0; j < show.length; j++) {
function get(array, index) {
if (index >= array.length)
@ -158,13 +155,12 @@ function addData(raw, dataidx, unit) {
else
return array[index];
}
var amount = get(raw[i][dataidx+1],show[j]) - (j == show.length-1 ? 0 : get(raw[i][dataidx+1],show[j+1]));
var amount = 0;
for (k = show[j]; k < (j == show.length ? ranges.length : show[j + 1]); k++) {
amount = amount + get(raw[i][dataidx+1],k);
}
data[dataidx][j].push([raw[i][0]*1000, amount/unit]);
}
}
if (raw[i][3] > 0) {
data[dataidx][feeidx].push([raw[i][0]*1000, raw[i][3]/1e8]);
}
}
return data[dataidx];
}
@ -196,7 +192,7 @@ function convertData(raw, dataidx, unit) {
var theData = storeData(raw, dataidx, unit);
for (j = 0; j < show.length; j++) {
var name = ranges[show[j]];
var legend =
var legend =
j == show.length-1 ? (name+"+ sat/B") :
name+"-"+ranges[show[j+1]];
var color = colors[j];
@ -306,7 +302,7 @@ function loadData(rawdata) {
}
}
var periods = ["2h", "8h", "24h", "2d", "4d", "1w", "2w", "30d", "3m", "all"];
var periods = ["2h", "8h", "24h", "2d", "4d", "1w", "2w", "30d", "3m", "6m", "1y", "all"];
function selectbutton(timespan) {
for (i = 0; i < periods.length; i++) {
if (periods[i] == timespan) {

View File

@ -70,3 +70,17 @@ div.button {
background-size: cover;
background-repeat: no-repeat;
}
.qrcontainer {
display: inline-block;
position: relative;
margin: 1ex 3em;
}
.qrcode {
display: inline-block;
}
.qrlogo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}