Electrum on Ubuntu

This guide will help you install and configure electrum via the command line what could turn out helpful if you decide to use it on you server.

Installing

If you use virtual box you should skip an unattended guest installation

Then go to https://electrum.org/panel-download.html and look at Installation from Python sources

Install dependencies:sudo apt-get install python3-pyqt5 libsecp256k1-dev python3-cryptography
Download package:wget https://download.electrum.org/4.4.3/Electrum-4.4.3.tar.gz
Verify signatures:wget https://download.electrum.org/4.4.3/Electrum-4.4.3.tar.gz.asc
gpg --verify Electrum-4.4.3.tar.gz.asc
Run without installing:tar -xvf Electrum-4.4.3.tar.gz
python3 Electrum-4.4.3/run_electrum
Install with PIP:sudo apt-get install python3-setuptools python3-pip
python3 -m pip install --user Electrum-4.4.3.tar.gz

After last command you may get warnings:

WARNING: The script qtpy is installed in '/home/test/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script qr is installed in '/home/test/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script normalizer is installed in '/home/test/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts qdarkstyle, qdarkstyle.example and qdarkstyle.utils are installed in '/home/test/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

To fix it you should type:

$ export PATH="/home/test/.local/bin:$PATH"

Now we can try to run a daemon. I will use testnet mode.

$ electrum daemon --testnet  -d
starting daemon (PID 19642)

And to get some information type the command

electrum getinfo --testnet
{
    "auto_connect": true,
    "blockchain_height": 2412598,
    "connected": true,
    "default_wallet": "/home/test/.electrum/testnet/wallets/default_wallet",
    "fee_per_kb": 1000,
    "path": "/home/test/.electrum/testnet",
    "server": "blockstream.info",
    "server_height": 2412598,
    "spv_nodes": 5,
    "version": "4.3.2"
}

Looks Ok. Let’s create the wallet from a seed phrase.

$ electrum restore "run ran get come came got let go went gone off on" --testnet
{
    "msg": "This wallet was restored offline. It may contain more addresses than displayed. Start a daemon and use load_wallet to sync its history.",
    "path": "/home/test/.electrum/testnet/wallets/default_wallet"
}

And now we will try to get addresses:

$ electrum load_wallet --testnet
true
$ electrum listaddresses --testnet
[
    "tb1qa7y3pnrptaw9h055xxd2ztrwxnp4k2wlmw0dec",
    "tb1qmwjaf836xhd6857ga65gd0sqrwrs7t3lssagwg",
    "tb1qduk87sevqjh6jgc9xk0ka7kt9hrw3jvustscdv",
    "tb1q6dpc2wun3tkhusa6403use52kpq2su9w49c3lc",
    "tb1qye8m4s88qmuhqk4ynsp8cqe6u3czm9sez63zd3",
    "tb1qv9wzfkqj2pyc3wv9l0fjs24p9wl0pflmendwtz",
    "tb1q2rl5e7nzv8dux3ncuqal53je8x32s2t8z8djgg",
    "tb1qw8dgy6pk0vzjkzcujzyt4pn7ahntw4zm34nhp6",
    "tb1qsvcfnpt8f0rt54jvrwf7f5d2wr9zer03j76wnc",
    "tb1q86f4jqcnnv8j5arl5dytgxc67r8yr473f93wzs",
    "tb1qfysp55438tz8rsz93rlcyfg85kn943eaccjh64",
    "tb1qej4juj46gz8pwp2f5thxmck003jfkfn6rnyh32",
    "tb1q4zh0lm3anh9kj3dnqy2z4r24pfpywguyhdr92m",
    "tb1ql7hltrj6vpvmah2shl84vpkrmq4wl38h50g4w7",
    "tb1qhnresg555vkpgu0u46urldqky35zn4zke7cxjf",
    "tb1qsjp5t0lunv87r5y3u4wjvrhpkpsz8t392u97hs",
    "tb1qpx06u9eadq9asnu0g9nhgksk3vxhqgpv6t965c",
    "tb1q2sxwk6x5h07muxc5psphjvtwkafhnp968mpdrh",
    "tb1qvcqp5lm3n9wugkeh777lmqkqfnzlqdpteh7gfw",
    "tb1qexr2n2jhnj3e4l28s4wp2ksw3yxytsmqzr5y20",
    "tb1qekcnp3wysnl86cvh97qd4rwv3twg0nzl8d0ln2",
    "tb1qw7uf8ewm4ttc8xuh9ktqvj5vgudjq984m6gvxy",
    "tb1q0t4ul8waf5n6luw6ng9radwtazekvppts934ra",
    "tb1q7yufm9tnxj9vddk6gj3yug3w7r07s5vah52w54",
    "tb1qc6w33n85xkqznndke6u392fpvn7ulxajk5yhfl",
    "tb1q2v09e7eg8rydvnfl6ncregn3wtuwk5mmhf56yj",
    "tb1qq2q2yfzvl04s2hauramfta8ewdve266k5jtwsz",
    "tb1qrkwxrd9gkup3aju5ymdjnjja0dallh7ymel77s",
    "tb1q3296p647xy9j0lzldcu345qxzunlujxtvhry9e",
    "tb1q2xsn0azyv808fhmc2ck44fxr2cgj488tjh5rnk"
]

To get some testnet bitcoins go here https://coinfaucet.eu/en/btc-testnet/

Now let’s configure RPC:

$ electrum setconfig rpcport 7777 --testnet
true
$ electrum setconfig rpcuser "user" --testnet
true
$ electrum setconfig rpcpassword "t" --testnet
true

And will try to get the balance:

$ curl --data-binary '{"jsonrpc":"2.0","id":"curltext","method":"getbalance","params":[]}' http://user:t@127.0.0.1:7777
{"id": "curltext", "jsonrpc": "2.0", "result": {"confirmed": "0.03251479"}}

If it won’t work just try restart.