Installation of Flo-ElectrumX Server
How to Install an ElectrumX Server for FLO
Before you start, make sure to install a FLO Core Wallet node first and set at least the following minimum options in
flo.conf
:server=1 listen=1 daemon=1 txindex=1 rpcuser=<random username> rpcpassword=<strong password>
If you already have FLO Core Wallet node installed, you need to reindex the blockchain:
When running flo-qt it should be enough to just close and reopen the wallet. It will reindex the chain automatically.
1. Install LevelDB
sudo apt-get install python3-leveldb libleveldb-dev
2. Install Python 3.6
The latest Ubuntu only comes with Python 3.5. You will have to install the newer version from a 3rd party repository:sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt-get update && sudo apt-get install python3.6 python3.6-dev
Set Python 3.6 as default python 3
Check the default python3 version using the command
python3 --version
If the version in 3.6 then skip to next step, else set python 3.6 as default python 3 as follows :
Run the command :
sudo update-alternatives --config python3
If it shows you this error:update-alternatives: error: no alternatives for python3
You need to update your update-alternatives
, then you will be able to set your default python version.sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
Then run :sudo update-alternatives --config python3
Set python3.6 as default for python3.
Check the default python3 version using the command
python3 --version Install required Python packages
You will also need to install some Python 3.6 dependencies for ElectrumX.Let's first upgrade setuptools:
pip3 install --upgrade pip setuptools wheelthen install some required packages:
pip3 install aiohttp pylru leveldb plyvelIf the above command gives you an error, try installing it with
sudo
(try to avoid it as much as possible, though).3. Install and set up ElectrumX
Clone the ElectrumX code from a GitHub repository using git:
git clone https://github.com/bitspill/flo-electrumx.git cd flo-electrumxRun the installation script (use
sudo
if it doesn't work):python3 setup.py installNext, create a data folder where the blockchain data will be stored:
mkdir ~/.electrumx
4. Create a self-signed certificate
To allow Electrum wallets to connect to your server over SSL you need to create a self-signed certificate.Go to the data folder:
cd ~/.electrumxand generate your key:
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 openssl rsa -passin pass:x -in server.pass.key -out server.key rm server.pass.key openssl req -new -key server.key -out server.csrFollow the on-screen information. It will ask for certificate details such as your country and password. You can leave those fields empty.
When done, create a certificate:
openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crtThese commands will create 2 files:
server.key
and server.crt
.When configuring the ElectrumX instance, make sure to add server.key to
SSL_KEYFILE
and server.crt to SSL_CERTFILE
. More on this in the next step.5. Launch ElectrumX as service
First, make sure a fully validating Florincoin node is running:flo-cli getinfo
(or)
python3 ~/flo-electrumx/electrumx_rpc.py getinfoIt should output information about your node such as block height, open connections etc.
If it doesn't, run the node (flo-qt) first.
Most if not all Debian-based distribution use Systemd by default. Make sure that is the case for your system:
sudo stat /proc/1/exe | grep systemdIf it outputs something like
File: '/proc/1/exe' -> '/lib/systemd/systemd'
you're good to go.Open a sudo session and copy a service file from the ElectrumX repo to your Systemd directory:
sudo -s cp ~/source/electrumx/contrib/systemd/electrumx.service /lib/systemd/system/Edit the file to match your setup:
vim /lib/systemd/system/electrumx.servicePress i and start editing.
You need to edit at least
ExecStart
and User
variables.ExecStart=/home/<username>/flo-electrumx/electrumx_server.py User=<username>When you're happy with the changes, hit ESC and type
:wqa
followed by ENTER.Create a configuration file for the server:
touch /etc/electrumx.conf vim /etc/electrumx.confand configure it according to your environment.
Please refer to ElectrumX's documentation. For sample see below :
COIN = Flo
DAEMON_URL = http://<rpcuserName>:<rpcPassword>@localhost:7313/
DB_DIRECTORY = /home/<username>/.electrumx/
DB_ENGINE = leveldb
USERNAME = <username>
ELECTRUMX = /home/<username>/flo-electrumx/electrumx_server.py
HOST = 0.0.0.0
ANON_LOGS = xx.xx.xx.xx:xxx
CACHE_MB = 1800
MAX_SESSIONS = 500
SSL_CERTFILE = /home/<username>/.electrumx/server.crt
SSL_KEYFILE = /home/<username>/.electrumx/server.key
SSL_PORT = 50002
TCP_PORT = 50001
(make sure <rpcuserName> and <rpcPassword> are same as in flo.conf)
Now you can start ElectrumX using
systemctl
:systemctl start electrumxYou can use
journalctl
to check the log output:journalctl -u electrumx -fIf it gives you no errors, enable the service and start ElectrumX at boot:
systemctl enable electrumx
The logs output will update continuously every minute so press Ctrl+z to stop logs.
Adding gen=1 in flo.conf triggers testnet mining which is very helpful
ReplyDelete