How can I setup a local instance of https://github.com/Blockstream/electrs, for example to test/experiment with the Esplora backend for syncing BDK or LDK?
3 Answers
To setup a local instance running in the regtest network, you basically just have to run bitcoind -regtest as usual, and then follow the instructions given by the electrs installation instructions:
$ git clone https://github.com/blockstream/electrs && cd electrs
$ git checkout new-index
$ cargo run --release --bin electrs -- -vvvv --daemon-dir ~/.bitcoin
However, you have to give a --network=regtest to the last command and possibly need to adapt you bitcoin dir.
After the chain made some progress, the log outputs of electrs will spit out localhost addresses you can give to BDK, LDK transaction sync, or just an instance of rust-esplora-client:
INFO - REST server running on 127.0.0.1:3002
(Note that an Electrum RPC address is also given in case you prefer to use the Electrum protocol)
- 101
- 6
-
This is how I startup my `bitcoind` for regtest testing, I also enable filters for any CBF testing: `mkdir -p /tmp/regtest1/bitcoind; bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon ` For cookie authentication the file is at `/tmp/regtest1/bitcoind/regtest/.cookie`. – Not Mandatory Jan 27 '23 at 15:51
Here is an example if using Polar.
cargo run --release --bin electrs -- -vvvv --daemon-dir ~/.polar/networks/1/volumes/bitcoind/backend1/ --network=regtest
- 61
- 5
Nigiri is another way of doing it https://nigiri.vulpem.com/ though it comes with other things that you probably want to run yourself
- 21
- 3