chris-belcher / electrum-personal-server

Maximally lightweight electrum server for a single user
MIT License
601 stars 110 forks source link

Electrum Personal Server

Electrum Personal Server aims to make using Electrum bitcoin wallet more secure and more private. It makes it easy to connect your Electrum wallet to your own full node.

Full node wallets are important in bitcoin because they are a big part of what makes the system trustless. No longer do people have to trust a financial institution like a bank or Paypal, they can run software on their own computers. If bitcoin is digital gold, then a full node wallet is your own personal goldsmith who checks for you that received payments are genuine.

Full node wallets are also important for privacy. Using Electrum under default configuration requires it to send (hashes of) all your bitcoin addresses to some server. That server can then easily spy on your transactions. Full node wallets like Electrum Personal Server would download the entire blockchain and scan it for the user's own addresses, and therefore don't reveal to anyone else which bitcoin addresses they are interested in.

Contents

Features

How To

Pro Tip: run Electrum wallet with the command line arguments --oneserver --server localhost:50002:s. This stops Electrum connecting to other servers to obtain block headers; and locks Electrum to connect only to your server, disabling the GUI button to stop accidental connections. This helps avoid a user accidentally ruining their privacy by connecting to public Electrum servers. Another way to do this is to open Electrum's config file and edit the lines to oneserver=true.

Pro Tip2: run tor on the same machine as Electrum Personal Server. Then by default transactions will be broadcast through tor. If running tor, also set walletbroadcast=0 in your bitcoin.conf. This prevents the node from rebroadcasting transactions without tor.

Quick start on a Debian/Ubuntu machine with a running Bitcoin full node

  1. Download the latest release of Electrum Personal Server. (Not the Windows version, the "Source code" zip or tar.gz.)
  2. Extract the compressed file
  3. Enter the directory
  4. cp config.ini_sample config.ini
  5. Edit the config.ini file:
    1. Add bitcoind back-end RPC auth information
    2. Add wallet master public keys for your wallets
  6. Install the server to your home directory with pip3 install --user .
  7. Make sure ~/.local/bin is in your \$PATH (echo $PATH). If not, add it: echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.profile, logout, and log in again
  8. Run the server: electrum-personal-server config.ini
  9. Rescan if needed: electrum-personal-server --rescan config.ini
  10. Restart the server if needed
  11. Start your Electrum wallet: electrum --oneserver --server localhost:50002:s.

Updating to a new version

Updating to a new version of Electrum Personal Server does not require a blockchain rescan.

Links to other setup guides

Exposure to the Internet

Right now, Electrum Personal Server is easiest to use when it, your full node and your Electrum wallet are all on the same computer.

Other people should not be connecting to your server. They won't be able to synchronize their wallet, and they could potentially learn all your wallet transactions. By default the server will accept connections only from localhost, though this can be changed in the configuration file.

The whitelisting feature can be used accept only certain IP addresses ranges connecting to the server. The Electrum protocol uses SSL for encryption. If your wallet connects over the public internet you should generate your own SSL certificate instead of using the default one, otherwise your connection can be decrypted. See the configuration file for instruction on how to do this.

Another option is to use a SSH tunnel to reach Electrum Personal Server. SSH connections are encrypted and authenticated. This can be done on the command line with: ssh username@host -L 50002:localhost:50002 or with Putty for Windows. Then connect Electrum to localhost, and SSH will forward that connection to the server.

Number of connections

Right now Electrum Personal Server can only accept one connection at a time.

Lightning Network

Right now Electrum Personal Server does not support Lightning Network which Electrum wallet 4.0 and above implements.

How is this different from other Electrum servers ?

They are different approaches with different tradeoffs. Electrum Personal Server is compatible with pruning, blocksonly and txindex=0, uses less CPU and RAM, is suitable for being used intermittently rather than needing to be always-on, and doesn't require an index of every bitcoin address ever used. The tradeoff is when recovering an old wallet, you must import your wallet first and you may need to rescan, so it loses the "instant on" feature of Electrum wallet. Other Electrum server implementations will be able to sync your wallet immediately even if you have historical transactions, and they can serve multiple Electrum connections at once.

Traditional Electrum servers inherently are not very scalable and use many resources which push people towards using centralized solutions. This is what we'd like to avoid with Electrum Personal Server.

Definitely check out other implementations:

Further ideas for work

Contact

I can be contacted on freenode IRC on the #bitcoin and #electrum channels, by email or on twitter.

My PGP key fingerprint is: 0A8B 038F 5E10 CC27 89BF CFFF EF73 4EA6 77F3 1129.

Articles, Discussion and Talks

Contributing

Donate to help improve Electrum Personal Server: bc1qe74qzd256kxevq2gn7gmscs564lfk5tqrxqsuy. Signed donation addresses can be found here.

This is open source project which happily accepts coding contributions from anyone. See developer-notes.md.