Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: apogio on December 10, 2023, 06:14:05 PM



Title: [BitcoinTalk Node Tutorial #2] Installing Electrs from source
Post by: apogio on December 10, 2023, 06:14:05 PM
Links to other tutorials from the series:
[BitcoinTalk Node Tutorial #1] Running Bitcoin Core on Raspbian Lite (GUI-less) https://bitcointalk.org/index.php?topic=5476754.0
[BitcoinTalk Node Tutorial #3] Sparrow terminal / infinite Whirlpool mixes https://bitcointalk.org/index.php?topic=5470024.0
[BitcoinTalk Node Tutorial #4] Connecting BISQ to our node https://bitcointalk.org/index.php?topic=5478756.0
[BitcoinTalk Node Tutorial #5] Hosting a Monero node on the same machine https://bitcointalk.org/index.php?topic=5480371.0

Size required on disk:
Code:
$ sudo du -sh /media/apogio/BTC/electrs
42G /media/apogio/BTC/electrs



Installing Electrs from source

We have to download the sources from github: https://github.com/romanz/electrs

In order to do this, we need some packages, which we will install using the following command:
Code:
sudo apt install cargo clang cmake git curl

Then, we will download the sources for Electrs in our home directory:
Code:
cd ~
git clone https://github.com/romanz/electrs.git

We need to run the following command to install electrs:
Code:
cargo build --locked --release

This will take a while...

Now that the installation is finished, I want to run the electrs executable which is located in the path: ~/electrs/target/release/electrs. However, I want to be able to run it from everywhere, so I will move it where the bitcoin core binaries are:
Code:
mv ~/electrs/target/release/electrs /usr/local/bin

Now we must create a directory in our external SSD, alongside our bitcoincore directory.
Code:
mkdir /media/apogio/BTC/electrs

We will create a configuration file (electrs.conf) inside this directory.
Code:
cd /media/apogio/BTC/electrs
nano electrs.conf

At this point, we need to specify some details in our configuration file.
Code:
network="bitcoin"
auth="<user>:<pass>"
daemon_dir="/media/apogio/BTC/bitcoincore"
db_dir="/media/apogio/BTC/electrs/db"
daemon_rpc_addr="127.0.0.1:8332"
daemon_p2p_addr="127.0.0.1:8333"
electrum_rpc_addr="127.0.0.1:50001"
index_lookup_limit=1000
log_filters="INFO"
timestamp=true

Notice that I have set log_filters level to INFO and not DEBUG but if I need more information I will change it.

Now it is time to run electrs using the following command:
Code:
electrs --conf /media/apogio/BTC/electrs/electrs.conf

After it is finished, the electrum server will be running on port 50001.