Installing Electrs ontop of Dojo

A guide on how to utilize your Dojo backend with Electrs Private Server to connect hardware devices (i.e Trezor, Cold Card, Ledger) to your own Full Dojo node completely over Tor.

Prep Dojo

In order to connect to External Apps via RPC (like Electrs, Explorer, and LND) you'll need to modify the default settings of your Dojo.

You must be on Dojo v1.2 to not produce errors.

$ cd dojo/docker/my-dojo
$ sudo ./ stop
$ cd conf
$ sudo nano docker-bitcoind.conf

#You must change line 73: to the IP of your Pi

Ctrl+X, y, Enter
$ cd ..
$ sudo ./ start

You Dojo is now ready to connect to external apps.

Getting Started

Electrs is a unique build of ElectrumX server as it is written in Rust language and much more efficient on your resources. So first let's install Rust:

$ sudo curl -sf -L | sh

If you'd like to few this script and verify its source. Go to

Now, lets set up the environment so we can properly install:

$ source $HOME/.cargo/env
#NOTE: this step is extremely important

Next we need to get clang in order for rust to build the rust-rocksdb

$ sudo apt update
$ sudo apt install -y clang cmake  # for building 'rust-rocksdb'

Now we have the required tools to build electrs. Let's pull the code:

$ sudo git clone
$ cd /home/***USER***/electrs
$ sudo cargo build --release

Now this is going to take some time. If you get an error at the end, re-enter the environment comment from above ($ source $HOME/.cargo/env) and run again.

Now in a new window we can start prepping the database

$ sudo mkdir /mnt/hdd/electrs/db 

Note: This recommended to be on your external device your dojo is set up on. You can expect the full index to be around 40-50GB.

Once the install of Electrs is complete, before we run it. Let's go ahead and create our config.toml file.

$ nano /home/**USER**/.electrs/config.toml
#Paste the following in the file:
verbose = 4
timestamp = true
jsonrpc_import = true
db_dir = "/mnt/hdd/electrs/db"

#save and exit with Ctrl+X, y, Enter

Lock down the port 50001 via UFW (even tho we will be connecting thru Tor, best to lock it down)

$ sudo ufw allow from 192.168.X.X/24 to any port 50001 comment 'Electrs access restricted to local LAN only' 

Start Electrs

$ cd /home/**user**/electrs
$ cargo run --release -- -vvv --timestamp  --index-batch-size=100 --db-dir /mnt/hdd/electrs/db --electrum-rpc-addr="" --daemon-rpc-addr="<YOUR.DOJO.EXTERNAL.APP.IP:28256"

Important to note that you must enable external apps in your Dojo bitcoin.conf file. Unless you are utilizing your Dojo's RPC via Local LAN, ie from Pi to Laptop, you can keep the IP address as . However, if you are using other apps on your Local LAN, you'll need to substitute the above IP with the IP of your RPi4.

If you get errors, enter Ctrl+C and enter the following:

$ sudo /home/**user**/.cargo/bin/cargo run --release -- --index-batch-size=100 --electrum-rpc-addr=""

Now that is going to take awhile to sync. So lets setup tor as a service outside the docker. (Guide credit:

$ sudo nano /etc/apt/sources.list
#add the following:
deb stretch main
deb-src stretch main
#Save and exit with: Ctrl+X, y, Enter

In order to verify the integrity of the Tor files, download and add the signing keys of the torproject using the network certificate management service (dirmngr).

$ sudo apt install dirmngr apt-transport-https
$ curl | gpg --import
$ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -

Create a new user for Tor

$ sudo useradd -m toruser
##create password and remember it
$ sudo usermod -aG sudo toruser
$ su toruser

The latest version of Tor can now be installed. While not required, tor-arm provides a dashboard that you might find useful.

$ sudo apt update
$ sudo apt install tor tor-arm

edit the torrc

$ sudo nano /etc/tor/torrc
# uncomment:
ControlPort 9051
CookieAuthentication 1

# add:
CookieAuthFileGroupReadable 1
# also add:

# Hidden Service for Electrum Server
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServiceVersion 3
HiddenServicePort 50001

#Save and exit: Ctrl+X, y, Enter

$ sudo systemctl restart tor

Check the onion address of your new hidden service

$ sudo cat /var/lib/tor/hidden_service/hostname

## At this point you can switch back to your main account/electrs account if you created a new user for it
$ su **username**

Install Electrum on Host device by following the steps at:

Now that Electrum is downloaded on your host device we are going to set it up to connect thru Tor (so if you don't have tor or tor browser set up do that now) Note: If you use tor browser the Port is 9051, tor service is 9050.

Once Electrum is downloaded it is important to make sure you are in the right env and PATH so the commands work properly:

$ PATH=$PATH:~/.local/bin
$ touch ~/.profile
$ export PATH
$ ~/.profile

Start electrum with the Tor Browser open (proxy on port 9150)

$ electrum --oneserver --server Tor_address.onion:50001:t --proxy socks5:

With Tor installed and running (proxy on port 9050):

$ electrum --oneserver --server <your-onion-address>.onion:50001:t --proxy socks5:

"If you try to connect to Electrs before the index is complete, it will not appear to be connecting. You MUST wait for index to be complete before Electrs will allow for Electrum to connect. This took me about 8ish hours on my Pi4."


Heavily utilized the guides provided by:

openoms @

Romanz @

And bit shout out to the Dojo Telegram who helped along the way. Join the group at

DM me on Twitter: @BTCxZelko or Telegram @BTCxZelko if you have any questions. <---So my wife doesn't kill me 😅

Last updated