block.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>DarkFi Blocks - Block Explorer</title>
  7. <link rel="stylesheet" href="/static/layout.css">
  8. </head>
  9. <body>
  10. <header class="header">
  11. <div class="container flex justify-between items-center">
  12. <div class="logo">DarkFi {{ network }} Blocks</div>
  13. <nav class="nav">
  14. <a href="/" class="active">Explorer</a>
  15. <a href="#">Stats</a>
  16. <a href="https://dark.fi/book/">Docs</a>
  17. <a href="https://codeberg.org/darkrenaissance/darkfi/">Code</a>
  18. </nav>
  19. </div>
  20. </header>
  21. <main class="container section">
  22. <form action="/search" method="GET" class="input-group mb-lg" style="max-width: 600px;">
  23. <input type="search" name="q" class="input" placeholder="Search by block height, hash, or transaction...">
  24. <button type="submit" class="btn">Search</button>
  25. </form>
  26. <div class="stats-grid mb-lg">
  27. <div class="stat-card">
  28. <div class="label">Difficulty</div>
  29. <div class="value">{{ current_difficulty }}</div>
  30. </div>
  31. <div class="stat-card">
  32. <div class="label">Height</div>
  33. <div class="value">{{ current_height }}</div>
  34. </div>
  35. <div class="stat-card">
  36. <div class="label">Hashrate</div>
  37. <div class="value">{{ hashrate|default('n/a') }}</div>
  38. </div>
  39. <div class="stat-card">
  40. <div class="label">Emission</div>
  41. <div class="value">n/a</div>
  42. </div>
  43. </div>
  44. <div class="block-title mb-lg">
  45. <h1>
  46. Block
  47. {% if block.height != 0 %}
  48. <a href="/block/{{ block.height - 1 }}" class="block-nav">&lt</a>
  49. {% else %}
  50. <a href="/block/0" class="block-nav">&lt</a>
  51. {% endif %}
  52. {{ block.height }}
  53. <a href="/block/{{ block.height + 1 }}" class="block-nav">&gt;</a>
  54. </h1>
  55. <span class="block-hash">{{ block.hash }}</span>
  56. </div>
  57. <div class="table-section mb-lg">
  58. <div class="table-header">
  59. <h3>Block Info</h3>
  60. </div>
  61. <div class="table-wrapper">
  62. <table class="info-table">
  63. <tbody>
  64. <tr>
  65. <td class="info-label">Version</td>
  66. <td>{{ block.version }}</td>
  67. </tr>
  68. <tr>
  69. <td class="info-label">Previous Hash</td>
  70. {% if block.height == 0 %}
  71. <td><span class="hash text-muted">{{ block.previous_hash }}</span> <span class="badge">Genesis</span></td>
  72. {% else %}
  73. <td><a href="/block/{{ block.height - 1 }}" class="hash">{{ block.previous_hash }}</a></td>
  74. {% endif %}
  75. </tr>
  76. <tr>
  77. <td class="info-label">Height</td>
  78. <td>{{ block.height }}</td>
  79. </tr>
  80. <tr>
  81. <td class="info-label">Nonce</td>
  82. <td>{{ block.nonce }}</td>
  83. </tr>
  84. <tr>
  85. <td class="info-label">Timestamp</td>
  86. <td>{{ block.timestamp }}</td>
  87. </tr>
  88. <tr>
  89. <td class="info-label">Transactions Root</td>
  90. <td class="hash">{{ block.transactions_root }}</td>
  91. </tr>
  92. <tr>
  93. <td class="info-label">State Root</td>
  94. <td class="hash">{{ block.state_root }}</td>
  95. </tr>
  96. <tr>
  97. <td class="info-label">Block Size (bytes)</td>
  98. <td>{{ block.size }}</td>
  99. </tr>
  100. <tr>
  101. <td class="info-label">Block Difficulty</td>
  102. <td>{{ block.difficulty }}</td>
  103. </tr>
  104. <tr>
  105. <td class="info-label">Cumulative Difficulty</td>
  106. <td>{{ block.cumulative }}</td>
  107. </tr>
  108. <tr>
  109. <td class="info-label">Transactions</td>
  110. <td>{{ block.n_txs }}</td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. </div>
  116. {% if block.powtype == "Monero" %}
  117. <div class="table-section mb-lg pow-monero">
  118. <div class="table-header">
  119. <h3>PoW Data</h3>
  120. <span class="badge badge-monero">Merge Mined · Monero</span>
  121. </div>
  122. <div class="table-wrapper">
  123. <table class="info-table">
  124. <tbody>
  125. <tr>
  126. <td class="info-label">Monero Block Hash</td>
  127. <td><a href="https://localmonero.co/blocks/block/{{ monero_hash }}" target="_blank" class="hash hash-monero">{{ monero_hash }}</a></td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. </div>
  132. </div>
  133. {% else %}
  134. <div class="table-section mb-lg pow-native">
  135. <div class="table-header">
  136. <h3>PoW Data</h3>
  137. <span class="badge">Native · DarkFi</span>
  138. </div>
  139. <div class="pow-native-info">
  140. <span class="text-muted">Native DarkFi proof-of-work</span>
  141. </div>
  142. </div>
  143. {% endif %}
  144. <div class="table-section mb-lg">
  145. <div class="table-header">
  146. <h3>Coinbase Transaction</h3>
  147. </div>
  148. <div class="table-wrapper">
  149. <table>
  150. <thead>
  151. <tr>
  152. <th>Hash</th>
  153. <th>Amount</th>
  154. <th>Bytes</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. <tr>
  159. <td><a href="/tx/{{ block.coinbase.hash }}" class="hash">{{ block.coinbase.hash }}</a></td>
  160. <td>{{ block.coinbase.reward }}</td>
  161. <td>{{ block.coinbase.size }}</td>
  162. </tr>
  163. </tbody>
  164. </table>
  165. </div>
  166. </div>
  167. <div class="table-section">
  168. <div class="table-header">
  169. <h3>Transactions ({{ block.n_txs }})</h3>
  170. </div>
  171. <div class="table-scroll">
  172. <table>
  173. <thead>
  174. <tr>
  175. <th>Hash</th>
  176. <th>Calls</th>
  177. <th>Fee</th>
  178. <th>Bytes</th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. {% for tx in block.txs %}
  183. <tr>
  184. <td><a href="/tx/{{ tx.hash }}" class="hash">{{ tx.hash }}</a></td>
  185. <td>{{ tx.n_calls }}</td>
  186. <td>{{ tx.fee }}</td>
  187. <td>{{ tx.size }}</td>
  188. </tr>
  189. {% endfor %}
  190. </tbody>
  191. </table>
  192. </div>
  193. </div>
  194. </main>
  195. <footer class="footer">
  196. <div class="container">
  197. <a href="https://dark.fi">Let there be Dark</a> · Code licensed under AGPL-3
  198. </div>
  199. </footer>
  200. </body>
  201. </html>