N. P. O'Donnell, 2021
Ubuntu instructions. More info can be found here
sudo apt update
sudo apt install clang cmake build-essential rustc cargo librocksdb-dev
Clone and select version:
git clone https://github.com/romanz/electrs.git
git tag
git checkout <latest tag> # eg. git checkout v0.8.6
Build:
cargo build --locked --release
Assume the Litecoin daemon runs under a user called litecoin
:
ELECTRS_DATA_DIR=/electrs-ltc # perhaps change to a directory on a faster disk
sudo mkdir -p $ELECTRS_DATA_DIR
sudo mkdir -p $ELECTRS_DATA_DIR/db
sudo chown litecoin $ELECTRS_DATA_DIR
sudo chgrp litecoin $ELECTRS_DATA_DIR
sudo -u litecoin chmod 700 $ELECTRS_DATA_DIR
Copy binary:
sudo cp target/release/electrs /usr/local/bin
Modify litecoind.conf
file to set at least rpccokiefile
and rpcport
:
# Example litecoind.conf
rpccookiefile=/litecoin/.cookie
rpcport=9332
# Does not need to be set to 1 but it's no harm.
txindex=1
Create a file called /electrs-ltc/electrs.toml
:
# electrs.toml
network = "bitcoin" # Not a mistake. Set network to "bitcoin".
db_dir = "/electrs-ltc/db"
cookie_file = "/litecoin/.cookie"
#daemon_dir = "/litecoin" # DO NOT INCLUDE daemon_dir. Electrs doesn't like litecoind's data files.
jsonrpc_import = true
daemon_rpc_addr = "127.0.0.1:9332"
electrum_rpc_addr = "0.0.0.0:50001"
verbosity = 3
Make a test run in a terminal (will cause initial sync, so perhaps run with screen
or tmux
):
sudo su litecoin # Switch to user litecoin first. su -u ... won't work!
cd /electrs-ltc # also required.
RUST_BACKTRACE=full electrs --conf electrs.toml -vvvv
Example Unit file:
# electrs-ltc.unit
[Unit]
Description=Electrs Litecoin
After=network.target
[Service]
ExecStart=/usr/local/bin/electrs --conf /electrs-ltc/electrs.toml
WorkingDirectory=/electrs-ltc
User=litecoin
Group=litecoin
Restart=on-failure
[Install]
WantedBy=multi-user.target
Then enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable electrs-ltc
sudo systemctl start electrs-ltc
Ensure service is running:
systemctl status electrs-ltc
Tail logs:
journalctl --follow _SYSTEMD_UNIT=electrs-ltc.service
On client machine, run Electrum-LTC with only your personal server and will not allow any other server to be used:
electrum-ltc-3.3.8.1-x86_64.AppImage --oneserver --server=<hostname>:50001:t