6

I have 2 servers running:

  1. Ubuntu 18.04 running bitcoind daemon (v0.18.1 full blockchain synchronized)
  2. Ubuntu 18.04 running esplora (the local single page website works, but it has no data from the local blockchain)

Both servers are on the same network.

How do I configure esplora to point to the ip address of the bitcoind server? I would like to use my own full blockchain and explore it with esplora, aka a personal blockchain explorer.

The bitcoind server is already configured and working. So the only part remaining (I think) is to configure esplora to point to the bitcoind server. I can't find any clear instructions on how to do that.

4
+350

esplora is just the web ui frontend, you also need to setup the (forked) electrs backend for indexing and for providing the HTTP API that esplora queries.

electrs can index the bitcoin block chain using two methods: by reading the blk files directly out of disk, or by querying for blocks using the bitcoind rpc. The first method is significantly faster, but requires electrs to have filesystem access to the bitcoin datadir, which would typically mean running them on the same server (you could technically do this remotely but you'll lose most of the performance gain, so not much point in doing that). The second method can work if you have two separate servers, but I wouldn't recommend it (would be painfully slow).

To setup electrs, install Rust and:

$ sudo apt install clang cmake # required for building rust-rocksdb
$ git clone https://github.com/blockstream/electrs && cd electrs
$ git checkout new-index
$ cargo run --release --bin electrs -- -vvv --daemon-dir ~/.bitcoin

If the bitcoin datadir is not at ~/.bitcoin, change --daemon-dir to point to it. It should automatically pick up the rpc credentials from the cookie file. If you want to index from a remote bitcoind node, set --jsonrpc-import --daemon-rpc-addr <addr:port> --cookie <user:pass>.

By default, electrs will bind its HTTP API server on 127.0.0.1:3000. To enable remote access, it is recommended to setup a reverse proxy with tls (like nginx) in front of electrs. You could also set --http-addr <host:ip> to have electrs accept remote connections directly, but you probably shouldn't.

The initial indexing process will take quite some time and disk space (up to 1TB at the peak during the indexing, which then shrinks down to about 450GB after compaction). To test it worked, you can try issuing requests to the electrs HTTP API:

$ curl http://localhost:3000/blocks/tip/height
$ curl http://localhost:3000/address/1EMBaSSyxMQPV2fmUsdB7mMfMoocgfiMNw

Then, to start esplora and point it to your electrs server, install nodejs and:

$ git clone https://github.com/Blockstream/esplora && cd esplora
$ npm install

# needs to be set to the URL where the electrs HTTP API is available for
# requests coming from the user's browser. if you're browsing from the same
# machine running electrs, this should work:
$ export API_URL=http://localhost:3000/

# start a dev server on port 5000 (on-the-fly babel/browserify transpilation, slow, cpu hog)
$ npm run dev-server

# or pre-build the web ui as a static directory with:
$ npm run dist

You will then have the esplora web ui available at http://localhost:5000/. As with electrs, it is recommend to setup a tls-enabled frontend http server for remote access, either reverse proxying the dev server, or (more ideally) directly serving the pre-built static files.

The last thing that you'll need to do is configure electrs to accept cross-origin requests from the esplora web ui. Do to this, add --cors <origin> to the end of the cargo run command. If you're accessing esplora locally, --cors localhost:5000 should work. Otherwise, set it to the origin that the esplora web ui is served from. Or just use --cors '*' if you're okay allowing cors requests from all origins.

Alternatively, you could also use the esplora docker image that makes setting up everything (bitcoind+electrs+esplora) much easier, but that doesn't play nicely with an existing bitcoind node.

  • Trying this out now. – oshirowanen Nov 26 at 19:54
0

You can just mount the data dir of your bitcoind on the second linux and point esplora to it ? (note that it will probably be very slow, better to allow esplora to access the data directly and not via network)

  • I already have bitcoind pointing to the right place using datadir. But don't know how to get esplora to point to the bitcoind server. – oshirowanen Nov 21 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.