Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantamis committed Oct 2, 2021
2 parents bbd4ece + ea2b712 commit 0d21a9f
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 9 deletions.
Binary file added btc-rpc-explorer-node-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 139 additions & 9 deletions views/includes/transaction-io-details.pug
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,68 @@ mixin outputValueDisplay(vout, voutIndex)
if (deltaTYears > 5)
span.me-2.d-none.d-sm-inline(title=`This UTXO was very old! It existed for ${parseInt(deltaTYears)}+ years - from ${moment.utc(new Date(vout.utxoTime * 1000)).format('MMM D, Y')} until ${moment.utc(new Date(tx.time * 1000)).format('MMM D, Y')} - before being spent (destroyed) in this transaction!`, data-bs-toggle="tooltip")
+funItemIcon


span.mt-1
a.sz-xl-plus.d-none.d-xl-inline(href=`./tx/${txInput.txid}#output-${txVin.vout}`) #{utils.ellipsizeMiddle(txInput.txid, 22)}
span.text-muted ##{txVin.vout}

if (tx.vin.length > 0)
small.d-inline.d-md-none.fw-light.text-muted / #{(tx.vin.length - 1).toLocaleString()}

.tx-io-content
.clearfix
.tx-io-desc
if (txVin.coinbase)
span.badge.bg-success.me-2.mb-2(title="Coinbase transactions are special transactions created by the miner of a block. They distribute the block reward (subsidy) as the miner chooses, along with all of the fees paid by transactions included in the block.", data-bs-toggle="tooltip") coinbase

+asciiHexDataDisplay("coinbase data", "coinbase-data", txVin.coinbase)


else
.word-wrap
if (vout.scriptPubKey)
span(title=`Input Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-bs-toggle="tooltip")
+darkBadge(utils.outputTypeAbbreviation(vout.scriptPubKey.type))

if (vout.coinbaseSpend)
span.badge.bg-success.me-2
span(title=`This input spends a coinbase output (mining reward).`, data-bs-toggle="tooltip") coinbase-spend

if (vout.utxoTime)
- var deltaT = tx.time - vout.utxoTime
- var deltaTYears = deltaT / 60 / 60 / 24 / 365

if (deltaTYears > 5)
span.me-2(title=`This UTXO was very old! It existed for ${parseInt(deltaTYears)}+ years - from ${moment.utc(new Date(vout.utxoTime * 1000)).format('MMM D, Y')} until ${moment.utc(new Date(tx.time * 1000)).format('MMM D, Y')} - before being spent (destroyed) in this transaction!`, data-bs-toggle="tooltip")
+funItemIcon


a(href=`./tx/${txInput.txid}#output-${txVin.vout}`) #{utils.ellipsizeMiddle(txInput.txid, 22)}
span ##{txVin.vout}

if (vout && vout.scriptPubKey && vout.scriptPubKey.addresses)
.word-wrap
small.text-muted
span.me-1 (addr:
a(href=`./address/${vout.scriptPubKey.addresses[0]}`, class=(txIOHighlightAddress == vout.scriptPubKey.addresses[0] ? "text-info" : null)) #{vout.scriptPubKey.addresses[0]}

if (txIOHighlightAddress == vout.scriptPubKey.addresses[0])
span(title="Current address", data-bs-toggle="tooltip")
i.fas.fa-arrow-left.text-warning.ms-1.text-info

if (global.specialAddresses[vout.scriptPubKey.addresses[0]])
- var specialAddressInfo = global.specialAddresses[vout.scriptPubKey.addresses[0]];
if (specialAddressInfo.type == "minerPayout")
span
a(data-bs-toggle="tooltip", title=`Miner payout address: ${specialAddressInfo.minerInfo.name}`)
+funItemIcon

a.sz-md-lg.d-none.d-md-inline.d-xl-none(href=`./tx/${txInput.txid}#output-${txVin.vout}`) #{utils.ellipsizeMiddle(txInput.txid, 14)}
span.text-muted ##{txVin.vout}
span )

a.sz-xs-sm.small.d-inline.d-md-none(href=`./tx/${txInput.txid}#output-${txVin.vout}`) #{utils.ellipsizeMiddle(txInput.txid, 14)}
span.text-muted ##{txVin.vout}
if (false)
small
span.border-dotted(title="Transaction output", data-bs-toggle="tooltip") txo
span.me-1 :
a(href=`./tx/${txInput.txid}#output-${txVin.vout}`) #{utils.ellipsize(txInput.txid, 20)}[#{txVin.vout}]

else
0

if (vout && vout.scriptPubKey)
- var voutAddresses = utils.getVoutAddresses(vout);
Expand Down Expand Up @@ -241,6 +292,10 @@ mixin outputValueDisplay(vout, voutIndex)
- hiddenRow = true;
- hiddenRowCount++;

- var spent = false;
if (false && config.electrumServers && config.electrumServers.length > 0)
- spent = electrumAddressApi.lookupOutpointTx(vout, voutIndex)

div(data-txid=tx.txid, class=(hiddenRow ? "d-none" : ""))
.clearfix.mb-0.mb-sm-2.mb-md-0
a.xs-hidden.d-none.d-sm-inline.badge.card-highlight.border.text-decoration-none.fw-normal.me-2(data-bs-toggle="tooltip", title=`Output #${voutIndex.toLocaleString()}`, style="white-space: nowrap;")
Expand Down Expand Up @@ -349,6 +404,81 @@ mixin outputValueDisplay(vout, voutIndex)
if (vout.scriptPubKey)
if (voutAddresses.length > 0)

if (tx.vout.length > 0)
small.d-inline.d-md-none.fw-light.text-muted / #{(tx.vout.length - 1).toLocaleString()}

.tx-io-content
.clearfix
.tx-io-desc
if (vout.scriptPubKey)
if (vout.scriptPubKey.addresses)
if (true)
.mb-1
+darkBadge
span(title=`Output Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-bs-toggle="tooltip") #{utils.outputTypeAbbreviation(vout.scriptPubKey.type)}

if (spent)
.word-wrap
a(href=`./tx/${spent[0]}#output-${voutIndex}`) #{utils.ellipsizeMiddle(spent[0], 22)}
span ##{voutIndex}
each addr in vout.scriptPubKey.addresses
if (spent)
span.me-1 (addr:
a(id=`output-${voutIndex}`, href=`./address/${addr}`) #{addr})
else
a(id=`output-${voutIndex}`, href=`./address/${addr}`)
span.font-monospace.word-wrap(class=(highlightRow ? "text-info" : null)) #{addr}

if (highlightRow)
span(title="Current address", data-bs-toggle="tooltip")
i.fas.fa-arrow-left.ms-1.text-warning

if (global.specialAddresses[addr])
- var specialAddressInfo = global.specialAddresses[addr];
if (specialAddressInfo.type == "minerPayout")
span
a(data-bs-toggle="tooltip", title=`Miner payout address: ${specialAddressInfo.minerInfo.name}`)
+funItemIcon

br

else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
.mb-2
+primaryBadge("OP_RETURN")

+darkBadge("SegWit commitment")
a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure", data-bs-toggle="tooltip", title="Read about the SegWit Commitment", target="_blank")
i.fas.fa-external-link-alt


+asciiHexDataDisplay("OP_RETURN data", `op_return-${tx.txid}-${vout.n}`, vout.scriptPubKey.asm.substring("OP_RETURN ".length))


else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
.mb-2
+primaryBadge("OP_RETURN")

+asciiHexDataDisplay("OP_RETURN data", `op_return-${tx.txid}-${vout.n}`, vout.scriptPubKey.asm.substring("OP_RETURN ".length))


else
.mb-tiny
span(title=`Output Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-bs-toggle="tooltip")
+darkBadge(utils.outputTypeAbbreviation(vout.scriptPubKey.type))

+asciiHexDataDisplay("ASM data", `asm-${tx.txid}-${vout.n}`, vout.scriptPubKey.asm)


.tx-io-value.mt-3.mt-md-0
if (!vout.scriptPubKey.asm.startsWith('OP_RETURN '))
if (utxos)
if (utxos[voutIndex])
span(title="This output remains unspent (a valid UTXO)." data-bs-toggle="tooltip")
i.fas.fa-lock.text-success.me-2

else if (utxos[voutIndex] == null)
span(title="This output has been spent (destroyed)." data-bs-toggle="tooltip")
i.fas.fa-lock-open.text-secondary.me-2

else if (false)
.mb-tiny
Expand Down

0 comments on commit 0d21a9f

Please sign in to comment.