diff options
author | Andy Weidenbaum | 2017-03-12 13:15:42 -0700 |
---|---|---|
committer | Andy Weidenbaum | 2017-03-12 13:15:42 -0700 |
commit | f0ae7f250f3bf293bd033987643b072ec51f4402 (patch) | |
tree | 64dca3e0876bd971a81fac26d6edec32b117b490 | |
download | aur-f0ae7f250f3bf293bd033987643b072ec51f4402.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 31 | ||||
-rw-r--r-- | PKGBUILD | 63 | ||||
-rw-r--r-- | electrumx.conf | 68 | ||||
-rw-r--r-- | electrumx.install | 114 | ||||
-rw-r--r-- | electrumx.service | 17 |
5 files changed, 293 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..04f39ac1f6eb --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,31 @@ +# Generated by mksrcinfo v8 +# Sun Mar 12 19:33:53 UTC 2017 +pkgbase = electrumx + pkgdesc = Server implementation for the Electrum wallet + pkgver = 1.0 + pkgrel = 1 + url = https://github.com/kyuupichan/electrumx + install = electrumx.install + arch = any + license = MIT + makedepends = expect + makedepends = openssl + makedepends = python-setuptools + depends = leveldb + depends = python + depends = python-aiohttp + depends = python-irc + depends = python-plyvel + depends = python-pylru + optdepends = bitcoin-core: Bitcoin core headless P2P node + optdepends = electrum: Bitcoin thin client + options = !emptydirs + source = electrumx-1.0.tar.gz::https://codeload.github.com/kyuupichan/electrumx/tar.gz/1.0 + source = electrumx.conf + source = electrumx.service + sha256sums = ff29de5a0065696815256db41585bbcb00002cc7cafe3ea2f4a7d2823e109369 + sha256sums = 8ae619f49ecea09626ac038d2170aeee6d0422f0918d8ef04672a2e614c32fc8 + sha256sums = a70e6d2ff4e0eb8125ba2d52bcdaec96129068363e365d48a47961f47b9fc554 + +pkgname = electrumx + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..6c524d1a484b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: Andy Weidenbaum <archbaum@gmail.com> + +pkgname=electrumx +pkgver=1.0 +pkgrel=1 +pkgdesc="Server implementation for the Electrum wallet" +arch=('any') +depends=('leveldb' + 'python' + 'python-aiohttp' + 'python-irc' + 'python-plyvel' + 'python-pylru') +makedepends=('expect' 'openssl' 'python-setuptools') +optdepends=('bitcoin-core: Bitcoin core headless P2P node' + 'electrum: Bitcoin thin client') +url="https://github.com/kyuupichan/electrumx" +license=('MIT') +options=(!emptydirs) +source=($pkgname-$pkgver.tar.gz::https://codeload.github.com/kyuupichan/$pkgname/tar.gz/$pkgver + 'electrumx.conf' + 'electrumx.service') +sha256sums=('ff29de5a0065696815256db41585bbcb00002cc7cafe3ea2f4a7d2823e109369' + '8ae619f49ecea09626ac038d2170aeee6d0422f0918d8ef04672a2e614c32fc8' + 'a70e6d2ff4e0eb8125ba2d52bcdaec96129068363e365d48a47961f47b9fc554') +install=electrumx.install + +build() { + cd "$srcdir/$pkgname-$pkgver" + + msg2 'Building...' + python setup.py build +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + msg2 'Installing license...' + install -Dm 644 LICENCE -t "$pkgdir/usr/share/licenses/$pkgname" + + msg2 'Installing documentation...' + install -dm 755 "$pkgdir/usr/share/doc/$pkgname" + cp -dpr --no-preserve=ownership README.rst docs/* samples \ + "$pkgdir/usr/share/doc/$pkgname" + + msg2 'Making essential directories...' + install -dm 700 "$pkgdir/etc/electrumx" + install -dm 755 "$pkgdir/srv/electrumx" + + msg2 'Installing electrumx.conf...' + install -Dm 600 "$srcdir/electrumx.conf" -t "$pkgdir/etc/electrumx" + + msg2 'Installing electrumx.service...' + install -Dm 644 "$srcdir/electrumx.service" \ + -t "$pkgdir/usr/lib/systemd/system" + + msg2 'Installing...' + python setup.py install --root="$pkgdir" --optimize=1 + + msg2 'Renaming executables...' + mv "$pkgdir/usr/bin/electrumx_server.py" "$pkgdir/usr/bin/electrumx-server" + mv "$pkgdir/usr/bin/electrumx_rpc.py" "$pkgdir/usr/bin/electrumx-rpc" +} diff --git a/electrumx.conf b/electrumx.conf new file mode 100644 index 000000000000..87e18b30bd24 --- /dev/null +++ b/electrumx.conf @@ -0,0 +1,68 @@ +#suggested /etc/electrumx.conf for systemd + +# +#REQUIRED +# + + DB_DIRECTORY = /srv/electrumx + USERNAME = electrumx + ELECTRUMX = /usr/bin/electrumx-server + + #Bitcoin Node RPC Credentials + #assumes https://aur.archlinux.org/packages/bitcoin-core/bitcoin.conf + DAEMON_URL = http://bitcoin:secret@127.0.0.1:8332/ + #port is optional, defaults to COIN RPC default + +# +#REQUIRED FOR PUBLIC VISIBILITY +# + + HOST = 127.0.0.1 + #listen on interface, (0.0.0.0 is any) + TCP_PORT = 50001 + SSL_PORT = 50002 + #Requires + SSL_CERTFILE = /etc/electrumx/server.cert + SSL_KEYFILE = /etc/electrumx/server.pem + +# +#OPTIONAL VISIBILITY +# + + #BANNER_FILE = /path/to/banner + #DONATION_ADDRESS = + #IRC = yes + #IRC_NICK = + #REPORT_HOST = $HOST + #REPORT_TCP_PORT = #defaults to TCP_PORT + #REPORT_SSL_PORT = #defaults to SSL_PORT + RPC_PORT = 8000 + + +# +#MISC +# + COIN = Bitcoin # lib/coins.py + NET = mainnet # lib/coins.py + DB_ENGINE = leveldb + #leveldb, rocksdb (You'll need to install appropriate python packages) + + #REORG_LIMIT = 200 + #maximum number of blocks to be able to handle in a chain + #reorganisation. ElectrumX retains some fairly compact + #undo information for this many blocks in levelDB. + + ANON_LOGS = yes + #Set to anything non-empty to remove IP addresses from logs. + + +#These following environment variables are to help limit server +#resource consumption and to prevent simple DoS. Address subscriptions +#in ElectrumX are very cheap - they consume about 100 bytes of memory +#each and are processed efficiently. I feel the defaults are low and +#encourage you to raise them. + + MAX_SUBS = 250000 + #Maximum number of address subscriptions across all sessions + MAX_SESSION_SUBS = 50000 + #Maximum number of address subscriptions permitted to a single session. diff --git a/electrumx.install b/electrumx.install new file mode 100644 index 000000000000..2cbec72882e4 --- /dev/null +++ b/electrumx.install @@ -0,0 +1,114 @@ +_es_user=electrumx +_es_group=electrumx + +post_install() { + mkdir -p /etc/electrumx + mkdir -p /srv/electrumx + _mkuser + _mkssl + chown -R $_es_user:$_es_group /etc/electrumx /srv/electrumx + printf "%b\n" "$ecsda" +} + +post_upgrade() { + _mkuser + chown -R $_es_user:$_es_group /etc/electrumx /srv/electrumx + printf "%b\n" "$ecsda" +} + +post_remove() { + _rmuser + rm -rf /etc/electrumx /srv/electrumx +} + +_mkssl() { + echo -n "Enabling SSL..." # https://en.bitcoin.it/wiki/Enabling_SSL_on_original_client_daemon + openssl genrsa -out /etc/electrumx/server.pem 2048 + expect <<EOF | perl -ne 'print if /-----BEGIN\sCERTIFICATE-----/../-----END\sCERTIFICATE-----/' > /etc/electrumx/server.cert + spawn openssl req -new -x509 -nodes -sha1 -days 3650 -key /etc/electrumx/server.pem + expect "Country*" { + send "\r" + } + expect "State*" { + send "\r" + } + expect "Locality*" { + send "\r" + } + expect "Organization*" { + send "\r" + } + expect "Organizational*" { + send "\r" + } + expect "Common*" { + send "\r" + } + expect "Email*" { + send "\r" + } + expect eof +EOF + echo "done" +} + +_mkuser() { + getent passwd $_es_user &>/dev/null || { + echo -n "Creating electrumx user... " + grep -E "^$_es_group:" /etc/group >/dev/null || groupadd $_es_group + useradd -m -d /etc/electrumx -g $_es_group -s /usr/bin/nologin $_es_user + echo "done" + } +} + +_rmuser() { + echo -n "Removing electrumx user... " + userdel -rf $_es_user 2>/dev/null + echo "done" +} + +read -d '' ecdsa <<'EOF' +######################################################################## +######################################################################## +## ## +## ElectrumX Server ## +## ________________ ## +## ## +## To start electrumx: ## +## ## +## # systemctl start electrumx ## +## ## +## To communicate with electrumx as a normal user: ## +## ## +## $ electrumx-rpc -p 8000 <command> ## +## ## +## To connect to electrumx: ## +## ## +## $ electrum --server 127.0.0.1:50002:s --oneserver ## +## ## +## Config: /etc/electrumx/electrumx.conf ## +## Database: /srv/electrumx ## +## Documentation: /usr/share/doc/electrumx ## +## ## +## ## +## ';,;:. ## +## 'o' .;d. ## +## K. :l ## +## cl .O, ## +## .c:cclc. ## +## .;::;. .;ko,. ':::' .',,,. ## +## .OMMMMMWo ,d,. .oo cXMMMMMX: do. .:d. ## +## x MMMMMMMMxlX. kdoMMMMMMMMMoxl '0 ## +## oMMMMMMMN;'K, .Oc;NMMMMMMMX,ld ;k ## +## :0WMMNk. .cl;,;cl, 'kWMMMWx. :o:,';cc ## +## .. .'. .oWc. .''. ## +## 'oc;,;lo. ## +## ,O. .0. ## +## :k .0. ## +## cl,...:o, ## +## .,,,. ## +## ## +## ## +######################################################################## +######################################################################## +EOF diff --git a/electrumx.service b/electrumx.service new file mode 100644 index 000000000000..f9efc5233c11 --- /dev/null +++ b/electrumx.service @@ -0,0 +1,17 @@ +[Unit] +Description=ElectrumX Server +Wants=bitcoin.service +After=network.target bitcoin.service + +[Service] +EnvironmentFile=/etc/electrumx/electrumx.conf +ExecStart=/usr/bin/electrumx-server +ExecReload=/usr/bin/kill -s SIGHUP $MAINPID +ExecStop=/usr/bin/electrumx-rpc -p 8000 stop +User=electrumx +Group=electrumx +LimitNOFILE=infinity +TimeoutStopSec=30min + +[Install] +WantedBy=multi-user.target |