25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

248 satır
9.0KB

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