Last active
April 16, 2021 19:42
-
-
Save UdjinM6/f084bdd9f2c5a80cab247a437ee052ee to your computer and use it in GitHub Desktop.
ElectrumX setup for Dash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ElectrumX setup for Dash | |
# NOTE: with this setup ElectrumX will be running under root (to simplify things), | |
# modify it accordingly if you want to run it under some specific user | |
# NOTE: this script itself is not enough, you'll have to edit a couple of files manually, | |
# pls read comments below | |
# python3.7 is requried for ElectrumX, | |
# build-essential and -dev version of Python are required for x11_hash, | |
# daemontools is the way we are going to manage ElectrumX service | |
add-apt-repository ppa:deadsnakes/ppa # the repo with python3.7 | |
apt update | |
apt install software-properties-common build-essential daemontools python3.7-dev | |
ln -sf /usr/bin/python3.7 /usr/bin/python3 | |
python3 -V # should say Python 3.7.x now | |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3 | |
# might also need to reinstall setuptools now if you had them before | |
pip3 install --upgrade --force-reinstall setuptools | |
openssl genrsa -out server.key 2048 | |
openssl req -new -key server.key -out server.csr | |
openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt | |
# should have server.crt, server.csr and server.key files now | |
git clone https://github.com/spesmilo/electrumx.git | |
cd electrumx && python3 setup.py install && pip3 install . --upgrade && cd | |
mkdir -p /scripts /service /data/electrumx-server | |
cp -R /root/electrumx/contrib/daemontools /scripts/electrumx | |
echo "non-empty" > /scripts/electrumx/env/ALLOW_ROOT | |
# assuming you want a banner and it's going to be located at /root/electrumx/banner | |
echo '$SERVER_SUBVERSION running on $DAEMON_SUBVERSION' > /root/electrumx/banner | |
echo "/root/electrumx/banner" > /scripts/electrumx/env/BANNER_FILE | |
echo "Dash" > /scripts/electrumx/env/COIN | |
# make sure to replace "you_real_rpcuser" and "your_real_rpcpassword" with actual values and tweak rpc port before running the command below | |
# NOTE: use port 19998 for testnet | |
echo "http://you_real_rpcuser:[email protected]:9998/" > /scripts/electrumx/env/DAEMON_URL | |
echo "/data/electrumx-server/" > /scripts/electrumx/env/DB_DIRECTORY | |
echo "/root/electrumx/electrumx_server" > /scripts/electrumx/env/ELECTRUMX | |
echo "%(asctime)s %(levelname)s:%(name)s:%(message)s" > /scripts/electrumx/env/LOG_FORMAT | |
echo "128" > /scripts/electrumx/env/MAX_SESSIONS # might want less on testnet, smth like 32 | |
echo "mainnet" > /scripts/electrumx/env/NET # or "testnet" | |
# make sure to replace "your_external_ip" with the actual value and to tweak ports | |
# NOTE: use ports 51001 and 51002 for testnet, make sure ports match in two commands below | |
echo "tcp://your_external_ip:50001,ssl://your_external_ip:50002" > /scripts/electrumx/env/REPORT_SERVICES | |
echo "tcp://:50001,ssl://:50002,rpc://" > /scripts/electrumx/env/SERVICES | |
echo "/root/server.crt" > /scripts/electrumx/env/SSL_CERTFILE | |
echo "/root/server.key" > /scripts/electrumx/env/SSL_KEYFILE | |
echo "root" > /scripts/electrumx/env/USERNAME | |
# Few things to do manually: | |
# 1. replace /path/to/log/ in /scripts/electrumx/log/run e.g. with /var/log/electrumx | |
# 2. make sure you have rpcallowip=127.0.0.1 in dash.conf, if not add it and restart dashd | |
# add service | |
svscan /service & disown | |
ln -s /scripts/electrumx/ /service/electrumx | |
# should start automagically, use | |
# svc -u /service/electrumx # to start | |
# svc -d /service/electrumx # to stop | |
# see logs if all is good, should start syncing from dashd | |
tail -100f /var/log/electrumx/current |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🤷♂️ It should be. I'll have to revisit this.