From f7e8ef0932ee06cda2a543f721ba8646859db79f Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Sun, 15 Apr 2018 14:34:32 -0400 Subject: [PATCH] - cleanup BTC/LTC support - tweak readme --- README.md | 14 ++- app/coins.js | 223 +------------------------------------ app/coins/btc.js | 146 ++++++++++++++++++++++++ app/coins/ltc.js | 73 ++++++++++++ public/img/logo/btc-64.png | Bin 2483 -> 0 bytes public/img/logo/btc.svg | 1 + public/img/logo/ltc.svg | 6 + 7 files changed, 239 insertions(+), 224 deletions(-) create mode 100644 app/coins/btc.js create mode 100644 app/coins/ltc.js delete mode 100644 public/img/logo/btc-64.png create mode 100644 public/img/logo/btc.svg create mode 100644 public/img/logo/ltc.svg diff --git a/README.md b/README.md index e2d5b8a..c0cddf7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# ![BTC Explorer](public/img/logo/btc-64.png) BTC Explorer - Simple, database-free Bitcoin blockchain explorer, via RPC. Built with Node.js, express, bootstrap-v4. This tool is intended to be a simple, self-hosted explorer for the Bitcoin blockchain, driven by RPC calls to your own bitcoind node. This tool is easy to run but lacks features compared to full-fledged (stateful) explorers. @@ -18,10 +16,13 @@ A live demo of the tool is available at https://btc-explorer.com * Search to directly navigate to transactions or blocks * Mempool summary, showing unconfirmed transaction counts by fee level * RPC Browser to explore all of the RPC commands available from your node -* RPC Terminal to send arbitrary commands to your node +* RPC Terminal to send commands to your node +* Currently supports BTC, LTC. Support for any Bitcoin-RPC-protocol-compliant coin can be added easily. # Getting started +The below instructions are geared toward BTC, but can be adapted easily to other coins. + ## Prerequisites 1. Install and run a full, archiving node - [instructions](https://bitcoin.org/en/full-node). Ensure that your node has full transaction indexing enabled (`txindex=1`) and the RPC server enabled (`server=1`). @@ -32,9 +33,10 @@ A live demo of the tool is available at https://btc-explorer.com 1. Clone this repo 2. `npm install` to install all required dependencies 3. Optional: Uncomment the "bitcoind" section in [env.js](app/env.js) to automatically connect to the target node. -4. `npm start` to start the local server -5. Navigate to http://127.0.0.1:3002/ -6. Connect using the RPC credentials for your target bitcoin node (if you didn't edit [env.js](app/env.js) in Step 3) +4. Optional: Change the "coin" value in [env.js](app/env.js). Currently supported values are "BTC" and "LTC". +5. `npm start` to start the local server +6. Navigate to http://127.0.0.1:3002/ +7. Connect using the RPC credentials for your target bitcoin node (if you didn't edit [env.js](app/env.js) in Step 3) # Screenshots diff --git a/app/coins.js b/app/coins.js index d55ea2e..cc156ea 100644 --- a/app/coins.js +++ b/app/coins.js @@ -1,220 +1,7 @@ +var btc = require("./coins/btc.js"); +var ltc = require("./coins/ltc.js"); + module.exports = { - "BTC": { - name:"Bitcoin", - logoUrl:"/img/logo/btc-64.png", - siteTitle:"BTC Explorer", - siteDescriptionHtml:"BTC Explorer is read more about the genesis block." - } - }, - specialTransactions:{ - "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b":{ - "noteTitle":"This transaction doesn't really exist!", - "noteBodyHtml":"This is the coinbase transaction of the Bitcoin Genesis Block. For more background about this special-case transaction, you can read this brief discussion among some of the Bitcoin developers." - } - }, - historicalData: [ - { - type: "block", - date: "2009-01-03", - blockHash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", - note: "The bitcoin genesis block.", - referenceUrl: "https://en.bitcoin.it/wiki/Genesis_block" - }, - { - type: "tx", - date: "2009-01-03", - txid: "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", - note: "The coinbase transaction of the genesis block.", - referenceUrl: "https://github.com/bitcoin/bitcoin/issues/3303" - }, - { - type: "tx", - date: "2009-10-12", - txid: "7dff938918f07619abd38e4510890396b1cef4fbeca154fb7aafba8843295ea2", - note: "First bitcoin traded for fiat currency.", - 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: "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: "The 'Bitcoin Pizza' transaction.", - referenceUrl: "https://bitcointalk.org/index.php?topic=137.0" - }, - { - type: "tx", - date: "2011-05-18", - txid: "5d80a29be1609db91658b401f85921a86ab4755969729b65257651bb9fd2c10d", - 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/" - } - ] - }, - "LTC": { - name:"Litecoin", - siteTitle:"LTC Explorer", - nodeTitle:"Litecoin Full Node", - nodeUrl:"https://litecoin.org/", - currencyUnits:[ - { - name:"LTC", - multiplier:1, - default:true, - values:["", "btc", "BTC"] - }, - { - name:"mLTC", - multiplier:1000, - values:["mltc"] - } - ], - genesisBlockHash: "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", - genesisCoinbaseTransactionId: "97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", - genesisCoinbaseTransaction: { - "txid":"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", - "hash":"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", - "blockhash":"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", - "version":1, - "locktime":0, - "size":199, - "vsize":199, - "time":1317972665, - "blocktime":1317972665, - "vin":[ - { - "prev_out":{ - "hash":"0000000000000000000000000000000000000000000000000000000000000000", - "n":4294967295 - }, - "coinbase":"04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536" - } - ], - "vout":[ - { - "value":"50.00000000", - "n":0, - "scriptPubKey":{ - "hex":"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 OP_CHECKSIG", - "type":"pubkey", - "reqSigs":1, - "addresses":[ - "Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2" - ] - } - } - ] - }, - specialBlocks:{ - "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2":{ - "noteTitle":"Litecoin Genesis Block", - "noteBodyHtml":"This is the first block in the Litecoin blockchain." - } - }, - specialTransactions:{ - }, - historicalData: [ - { - type: "block", - date: "2011-10-07", - blockHash: "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", - note: "The Litecoin genesis block.", - referenceUrl: "https://medium.com/@SatoshiLite/satoshilite-1e2dad89a017" - } - ] - } + "BTC": btc, + "LTC": ltc }; \ No newline at end of file diff --git a/app/coins/btc.js b/app/coins/btc.js new file mode 100644 index 0000000..7221eee --- /dev/null +++ b/app/coins/btc.js @@ -0,0 +1,146 @@ +module.exports = { + name:"Bitcoin", + logoUrl:"/img/logo/btc.svg", + siteTitle:"BTC Explorer", + siteDescriptionHtml:"BTC Explorer is read more about the genesis block." + } + }, + specialTransactions:{ + "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b":{ + "noteTitle":"This transaction doesn't really exist!", + "noteBodyHtml":"This is the coinbase transaction of the Bitcoin Genesis Block. For more background about this special-case transaction, you can read this brief discussion among some of the Bitcoin developers." + } + }, + historicalData: [ + { + type: "block", + date: "2009-01-03", + blockHash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", + note: "The bitcoin genesis block.", + referenceUrl: "https://en.bitcoin.it/wiki/Genesis_block" + }, + { + type: "tx", + date: "2009-01-03", + txid: "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", + note: "The coinbase transaction of the genesis block.", + referenceUrl: "https://github.com/bitcoin/bitcoin/issues/3303" + }, + { + type: "tx", + date: "2009-10-12", + txid: "7dff938918f07619abd38e4510890396b1cef4fbeca154fb7aafba8843295ea2", + note: "First bitcoin traded for fiat currency.", + 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: "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: "The 'Bitcoin Pizza' transaction.", + referenceUrl: "https://bitcointalk.org/index.php?topic=137.0" + }, + { + type: "tx", + date: "2011-05-18", + txid: "5d80a29be1609db91658b401f85921a86ab4755969729b65257651bb9fd2c10d", + 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/" + } + ] +}; \ No newline at end of file diff --git a/app/coins/ltc.js b/app/coins/ltc.js new file mode 100644 index 0000000..93dd2f2 --- /dev/null +++ b/app/coins/ltc.js @@ -0,0 +1,73 @@ +module.exports = { + name:"Litecoin", + logoUrl:"/img/logo/ltc.svg", + siteTitle:"LTC Explorer", + nodeTitle:"Litecoin Full Node", + nodeUrl:"https://litecoin.org/", + currencyUnits:[ + { + name:"LTC", + multiplier:1, + default:true, + values:["", "btc", "BTC"] + }, + { + name:"mLTC", + multiplier:1000, + values:["mltc"] + } + ], + genesisBlockHash: "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", + genesisCoinbaseTransactionId: "97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", + genesisCoinbaseTransaction: { + "txid":"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", + "hash":"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", + "blockhash":"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", + "version":1, + "locktime":0, + "size":199, + "vsize":199, + "time":1317972665, + "blocktime":1317972665, + "vin":[ + { + "prev_out":{ + "hash":"0000000000000000000000000000000000000000000000000000000000000000", + "n":4294967295 + }, + "coinbase":"04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536" + } + ], + "vout":[ + { + "value":"50.00000000", + "n":0, + "scriptPubKey":{ + "hex":"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 OP_CHECKSIG", + "type":"pubkey", + "reqSigs":1, + "addresses":[ + "Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2" + ] + } + } + ] + }, + specialBlocks:{ + "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2":{ + "noteTitle":"Litecoin Genesis Block", + "noteBodyHtml":"This is the first block in the Litecoin blockchain." + } + }, + specialTransactions:{ + }, + historicalData: [ + { + type: "block", + date: "2011-10-07", + blockHash: "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2", + note: "The Litecoin genesis block.", + referenceUrl: "https://medium.com/@SatoshiLite/satoshilite-1e2dad89a017" + } + ] +}; \ No newline at end of file diff --git a/public/img/logo/btc-64.png b/public/img/logo/btc-64.png deleted file mode 100644 index 1f8064fbcc4f7b60cb4652e54d906b581bb7bca2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2483 zcmV;k2~75hP)2=xOOmSg>G*We)nAIQtqHDCw46)2_%j47TEaerU{IC313O@F}~f7^{! zIev8dCX5CynvC^N--M?sry6QM2##*G}(Q)w6p(M4Orhj2#DdWi@7Z zoW)o7H)D&hstgMrT!y-eY49VYdr)QCyFClMIFA6n+}Mnt(YPNcd^gr&!}2R}v5$QT zz_Y}xC@2EXb)w8aha6sRuCRb^2~EyS=3QjaJYDky&hJZY zI>(>vZ}LYZ-;Z50k4D~bu6gS4m<4H3B~LDaPs{+XyuBS@PV2h}KJKI4@c~Q$q}2@Z z7`#{lc1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eem+dcrw) zx64&?Ni)0*1d44WMooQyLTEa4Z1{kW9|Nqu5mk$sbr{Frb_^#1COmVQC<-7 z{GDyU;x)-%uP3Ryas?TwOKg;0`a?3(p~U?PA~f4xMe6DaKfga@a8`O{RlwNpm4d5Z^tiF!d;N|DhHneFw_Tl9t$K^JmJ zP2_|sYpQWE|3{_jHuDz=JU=$qcRSAFl3C@bC@ePQ__BTOpH~;_u002ovPDHLkV1kPao2dW* diff --git a/public/img/logo/btc.svg b/public/img/logo/btc.svg new file mode 100644 index 0000000..eca66c2 --- /dev/null +++ b/public/img/logo/btc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/logo/ltc.svg b/public/img/logo/ltc.svg new file mode 100644 index 0000000..65625dd --- /dev/null +++ b/public/img/logo/ltc.svg @@ -0,0 +1,6 @@ + + + + + +