janoside / btc-rpc-explorer

Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
https://bitcoinexplorer.org
MIT License
1.56k stars 1.18k forks source link

Error when clicking on any block to get info #664

Open tadeubas opened 1 month ago

tadeubas commented 1 month ago

Describe the bug

When trying to click on a block I got an error

Environment (please complete the following information):

Configuration file content

Please include the content from the following files. BE SURE TO MODIFY YOUR CREDENTIALS BEFORE SUBMITTING!!!

[rpc]

Accept command line and JSON-RPC commands.

Needed for electrs

server=1

Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times. (default: 127.0.0.1 and ::1 i.e., localhost)

rpcbind=0.0.0.0

Allow JSON-RPC connections from specified source. Valid for are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times.

rpcallowip=0.0.0.0/0


 - Your btc-rpc-explorer environment configuration (either `$WORKING_DIR/.env` or `~/.config/btc-rpc-explorer.env`)

BTCEXP_BITCOIND_COOKIE=/media/myuser/mydisk/Bitcoin/.cookie

BTCEXP_ADDRESS_API=electrum

BTCEXP_ELECTRUM_SERVERS=tcp://127.0.0.1:50001

BTCEXP_ELECTRUM_TXINDEX=true

BTCEXP_PRIVACY_MODE=true


**To Reproduce**

Steps to reproduce the behavior:
1. Go to http://127.0.0.1:3002/
2. Click on any block
3. See error

**Screenshots or Log Output**

TypeError: btc-rpc-explorer/views/includes/shared-mixins.pug:227 225| 226|

227| if (!coinbaseTx && Object.keys(txInputs).length < tx.vin.length) 228| +infoBadge 229| span(data-bs-toggle="tooltip", title="Data truncated by performance settings. See transaction details for fee info.") 230| span.fw-light …

Cannot convert undefined or null to object at Function.keys () at Object.eval (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :479:28) at Object.pug_interp [as txList] (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :1102:4) at block (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :5443:21) at Object.pug_interp (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :173:10) at block (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :5440:30) at Object.pug_interp (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :1210:10) at eval (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :4916:23) at template (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), :6019:7) at exports.renderFile (btc-rpc-explorer/node_modules/pug/lib/index.js:454:38)

tadeubas commented 1 month ago

Actually I can't see anything, tx and addr gives error 403: ForbiddenError: invalid csrf token, I've noticed this on logs:

btcexp:app txindex check: trying getindexinfo +0ms
btcexp:app txindex check: getindexinfo={} +3ms
btcexp:app txindex check: unavailable +0ms
tadeubas commented 1 month ago

I managed to make addrs search and tx navigation by usign the config BTCEXP_NOTXINDEX_SEARCH_DEPTH=0. It appears to be necessary to enable txindex on the bitcoin core in order to btc explorer to work properly, the config BTCEXP_ELECTRUM_TXINDEX=true is not working?