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.
 
 
 

236 lines
8.2 KiB

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-raw", class="nav-link", role="tab") Raw
- var txCount = result.getblock.tx.length;
div(class="tab-content")
div(id="tab-summary", class="tab-pane active", role="tabpanel")
if (result.getblock.hash == "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")
div(class="alert alert-success", style="padding-bottom: 0;")
h4(class="alert-heading h5") This is the Bitcoin Genesis Block!
:markdown-it
This is the first block in the Bitcoin blockchain. This block was mined by Bitcoin's anonymous/pseudonymous creator Satoshi Nakamoto. If you're interested, you can [read more about the genesis block](https://en.bitcoin.it/wiki/Genesis_block).
table(class="table")
tr
th(class="table-active properties-header") Block Hash
td
a(href=("/block/" + result.getblock.hash)) #{result.getblock.hash}
tr
th(class="table-active properties-header") Previous Block Hash
td
if (result.getblock.previousblockhash)
a(href=("/block/" + result.getblock.previousblockhash)) #{result.getblock.previousblockhash}
else if (result.getblock.hash == "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")
span N/A - This is the
a(href="https://en.bitcoin.it/wiki/Genesis_block") Bitcoin Genesis Block
tr
th(class="table-active properties-header") Next Block Hash
td
if (result.getblock.nextblockhash)
a(href=("/block/" + result.getblock.nextblockhash)) #{result.getblock.nextblockhash}
else
span None
span(class="text-muted") (latest block)
tr
th(class="table-active properties-header") Block Height
td
a(href=("/block-height/" + result.getblock.height)) #{result.getblock.height}
tr
th(class="table-active properties-header") Timestamp
td #{moment.utc(new Date(result.getblock.time * 1000)).format("Y-MM-DD HH:mm:ss")} (utc)
tr
th(class="table-active properties-header") Transaction Count
td #{result.getblock.tx.length.toLocaleString()}
tr
th(class="table-active properties-header") Size
td
span #{result.getblock.size.toLocaleString()} bytes
br
span(class="text-muted") (weight: #{result.getblock.weight.toLocaleString()})
tr
th(class="table-active properties-header") Confirmations
td
if (result.getblock.confirmations < 6)
strong(class="text-warning") #{result.getblock.confirmations}
else
strong(class="text-success") #{result.getblock.confirmations.toLocaleString()}
tr
- var scales = [ {val:1000000000000000, name:"quadrillion"}, {val:1000000000000, name:"trillion"}, {val:1000000000, name:"billion"}, {val:1000000, name:"million"} ];
- var scaleDone = false;
th(class="table-active properties-header") Difficulty
td
span #{result.getblock.difficulty.toLocaleString()}
each item in scales
if (!scaleDone)
- var fraction = Math.floor(result.getblock.difficulty / item.val);
if (fraction >= 1)
- scaleDone = true;
span(class="text-muted") (#{fraction} #{item.name})
tr
th(class="table-active text-right") Version
td 0x#{result.getblock.versionHex}
span(class="text-muted") (decimal: #{result.getblock.version})
tr
th(class="table-active text-right") Nonce
td #{result.getblock.nonce}
tr
th(class="table-active text-right") Bits
td #{result.getblock.bits}
tr
th(class="table-active text-right") Merkle Root
td #{result.getblock.merkleroot}
tr
th(class="table-active text-right") Chainwork
td #{result.getblock.chainwork}
hr
h2(class="h4") Transactions (#{txCount.toLocaleString()})
small - Showing
if (txCount <= limit)
span all
else
span #{(offset + 1)} - #{Math.min(offset + limit, txCount)}
each tx, txIndex in result.transactions
//pre
// code #{JSON.stringify(tx, null, 4)}
div(class="card mb-3")
div(class="card-header")
if (tx && tx.txid)
a(href=("/tx/" + tx.txid), class="monospace") #{tx.txid}
div(class="card-body")
//pre
// code #{JSON.stringify(result.txInputsByTransaction[tx.txid], null, 4)}
if (true)
div(class="row")
div(class="col-md-6")
h6 Input (#{tx.vin.length.toLocaleString()})
if (result.txInputsByTransaction[tx.txid])
- var totalInputValue = new Decimal(0);
table(class="table mb-0")
thead
tr
th(style="width: 40px;")
th Input
th Amount
tbody
if (tx.vin[0].coinbase)
- totalInputValue = totalInputValue.plus(new Decimal(utils.getBlockReward(result.getblock.height)));
tr
th 1
td
span(class="tag monospace") coinbase
span(class="monospace") Newly minted BTC
td #{utils.getBlockReward(result.getblock.height)}
each txInput, txInputIndex in result.txInputsByTransaction[tx.txid]
if (txInput)
- var vout = txInput.vout[tx.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-" + tx.vin[txInputIndex].vout), class="monospace") #{txInput.txid.substring(0, 14)}..., Output ##{tx.vin[txInputIndex].vout + 1}
td
if (vout.value)
- totalInputValue = totalInputValue.plus(new Decimal(vout.value));
span(class="monospace") #{vout.value}
- var coinbaseCount = tx.vin[0].coinbase ? 1 : 0;
if ((tx.vin.length - coinbaseCount) > result.txInputsByTransaction[tx.txid].length)
tr
td
td
span(class="monospace text-muted") #{(tx.vin.length - result.txInputsByTransaction[tx.txid].length).toLocaleString()} more...
td
else
tr
td
td
td
strong(class="monospace") #{totalInputValue}
div(class="col-md-6")
h6 Output (#{tx.vout.length.toLocaleString()})
- var totalOutputValue = new Decimal(0);
table(class="table mb-0")
thead
tr
th
th Output
th Amount
tbody
each vout, voutIndex in tx.vout
tr
th #{(voutIndex + 1)}
td
if (vout.scriptPubKey)
if (vout.scriptPubKey.addresses)
a(id="output-" + voutIndex)
span(class="monospace") #{vout.scriptPubKey.addresses[0]}
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}
- totalOutputValue = totalOutputValue.plus(vout.value);
tr
td
td
td
strong(class="monospace") #{totalOutputValue}
//pre
// code #{JSON.stringify(tx, null, 4)}
if (txCount > limit)
- var pageNumber = offset / limit + 1;
- var pageCount = Math.floor(txCount / limit);
- if (pageCount * limit < txCount) {
- pageCount++;
- }
- var paginationUrlFunction = function(x) {
- return paginationBaseUrl + "?limit=" + limit + "&offset=" + ((x - 1) * limit);
- }
hr
include ./pagination.pug
div(id="tab-raw", class="tab-pane", role="tabpanel")
pre
code #{JSON.stringify(result.getblock, null, 4)}