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.

268 lines
9.9KB

  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. br
  151. span(class="monospace text-muted") via tx
  152. 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}
  153. td
  154. if (vout.value)
  155. span(class="monospace") Σ #{vout.value}
  156. tr
  157. td
  158. td
  159. td
  160. strong(class="monospace") Σ #{totalInputValue}
  161. div(class="col-md-6")
  162. table(class="table mb-0")
  163. thead
  164. tr
  165. th
  166. th Output
  167. th Amount
  168. tbody
  169. each vout, voutIndex in result.getrawtransaction.vout
  170. tr
  171. th #{(voutIndex + 1)}
  172. td
  173. if (vout.scriptPubKey)
  174. if (vout.scriptPubKey.addresses)
  175. a(id="output-" + voutIndex)
  176. span(class="monospace") #{vout.scriptPubKey.addresses[0]}
  177. else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
  178. span(class="monospace") Segregated Witness committment -
  179. a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure") docs
  180. i(class="fa fa-external-link")
  181. else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
  182. span(class="monospace") OP_RETURN:
  183. span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
  184. td
  185. span(class="monospace") Σ #{vout.value}
  186. tr
  187. td
  188. td
  189. td
  190. strong(class="monospace") Σ #{totalOutputValue}
  191. div(id="tab-scripts", class="tab-pane", role="tabpanel")
  192. h3 Input Scripts
  193. table(class="table table-striped")
  194. thead
  195. tr
  196. th(style="width: 50px;")
  197. th Script Sig (asm)
  198. tbody
  199. each vin, vinIndex in result.getrawtransaction.vin
  200. tr
  201. th #{vinIndex + 1}
  202. td
  203. if (vin.scriptSig && vin.scriptSig.asm)
  204. span(class="word-wrap monospace") #{vin.scriptSig.asm}
  205. else if (vin.coinbase)
  206. div(style="line-height: 1.75em;")
  207. span(class="tag") coinbase
  208. br
  209. span(class="word-wrap monospace") #{vin.coinbase}
  210. br
  211. span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vin.coinbase)}
  212. h3 Output Scripts
  213. table(class="table table-striped")
  214. thead
  215. tr
  216. th(style="width: 50px;")
  217. th Script Pub Key (asm)
  218. tbody
  219. each vout, voutIndex in result.getrawtransaction.vout
  220. tr
  221. th #{voutIndex + 1}
  222. td
  223. if (vout.scriptPubKey && vout.scriptPubKey.asm)
  224. span(class="word-wrap monospace") #{vout.scriptPubKey.asm}
  225. if (vout.scriptPubKey.asm.startsWith("OP_RETURN"))
  226. br
  227. span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vout.scriptPubKey.asm)}
  228. div(id="tab-raw", class="tab-pane", role="tabpanel")
  229. div(class="highlight")
  230. pre
  231. code(class="language-json", data-lang="json") #{JSON.stringify(result.getrawtransaction, null, 4)}
  232. //pre #{JSON.stringify(result.txInputs, null, 4)}