Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when clicking on any block to get info when txindex=0 #664

Open
tadeubas opened this issue Sep 30, 2024 · 4 comments · May be fixed by #699
Open

Error when clicking on any block to get info when txindex=0 #664

tadeubas opened this issue Sep 30, 2024 · 4 comments · May be fixed by #699
Labels

Comments

@tadeubas
Copy link
Contributor

Describe the bug

When trying to click on a block I got an error

Environment (please complete the following information):

  • Bitcoin Core / Node Version [e.g. 0.16.3] v27.1.0
  • NodeJS Version [e.g. 9.x] v18.19.1
  • Browser [e.g. chrome, safari] brave
  • Code Version / Commit [e.g. ab6cde8] ffd8022
  • Installation Method [e.g. "npm" or "source code"] source code

Configuration file content

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

  • bitcoin.conf:
# [relay]
# Accept transaction replace-by-fee without requiring replaceability signaling.
mempoolfullrbf=1
# Relay non-P2SH multisig transactions.
permitbaremultisig=0

# [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 <ip> 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 (<anonymous>)
    at Object.eval (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:479:28)
    at Object.pug_interp [as txList] (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:1102:4)
    at block (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:5443:21)
    at Object.pug_interp (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:173:10)
    at block (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:5440:30)
    at Object.pug_interp (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:1210:10)
    at eval (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:4916:23)
    at template (eval at wrap (btc-rpc-explorer/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:6019:7)
    at exports.renderFile (btc-rpc-explorer/node_modules/pug/lib/index.js:454:38)
@tadeubas tadeubas added the bug label Sep 30, 2024
@tadeubas
Copy link
Contributor Author

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 tadeubas changed the title Latest commit gives error when clicking on any block to get info Error when clicking on any block to get info Sep 30, 2024
@tadeubas
Copy link
Contributor Author

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?

@hasti0073
Copy link

1JjXPKN1yyPMxi2WvJv4BHVaJqqgzxSRGg

@tadeubas
Copy link
Contributor Author

tadeubas commented Dec 5, 2024

I've managed to access blocks by commenting the whole if and else: if (!coinbaseTx && Object.keys(txInputs).length < tx.vin.length)...

@tadeubas tadeubas changed the title Error when clicking on any block to get info Error when clicking on any block to get info when txindex=0 Dec 19, 2024
@0xf0xx0 0xf0xx0 linked a pull request Dec 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants