You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
8.7KB

  1. ul(class='nav nav-tabs mb-3')
  2. li(class="nav-item")
  3. a(data-toggle="tab", href="#tab-summary", class="nav-link active", role="tab") Summary
  4. li(class="nav-item")
  5. a(data-toggle="tab", href="#tab-raw", class="nav-link", role="tab") Raw
  6. - var txCount = result.getblock.tx.length;
  7. div(class="tab-content")
  8. div(id="tab-summary", class="tab-pane active", role="tabpanel")
  9. table(class="table")
  10. tr
  11. th(class="table-active properties-header") Block Hash
  12. td(class="monospace")
  13. a(href=("/block/" + result.getblock.hash)) #{result.getblock.hash}
  14. tr
  15. th(class="table-active properties-header") Previous Block Hash
  16. td(class="monospace")
  17. if (result.getblock.previousblockhash)
  18. a(href=("/block/" + result.getblock.previousblockhash)) #{result.getblock.previousblockhash}
  19. tr
  20. th(class="table-active properties-header") Next Block Hash
  21. td(class="monospace")
  22. if (result.getblock.nextblockhash)
  23. a(href=("/block/" + result.getblock.nextblockhash)) #{result.getblock.nextblockhash}
  24. else
  25. span None
  26. span(class="text-muted") (latest block)
  27. tr
  28. th(class="table-active properties-header") Block Height
  29. td(class="monospace")
  30. a(href=("/block-height/" + result.getblock.height)) #{result.getblock.height}
  31. tr
  32. th(class="table-active properties-header") Timestamp
  33. td(class="monospace") #{moment.utc(new Date(result.getblock.time * 1000)).format("Y-MM-DD HH:mm:ss")} (utc)
  34. tr
  35. th(class="table-active properties-header") Transaction Count
  36. td(class="monospace") #{result.getblock.tx.length.toLocaleString()}
  37. tr
  38. th(class="table-active properties-header") Size
  39. td(class="monospace")
  40. span #{result.getblock.size.toLocaleString()} bytes
  41. if (result.getblock.weight)
  42. br
  43. span(class="text-muted") (weight: #{result.getblock.weight.toLocaleString()})
  44. tr
  45. th(class="table-active properties-header") Confirmations
  46. td(class="monospace")
  47. if (result.getblock.confirmations < 6)
  48. strong(class="text-warning") #{result.getblock.confirmations}
  49. else
  50. strong(class="text-success") #{result.getblock.confirmations.toLocaleString()}
  51. tr
  52. - var scales = [ {val:1000000000000000, name:"quadrillion"}, {val:1000000000000, name:"trillion"}, {val:1000000000, name:"billion"}, {val:1000000, name:"million"} ];
  53. - var scaleDone = false;
  54. th(class="table-active properties-header") Difficulty
  55. td(class="monospace")
  56. span #{result.getblock.difficulty.toLocaleString()}
  57. each item in scales
  58. if (!scaleDone)
  59. - var fraction = Math.floor(result.getblock.difficulty / item.val);
  60. if (fraction >= 1)
  61. - scaleDone = true;
  62. span(class="text-muted") (#{fraction} #{item.name})
  63. tr
  64. th(class="table-active text-right") Version
  65. td(class="monospace") 0x#{result.getblock.versionHex}
  66. span(class="text-muted") (decimal: #{result.getblock.version})
  67. tr
  68. th(class="table-active text-right") Nonce
  69. td(class="monospace") #{result.getblock.nonce}
  70. tr
  71. th(class="table-active text-right") Bits
  72. td(class="monospace") #{result.getblock.bits}
  73. tr
  74. th(class="table-active text-right") Merkle Root
  75. td(class="monospace") #{result.getblock.merkleroot}
  76. tr
  77. th(class="table-active text-right") Chainwork
  78. td(class="monospace") #{result.getblock.chainwork}
  79. hr
  80. h2(class="h4") Transactions (#{txCount.toLocaleString()})
  81. small - Showing
  82. if (txCount <= limit)
  83. span all
  84. else
  85. span #{(offset + 1)} - #{Math.min(offset + limit, txCount)}
  86. each tx, txIndex in result.transactions
  87. //pre
  88. // code #{JSON.stringify(tx, null, 4)}
  89. div(class="card mb-3")
  90. div(class="card-header")
  91. if (tx && tx.txid)
  92. a(href=("/tx/" + tx.txid), class="monospace") #{tx.txid}
  93. else if (result.getblock.height == 0)
  94. a(href=(""), class="monospace") #{result.getblock.tx}
  95. div(class="card-body")
  96. //pre
  97. // code #{JSON.stringify(result.txInputsByTransaction[tx.txid], null, 4)}
  98. if (tx && tx.txid)
  99. div(class="row")
  100. div(class="col-md-6")
  101. h6 Input (#{tx.vin.length.toLocaleString()})
  102. if (result.txInputsByTransaction[tx.txid])
  103. - var totalInputValue = new Decimal(0);
  104. table(class="table mb-0")
  105. thead
  106. tr
  107. th(style="width: 40px;")
  108. th Input
  109. th Amount
  110. tbody
  111. if (tx.vin[0].coinbase)
  112. - totalInputValue = totalInputValue.plus(new Decimal(utils.getBlockReward(result.getblock.height)));
  113. tr
  114. th 1
  115. td
  116. span(class="tag monospace") coinbase
  117. span(class="monospace") Newly minted VIVO
  118. td(class="monospace") Σ #{utils.getBlockReward(result.getblock.height)}
  119. each txInput, txInputIndex in result.txInputsByTransaction[tx.txid]
  120. if (txInput)
  121. - var vout = txInput.vout[tx.vin[txInputIndex].vout];
  122. tr
  123. th #{(txInputIndex + 1)}
  124. //pre
  125. // code #{JSON.stringify(txInput)}
  126. td
  127. if (vout.scriptPubKey && vout.scriptPubKey.addresses)
  128. span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  129. br
  130. span(class="monospace text-muted") via tx
  131. a(href=("/tx/" + txInput.txid + "#output-" + tx.vin[txInputIndex].vout), class="monospace") #{txInput.txid.substring(0, 14)}..., Output ##{tx.vin[txInputIndex].vout + 1}
  132. td
  133. if (vout.value)
  134. - totalInputValue = totalInputValue.plus(new Decimal(vout.value));
  135. span(class="monospace") Σ #{vout.value}
  136. - var coinbaseCount = tx.vin[0].coinbase ? 1 : 0;
  137. if ((tx.vin.length - coinbaseCount) > result.txInputsByTransaction[tx.txid].length)
  138. tr
  139. td
  140. td
  141. //span(class="monospace text-muted") #{(tx.vin.length - result.txInputsByTransaction[tx.txid].length).toLocaleString()} : click on transaction id for all ...
  142. //span(class="monospace text-muted") a(href=("/tx/" + tx.txid), click on transaction id for all ....)}
  143. //a(href=""/tx/" + #{tx.txid}", class="nav-link") more ... #{tx.txid}
  144. //a(href=("/tx/" + tx.txid), class="monospace") #{tx.txid}
  145. span(class="monospace text-muted") #{(tx.vin.length - result.txInputsByTransaction[tx.txid].length).toLocaleString()}:
  146. //a(href=("/tx/" + tx.txid), class="monospace")
  147. a(href=("/tx/" + tx.txid), class="monospace") more ..
  148. td
  149. else
  150. tr
  151. td
  152. td
  153. td
  154. strong(class="monospace") Σ #{totalInputValue}
  155. div(class="col-md-6")
  156. h6 Output (#{tx.vout.length.toLocaleString()})
  157. - var totalOutputValue = new Decimal(0);
  158. table(class="table mb-0")
  159. thead
  160. tr
  161. th
  162. th Output
  163. th Amount
  164. tbody
  165. each vout, voutIndex in tx.vout
  166. tr
  167. th #{(voutIndex + 1)}
  168. td
  169. if (vout.scriptPubKey)
  170. if (vout.scriptPubKey.addresses)
  171. a(id="output-" + voutIndex)
  172. span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  173. else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
  174. span(class="monospace") Segregated Witness committment -
  175. a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure") docs
  176. i(class="fa fa-external-link")
  177. else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
  178. span(class="monospace") OP_RETURN:
  179. span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
  180. td
  181. span(class="monospace") Σ #{vout.value}
  182. - totalOutputValue = totalOutputValue.plus(vout.value);
  183. tr
  184. td
  185. td
  186. td
  187. strong(class="monospace") Σ #{totalOutputValue}
  188. else if (result.getblock.height == 0)
  189. table(class="table mb-0")
  190. thead
  191. tr
  192. th(style="text-align: center;") Genesis
  193. //pre
  194. // code #{JSON.stringify(tx, null, 4)}
  195. if (txCount > limit)
  196. - var pageNumber = offset / limit + 1;
  197. - var pageCount = Math.floor(txCount / limit);
  198. - if (pageCount * limit < txCount) {
  199. - pageCount++;
  200. - }
  201. - var paginationUrlFunction = function(x) {
  202. - return paginationBaseUrl + "?limit=" + limit + "&offset=" + ((x - 1) * limit);
  203. - }
  204. hr
  205. include ./pagination.pug
  206. div(id="tab-raw", class="tab-pane", role="tabpanel")
  207. pre
  208. code #{JSON.stringify(result.getblock, null, 4)}