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.
151 lines
4.7 KiB
151 lines
4.7 KiB
var fs = require('fs');
|
|
var crypto = require('crypto');
|
|
var url = require('url');
|
|
|
|
var coins = require("./coins.js");
|
|
var credentials = require("./credentials.js");
|
|
|
|
var currentCoin = process.env.BTCEXP_COIN || "BTC";
|
|
|
|
var rpcCred = credentials.rpc;
|
|
|
|
if (rpcCred.cookie && !rpcCred.username && !rpcCred.password && fs.existsSync(rpcCred.cookie)) {
|
|
console.log(`Loading RPC cookie file: ${rpcCred.cookie}`);
|
|
|
|
[ rpcCred.username, rpcCred.password ] = fs.readFileSync(rpcCred.cookie).toString().split(':', 2);
|
|
|
|
if (!rpcCred.password) {
|
|
throw new Error(`Cookie file ${rpcCred.cookie} in unexpected format`);
|
|
}
|
|
}
|
|
|
|
var cookieSecret = process.env.BTCEXP_COOKIE_SECRET
|
|
|| (rpcCred.password && crypto.createHmac('sha256', JSON.stringify(rpcCred))
|
|
.update('btc-rpc-explorer-cookie-secret').digest('hex'))
|
|
|| "0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
|
|
|
|
|
|
var electrumXServerUriStrings = (process.env.BTCEXP_ELECTRUMX_SERVERS || "").split(',').filter(Boolean);
|
|
var electrumXServers = [];
|
|
for (var i = 0; i < electrumXServerUriStrings.length; i++) {
|
|
var uri = url.parse(electrumXServerUriStrings[i]);
|
|
|
|
electrumXServers.push({protocol:uri.protocol.substring(0, uri.protocol.length - 1), host:uri.hostname, port:parseInt(uri.port)});
|
|
}
|
|
|
|
module.exports = {
|
|
cookieSecret: cookieSecret,
|
|
demoSite: !!process.env.BTCEXP_DEMO,
|
|
coin: currentCoin,
|
|
|
|
rpcBlacklist:
|
|
process.env.BTCEXP_RPC_ALLOWALL ? []
|
|
: process.env.BTCEXP_RPC_BLACKLIST ? process.env.BTCEXP_RPC_BLACKLIST.split(',').filter(Boolean)
|
|
: [
|
|
"addnode",
|
|
"backupwallet",
|
|
"bumpfee",
|
|
"clearbanned",
|
|
"createmultisig",
|
|
"disconnectnode",
|
|
"dumpprivkey",
|
|
"dumpwallet",
|
|
"encryptwallet",
|
|
"generate",
|
|
"generatetoaddress",
|
|
"getaccountaddrss",
|
|
"getaddressesbyaccount",
|
|
"getbalance",
|
|
"getnewaddress",
|
|
"getrawchangeaddress",
|
|
"getreceivedbyaccount",
|
|
"getreceivedbyaddress",
|
|
"gettransaction",
|
|
"getunconfirmedbalance",
|
|
"getwalletinfo",
|
|
"importaddress",
|
|
"importmulti",
|
|
"importprivkey",
|
|
"importprunedfunds",
|
|
"importpubkey",
|
|
"importwallet",
|
|
"keypoolrefill",
|
|
"listaccounts",
|
|
"listaddressgroupings",
|
|
"listlockunspent",
|
|
"listreceivedbyaccount",
|
|
"listreceivedbyaddress",
|
|
"listsinceblock",
|
|
"listtransactions",
|
|
"listunspent",
|
|
"listwallets",
|
|
"lockunspent",
|
|
"logging",
|
|
"move",
|
|
"preciousblock",
|
|
"pruneblockchain",
|
|
"removeprunedfunds",
|
|
"rescanblockchain",
|
|
"savemempool",
|
|
"sendfrom",
|
|
"sendmany",
|
|
"sendtoaddress",
|
|
"sendrawtransaction",
|
|
"setaccount",
|
|
"setban",
|
|
"setnetworkactive",
|
|
"signmessage",
|
|
"signmessagewithprivatekey",
|
|
"signrawtransaction",
|
|
"stop",
|
|
"submitblock",
|
|
"verifychain",
|
|
"walletlock",
|
|
"walletpassphrase",
|
|
"walletpassphrasechange",
|
|
],
|
|
|
|
electrumXServers:electrumXServers,
|
|
|
|
site: {
|
|
blockTxPageSize:20,
|
|
addressTxPageSize:20,
|
|
txMaxInput:15,
|
|
browseBlocksPageSize:20
|
|
},
|
|
|
|
credentials: credentials,
|
|
|
|
siteTools:[
|
|
{name:"Node Status", url:"/node-status", desc:"Summary of this node: version, network, uptime, etc.", fontawesome:"fas fa-broadcast-tower"},
|
|
{name:"Peers", url:"/peers", desc:"Detailed info about the peers connected to this node.", fontawesome:"fas fa-sitemap"},
|
|
|
|
{name:"Browse Blocks", url:"/blocks", desc:"Browse all blocks in the blockchain.", fontawesome:"fas fa-cubes"},
|
|
{name:"Transaction Stats", url:"/tx-stats", desc:"See graphs of total transaction volume and transaction rates.", fontawesome:"fas fa-chart-bar"},
|
|
|
|
{name:"Mempool Summary", url:"/mempool-summary", desc:"Detailed summary of the current mempool for this node.", fontawesome:"fas fa-clipboard-list"},
|
|
{name:"Unconfirmed Transactions", url:"/unconfirmed-tx", desc:"Browse unconfirmed/pending transactions.", fontawesome:"fas fa-unlock-alt"},
|
|
|
|
{name:"RPC Browser", url:"/rpc-browser", desc:"Browse the RPC functionality of this node. See docs and execute commands.", fontawesome:"fas fa-book"},
|
|
{name:"RPC Terminal", url:"/rpc-terminal", desc:"Directly execute RPCs against this node.", fontawesome:"fas fa-terminal"},
|
|
|
|
{name:(coins[currentCoin].name + " Fun"), url:"/fun", desc:"See fun/interesting historical blockchain data.", fontawesome:"fas fa-certificate"}
|
|
],
|
|
|
|
donationAddresses:{
|
|
coins:["BTC", "LTC"],
|
|
sites:{"BTC":"https://btc.chaintools.io", "LTC":"https://ltc.chaintools.io"},
|
|
|
|
"BTC":{address:"3NPGpNyLLmVKCEcuipBs7G4KpQJoJXjDGe"},
|
|
"LTC":{address:"ME4pXiXuWfEi1ANBDo9irUJVcZBhsTx14i"}
|
|
},
|
|
|
|
headerDropdownLinks: {
|
|
title:"Related Sites",
|
|
links:[
|
|
{name: "Bitcoin Explorer", url:"https://btc.chaintools.io", imgUrl:"/img/logo/btc.svg"},
|
|
{name: "Litecoin Explorer", url:"https://ltc.chaintools.io", imgUrl:"/img/logo/ltc.svg"},
|
|
{name: "Lightning Explorer", url:"https://lightning.chaintools.io", imgUrl:"/img/logo/lightning.svg"},
|
|
]
|
|
}
|
|
};
|
|
|