Skip to content
Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information
pendingbot committed Nov 21, 2019
2 parents a05c766 + 1958749 commit 839fed3ea094d1e91e8db7db6b72ced1ba61501d
@@ -0,0 +1,54 @@
#### Pending Release

* Version number in footer
* `/changelog` linked in footer

#### v1.1.2
###### 2019-10-17

* Add back map on `/peers` that was lost with recent bug

#### v1.1.1
###### 2019-10-01

* Add new default blacklist items for some 'hidden' RPCs
* Print app version info to log on startup
* Remove LTC site from footer

#### v1.1.0
###### 2019-09-30

* Show spent/unspent status on tx detail pages
* Show mempool ancestor/descendant txs on tx detail pages
* Blacklist 'createwallet' by default
* Show RBF status for unconfirmed txs
* Faster, more reliable display of `/mempool-summary` and `/unconfirmed-tx` pages
* Fix for persisting arg values in UI on `/rpc-browser`
* Misc minor fixes and ux tweaks

#### v1.0.3
###### 2019-04-27

* Pluggable address API supporting different implementations
* Logging improvements
* Fix to avoid caching unconfirmed txs
* Identify destroyed fees
* Misc minor fixes and ux tweaks

#### v1.0.2
###### 2019-03-13

* Fix for background color on light theme

#### v1.0.1
###### 2019-03-13

* Dark theme
* Tx rate graph on homepage
* Improved caching
* Misc minor fixes and ux tweaks

#### v1.0.0
###### 2019-02-23

* Initial release
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Dan Janosik
Copyright (c) 2018-2019 Dan Janosik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -23,6 +23,10 @@ Live demo available at: [https://btc-explorer.com](https://btc-explorer.com)
* RPC command browser and terminal
* Currently supports BTC, LTC, MONA (support for any Bitcoin-RPC-protocol-compliant coin can be added easily)

# Changelog / Release notes

See [CHANGELOG.md](/CHANGELOG.md).

# Getting started

The below instructions are geared toward BTC, but can be adapted easily to other coins.
27 app.js
@@ -139,12 +139,27 @@ function getSourcecodeProjectMetadata() {
});
}

function loadChangelog() {
var filename = "CHANGELOG.md";

fs.readFile(filename, 'utf8', function(err, data) {
if (err) {
utils.logError("2379gsd7sgd334", err);

} else {
global.changelogMarkdown = data;
}
});
}


app.onStartup = function() {
global.config = config;
global.coinConfig = coins[config.coin];
global.coinConfigs = coins;

loadChangelog();

if (global.sourcecodeVersion == null && fs.existsSync('.git')) {
simpleGit(".").log(["-n 1"], function(err, log) {
if (err) {
@@ -181,7 +196,17 @@ app.continueStartup = function() {
timeout: rpcCred.timeout
};

global.client = new bitcoinCore(rpcClientProperties);
global.rpcClient = new bitcoinCore(rpcClientProperties);

var rpcClientNoTimeoutProperties = {
host: rpcCred.host,
port: rpcCred.port,
username: rpcCred.username,
password: rpcCred.password,
timeout: 0
};

global.rpcClientNoTimeout = new bitcoinCore(rpcClientNoTimeoutProperties);

coreApi.getNetworkInfo().then(function(getnetworkinfo) {
debugLog(`Connected via RPC to node. Basic info: version=${getnetworkinfo.version}, subversion=${getnetworkinfo.subversion}, protocolversion=${getnetworkinfo.protocolversion}, services=${getnetworkinfo.localservices}`);
@@ -269,6 +269,8 @@ function getRpcData(cmd) {
debugLog(`RPC: ${cmd}`);

rpcCall = function(callback) {
var client = (cmd == "gettxoutsetinfo" ? global.rpcClientNoTimeout : global.rpcClient);

client.command(cmd, function(err, result, resHeaders) {
if (err) {
utils.logError("32euofeege", err, {cmd:cmd});
@@ -295,7 +297,7 @@ function getRpcDataWithParams(request) {
debugLog(`RPC: ${JSON.stringify(request)}`);

rpcCall = function(callback) {
client.command([request], function(err, result, resHeaders) {
global.rpcClient.command([request], function(err, result, resHeaders) {
if (err != null) {
utils.logError("38eh39hdee", err, {result:result, headers:resHeaders});

@@ -367,7 +367,7 @@ function refreshExchangeRates() {
// Uses ipstack.com API
function geoLocateIpAddresses(ipAddresses, provider) {
return new Promise(function(resolve, reject) {
if (config.privacyMode || config.ipStackComApiAccessKey === undefined) {
if (config.privacyMode || config.credentials.ipStackComApiAccessKey === undefined) {
resolve({});

return;

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
{
"name": "btc-rpc-explorer",
"version": "1.1.1",
"version": "1.1.2",
"description": "Explorer for Bitcoin and RPC-compatible blockchains",
"private": false,
"bin": "bin/cli.js",
@@ -36,6 +36,7 @@
"express-session": "1.16.1",
"jstransformer-markdown-it": "^2.1.0",
"lru-cache": "5.1.1",
"marked": "0.7.0",
"meow": "^5.0.0",
"moment": "^2.24.0",
"moment-duration-format": "2.2.2",
@@ -52,6 +52,10 @@ pre {
word-wrap: break-word;
}

dd {
margin-bottom: 1rem;
}

.word-wrap {
word-wrap: break-word;
word-break: break-all;
@@ -12,6 +12,7 @@ var bitcoinjs = require('bitcoinjs-lib');
var sha256 = require("crypto-js/sha256");
var hexEnc = require("crypto-js/enc-hex");
var Decimal = require("decimal.js");
var marked = require("marked");

var utils = require('./../app/utils.js');
var coins = require("./../app/coins.js");
@@ -229,17 +230,17 @@ router.post("/connect", function(req, res, next) {
req.session.port = port;
req.session.username = username;

var client = new bitcoinCore({
var newClient = new bitcoinCore({
host: host,
port: port,
username: username,
password: password,
timeout: 30000
});

debugLog("created client: " + client);
debugLog("created new rpc client: " + newClient);

global.client = client;
global.rpcClient = newClient;

req.session.userMessage = "<strong>Connected via RPC</strong>: " + username + " @ " + host + ":" + port;
req.session.userMessageType = "success";
@@ -256,9 +257,9 @@ router.get("/disconnect", function(req, res, next) {
req.session.port = "";
req.session.username = "";

debugLog("destroyed client.");
debugLog("destroyed rpc client.");

global.client = null;
global.rpcClient = null;

req.session.userMessage = "Disconnected from node.";
req.session.userMessageType = "success";
@@ -575,7 +576,7 @@ router.get("/tx/:transactionId", function(req, res, next) {
}

promises.push(new Promise(function(resolve, reject) {
client.command('getblock', rawTxResult.blockhash, function(err3, result3, resHeaders3) {
global.rpcClient.command('getblock', rawTxResult.blockhash, function(err3, result3, resHeaders3) {
res.locals.result.getblock = result3;

var txids = [];
@@ -945,7 +946,7 @@ router.post("/rpc-terminal", function(req, res, next) {
return;
}

client.command([{method:cmd, parameters:parsedParams}], function(err, result, resHeaders) {
global.rpcClientNoTimeout.command([{method:cmd, parameters:parsedParams}], function(err, result, resHeaders) {
debugLog("Result[1]: " + JSON.stringify(result, null, 4));
debugLog("Error[2]: " + JSON.stringify(err, null, 4));
debugLog("Headers[3]: " + JSON.stringify(resHeaders, null, 4));
@@ -1060,7 +1061,7 @@ router.get("/rpc-browser", function(req, res, next) {

debugLog("Executing RPC '" + req.query.method + "' with params: [" + argValues + "]");

client.command([{method:req.query.method, parameters:argValues}], function(err3, result3, resHeaders3) {
global.rpcClientNoTimeout.command([{method:req.query.method, parameters:argValues}], function(err3, result3, resHeaders3) {
debugLog("RPC Response: err=" + err3 + ", result=" + result3 + ", headers=" + resHeaders3);

if (err3) {
@@ -1191,6 +1192,14 @@ router.get("/about", function(req, res, next) {
next();
});

router.get("/changelog", function(req, res, next) {
res.locals.changelogHtml = marked(global.changelogMarkdown);

res.render("changelog");

next();
});

router.get("/fun", function(req, res, next) {
var sortedList = coins[config.coin].historicalData;
sortedList.sort(function(a, b){
@@ -4,7 +4,7 @@ block headContent
title About

block content
h1(class="h3") About
h1.h3 About
hr

p This tool is intended to be a simple, self-hosted explorer for the #{coinConfig.name} blockchain, driven by RPC calls to your own node. This tool is easy to run but lacks some features compared to database-backed explorers.
@@ -10,7 +10,7 @@ block content
br
small(class="monospace") #{address}
else
h1(class="h3") Address
h1.h3 Address
br
small(class="monospace") #{address}

@@ -75,7 +75,7 @@ block content

if (false)
pre
code(class="json bg-light") #{JSON.stringify(addressObj, null, 4)}
code.json.bg-light #{JSON.stringify(addressObj, null, 4)}

ul(class='nav nav-tabs mb-3')
li(class="nav-item")
@@ -146,7 +146,7 @@ block content

if (false)
pre
code(class="json bg-light") #{JSON.stringify(firstSeenTransaction)}
code.json.bg-light #{JSON.stringify(firstSeenTransaction)}

if (balance)
if (balance.conflictedResults)
@@ -315,7 +315,7 @@ block content

each tx, txIndex in transactions
//pre
// code(class="json bg-light") #{JSON.stringify(tx, null, 4)}
// code.json.bg-light #{JSON.stringify(tx, null, 4)}
div(class=("xcard bg-light rounded shadow-sm " + ((txIndex < (transactions.length - 1) || txids.length > limit) ? "mb-4" : "")))
div(class="card-header monospace clearfix")
div(class="float-left", style="margin-right: 0px;")
@@ -373,7 +373,7 @@ block content

if (false)
pre
code(class="json bg-light") #{JSON.stringify(transactions, null, 4)}
code.json.bg-light #{JSON.stringify(transactions, null, 4)}

if (!crawlerBot && addressDetails && addressDetails.txCount > limit)
- var txCount = addressDetails.txCount;
@@ -4,7 +4,7 @@ block headContent
title Block ##{result.getblock.height.toLocaleString()}, #{result.getblock.hash}

block content
h1(class="h3") Block
h1.h3 Block
small(style="width: 100%;", class="monospace") ##{result.getblock.height.toLocaleString()}
br
small(style="width: 100%;", class="monospace word-wrap") #{result.getblock.hash}
@@ -10,7 +10,7 @@ block headContent
}

block content
h1(class="h3") RPC Browser
h1.h3 RPC Browser
hr

if (gethelp)
@@ -0,0 +1,10 @@
extends layout

block headContent
title Changelog

block content
h1.h3 Changelog
hr

| !{changelogHtml}
@@ -6,11 +6,11 @@ block content

if (message)
pre
code(class="json bg-light") !{message}
code.json.bg-light !{message}
else
p Unknown error

if (error)
h2 #{error.status}
pre
code(class="json bg-light") #{error.stack}
code.json.bg-light #{error.stack}
@@ -4,7 +4,7 @@ block headContent
title #{coinConfig.name} Fun

block content
h1(class="h3") #{coinConfig.name} Fun
h1.h3 #{coinConfig.name} Fun
hr

p Below is a list of fun/interesting things in the #{coinConfig.name} blockchain. Some are historical firsts, others are just fun or cool.

0 comments on commit 839fed3

Please sign in to comment.
You can’t perform that action at this time.