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.

250 lines
9.1KB

  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. span(class="monospace")
  130. a(href=("/address/" + vout.scriptPubKey.addresses[0])) #{vout.scriptPubKey.addresses[0]}
  131. br
  132. span(class="monospace text-muted") via tx
  133. a(href=("/tx/" + txInput.txid + "#output-" + tx.vin[txInputIndex].vout), class="monospace") #{txInput.txid.substring(0, 14)}..., Output ##{tx.vin[txInputIndex].vout + 1}
  134. td
  135. if (vout.value)
  136. - totalInputValue = totalInputValue.plus(new Decimal(vout.value));
  137. span(class="monospace") Σ #{vout.value}
  138. - var coinbaseCount = tx.vin[0].coinbase ? 1 : 0;
  139. if ((tx.vin.length - coinbaseCount) > result.txInputsByTransaction[tx.txid].length)
  140. tr
  141. td
  142. td
  143. //span(class="monospace text-muted") #{(tx.vin.length - result.txInputsByTransaction[tx.txid].length).toLocaleString()} : click on transaction id for all ...
  144. //span(class="monospace text-muted") a(href=("/tx/" + tx.txid), click on transaction id for all ....)}
  145. //a(href=""/tx/" + #{tx.txid}", class="nav-link") more ... #{tx.txid}
  146. //a(href=("/tx/" + tx.txid), class="monospace") #{tx.txid}
  147. //span(class="monospace text-muted") #{(tx.vin.length - result.txInputsByTransaction[tx.txid].length).toLocaleString()}:
  148. span(class="monospace text-muted") #{tx.vin.length.toLocaleString()}:
  149. //a(href=("/tx/" + tx.txid), class="monospace")
  150. a(href=("/tx/" + tx.txid), class="monospace") Go to all #{tx.vin.length.toLocaleString()}
  151. td
  152. else
  153. tr
  154. td
  155. td
  156. td
  157. strong(class="monospace") Σ #{totalInputValue}
  158. div(class="col-md-6")
  159. h6 Output (#{tx.vout.length.toLocaleString()})
  160. - var totalOutputValue = new Decimal(0);
  161. table(class="table mb-0")
  162. thead
  163. tr
  164. th
  165. th Output
  166. th Amount
  167. tbody
  168. each vout, voutIndex in tx.vout
  169. tr
  170. th #{(voutIndex + 1)}
  171. td
  172. if (vout.scriptPubKey)
  173. if (vout.scriptPubKey.addresses)
  174. a(id="output-" + voutIndex)
  175. //span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  176. span(class="monospace")
  177. a(href=("/address/" + vout.scriptPubKey.addresses[0])) #{vout.scriptPubKey.addresses[0]}
  178. else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
  179. span(class="monospace") Segregated Witness committment -
  180. a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure") docs
  181. i(class="fa fa-external-link")
  182. else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
  183. span(class="monospace") OP_RETURN:
  184. span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
  185. td
  186. span(class="monospace") Σ #{vout.value}
  187. - totalOutputValue = totalOutputValue.plus(vout.value);
  188. tr
  189. td
  190. td
  191. td
  192. strong(class="monospace") Σ #{totalOutputValue}
  193. else if (result.getblock.height == 0)
  194. table(class="table mb-0")
  195. thead
  196. tr
  197. th(style="text-align: center;") Genesis
  198. //pre
  199. // code #{JSON.stringify(tx, null, 4)}
  200. if (txCount > limit)
  201. - var pageNumber = offset / limit + 1;
  202. - var pageCount = Math.floor(txCount / limit);
  203. - if (pageCount * limit < txCount) {
  204. - pageCount++;
  205. - }
  206. - var paginationUrlFunction = function(x) {
  207. - return paginationBaseUrl + "?limit=" + limit + "&offset=" + ((x - 1) * limit);
  208. - }
  209. hr
  210. include ./pagination.pug
  211. div(id="tab-raw", class="tab-pane", role="tabpanel")
  212. pre
  213. code #{JSON.stringify(result.getblock, null, 4)}