diff --git a/app/rpcApi.js b/app/rpcApi.js index c9aaec7..c1508d3 100644 --- a/app/rpcApi.js +++ b/app/rpcApi.js @@ -37,36 +37,76 @@ var genesisCoinbaseTransaction = { "blocktime": 1230988505 }; -var interestingTx = [ +var historicalData = [ { + type: "block", + date: "2009-01-03", + blockHash: genesisBlockHash, + note: "The bitcoin genesis block.", + referenceUrl: "https://en.bitcoin.it/wiki/Genesis_block" + }, + { + type: "tx", + date: "2009-01-03", txid: genesisCoinbaseTransactionId, note: "The coinbase transaction of the genesis block.", - referenceUrl: "" + referenceUrl: "https://github.com/bitcoin/bitcoin/issues/3303" }, { + type: "tx", + date: "2009-10-12", txid: "7dff938918f07619abd38e4510890396b1cef4fbeca154fb7aafba8843295ea2", note: "First bitcoin traded for fiat currency.", - referenceUrl: "" + referenceUrl: "https://twitter.com/marttimalmi/status/423455561703624704" }, { + type: "block", + date: "2017-08-24", + blockHash: "0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893", + note: "First SegWit block.", + referenceUrl: "https://twitter.com/conio/status/900722226911219712" + }, + { + type: "tx", + date: "2017-08-24", txid: "8f907925d2ebe48765103e6845C06f1f2bb77c6adc1cc002865865eb5cfd5c1c", note: "First SegWit transaction.", - referenceUrl: "" + referenceUrl: "https://twitter.com/KHS9NE/status/900553902923362304" }, { + type: "tx", + date: "2014-06-16", txid: "143a3d7e7599557f9d63e7f224f34d33e9251b2c23c38f95631b3a54de53f024", note: "Star Wars: A New Hope", referenceUrl: "" }, { + type: "tx", + date: "2010-05-22", txid: "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d", - note: "Bitcoin Pizza Transaction", - referenceUrl: "" + note: "The 'Bitcoin Pizza' transaction.", + referenceUrl: "https://bitcointalk.org/index.php?topic=137.0" }, { + type: "tx", + date: "2011-05-18", txid: "5d80a29be1609db91658b401f85921a86ab4755969729b65257651bb9fd2c10d", - note: "Destroyed bitcoin", + note: "Destroyed bitcoin.", referenceUrl: "https://www.reddit.com/r/Bitcoin/comments/7mhoks/til_in_2011_a_user_running_a_modified_mining/" + }, + { + type: "block", + date: "2009-01-12", + blockHash: "00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee", + note: "First block containing a (non-coinbase) transaction.", + referenceUrl: "https://bitcointalk.org/index.php?topic=91806.msg1012234#msg1012234" + }, + { + type: "block", + date: "2017-08-25", + blockHash: "00000000000000000139cb443e16442fcd07a4a0e0788dd045ee3cf268982016", + note: "First block mined that was greater than 1MB.", + referenceUrl: "https://en.bit.news/bitfury-mined-first-segwit-block-size-1-mb/" } ]; @@ -619,8 +659,13 @@ function getRpcMethodHelp(methodName) { }); } -function getInterestingTransactions() { - return interestingTx; +function getHistoricalData() { + var sortedList = historicalData; + sortedList.sort(function(a, b){ + return ((a.date > b.date) ? 1 : -1); + }); + + return sortedList; } module.exports = { @@ -641,5 +686,5 @@ module.exports = { getUptimeSeconds: getUptimeSeconds, getHelp: getHelp, getRpcMethodHelp: getRpcMethodHelp, - getInterestingTransactions: getInterestingTransactions + getHistoricalData: getHistoricalData }; \ No newline at end of file diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index 64c6b7c..8e6b916 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -532,10 +532,10 @@ router.get("/rpc-browser", function(req, res) { }); }); -router.get("/interesting-transactions", function(req, res) { - res.locals.interestingTransactions = rpcApi.getInterestingTransactions(); +router.get("/fun", function(req, res) { + res.locals.historicalData = rpcApi.getHistoricalData(); - res.render("interesting-transactions"); + res.render("fun"); }); module.exports = router; diff --git a/views/fun.pug b/views/fun.pug new file mode 100644 index 0000000..fe2a059 --- /dev/null +++ b/views/fun.pug @@ -0,0 +1,45 @@ +extends layout + +block headContent + title Bitcoin History + +block content + h1(class="h2") Bitcoin History + hr + + :markdown-it + Below is a list of fun/interesting things in the Bitcoin blockchain. Some are historical firsts, others are just fun or cool. + + table(class="table table-striped table-responsive-sm mt-4") + thead + tr + th(class="data-header") Date + th(class="data-header") Description + th(class="data-header") Link + th(class="data-header") Reference + tbody + each item, index in historicalData + tr + td(class="data-cell") #{item.date} + + td(class="data-cell") #{item.note} + + td(class="data-cell monospace") + if (item.type == "tx") + a(href=("/tx/" + item.txid)) Tx:#{item.txid.substring(0, 23)}... + else if (item.type == "block") + a(href=("/block/" + item.blockHash)) Block:#{item.blockHash.substring(0, 20)}... + + td(class="data-cell") + if (item.referenceUrl && item.referenceUrl.trim().length > 0) + - var matches = item.referenceUrl.match(/^https?\:\/\/([^\/:?#]+)(?:[\/:?#]|$)/i); + + - var domain = null; + - var domain = matches && matches[1]; + + if (domain) + a(href=item.referenceUrl, rel="nofollow") #{domain} + else + a(href=item.referenceUrl, rel="nofollow") Reference + else + span - \ No newline at end of file diff --git a/views/interesting-transactions.pug b/views/interesting-transactions.pug deleted file mode 100644 index 1ba1398..0000000 --- a/views/interesting-transactions.pug +++ /dev/null @@ -1,28 +0,0 @@ -extends layout - -block headContent - title Interesting Transactions - -block content - h1(class="h2") Interesting Transactions - hr - - table(class="table table-striped table-responsive-sm mt-4") - thead - tr - th(class="data-header") Note - th(class="data-header") TxID - th(class="data-header") Read More - tbody - each tx, index in interestingTransactions - tr - td(class="data-cell") #{tx.note} - - td(class="data-cell monospace") - a(href=("/tx/" + tx.txid)) #{tx.txid.substring(0, 25)}... - - td(class="data-cell") - if (tx.referenceUrl && tx.referenceUrl.trim().length > 0) - a(href=tx.referenceUrl) Read More - else - span - \ No newline at end of file diff --git a/views/layout.pug b/views/layout.pug index e0b5521..6214a20 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -51,7 +51,7 @@ html li(class="nav-item") a(href="/mempool-summary", class="nav-link") Mempool Summary li(class="nav-item") - a(href="/interesting-transactions", class="nav-link") Interesting Transactions + a(href="/fun", class="nav-link") Bitcoin Fun hr