<p>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)</p>

CC BY-SA 4.0
2019-11-21T15:02:20.877Z
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
CC BY-SA 4.0
2019-11-21T13:22:01.623Z
2019-11-21T13:22:01.623Z
thedrs
<p>esplora is just the web ui frontend, you also need to setup the (forked) <a href="https://github.com/Blockstream/electrs" rel="nofollow noreferrer">electrs</a> backend for indexing and for providing the HTTP API that esplora queries.</p>
<p>electrs can index the bitcoin block chain using two methods: by reading the <code>blk</code> files directly out of disk, or by querying for blocks using the bitcoind rpc. The first method is <em>significantly</em> 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).</p>
<p>To setup electrs, <a href="https://www.rust-lang.org/tools/install" rel="nofollow noreferrer">install Rust</a> and:</p>
<pre><code>$ sudo apt install clang cmake # required for building rust-rocksdb
$ git clone https://github.com/blockstream/electrs &amp;&amp; cd electrs
$ git checkout new-index
$ cargo run --release --bin electrs -- -vvv --daemon-dir ~/.bitcoin
</code></pre>
<p>If the bitcoin datadir is not at <code>~/.bitcoin</code>, change <code>--daemon-dir</code> 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 <code>--jsonrpc-import --daemon-rpc-addr &lt;addr:port&gt; --cookie &lt;user:pass&gt;</code>.</p>
<p>By default, electrs will bind its HTTP API server on <code>127.0.0.1:3000</code>. To enable remote access, it is recommended to setup a reverse proxy with tls (like nginx) in front of electrs. You could also set <code>--http-addr &lt;host:ip&gt;</code> to have electrs accept remote connections directly, but you probably shouldn't.</p>
<p>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:</p>
<pre><code>$ curl http://localhost:3000/blocks/tip/height
$ curl http://localhost:3000/address/1EMBaSSyxMQPV2fmUsdB7mMfMoocgfiMNw
</code></pre>
<p>Then, to start esplora and point it to your electrs server, <a href="https://nodejs.org/en/download/package-manager/" rel="nofollow noreferrer">install nodejs</a> and:</p>
<pre><code>$ git clone https://github.com/Blockstream/esplora &amp;&amp; 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
</code></pre>
<p>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.</p>
<p>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 <code>--cors &lt;origin&gt;</code> to the end of the <code>cargo run</code> command. If you're accessing esplora locally, <code>--cors http://localhost:5000</code> should work. Otherwise, set it to the origin that the esplora web ui is served from. Or just use <code>--cors '*'</code> if you're okay allowing cors requests from all origins.</p>
<p>Alternatively, you could also use the <a href="https://github.com/Blockstream/esplora/#how-to-run-the-explorer-for-bitcoin-mainnet" rel="nofollow noreferrer">esplora docker image</a> that makes setting up everything (bitcoind+electrs+esplora) much easier, but that doesn't play nicely with an existing bitcoind node.</p>

CC BY-SA 4.0
2019-11-26T19:54:15.303Z
Trying this out now.
oshirowanen
CC BY-SA 4.0
2020-10-12T16:13:53.443Z
Hi @shesek, thanks for the setup information. It works and i did setup an nginx server as you suggested on gh, but am only getting some junk html, not esplora(its a vagrant vm  to test esplora installation). Could you share how you expose esplora static files using nginx? 

Also, how will `npm run dist` serve the Tor site? Wouldn't we have to run `dev-server` for that?
jodobear
CC BY-SA 4.0
2020-10-12T19:38:01.603Z
`npm run dist` prepares the static files, but it does not serve them. A simple `location / { root /path/to/dist/; try_files $uri /index.html; }` nginx configuration should do the trick for serving the static assets. You might also want to setup nginx as a reverse proxy to the electrs api backend, but its not strictly necessary - you can also configure `API_URL` to access electrs directly.
shesek
CC BY-SA 4.0
2019-11-22T18:48:42.110Z
2021-01-05T23:14:06.780Z
2021-01-05T23:14:06.780Z
shesek
<p>I have 2 servers running:</p>

<ol>
<li>Ubuntu 18.04 running bitcoind daemon (v0.18.1 full blockchain synchronized)</li>
<li>Ubuntu 18.04 running esplora (the local single page website works, but it has no data from the local blockchain)</li>
</ol>

<p>Both servers are on the same network.</p>

<p>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.</p>

<p>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.</p>

<bitcoin-core><blockchain><ubuntu><blockexplorer><esplora>
Configure esplora to point to the bitcoind servers ip address
oshirowanen
# Configure esplora to point to the bitcoind servers ip address

(Asked by: username_0 on 2019-11-17)

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.

**Tags:** bitcoin-core, blockchain, ubuntu, blockexplorer, esplora


---

## 2 answers

### Answer by username_2 on 2019-11-22. Score: 9 | Accepted answer

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  --cookie .
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  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  to the end of the cargo run command. If you're accessing esplora locally, --cors http://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.

> **Comments:**
> **username_0**: Trying this out now.  
> **username_3**: Hi @username_2, thanks for the setup information. It works and i did setup an nginx server as you suggested on gh, but am only getting some junk html, not esplora(its a vagrant vm  to test esplora installation). Could you share how you expose esplora static files using nginx?   Also, how will `npm run dist` serve the Tor site? Wouldn't we have to run `dev-server` for that?  
> **username_2**: `npm run dist` prepares the static files, but it does not serve them. A simple `location / { root /path/to/dist/; try_files $uri /index.html; }` nginx configuration should do the trick for serving the static assets. You might also want to setup nginx as a reverse proxy to the electrs api backend, but its not strictly necessary - you can also configure `API_URL` to access electrs directly.  

---

### Answer by username_1 on 2019-11-21. Score: 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)

> **Comments:**
> **username_0**: 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.  

---

