Coder Social home page Coder Social logo

janoside / btc-rpc-explorer Goto Github PK

View Code? Open in Web Editor NEW
1.5K 1.5K 1.1K 17.81 MB

Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.

Home Page: https://bitcoinexplorer.org

License: MIT License

JavaScript 60.49% CSS 1.40% Dockerfile 0.02% Pug 36.58% SCSS 1.51%
bitcoin bitcoin-blockchain bitcoin-explorer bitcoind bootstrap5 btc-rpc-explorer express json-rpc nodejs rpc

btc-rpc-explorer's People

Contributors

abhishandy avatar arno01 avatar cd2357 avatar dirkson643 avatar dougefresh avatar experibass avatar guggero avatar henrikuittinen avatar janoside avatar jonasschnelli avatar josephgoulden avatar jsarenik avatar jtcleek avatar ketominer avatar kixunil avatar lukechilds avatar neptunix avatar nerfzooka avatar oktapodia avatar pantamis avatar periodic1236 avatar pointbiz avatar qshuai avatar sangaman avatar shesek avatar st3b1t avatar thierry61 avatar tyzbit avatar v0s avatar yamada-guro-baru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btc-rpc-explorer's Issues

Whitelist RPC calls on the RPC terminal

I accidentally killed it by sending the stop RPC command (sorry for that).

You should build a whitelist of authorized RPC calls, excluding stop, wallet calls and such.

Load cookie auth from daemon data dir

Allow us to specify the data dir of the coin so that you can retrieve the cookie auth. This complements docker support through a simple volume share. :)

FYI, trying to integrate this as an optional service in btcpayserver. :)

SyntaxError: Unexpected token [

I see the following error:


blk@e8020:~/Elements/work/btc-rpc-explorer$ npm start

[email protected] start /media/blk/Elements/work/btc-rpc-explorer
node ./bin/www

/media/blk/Elements/work/btc-rpc-explorer/app/utils.js:360
var [lead,decimal,pow] = val.toString().split(/e|./);
^

SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/media/blk/Elements/work/btc-rpc-explorer/app.js:14:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)

npm ERR! Linux 4.10.0-32-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the btc-rpc-explorer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs btc-rpc-explorer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls btc-rpc-explorer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /media/blk/Elements/work/btc-rpc-explorer/npm-debug.log

Socket Hangups for RPC calls

While trying to access http://localhost:8332
I get the following error and unable to access the website through browser.

Error for RPC command 'getchaintxstats': Error: socket hang up
Error for RPC command 'getchaintxstats': Error: socket hang up
Error for RPC command 'getblockchaininfo': Error: socket hang up
Unhandled Rejection at: Promise Promise {
{ Error: socket hang up
at createHangUpError (_http_client.js:322:15)
at Socket.socketOnEnd (_http_client.js:425:23)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1085:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
cause:
{ Error: socket hang up

plotting the chart

good work and keep it coming wondering if there is a way to plot chart with RPC and php array data, would be an amazing addon to yours explorer

Better handling of many-input transactions

Transactions with high numbers of inputs can cause issues when viewing block-details or transaction-details pages.

Example block:
Height 478453
Hash 000000000000000000f2f2b3f56c37ceb7566a3512d3732b1e2528a07586f9fa

Example tx:
1f7ef5e54138b77a8b7210b05e30dfde7fa03d5238e15a2b335f0926e75e0c9d

Cannot read property 'vin' of undefined

I can not write pug code, but I encounter this problem. The problem is viewing some blocks is working well but others not.

/Users/scrapup/cpp/bti/btc-rpc-explorer/views/includes/block-content.pug:126 124| div(class="row") 125| div(class="col-md-6") > 126| h6 Input (#{tx.vin.length.toLocaleString()}) 127| if (result.txInputsByTransaction[tx.txid]) 128| - var totalInputValue = new Decimal(0); 129| table(class="table mb-0") Cannot read property 'vin' of undefined

TypeError: /Users/scrapup/cpp/bti/btc-rpc-explorer/views/includes/block-content.pug:126
    124| 						div(class="row")
    125| 							div(class="col-md-6")
  > 126| 								h6 Input (#{tx.vin.length.toLocaleString()})
    127| 								if (result.txInputsByTransaction[tx.txid])
    128| 									- var totalInputValue = new Decimal(0);
    129| 									table(class="table mb-0")

Cannot read property 'vin' of undefined

Timeout Error with Raspberry Pi

Setup

Raspberry Pi 3 B+ with external HDD (1TB)
Linux raspberrypi 4.14.62-v7+ #1134 SMP Tue Aug 14 17:10:10 BST 2018 armv7l GNU/Linux
Nodejs: v8.11.1
Npm: 6.4.1
Bitcoin Core Daemon version v0.17.99.0-bb0277819

When trying to connect to the Website with my Browser, I get this error. My suspicion is that my Raspberry Pi ist just very slow since the SD card and HDD are not the fastest. I have it running with Litecoin on my other Raspberry Pi without problems.

Error Message

Unhandled Rejection at: Promise Promise {
_bitField: 154402816,
_fulfillmentHandler0:
{ Error: ESOCKETTIMEDOUT
at ClientRequest. (/home/pi/btc-rpc-explorer/node_modules/request/request.js:813:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at ClientRequest.emit (events.js:208:7)
at Socket.emitTimeout (_http_client.js:711:34)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)
cause: { Error: ESOCKETTIMEDOUT
at ClientRequest. (/home/pi/btc-rpc-explorer/node_modules/request/request.js:813:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at ClientRequest.emit (events.js:208:7)
at Socket.emitTimeout (_http_client.js:711:34)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5) code: 'ESOCKETTIMEDOUT', connect: false },
isOperational: true,
code: 'ESOCKETTIMEDOUT',
connect: false },
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined,
_boundTo:
Client {
agentOptions: undefined,
auth:
{ pass: 'xxx=',
user: 'xxx' },
hasNamedParametersSupport: false,
headers: false,
host: '127.0.0.1',
password: 'xxx=',
port: 8332,
timeout: 5000,
ssl: { enabled: false, strict: false },
request:
{ [Function]
get: [Function],
head: [Function],
post: [Function],
put: [Function],
patch: [Function],
del: [Function],
delete: [Function],
cookie: [Function],
jar: [Function],
defaults: [Function],
getAsync: [Function: ret],
headAsync: [Function: ret],
postAsync: [Function: ret],
putAsync: [Function: ret],
patchAsync: [Function: ret],
delAsync: [Function: ret],
deleteAsync: [Function: ret],
cookieAsync: [Function: ret],
jarAsync: [Function: ret],
defaultsAsync: [Function: ret] },
requester: Requester { unsupported: [], version: undefined },
parser: Parser { headers: false } } } reason: { Error: ESOCKETTIMEDOUT
at ClientRequest. (/home/pi/btc-rpc-explorer/node_modules/request/request.js:813:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at ClientRequest.emit (events.js:208:7)
at Socket.emitTimeout (_http_client.js:711:34)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)
cause: { Error: ESOCKETTIMEDOUT
at ClientRequest. (/home/pi/btc-rpc-explorer/node_modules/request/request.js:813:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at ClientRequest.emit (events.js:208:7)
at Socket.emitTimeout (_http_client.js:711:34)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5) code: 'ESOCKETTIMEDOUT', connect: false },
isOperational: true,
code: 'ESOCKETTIMEDOUT',
connect: false } stack: Error: ESOCKETTIMEDOUT
at ClientRequest. (/home/pi/btc-rpc-explorer/node_modules/request/request.js:813:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at ClientRequest.emit (events.js:208:7)
at Socket.emitTimeout (_http_client.js:711:34)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)

Getting Error When Trying To View Individual Blocks

visiting an individual block url, such as http://127.0.0.1:3002/block-height/535967, results in the following error:

/Users/redacted/Development/btc-rpc-explorer/views/includes/transaction-io-details.pug:10 8| each txInput, txInputIndex in txInputs 9| if (txInput) > 10| - var vout = txInput.vout[tx.vin[txInputIndex].vout]; 11| if (vout.value) 12| - totalInputValue = totalInputValue.plus(new Decimal(vout.value)); 13| Cannot read property 'undefined' of undefined

TypeError: /Users/redacted/Development/btc-rpc-explorer/views/includes/transaction-io-details.pug:10
    8| each txInput, txInputIndex in txInputs
    9| 	if (txInput)
  > 10| 		- var vout = txInput.vout[tx.vin[txInputIndex].vout];
    11| 		if (vout.value)
    12| 			- totalInputValue = totalInputValue.plus(new Decimal(vout.value));
    13| 

Cannot read property 'undefined' of undefined
    at eval (eval at wrap (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:1145:24)
    at eval (eval at wrap (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:1170:4)
    at eval (eval at wrap (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:2483:4)
    at template (eval at wrap (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:2900:72)
    at Object.exports.renderFile (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug/lib/index.js:427:38)
    at Object.exports.renderFile (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug/lib/index.js:417:21)
    at exports.__express (/Users/redacted/Development/btc-rpc-explorer/node_modules/pug/lib/index.js:464:11)
    at View.app.engine (/Users/redacted/Development/btc-rpc-explorer/app.js:39:23)
    at View.render (/Users/redacted/Development/btc-rpc-explorer/node_modules/express/lib/view.js:135:8)
    at tryRender (/Users/redacted/Development/btc-rpc-explorer/node_modules/express/lib/application.js:640:10)
    at Function.render (/Users/redacted/Development/btc-rpc-explorer/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/Users/redacted/Development/btc-rpc-explorer/node_modules/express/lib/response.js:1008:7)
    at /Users/redacted/Development/btc-rpc-explorer/routes/baseActionsRouter.js:405:8
    at process._tickCallback (internal/process/next_tick.js:109:7)

As a sanity check, the RPC calls to my node for getblockhash and getblock work fine via curl. Running macOS Sierra. Any thoughts?

Thanks for a great tool!

Add RPC API version management

App currently does not identify what version of node software it's connected to and therefore doesn't tailor itself to different versions of the RPC API. This should be changed or at least noted somehow.

No auth mechanism defined

I am using below credentials for connecting with my btc node.

const client = new Client({
host: 'localhost',
port: 18332,
timeout: 30000,
user: 'admin',
pass: 'admin'
});

And after using this i'm getting the below error -

Unhandled rejection Error: no auth mechanism defined
at Auth.onRequest (/home/ireslab11/Desktop/node/node/node_modules/request/lib/auth.js:132:32)
at Request.auth (/home/ireslab11/Desktop/node/node/node_modules/request/request.js:1347:14)
at Request.init (/home/ireslab11/Desktop/node/node/node_modules/request/request.js:378:10)
at new Request (/home/ireslab11/Desktop/node/node/node_modules/request/request.js:127:8)
at request (/home/ireslab11/Desktop/node/node/node_modules/request/index.js:53:10)
at /home/ireslab11/Desktop/node/node/node_modules/request/index.js:61:12
at Object.apply (/home/ireslab11/Desktop/node/node/node_modules/@uphold/request-logger/src/index.js:27:19)
at Function.post (/home/ireslab11/Desktop/node/node/node_modules/request/index.js:100:12)
at Function.tryCatcher (/home/ireslab11/Desktop/node/node/node_modules/bluebird/js/release/util.js:16:23)
at Function.ret [as postAsync] (eval at makeNodePromisifiedEval (/home/ireslab11/Desktop/node/node/node_modules/bluebird/js/release/promisify.js:184:12), :14:23)
at _bluebird.default.try (/home/ireslab11/Desktop/node/node/node_modules/bitcoin-core/dist/src/index.js:168:27)
at tryCatcher (/home/ireslab11/Desktop/node/node/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/home/ireslab11/Desktop/node/node/node_modules/bluebird/js/release/method.js:39:29)
at Client.command (/home/ireslab11/Desktop/node/node/node_modules/bitcoin-core/dist/src/index.js:154:33)
at apply (/home/ireslab11/Desktop/node/node/node_modules/lodash/lodash.js:495:27)
at Client.wrapper [as getInfo] (/home/ireslab11/Desktop/node/node/node_modules/lodash/lodash.js:5356:16)

Add http rest API

So this explorer can turn into pluggable backend for light wallet clients (once additional indexing by address is added)

Transaction stats: Error 500: Work queue depth exceeded

Running your fantastic block explorer on an Odroid HC2 with Debian, everything working very nicely.

Only when clicking on "Transaction stats" I can see on the console that the following error is generated, and the page is loading indefinitely.

  message: 'Internal Server Error',
  body: 'Work queue depth exceeded',
  code: 500,
  name: 'RpcError' } stack: RpcError: Internal Server Error
    at Client.rpc (/home/web/btc-rpc-explorer/node_modules/bitcoin-core/dist/src/parser.js:73:13)
    at Client.tryCatcher (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/promise.js:694:18)
    at Promise._fulfill (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/promise.js:638:18)
    at Request._callback (/home/web/btc-rpc-explorer/node_modules/bluebird/js/release/nodeback.js:45:21)
    at Request.self.callback (/home/web/btc-rpc-explorer/node_modules/request/request.js:186:22)
    at emitTwo (events.js:131:20)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/web/btc-rpc-explorer/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/web/btc-rpc-explorer/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)

No big deal, but maybe it helps to point out possible improvements.

On the third click it went through and the graphs were shown.

Search by address

Hey janoside,

thank you for the nice explorer! I modified it to support another coin and search by block id, block hash, and transaction hash works well. Also, block 0 gets displayed without problems.

I only run into problems when I search by address. Do I need to modify any other value to get this working?

Invalid query: ihgcntcbzgkvfuwfkvq7ghzpzmp26uyscs

Greetings,
Chris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.