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.

277 lines
10 KiB

7 years ago
extends layout
block headContent
title Transaction #{txid}
style.
.field {
word-wrap: break-word;
}
block content
if (result && result.getrawtransaction)
h1(class="h2") Transaction
br
small(class="monospace") #{txid}
hr
7 years ago
ul(class='nav nav-tabs mb-3')
li(class="nav-item")
a(data-toggle="tab", href="#tab-summary", class="nav-link active", role="tab") Summary
li(class="nav-item")
a(data-toggle="tab", href="#tab-scripts", class="nav-link", role="tab") Scripts
li(class="nav-item")
a(data-toggle="tab", href="#tab-raw", class="nav-link", role="tab") Raw
7 years ago
- DecimalRounded = Decimal.clone({ precision: 4, rounding: 2 })
7 years ago
- var totalInputValue = new Decimal(0);
if (result.getrawtransaction.vin[0].coinbase)
- totalInputValue = totalInputValue.plus(new Decimal(utils.getBlockReward(result.getblock.height)));
each txInput, txInputIndex in result.txInputs
if (txInput)
- var vout = txInput.vout[result.getrawtransaction.vin[txInputIndex].vout];
if (vout.value)
- totalInputValue = totalInputValue.plus(new Decimal(vout.value));
7 years ago
- var totalOutputValue = new Decimal(0);
each vout, voutIndex in result.getrawtransaction.vout
- totalOutputValue = totalOutputValue.plus(new Decimal(vout.value));
7 years ago
div(class="tab-content")
div(id="tab-summary", class="tab-pane active", role="tabpanel")
if (txid == "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")
div(class="alert alert-warning", style="padding-bottom: 0;")
h4(class="alert-heading h5") This transaction doesn't really exist!
:markdown-it
This is the coinbase transaction of the [Bitcoin Genesis Block](/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f). 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 [Bitcoin Core](https://bitcoin.org) developers.
7 years ago
table(class="table")
7 years ago
tr
th(class="table-active properties-header") Included in Block
td(class="monospace")
if (result.getblock)
a(href=("/block/" + result.getrawtransaction.blockhash)) #{result.getrawtransaction.blockhash}
if (result.getblock.height)
span(class="text-muted") (#{result.getblock.height.toLocaleString()})
7 years ago
else
span N/A
span(class="text-muted") (unconfirmed)
tr
th(class="table-active properties-header") Timestamp
if (result.getrawtransaction.time)
td(class="monospace") #{moment.utc(new Date(result.getrawtransaction["time"] * 1000)).format("Y-MM-DD HH:mm:ss")} (utc)
7 years ago
else
td(class="monospace") N/A
span(class="text-muted") (unconfirmed)
//tr
// th(class="table-active properties-header") Transaction ID
// td #{txid}
7 years ago
tr
th(class="table-active properties-header") Version
td(class="monospace") #{result.getrawtransaction.version}
7 years ago
tr
th(class="table-active properties-header") Size
td(class="monospace")
span #{result.getrawtransaction.size.toLocaleString()} bytes
if (result.getrawtransaction.vsize != result.getrawtransaction.size)
span (
a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Transaction_size_calculations") virtual size
span : #{result.getrawtransaction.vsize.toLocaleString()} bytes)
if (result.getrawtransaction.locktime > 0)
tr
th(class="table-active properties-header")
span Locktime
td(class="monospace")
if (result.getrawtransaction.locktime < 500000000)
span Spendable in block
a(href=("/block-height/" + result.getrawtransaction.locktime)) #{result.getrawtransaction.locktime}
span or later - (
a(href="https://bitcoin.org/en/developer-guide#locktime-and-sequence-number", title="Locktime documentation")
span docs
i(class="fa fa-external-link")
span )
else
span Spendable after #{moment.utc(new Date(result.getrawtransaction.locktime * 1000)).format("Y-MM-DD HH:mm:ss")} (utc) - (
a(href="https://bitcoin.org/en/developer-guide#locktime-and-sequence-number", title="Locktime documentation")
span docs
i(class="fa fa-external-link")
span )
tr
th(class="table-active properties-header") Confirmations
td(class="monospace")
if (!result.getrawtransaction.confirmations || result.getrawtransaction.confirmations == 0)
strong(class="text-danger") 0 (unconfirmed)
else if (result.getrawtransaction.confirmations < 6)
strong(class="text-warning") #{result.getrawtransaction.confirmations}
else
strong(class="text-success") #{result.getrawtransaction.confirmations.toLocaleString()}
if (result.getrawtransaction.vin[0].coinbase)
tr
th(class="table-active properties-header") Total Network Fees
td(class="monospace") #{new Decimal(totalOutputValue).minus(totalInputValue)}
else
tr
th(class="table-active properties-header") Network Fee Paid
td(class="monospace")
strong #{new Decimal(totalInputValue).minus(totalOutputValue)}
span(class="text-muted") (#{totalInputValue} - #{totalOutputValue})
br
span ~#{new DecimalRounded(totalInputValue).minus(totalOutputValue).dividedBy(result.getrawtransaction.size).times(100000000)} sat/B
if (result.getrawtransaction.vin[0].coinbase)
div(class="card mb-3")
div(class="card-header")
h2(class="h5 mb-0") Coinbase
div(class="card-body")
h6 Hex
div(style="background-color: #f0f0f0; padding: 5px 10px;", class="mb-3")
span(class="monospace word-wrap") #{result.getrawtransaction.vin[0].coinbase}
h6 Decoded
div(style="background-color: #f0f0f0; padding: 5px 10px;", class="mb-3")
span(class="monospace word-wrap") #{utils.hex2ascii(result.getrawtransaction.vin[0].coinbase)}
7 years ago
div(class="card mb-3")
div(class="card-header")
div(class="row")
div(class="col-md-6")
h2(class="h5 mb-0") Input (#{result.getrawtransaction.vin.length.toLocaleString()})
div(class="col-md-6")
h2(class="h5 mb-0") Output (#{result.getrawtransaction.vout.length.toLocaleString()})
div(class="card-body")
div(class="row")
div(class="col-md-6")
if (result.txInputs)
table(class="table mb-0")
thead
tr
th(style="width: 40px;")
th Input
th Amount
tbody
if (result.getrawtransaction.vin[0].coinbase)
tr
th 1
td
span(class="tag monospace") coinbase
span(class="monospace") Newly minted BTC
td(class="monospace") #{utils.getBlockReward(result.getblock.height)}
7 years ago
each txInput, txInputIndex in result.txInputs
if (txInput)
- var vout = txInput.vout[result.getrawtransaction.vin[txInputIndex].vout];
tr
th #{(txInputIndex + 1)}
//pre
// code #{JSON.stringify(txInput)}
td
if (vout.scriptPubKey && vout.scriptPubKey.addresses)
span(class="monospace") #{vout.scriptPubKey.addresses[0]}
br
span(class="monospace text-muted") via tx
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}
td
if (vout.value)
span(class="monospace") #{vout.value}
7 years ago
tr
td
td
td
strong(class="monospace") #{totalInputValue}
div(class="col-md-6")
7 years ago
table(class="table mb-0")
thead
tr
th
th Output
7 years ago
th Amount
tbody
each vout, voutIndex in result.getrawtransaction.vout
7 years ago
tr
th #{(voutIndex + 1)}
7 years ago
td
if (vout.scriptPubKey)
if (vout.scriptPubKey.addresses)
a(id="output-" + voutIndex)
span(class="monospace") #{vout.scriptPubKey.addresses[0]}
7 years ago
else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
span(class="monospace") Segregated Witness committment -
a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure") docs
i(class="fa fa-external-link")
else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
span(class="monospace") OP_RETURN:
span(class="monospace text-muted") #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
td
span(class="monospace") #{vout.value}
7 years ago
tr
td
td
td
strong(class="monospace") #{totalOutputValue}
7 years ago
div(id="tab-scripts", class="tab-pane", role="tabpanel")
h3 Input Scripts
table(class="table table-striped")
thead
7 years ago
tr
th(style="width: 50px;")
th Script Sig (asm)
tbody
each vin, vinIndex in result.getrawtransaction.vin
tr
th #{vinIndex + 1}
td
if (vin.scriptSig && vin.scriptSig.asm)
span(class="word-wrap monospace") #{vin.scriptSig.asm}
7 years ago
else if (vin.coinbase)
div(style="line-height: 1.75em;")
span(class="tag") coinbase
br
span(class="word-wrap monospace") #{vin.coinbase}
br
span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vin.coinbase)}
7 years ago
h3 Output Scripts
table(class="table table-striped")
thead
7 years ago
tr
th(style="width: 50px;")
th Script Pub Key (asm)
tbody
each vout, voutIndex in result.getrawtransaction.vout
tr
th #{voutIndex + 1}
td
if (vout.scriptPubKey && vout.scriptPubKey.asm)
span(class="word-wrap monospace") #{vout.scriptPubKey.asm}
if (vout.scriptPubKey.asm.startsWith("OP_RETURN"))
br
span(class="word-wrap monospace text-muted") (decoded) #{utils.hex2ascii(vout.scriptPubKey.asm)}
7 years ago
div(id="tab-raw", class="tab-pane", role="tabpanel")
div(class="highlight")
pre
code(class="language-json", data-lang="json") #{JSON.stringify(result.getrawtransaction, null, 4)}
7 years ago
//pre #{JSON.stringify(result.txInputs, null, 4)}
7 years ago