|
| 1 | +### MACHINE SHOULD HAVE 8GB at least. 4GB with 4GB swap file should work as well. |
| 2 | + |
| 3 | +# Install Python3.6 and pip3 if we don't have it already |
| 4 | +sudo apt-get update && sudo apt-get install python3.6 python3.6-dev python3-pip -y |
| 5 | +python3.6 -m pip install --upgrade pip setuptools wheel |
| 6 | +python3.6 -m pip install --upgrade aiohttp pylru leveldb plyvel aiorpcx ecdsa |
| 7 | + |
| 8 | +# Install LevelDB |
| 9 | +sudo apt-get install python3-leveldb libleveldb-dev -y |
| 10 | + |
| 11 | +# Setup Database dictory |
| 12 | +cd ~ |
| 13 | +rm -rf electrumxdb |
| 14 | +mkdir electrumxdb |
| 15 | + |
| 16 | +# Install ElectrumX |
| 17 | +cd ~ |
| 18 | +sudo rm -rf electrumx |
| 19 | +git clone https://github.com/BTHPOS/electrumx.git |
| 20 | +cd electrumx |
| 21 | +sudo python3.6 setup.py install |
| 22 | + |
| 23 | +# Copy ElectrumX to the correct locations |
| 24 | +sudo rm -rf /usr/local/bin/electrumx_server |
| 25 | +sudo rm -rf /usr/local/bin/electrumx_rpc |
| 26 | +sudo cp electrumx_server /usr/local/bin/ |
| 27 | +sudo cp electrumx_rpc /usr/local/bin/ |
| 28 | + |
| 29 | +# ElectrumX Configuration |
| 30 | +cat <<EOT >> ~/electrumx.conf |
| 31 | +# default /etc/electrumx.conf for systemd |
| 32 | + |
| 33 | +# Coin |
| 34 | +COIN = Bithereum |
| 35 | +
|
| 36 | +# REQUIRE |
| 37 | +DB_DIRECTORY = /home/ubuntu/electrumxdb |
| 38 | +
|
| 39 | +# Network |
| 40 | +NET = mainnet |
| 41 | +
|
| 42 | +# Bitcoin Node RPC Credentials |
| 43 | +DAEMON_URL = http://bithereum:[email protected]:18554/ |
| 44 | +
|
| 45 | +# TCP Listening port |
| 46 | +TCP_PORT=50001 |
| 47 | +HOST=0.0.0.0 |
| 48 | +
|
| 49 | +SSL_PORT=50002 |
| 50 | +SSL_KEYFILE=/home/ubuntu/electrumxssl/server.key |
| 51 | +SSL_CERTFILE=/home/ubuntu/electrumxssl/server.crt |
| 52 | +
|
| 53 | +# See http://electrumx.readthedocs.io/en/latest/environment.html for |
| 54 | +# information about other configuration settings you probably want to consider. |
| 55 | +EOT |
| 56 | + |
| 57 | +# Move to configuration |
| 58 | +sudo rm -rf /etc/electrumx.conf |
| 59 | +sudo mv ~/electrumx.conf /etc/ |
| 60 | + |
| 61 | +# Create ElectrumX Service |
| 62 | +cat <<EOT >> ~/electrumx.service |
| 63 | +[Unit] |
| 64 | +Description=Electrumx |
| 65 | +After=network.target |
| 66 | +
|
| 67 | +[Service] |
| 68 | +EnvironmentFile=/etc/electrumx.conf |
| 69 | +ExecStart=/usr/local/bin/electrumx_server |
| 70 | +User=ubuntu |
| 71 | +LimitNOFILE=8192 |
| 72 | +TimeoutStopSec=30min |
| 73 | +
|
| 74 | +[Install] |
| 75 | +WantedBy=multi-user.target |
| 76 | +EOT |
| 77 | + |
| 78 | +# Move to services |
| 79 | +sudo rm -rf /etc/systemd/system/electrumx.service |
| 80 | +sudo mv ~/electrumx.service /etc/systemd/system/ |
| 81 | + |
| 82 | +# Increase Swap size |
| 83 | +sudo fallocate -l 4G /swapfile |
| 84 | +sudo chmod 600 /swapfile |
| 85 | +sudo mkswap /swapfile |
| 86 | +sudo swapon /swapfile |
| 87 | + |
| 88 | +# Update Open File Limit |
| 89 | +# sudo vim /etc/security/limits.conf |
| 90 | +# * soft nofile 10000 |
| 91 | +# * hard nofile 10000 |
| 92 | +# |
| 93 | +# |
| 94 | +# Setup SSL certificates for ElectrumX |
| 95 | +# |
| 96 | +# cd ~ |
| 97 | +# mkdir electrumxssl |
| 98 | +# cd electrumxssl |
| 99 | +# openssl genrsa -out server.key 2048 |
| 100 | +# openssl req -new -key server.key -out server.csr |
| 101 | +# openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt |
| 102 | +# |
| 103 | +# Reloading existing electrumx |
| 104 | +# |
| 105 | +# sudo systemctl daemon-reload |
| 106 | +# |
0 commit comments