Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

transaction.pug 10KB

před 3 roky
před 3 roky
před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. extends layout
  2. block headContent
  3. title Transaction #{txid}
  4. style.
  5. .field {
  6. word-wrap: break-word;
  7. }
  8. block content
  9. h1(class="h2") Transaction
  10. br
  11. small(class="monospace") #{txid}
  12. hr
  13. ul(class='nav nav-tabs mb-3')
  14. li(class="nav-item")
  15. a(data-toggle="tab", href="#tab-summary", class="nav-link active", role="tab") Summary
  16. li(class="nav-item")
  17. a(data-toggle="tab", href="#tab-scripts", class="nav-link", role="tab") Scripts
  18. li(class="nav-item")
  19. a(data-toggle="tab", href="#tab-raw", class="nav-link", role="tab") Raw
  20. - DecimalRounded = Decimal.clone({ precision: 4, rounding: 2 })
  21. - var totalInputValue = new Decimal(0);
  22. if (result.getrawtransaction.vin[0].coinbase)
  23. - totalInputValue = totalInputValue.plus(new Decimal(utils.getBlockReward(result.getblock.height)));
  24. each txInput, txInputIndex in result.txInputs
  25. if (txInput)
  26. - var vout = txInput.vout[result.getrawtransaction.vin[txInputIndex].vout];
  27. if (vout.value)
  28. - totalInputValue = totalInputValue.plus(new Decimal(vout.value));
  29. - var totalOutputValue = new Decimal(0);
  30. each vout, voutIndex in result.getrawtransaction.vout
  31. - totalOutputValue = totalOutputValue.plus(new Decimal(vout.value));
  32. div(class="tab-content")
  33. div(id="tab-summary", class="tab-pane active", role="tabpanel")
  34. if (txid == "00000f6be3e151f9082a2b82c2916192a791090015b80979934a45d625460d62")
  35. div(class="alert alert-warning", style="padding-bottom: 0;")
  36. h4(class="alert-heading h5") This transaction doesn't really exist!
  37. :markdown-it
  38. This is the coinbase transaction of the [Vivocoin Genesis Block](/block/00000f6be3e151f9082a2b82c2916192a791090015b80979934a45d625460d62). For more background about this special-case transaction, you can read [this brief discussion](https://github.com/bitcoin/bitcoin/issues/3303) among some of the [Vivocoin Core](https://bitcoin.org) developers.
  39. table(class="table")
  40. tr
  41. th(class="table-active properties-header") Included in Block
  42. td(class="monospace")
  43. if (result.getblock)
  44. a(href=("/block/" + result.getrawtransaction.blockhash)) #{result.getrawtransaction.blockhash}
  45. if (result.getblock.height)
  46. span(class="text-muted") (#{result.getblock.height.toLocaleString()})
  47. else
  48. span N/A
  49. span(class="text-muted") (unconfirmed)
  50. tr
  51. th(class="table-active properties-header") Timestamp
  52. if (result.getrawtransaction.time)
  53. td(class="monospace") #{moment.utc(new Date(result.getrawtransaction["time"] * 1000)).format("Y-MM-DD HH:mm:ss")} (utc)
  54. else
  55. td(class="monospace") N/A
  56. span(class="text-muted") (unconfirmed)
  57. //tr
  58. // th(class="table-active properties-header") Transaction ID
  59. // td #{txid}
  60. tr
  61. th(class="table-active properties-header") Version
  62. td(class="monospace") #{result.getrawtransaction.version}
  63. if (result.getrawtransaction.locktime > 0)
  64. tr
  65. th(class="table-active properties-header")
  66. span Locktime
  67. td(class="monospace")
  68. if (result.getrawtransaction.locktime < 500000000)
  69. span Spendable in block
  70. a(href=("/block-height/" + result.getrawtransaction.locktime)) #{result.getrawtransaction.locktime}
  71. span or later - (
  72. a(href="https://bitcoin.org/en/developer-guide#locktime-and-sequence-number", title="Locktime documentation")
  73. span docs
  74. i(class="fa fa-external-link")
  75. span )
  76. else
  77. span Spendable after #{moment.utc(new Date(result.getrawtransaction.locktime * 1000)).format("Y-MM-DD HH:mm:ss")} (utc) - (
  78. a(href="https://bitcoin.org/en/developer-guide#locktime-and-sequence-number", title="Locktime documentation")
  79. span docs
  80. i(class="fa fa-external-link")
  81. span )
  82. tr
  83. th(class="table-active properties-header") Confirmations
  84. td(class="monospace")
  85. if (!result.getrawtransaction.confirmations || result.getrawtransaction.confirmations == 0)
  86. strong(class="text-danger") 0 (unconfirmed)
  87. else if (result.getrawtransaction.confirmations < 6)
  88. strong(class="text-warning") #{result.getrawtransaction.confirmations}
  89. else
  90. strong(class="text-success") #{result.getrawtransaction.confirmations.toLocaleString()}
  91. if (result.getrawtransaction.vin[0].coinbase)
  92. tr
  93. th(class="table-active properties-header") Total Network Fees
  94. //td(class="monospace") Σ #{new Decimal(totalOutputValue).minus(totalInputValue)}
  95. td(class="monospace") Σ #{(totalOutputValue - totalInputValue)}
  96. else
  97. tr
  98. th(class="table-active properties-header") Network Fee Paid
  99. td(class="monospace")
  100. strong #{new Decimal(totalInputValue).minus(totalOutputValue)}
  101. //span(class="text-muted") (#{totalInputValue} - #{totalOutputValue})
  102. //br
  103. //span ~#{new DecimalRounded(totalInputValue).minus(totalOutputValue).dividedBy(result.getrawtransaction.size).times(100000000)} sat/B
  104. if (result.getrawtransaction.vin[0].coinbase)
  105. div(class="card mb-3")
  106. div(class="card-header")
  107. h2(class="h5 mb-0") Coinbase
  108. div(class="card-body")
  109. h6 Hex
  110. div(style="background-color: #fafafa; padding: 5px 10px;", class="mb-3")
  111. span(class="monospace word-wrap") #{result.getrawtransaction.vin[0].coinbase}
  112. h6 Decoded
  113. div(style="background-color: #fafafa; padding: 5px 10px;", class="mb-3")
  114. span(class="monospace word-wrap") #{utils.hex2ascii(result.getrawtransaction.vin[0].coinbase)}
  115. div(class="card mb-3")
  116. div(class="card-header")
  117. div(class="row")
  118. div(class="col-md-6")
  119. h2(class="h5 mb-0") Input (#{result.getrawtransaction.vin.length.toLocaleString()})
  120. div(class="col-md-6")
  121. h2(class="h5 mb-0") Output (#{result.getrawtransaction.vout.length.toLocaleString()})
  122. div(class="card-body")
  123. div(class="row")
  124. div(class="col-md-6")
  125. if (result.txInputs)
  126. table(class="table mb-0")
  127. thead
  128. tr
  129. th(style="width: 40px;")
  130. th Input
  131. th Amount
  132. tbody
  133. if (result.getrawtransaction.vin[0].coinbase)
  134. tr
  135. th 1
  136. td
  137. span(class="tag monospace") coinbase
  138. span(class="monospace") Newly minted VIVO
  139. td(class="monospace") Σ #{utils.getBlockReward(result.getblock.height)}
  140. each txInput, txInputIndex in result.txInputs
  141. if (txInput)
  142. - var vout = txInput.vout[result.getrawtransaction.vin[txInputIndex].vout];
  143. tr
  144. th #{(txInputIndex + 1)}
  145. //pre
  146. // code #{JSON.stringify(txInput)}
  147. td
  148. if (vout.scriptPubKey && vout.scriptPubKey.addresses)
  149. //span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  150. span(class="monospace")
  151. a(href=("/address/" + vout.scriptPubKey.addresses[0])) #{vout.scriptPubKey.addresses[0]}
  152. br
  153. span(class="monospace text-muted") via tx
  154. a(href=("/tx/" + txInput.txid + "#output-" + result.getrawtransaction.vin[txInputIndex].vout), class="monospace") #{txInput.txid.substring(0, 14)}..., Output ##{result.getrawtransaction.vin[txInputIndex].vout + 1}
  155. td
  156. if (vout.value)
  157. span(class="monospace") Σ #{vout.value}
  158. tr
  159. td
  160. td
  161. td
  162. strong(class="monospace") Σ #{totalInputValue}
  163. div(class="col-md-6")
  164. table(class="table mb-0")
  165. thead
  166. tr
  167. th
  168. th Output
  169. th Amount
  170. tbody
  171. each vout, voutIndex in result.getrawtransaction.vout
  172. tr
  173. th #{(voutIndex + 1)}
  174. td
  175. if (vout.scriptPubKey)
  176. if (vout.scriptPubKey.addresses)
  177. a(id="output-" + voutIndex)
  178. //span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  179. span(class="monospace")
  180. a(href=("/address/" + vout.scriptPubKey.addresses[0])) #{vout.scriptPubKey.addresses[0]}
  181. else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
  182. span(class="monospace") Segregated Witness committment -
  183. a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure") docs
  184. i(class="fa fa-external-link")
  185. else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
  186. span(class="monospace") OP_RETURN:
  187. span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
  188. td
  189. span(class="monospace") Σ #{vout.value}
  190. tr
  191. td
  192. td
  193. td
  194. strong(class="monospace") Σ #{totalOutputValue}
  195. div(id="tab-scripts", class="tab-pane", role="tabpanel")
  196. h3 Input Scripts
  197. table(class="table table-striped")
  198. thead
  199. tr
  200. th(style="width: 50px;")
  201. th Script Sig (asm)
  202. tbody
  203. each vin, vinIndex in result.getrawtransaction.vin
  204. tr
  205. th #{vinIndex + 1}
  206. td
  207. if (vin.scriptSig && vin.scriptSig.asm)
  208. span(class="word-wrap monospace") #{vin.scriptSig.asm}
  209. else if (vin.coinbase)
  210. div(style="line-height: 1.75em;")
  211. span(class="tag") coinbase
  212. br
  213. span(class="word-wrap monospace") #{vin.coinbase}
  214. br
  215. span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vin.coinbase)}
  216. h3 Output Scripts
  217. table(class="table table-striped")
  218. thead
  219. tr
  220. th(style="width: 50px;")
  221. th Script Pub Key (asm)
  222. tbody
  223. each vout, voutIndex in result.getrawtransaction.vout
  224. tr
  225. th #{voutIndex + 1}
  226. td
  227. if (vout.scriptPubKey && vout.scriptPubKey.asm)
  228. span(class="word-wrap monospace") #{vout.scriptPubKey.asm}
  229. if (vout.scriptPubKey.asm.startsWith("OP_RETURN"))
  230. br
  231. span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vout.scriptPubKey.asm)}
  232. div(id="tab-raw", class="tab-pane", role="tabpanel")
  233. div(class="highlight")
  234. pre
  235. code(class="language-json", data-lang="json") #{JSON.stringify(result.getrawtransaction, null, 4)}
  236. //pre #{JSON.stringify(result.txInputs, null, 4)}