forked from nimiq/nimiq-demo
-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.html
793 lines (723 loc) · 45.4 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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>NIMIQ.WATCH Blockchain Explorer</title>
<meta name="description" content="A blockchain explorer for the Nimiq blockchain. Explore accounts, blocks and transactions.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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="/site.webmanifest">
<link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#ffc107">
<link rel="shortcut icon" href="favicon.ico">
<meta name="apple-mobile-web-app-title" content="NIMIQ.WATCH">
<meta name="application-name" content="NIMIQ.WATCH">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="theme-color" content="#fafafa">
<link rel="stylesheet" href="/vendor/source-sans-pro/source-sans-pro.css">
<link rel="stylesheet" href="/vendor/fira/fira.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/css-toggle-switch@latest/dist/toggle-switch.css" />
<link rel="stylesheet" type="text/css" href="./style.css">
<script type="text/javascript" src="./nimiq/nimiq.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/whatwg-fetch"></script>
<script>
'use strict';
var useTestnet = location.hostname !== 'nimiq.watch';
var apiUrl = 'https://v2.nimiqwatch.com/api/v1';
var publicUrl = 'https://v2.nimiqwatch.com';
if (useTestnet) {
apiUrl = 'https://v2.test.nimiqwatch.com/api/v1';
publicUrl = 'https://v2.test.nimiqwatch.com';
}
// Dummy object to prevent JS errors
var nimiqLoaded = false;
var latestBlock = undefined;
function _onNimiqLoaded() {
document.getElementById('search-submit').removeAttribute('disabled');
document.getElementById('search-submit').removeAttribute('title');
nimiqLoaded = true;
_buildListOfLatestBlocks();
if(!window.onhashchange) {
window.onhashchange = _onHashChange;
_onHashChange();
}
}
function _onConsensusEstablished() {
$status.textContent = 'connected';
$status.classList.add('consensus-established');
}
function _onConsensusLost() {
console.warn('Connection lost');
$status.textContent = 'connection lost';
$status.classList.remove('consensus-established', 'synchronizing');
}
function _onHeadChanged(block) {
block.timestamp = Math.floor(new Date(block.date).getTime() / 1000);
delete block.date;
block.miner_address = block.creator_address;
delete block.creator_address;
if(block.height > 1) $height.textContent = ' @ #' + block.height;
if(blocklistBuilt && (!latestBlock || latestBlock.height < block.height)) {
latestBlock = block;
_addBlockToListOfLatestBlocks(latestBlock);
}
}
Nimiq.loadOffline().then(function() {
_onNimiqLoaded();
});
// $status.textContent = 'synchronizing';
// $status.classList.add('synchronizing');
var ws;
function connectWS() {
// Set up websocket connection
ws = new WebSocket(apiUrl + '/live');
ws.binaryType = 'arraybuffer';
ws.onopen = function() {
_onConsensusEstablished();
};
ws.onmessage = function(e) {
// console.log(e);
let msg;
if (typeof e.data === 'string') msg = JSON.parse(e.data);
else msg = JSON.parse(new TextDecoder().decode(e.data));
if (msg.type !== 'block') return;
_onHeadChanged(msg.block);
};
ws.onerror = function(e) {
console.error(e);
};
ws.onclose = function() {
_onConsensusLost();
setTimeout(connectWS, 2000);
};
}
connectWS();
</script>
<script src="/vendor/tmpl.min.js"></script>
</head>
<body>
<header>
<div>
<h1>
<a href="#" onclick="_linkClicked(this, true);">
<span class="nimiq-logo">
<img width="40" src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="45.922386mm" height="46.027046mm" viewBox="0 0 45.922386 46.027046"><g fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157821-8.850065c.33187-.568846.33187-1.490917 0-2.060247z" fill="%23ffd559"/><path d="M40.515655 13.128918c-.33186-.568847-1.1352-1.029874-1.79297-1.029874h-10.33354c-.65876 0-1.4606.461027-1.79296 1.029874l-5.157819 8.850083c-.331867.568829-.331867 1.491401 0 2.060247l5.157819 8.850065c.33187.568847 1.13521 1.030375 1.79296 1.030375h10.33354c.65876 0 1.46061-.461027 1.79297-1.030375l5.15783-8.850065c.33187-.568846.33187-1.490918 0-2.060247z" fill="%23ffc107"/><path d="M19.501729 25.236275c-.331867-.568846-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461028-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568846 1.135202 1.030374 1.792971 1.030374h10.333528c.65877 0 1.460617-.461027 1.79297-1.030374l5.157826-8.850065c.33187-.568847.33187-1.490918 0-2.060248z" fill="%23ffebad"/></g></svg>'>
</span>
<span id="page-name">NIMIQ.WATCH</span>
</a>
</h1>
<button id="mobile-menu-button">Menu</button>
<nav id="nav">
<div class="submenu-container">
<a href="#search" onclick="_linkClicked(this, true);" id="search">Search</a>
<div class="submenu">
<a href="#labels" onclick="_linkClicked(this);">Address Labels</a>
</div>
</div>
<a href="#labels" onclick="_linkClicked(this, true);" class="show-mobile-block">Address Labels</a>
<div class="submenu-container">
<a href="#charts" onclick="_linkClicked(this, true);" id="charts">Charts</a>
<div class="submenu">
<!--<a href="#chart-wealth-distribution" onclick="_linkClicked(this);">Wealth Distribution</a>-->
<a href="#chart-stake-distribution" onclick="_linkClicked(this);">Stake Distribution</a>
<a href="#chart-transactions-per-block" onclick="_linkClicked(this);">Transactions</a>
</div>
</div>
<!--<div class="submenu-container">
<a href="https://nimiq.watch/news" target="_blank">News</a>
<div class="submenu">
<a href="https://nimiq.watch/news/2017-11-24-week-in-review-1.html" target="_blank">24 Nov 2017 | Week In Review #1</a>
<a href="https://nimiq.watch/news/2017-12-01-week-in-review-2.html" target="_blank">01 Dec 2017 | Week In Review #2</a>
<a href="https://nimiq.watch/news/2017-12-08-week-in-review-3.html" target="_blank">08 Dec 2017 | Week In Review #3</a>
<a href="https://nimiq.watch/news/2017-12-17-week-in-review-4.html" target="_blank">17 Dec 2017 | Week In Review #4</a>
<a href="https://nimiq.watch/news/2017-12-23-week-in-review-5.html" target="_blank">23 Dec 2017 | Week In Review #5</a>
</div>
</div>-->
<a href="#about" onclick="_linkClicked(this, true);" id="about">What is this?</a>
</nav>
<span id="monitor">
<strong>Status:</strong>
<span id="status" class="not-connected">connecting</span><span id="height"></span></span>
</span>
</div>
<script>
var button = document.getElementById('mobile-menu-button');
var nav = document.getElementById('nav');
button.addEventListener('click', function(e) {
e.stopPropagation();
nav.classList.toggle('show');
});
document.addEventListener('click', function() {
nav.classList.remove('show');
});
</script>
</header>
<div id="searchbox">
<h1>BLOCKCHAIN EXPLORER</h1>
<form action="#" method="GET" id="search-form">
<input type="text" id="search-input" placeholder="Search accounts, blocks and transactions" onfocus="this.select();" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
<input type="submit" id="search-submit" value="go" disabled="" title="Initializing, please wait">
<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.7346 17C9.31633 17 5.7346 13.4183 5.7346 9C5.7346 4.58172 9.31633 1 13.7346 1C18.1529 1 21.7346 4.58172 21.7346 9C21.7346 13.4183 18.1529 17 13.7346 17Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1 21.7346L7.56931 15.1653" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="detection">Format detected: <span id="hash-format"><em>none</em></span></span>
</form>
</div>
<div id="infobox">
</div>
<div id="blocklist-wrapper">
<h2>Latest blocks</h2>
<div id="blocklist">
<div class="blocklist-block">
<div class="blocklist-cell">
<div class="blocklist-loader">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.922382 46.027046" height="46.027046mm" width="45.922382mm"><g fill="#ffc107" fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157824-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".66666667"/><path d="M40.515659 13.128918c-.331867-.568847-1.135201-1.029874-1.792971-1.029874H28.389146c-.658756 0-1.460603.461027-1.792956 1.029874L21.438366 21.979c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568847 1.135201 1.030375 1.792956 1.030375h10.333542c.658756 0 1.460604-.461028 1.792971-1.030375l5.157825-8.850065c.331866-.568847.331866-1.490918 0-2.060248z"/><path d="M19.501729 25.236275c-.331867-.568847-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461027-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060247L5.58226 44.99667c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333528c.65877 0 1.460617-.461027 1.79297-1.030375l5.157825-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".33333333"/></g></svg>
</div>
<p class="blocklist-loader-text">Initializing, please wait.</p>
</div>
</div>
</div>
</div>
<footer>
This web application is built on top of the <a target="_blank" href="https://nimiq.com">Nimiq Blockchain</a>.
<a target="_blank" href="https://github.com/sisou/nimiq-watch">View Source Code on Github.</a>
</footer>
<script type="text/x-tmpl" id="template-block-info">
<h2>Block Info</h2>
<div class="blockinfo-header">
<div class="height">
<h3>Height</h3>
<span>#{%=o.height%}</span>
<div>
<a href="#{%=o.height + 1%}">▲</a>
<a href="#{%=o.height - 1%}">▼</a>
</div>
</div>
<div class="hash">
<h3>Hash</h3>
<hash>{% if(o.hash) { %}{%=o.hash%}{% } else { %}-{% } %}</hash>
</div>
</div>
<div class="blockinfo-body">
<div class="blockinfo-body-left">
<div class="blockinfo-body-row">
<label>Transactions </label>
<span>{%=o.transaction_count%}</span>
</div>
<div class="blockinfo-body-row">
<label>Transaction Value </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.value))%} NIM</span>
</div>
<div class="blockinfo-body-row">
{% if (o.reward) { %}
<label>Block Reward </label>
<span style="cursor: help;" title="Block reward: {%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.reward))%} NIM, fees: {%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.fees))%} NIM">{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.reward + o.fees))%} NIM</span>
{% } else { %}
<label>Transaction fees </label>
<span style="cursor: help;" title="Transaction fees">{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.fees))%} NIM</span>
{% } %}
</div>
</div>
<div class="blockinfo-body-right">
<div class="blockinfo-body-row">
<label>Timestamp </label>
<span>{% if (o.timestamp) { var date = new Date(o.timestamp * 1000); print(date.toLocaleString()); } else { %}-{% } %}</span>
</div>
{% if(o.difficulty) { %}
<div class="blockinfo-body-row">
<label>Difficulty </label>
<span>{%=(Math.round(o.difficulty * 100) / 100)%}</span>
</div>
{% } %}
<div class="blockinfo-body-row">
<label>Size </label>
<span>{% if(o.size) { %}{%=_formatSize(o.size)%}{% } else { %}-{% } %}</span>
</div>
</div>
<div class="blockinfo-miner">
{% if(o.miner_address) { %}
<div class="blockinfo-body-row">
<label>Producer </label>
<hash><a href="#{%=o.miner_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.miner_address)%}</a></hash>
</div>
{% } %}
<div class="blockinfo-body-row">
<label>Extra Data </label>
<span class="blockinfo-extra-data">{% if(o.extra_data) { %}{%=o.extra_data%}{% } else { %}-{% } %}</span>
</div>
<!--
<div class="blockinfo-body-row">
<label>PoW </label>
<hash>{%=o.pow_hash%}</hash>
</div>
<div class="blockinfo-body-row">
<label>Previous Block </label>
<hash>{%=o.prev_hash%}</hash>
</div>
-->
</div>
</div>
<div class="blockinfo-transactions">
{% if(o.transaction_count) { %}
<div class="blockinfo-transaction-header-row">
<h3>Sender</h3>
<h3>Receiver</h3>
<h3>Value</h3>
</div>
{% for(var i = 0; i < o.transactions.length; i++) { %}
<div class="blockinfo-transaction-row">
<hash class="ellipsis"><a href="#{%=o.transactions[i].sender_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.transactions[i].sender_address)%}</a></hash>
<hash class="ellipsis"><a href="#{%=o.transactions[i].receiver_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.transactions[i].receiver_address)%}</a></hash>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.transactions[i].value))%} NIM</span>
<span><a href="#{%=o.transactions[i].hash%}" onclick="_linkClicked(this);" class="info-icon"></a></span>
</div>
{% } %}
{% } else { %}
<div class="no-more">No transactions</div>
{% } %}
</div>
</script>
<script type="text/x-tmpl" id="template-tx-info">
<div class="txinfo-wrapper">
<h2>Transaction Info</h2>
<div class="blockinfo-header">
<div class="hash">
<h3>Hash</h3>
<hash>{%=o.hash%}</hash>
</div>
</div>
<div class="blockinfo-body">
<div class="blockinfo-body-row">
<label>Sender </label>
<hash>
<a href="#{%=o.sender_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.sender_address)%}</a>
</hash>
</div>
<div class="blockinfo-body-row">
<label>Recipient </label>
<hash>
<a href="#{%=o.receiver_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.receiver_address)%}</a>
</hash>
</div>
<div class="blockinfo-body-row">
<label>Date </label>
<span>
{% if(o.timestamp && o.block_height) { %}
<span class="event-datetime">{% var date = new Date(o.timestamp * 1000); print(date.toLocaleString()); %}</span>
<span class="event-height">(<a href="#{%=o.block_height%}" onclick="_linkClicked(this);">#{%=o.block_height%}</a>)</span>
{% } else { %}
<span class="event-pending">pending</span>
{% } %}
</span>
</div>
<div class="blockinfo-body-row">
<label>Value </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.value))%} NIM</span>
</div>
<div class="blockinfo-body-row">
<label>Fee </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.fee))%} NIM</span>
</div>
{% if(o.data.length > 0) { %}
<div class="blockinfo-body-row">
<label>Message </label>
<span class="blockinfo-extra-data">{%=_formatTxData(o.data)%}</span>
</div>
{% } %}
<div class="blockinfo-body-row">
<label>Validity Start Height </label>
<span>{%=o.validity_start_height%}</span>
</div>
<div class="blockinfo-body-row">
<label>Confirmations </label>
<span>{%=o.confirmations%}</span>
</div>
</div>
</div>
</script>
<script type="text/x-tmpl" id="template-account-info">
<div class="accountinfo-wrapper">
<h2>Account Info</h2>
<div class="blockinfo-header">
<img class="iqon" src="{%=_addressIcon(o.address)%}">
<div class="hash">
<h3>Address</h3>
<hash>{%=o.address%}</hash>
</div>
</div>
<div class="blockinfo-body">
<div class="account-basics">
{% if(_labelAddress(o.address) !== o.address) { %}
<div class="blockinfo-body-row">
<label>Label </label>
<span>{%=_labelAddress(o.address)%}</span>
</div>
{% } %}
<div class="blockinfo-body-row">
<label>Balance </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.balance))%} NIM</span>
</div>
{% if (o.type !== 3) { %}
<div class="blockinfo-body-row">
<label>Type </label>
<span>{%=account_types[o.type]%}</span>
</div>
{% } else { %}
<div class="blockinfo-body-row">
<a href="#chart-stake-distribution" onclick="_linkClicked(this);">Stake Distribution</a>
</div>
{% } %}
{% if(_labelAddress(o.address) === o.address && o.balance >= 10e5) { %}
<div class="blockinfo-body-row">
<label>Label </label>
<span>
<form action="https://submit-form.com/UpWwc3rnNvBcfBGT_813W" method="POST">
<input type="text" name="label" placeholder="Suggest a label" required>
<input type="hidden" name="network" value="{%=location.origin%}">
<input type="hidden" name="address" value="{%=o.address%}">
<input name="username" type="text" style="display:none">
<input type="submit" value="Submit">
</form>
</span>
</div>
{% } %}
</div>
{% if(account_types[o.type] === 'Vesting Contract') { %}
<div class="account-data">
<div class="blockinfo-body-row">
<label>Owner </label>
<hash>
<a href="#{%=o.data.owner.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.data.owner)%}</a>
</hash>
</div>
<div class="blockinfo-body-row">
<label>Available Now </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.availableBalance))%} NIM</span>
</div>
<h3>Vesting Steps</h3>
{% for(var i = 0; i < o.steps.length; i++) { %}
<div class="blockinfo-body-row">
<label>
<span class="event-height">
{% if(o.steps[i].isFuture) { %}
#{%=o.steps[i].height%}
{% } else { %}
<a href="#{%=o.steps[i].height%}" onclick="_linkClicked(this);">#{%=o.steps[i].height%}</a>
{% } %}
</span>
<span class="event-datetime">({% var date = new Date(o.steps[i].timestamp * 1000); print(date.toLocaleString()); %}*)</span>
</label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.steps[i].amount))%} NIM</span>
</div>
{% } %}
<div class="blockinfo-body-row">
<small>* Estimated from the current time.</small>
</div>
</div>
{% } %}
{% if(account_types[o.type] === 'Hashed Timelock Contract') { %}
<div class="account-data">
<div class="blockinfo-body-row">
<label>Sender </label>
<hash>
<a href="#{%=o.data.sender.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.data.sender)%}</a>
</hash>
</div>
<div class="blockinfo-body-row">
<label>Recipient </label>
<hash>
<a href="#{%=o.data.recipient.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.data.recipient)%}</a>
</hash>
</div>
<div class="blockinfo-body-row">
<label>Total Amount </label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.data.total_amount))%} NIM</span>
</div>
<div class="blockinfo-body-row">
<label>Timeout </label>
<span>{%=o.data.timeout%}</span>
</div>
<div class="blockinfo-body-row">
<label>Hash Count </label>
<span>{%=o.data.hash_count%}</span>
</div>
<div class="blockinfo-body-row">
<label>Hash Root </label>
<hash class="hash-root">{%=o.data.hash_root%}</hash>
</div>
</div>
{% } %}
{% if(o.vestingContracts.length > 0) { %}
<div class="account-vestings">
<h3>Vesting Contracts</h3>
{% for(var i = 0; i < o.vestingContracts.length; i++) { %}
<div class="blockinfo-body-row">
<hash>
<a href="#{%=o.vestingContracts[i].address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.vestingContracts[i].address)%}</a>
</hash>
</div>
{% } %}
</div>
{% } %}
</div>
<h3>History</h3>
<div class="switch-toggle switch-candy">
<input id="latest-transactions-radio" name="account-history-radio" type="radio" checked="checked" onclick="switchAccountHistory('transactions')">
<label for="latest-transactions-radio" onclick="">Transactions</label>
<input id="latest-blocks-radio" name="account-history-radio" type="radio" onclick="switchAccountHistory('blocks')">
<label for="latest-blocks-radio" onclick="">Blocks</label>
<a></a>
</div>
<div class="accountinfo-transactions">
{% for(var i = o.transactions.length - 1; i >= 0; i--) { %}
{% o.transactions[i].isReceiver = o.transactions[i].receiver_address === o.address; %}
{%#o.accountTransaction(o.transactions[i])%}
{% } %}
<div class="blocklist-loader transaction-loader" data-page="1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.922382 46.027046" height="46.027046mm" width="45.922382mm"><g fill="#ffc107" fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157824-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".66666667"/><path d="M40.515659 13.128918c-.331867-.568847-1.135201-1.029874-1.792971-1.029874H28.389146c-.658756 0-1.460603.461027-1.792956 1.029874L21.438366 21.979c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568847 1.135201 1.030375 1.792956 1.030375h10.333542c.658756 0 1.460604-.461028 1.792971-1.030375l5.157825-8.850065c.331866-.568847.331866-1.490918 0-2.060248z"/><path d="M19.501729 25.236275c-.331867-.568847-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461027-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060247L5.58226 44.99667c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333528c.65877 0 1.460617-.461027 1.79297-1.030375l5.157825-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".33333333"/></g></svg>
</div>
<button class="event-loadmore hidden" onclick="loadMoreTransactions(this, '{%=o.address%}')" data-page="2">Load more</button>
</div>
<div class="accountinfo-blocks hidden">
{% for(var i = o.blocks.length - 1; i >= 0; i--) { %}
{%#o.accountBlock(o.blocks[i])%}
{% } %}
<div class="blocklist-loader block-loader" data-page="1" data-address="{%=o.address%}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.922382 46.027046" height="46.027046mm" width="45.922382mm"><g fill="#ffc107" fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157824-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".66666667"/><path d="M40.515659 13.128918c-.331867-.568847-1.135201-1.029874-1.792971-1.029874H28.389146c-.658756 0-1.460603.461027-1.792956 1.029874L21.438366 21.979c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568847 1.135201 1.030375 1.792956 1.030375h10.333542c.658756 0 1.460604-.461028 1.792971-1.030375l5.157825-8.850065c.331866-.568847.331866-1.490918 0-2.060248z"/><path d="M19.501729 25.236275c-.331867-.568847-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461027-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060247L5.58226 44.99667c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333528c.65877 0 1.460617-.461027 1.79297-1.030375l5.157825-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".33333333"/></g></svg>
</div>
<button class="event-loadmore hidden" onclick="loadMoreBlocks(this, '{%=o.address%}')" data-page="2">Load more</button>
</div>
</div>
</script>
<script type="text/x-tmpl" id="template-account-transaction">
{% o.otherAddress = o.isReceiver && o.sender_address || o.receiver_address; %}
<div class="event-item">
<span class="event-amount {% if(o.isReceiver) print('green'); else print('red'); %}">
{% if(o.isReceiver) print('+'); else print('-'); %}{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.value))%} NIM​
</span>
<span class="event-name">{% if(o.isReceiver) print('Received'); else print('Sent'); %} transaction</span>
<span><a href="#{%=o.hash%}" onclick="_linkClicked(this);" class="info-icon"></a></span><br>
{% if(o.timestamp && o.block_height) { %}
<span class="event-datetime">{% var date = new Date(o.timestamp * 1000); print(date.toLocaleString()); %}</span>
<span class="event-height">(<a href="#{%=o.block_height%}" onclick="_linkClicked(this);">#{%=o.block_height%}</a>)</span>
{% } else { %}
<span class="event-pending">pending</span>
{% } %}<br>
{% if(o.isReceiver) print('←', true); else print('→', true); %}
<hash class="event-address"><a href="#{%=o.otherAddress.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.otherAddress)%}</a></hash>
</div>
</script>
<script type="text/x-tmpl" id="template-account-block">
<div class="event-item">
{% if (o.reward) { %}
<span class="event-amount green" title="Block reward: {%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.reward))%} NIM, fees: {%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.fees))%} NIM">
+{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.reward + o.fees))%} NIM​
</span>
{% } else { %}
<span class="event-amount green" title="Transaction fees">
+{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.fees))%} NIM​
</span>
{% } %}
<span class="event-name">Mined block</span><br>
<span class="event-datetime">{% if (o.timestamp) { var date = new Date(o.timestamp * 1000); print(date.toLocaleString()); } else { %}-{% } %}</span>
<span class="event-height">(<a href="#{%=o.height%}" onclick="_linkClicked(this);">#{%=o.height%}</a>)</span>
</div>
</script>
<script type="text/x-tmpl" id="template-blocklist-block">
<a href="#{%=o.height%}" class="blocklist-cell" onclick="_linkClicked(this);">
#{%=o.height%}
</a>
<div class="blocklist-cell update-time-ago" data-timestamp="{%=o.timestamp%}">
{% if (o.timestamp) { print(_formatTimeAgo(o.timestamp)); } else { %}-{% } %}
</div>
<div class="blocklist-cell">
<span class="hide-mobile">{%=o.transaction_count%} transaction{% if(o.transaction_count !== 1) print('s'); %}</span>
<span class="show-mobile">{%=o.transaction_count%} tx{% if(o.transaction_count !== 1) print('s'); %}</span>
</div>
<div class="blocklist-cell miner-address ellipsis">
{% if(o.miner_address) { %}
<span class="hide-mobile">by </span><hash><a href="#{%=o.miner_address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">{%=_labelAddress(o.miner_address)%}</a></hash>
{% } %}
</div>
<div class="blocklist-cell hide-xs">
{% if(o.size) { %}
{%=_formatSize(o.size)%}
{% } else { %}
-
{% } %}
</div>
</script>
<script type="text/x-tmpl" id="template-validator-registration">
<summary>Validator Registration</summary>
<div class="blockinfo-body-row">
<label>Stake {%=o.inactivityFlag ? '(inactive)' : o.retired ? '(retired)' : o.jailedFrom ? '(jailed)' : ''%}</label>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.balance))%} NIM</span>
</div>
<div class="blockinfo-body-row">
<label>Signing Public Key</label>
<hash class="blockinfo-extra-data">{%=o.signingKey%}</hash>
</div>
<div class="blockinfo-body-row">
<label>Voting Public Key</label>
<hash class="blockinfo-extra-data">{%=o.votingKey%}</hash>
</div>
</script>
<!-- <script type="text/x-tmpl" id="template-validator-stakers">
<summary>Stake: {%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.stakers.reduce((sum, staker) => sum + staker.stake, 0) + o.deposit))%} NIM</summary>
<div class="staker-row">
<hash>Deposit</hash>
<span>{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.deposit))%} NIM</span>
</div>
{% if(o.stakers.length) { %}
{% for(var i = 0; i < o.stakers.length; i++) { %}
<div class="staker-row">
<hash>
<a href="#{%=o.stakers[i].address.replace(/ /g, '+')%}" onclick="_linkClicked(this);">
{%=_labelAddress(o.stakers[i].address)%}
</a>
</hash>
<span>
{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.stakers[i].stake))%} NIM
</span>
</div>
{% } %}
{% } else { %}
<div class="no-more">No stakers delegated</div>
{% } %}
</script> -->
<script type="text/x-tmpl" id="template-staker-delegation">
<summary>Delegation</summary>
<div class="validator-row">
<img class="iqon" src="{%=_addressIcon(o.delegation)%}">
<div class="validator-data">
<hash>
<a href="#{%=o.delegation.replace(/ /g, '+')%}" onclick="_linkClicked(this);">
{%=_labelAddress(o.delegation)%}
</a>
</hash>
<span>
{%=_formatBalance(Nimiq.Policy.satoshisToCoins(o.balance))%} NIM
</span>
</div>
</div>
</script>
<script type="text/x-tmpl" id="template-about">
<div class="about-wrapper">
<h2>What is this?</h2>
<p>
This website is a blockchain explorer for the <a href="https://nimiq.com" target="_blank">Nimiq blockchain project</a>.
</p>
<p>
The source code for this website is open source and available at
<a href="https://github.com/sisou/nimiq-watch" target="_blank">https://github.com/sisou/nimiq-watch</a>.
</p>
<p>
To learn more about the Nimiq blockchain, visit
<a href="https://nimiq.com" target="_blank">nimiq.com</a>,
check out
<a href="https://twitter.com/nimiq" target="_blank">@nimiq on Twitter</a> and join the
<a href="https://t.me/joinchat/AAAAAEJW-ozFwo7Er9jpHw" target="_blank">Telegram</a> and
<a href="https://discord.gg/cMHemg8" target="_blank">Discord</a> channels.
</p>
</div>
</script>
<script type="text/x-tmpl" id="template-charts">
<div class="charts-wrapper">
<h2>Charts</h2>
<p>
<!--<a href="#chart-wealth-distribution">Wealth Distribution</a>-->
<a href="#chart-stake-distribution">Stake Distribution</a>
<a href="#chart-transactions-per-block">Transactions</a>
</p>
</div>
</script>
<script type="text/x-tmpl" id="template-labels">
<div class="labels-wrapper">
<h2>Address Labels</h2>
<ul>
{% for(var address in o) { %}
{% if(
(useTestnet && o[address].toLowerCase().includes('testnet'))
|| (!useTestnet && !o[address].toLowerCase().includes('testnet'))
) %}
<li>
<img class="iqon" src="{%=_addressIcon(address)%}" loading="lazy">
<a href="#{%=address%}">{%=o[address]%}</a>
</li>
{% } %}
</ul>
</div>
</script>
<script src="./address-book.js"></script>
<script src="./script.js"></script>
<script>
if(useTestnet) {
document.head.querySelector('title').textContent = 'TESTNET.WATCH Blockchain Explorer';
document.querySelector('#page-name').textContent = 'TESTNET.WATCH';
}
</script>
<script type="text/x-tmpl" id="template-stake-distribution-chart">
<h2>Stake Distribution</h2>
<small>Stake per validator</small>
<div class="stake-distribution-chart-wrapper">
<canvas class="chart"></canvas>
<div class="blocklist-loader over-canvas">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.922382 46.027046" height="46.027046mm" width="45.922382mm"><g fill="#ffc107" fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157824-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".66666667"/><path d="M40.515659 13.128918c-.331867-.568847-1.135201-1.029874-1.792971-1.029874H28.389146c-.658756 0-1.460603.461027-1.792956 1.029874L21.438366 21.979c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568847 1.135201 1.030375 1.792956 1.030375h10.333542c.658756 0 1.460604-.461028 1.792971-1.030375l5.157825-8.850065c.331866-.568847.331866-1.490918 0-2.060248z"/><path d="M19.501729 25.236275c-.331867-.568847-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461027-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060247L5.58226 44.99667c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333528c.65877 0 1.460617-.461027 1.79297-1.030375l5.157825-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".33333333"/></g></svg>
</div>
<div class="chart-valid-info"></div>
<table class="validators-table"></table>
</div>
</script>
<script src="/script-chart-stake-distribution.js"></script>
<!--
<script type="text/x-tmpl" id="template-wealth-distribution-chart">
<div class="axis-type-switch">
<label class="switch-light switch-candy" onclick="">
<input type="checkbox" onchange="_wealthDistributionSwitchScale(this);" disabled="">
<span>
<span>Linear</span>
<span>Logarithmic</span>
<a></a>
</span>
</label>
</div>
<h2>Wealth Distribution</h2>
<small>Among non-zero accounts</small>
<canvas class="chart"></canvas>
<div class="blocklist-loader over-canvas">
<svg fill="#F6AE2D" xmlns="http://www.w3.org/2000/svg" width="34" height="30"><path d="M25.2 1H8.8l-8 14 8 14h16.4l8-14-8-14zm-6.7 22V26H16v-2.6c-1.5 0-3.3-.8-4.5-2l1.7-2.4c1.3 1 2.4 1.5 3.6 1.5 1.4 0 2-.6 2-1.7 0-2.6-6.7-2.6-6.7-7 0-2.6 1.6-4.3 4-4.8V4.2h2.5v2.6c1.6.2 2.8 1 3.8 2l-2 2.2c-.8-1-1.6-1.3-2.7-1.3-1.2 0-2 .5-2 1.6.2 2.4 7 2.2 7 7 0 2.4-1.5 4.3-4 4.8z"></path></svg>
</div>
<div class="chart-valid-info"></div>
</script>
<script src="/script-chart-wealth-distribution.js"></script>
-->
<script type="text/x-tmpl" id="template-transactions-per-block-chart">
<div class="switch-toggle switch-candy global-hashrate-range-switch">
<input id="global-hashrate-range-day" name="global-hashrate-range" type="radio" onclick="switchTransactionsPerBlockRange('day')">
<label for="global-hashrate-range-day" onclick="">D<span class="hide-xs">ay</span></label>
<input id="global-hashrate-range-week" name="global-hashrate-range" type="radio" onclick="switchTransactionsPerBlockRange('week')">
<label for="global-hashrate-range-week" onclick="">W<span class="hide-xs">eek</span></label>
<input id="global-hashrate-range-month" name="global-hashrate-range" type="radio" checked="checked" onclick="switchTransactionsPerBlockRange('month')">
<label for="global-hashrate-range-month" onclick="">M<span class="hide-xs">onth</span></label>
<input id="global-hashrate-range-year" name="global-hashrate-range" type="radio" onclick="switchTransactionsPerBlockRange('year')">
<label for="global-hashrate-range-year" onclick="">Y<span class="hide-xs">ear</span></label>
<!--
<input id="global-hashrate-range-all" name="global-hashrate-range" type="radio" onclick="switchTransactionsPerBlockRange('all')">
<label for="global-hashrate-range-all" onclick="">all</label>
-->
<a></a>
</div>
<h2>Transactions</h2>
<!-- <small>Description</small> -->
<canvas class="chart"></canvas>
<div class="blocklist-loader over-canvas">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.922382 46.027046" height="46.027046mm" width="45.922382mm"><g fill="#ffc107" fill-rule="evenodd"><path d="M19.326194 1.029874C18.994341.461027 18.191007 0 17.533238 0H7.199695c-.658756 0-1.460603.461027-1.792971 1.029874L.2489 9.879957c-.331867.568829-.331867 1.491401 0 2.060247l5.157824 8.850065c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333543c.658756 0 1.460603-.461027 1.792956-1.030375l5.157824-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".66666667"/><path d="M40.515659 13.128918c-.331867-.568847-1.135201-1.029874-1.792971-1.029874H28.389146c-.658756 0-1.460603.461027-1.792956 1.029874L21.438366 21.979c-.331867.568829-.331867 1.491401 0 2.060248l5.157824 8.850065c.331867.568847 1.135201 1.030375 1.792956 1.030375h10.333542c.658756 0 1.460604-.461028 1.792971-1.030375l5.157825-8.850065c.331866-.568847.331866-1.490918 0-2.060248z"/><path d="M19.501729 25.236275c-.331867-.568847-1.135201-1.029874-1.79297-1.029874H7.375231c-.658756 0-1.460603.461027-1.792971 1.029874L.424436 34.086358c-.331867.568829-.331867 1.491401 0 2.060247L5.58226 44.99667c.331867.568847 1.135202 1.030375 1.792971 1.030375h10.333528c.65877 0 1.460617-.461027 1.79297-1.030375l5.157825-8.850065c.331867-.568846.331867-1.490918 0-2.060247z" fill-opacity=".33333333"/></g></svg>
</div>
<div class="chart-valid-info"></div>
</script>
<script src="/script-chart-transactions-per-block.js"></script>
</body>
</html>