In this article I will tell you how to deploy ElectrumX server for Emercoin under Ubuntu Server 16.04 LTS, which can be used, for example, for running Emercoin Secure Wallet applications (iOS, Android, Linux, Windows, MacOS). The deployment process is no different for other supported cryptocurrencies (for example, for Bitcoin), with the only difference that it is necessary to install the appropriate node of the desired cryptocurrency and specify its data in the server config.
All commands in this article are run as root.
1. Installing Emercoin nodes
To install Emercoin nodes under Ubuntu Server 16.04 LTS, execute the following commands (taken from the official site):
apt-key adv --keyserver keyserver.ubuntu.com --recv B58C58F4 add-apt-repository 'deb http://download.emercoin.com/ubuntu xenial emercoin' apt update && apt -y install emercoin
We turn off RPC over SSL support in the node, since ElectrumX does not support this:
')
sed -i -e "s/\(^rpcssl=1\)\(.*\)/rpcssl=0/" /etc/emercoin/emercoin.conf systemctl restart emercoind
We are waiting for the blockchain to download. You can control this process with the command:
emc getinfo
the result of execution of which will be a similar conclusion:
{ "version": 60301, "protocolversion": 70002, "walletversion": 60000, "balance": 0.000000, "newmint": 0.000000, "stake": 0.000000, "blocks": 1936, "moneysupply": 9521307.700000, "timeoffset": 0, "connections": 3, "proxy": "", "ip": "xxx.xxx.xxx.xxx", "difficulty": 1.450595422550799, "testnet": false, "keypoololdest": 1513852706, "keypoolsize": 501, "encrypted": false, "mintonly": false, "paytxfee": 0.000100, "relayfee": 0.000100, "errors": "WARNING: Checkpoint is too old. Wait for block chain to download, or notify developers of the issue." }
We wait until the message "
WARNING: Checkpoint is too old will disappear in the"
errors "message. This will mean that the blockchain has swayed.
2. Installing dependencies
In the latter, at the time of this writing, the version of ElectrumX 1.2.1, there is a requirement for the Python version> = 3.6. In Ubuntu Server 16.04 LTS, the latest version of Python is 3.5. Accordingly, you need to install Python 3.6 from the external repository along with the necessary dependencies:
add-apt-repository ppa:jonathonf/python-3.6 apt update && apt -y install python3.6 python3.6-dev gcc g++ libleveldb-dev ln -sf python3.6 /usr/bin/python3 curl -sS https://bootstrap.pypa.io/get-pip.py | python3.6 pip3.6 install aiohttp pylru plyvel
3. Install ElectrumX
Download and install ElectrumX version 1.2.1 (the newest version at the time of this writing, as I mentioned above):
git clone https://github.com/kyuupichan/electrumx /opt/electrumx cd /opt/electrumx git checkout 1.2.1 -b live mkdir -p db groupadd -r electrumx useradd -r -m -d /var/lib/electrumx -k /dev/null -s /bin/false -g electrumx electrumx chown electrumx:electrumx /opt/electrumx/db cp contrib/systemd/electrumx.service /etc/systemd/system/ ln -sf /opt/electrumx/electrumx_server.py /usr/local/bin/electrumx_server.py ln -sf /opt/electrumx/electrumx.conf /etc/electrumx.conf
4. Configure ElectrumX for Emercoin
a) Create the file
/opt/electrumx/electrumx.conf with the following content:
COIN = Emercoin DB_DIRECTORY = /opt/electrumx/db DAEMON_URL = http://emccoinrpc:emccoinpass@localhost:6662/ TCP_PORT = 9110 RPC_PORT = 9000 HOST =
b) Change the
emccoinrpc and
emccoinpass in it for the login and password from the Emercoin node (you can see them in
/etc/emercoin/emercoin.conf )
c) Change access rights to config:
chown root:electrumx /opt/electrumx/electrumx.conf chmod 640 /opt/electrumx/electrumx.conf
d) Start the server and set it to autoload when the OS starts:
systemctl start electrumx systemctl enable electrumx
e) The server is running and has started indexing the blockchain. You can track the progress of the team:
journalctl -u electrumx -f
After the indexing of the blockchain is complete, the ElectrumX server will become fully operational and you can connect to it on port 9110 / tcp.