Electrum uses Electrum servers which can spy on or lie to wallet users. Electrum wallets may be tricked into accepting transactions of BitcoinXT or some other hostile hard fork proposal. And the servers have a list of all the user's bitcoin addresses which is harmful to privacy. Right now Electrum comes packaged with Tails OS which has the tagline "Privacy for anyone anywhere", which is simply not true when using Electrum with default servers.
Another way to synchronize a wallet would be to download full blocks and/or point the wallet to your own full node. One of Electrum's values is "instant on" so those methods will probably never be added to Electrum itself.
Probably a better way would be to create a
gateway, a script that behaves like an Electrum server but which obtains bitcoin network information in another way. To use it you would just run the gateway script and point your Electrum wallet to localhost. The script would be separate from the Electrum software itself so Electrum's raison d'etre which includes "instant on" would be preserved.
This is basically a proposal for an improved lightweightness of Electrum server. The goal is to keep all of Electrum's feature-richness of hardware wallet integration, multisignature, offline signing, coin control, etc but with better privacy, full node verification and minimal resource requirement compared to a full server.
Here are some gateway script ideas:
Type 1The gateway script adds watch-only addresses to Bitcoin Core's wallet via the RPC protocol. Updates to the wallet.dat are transmitted to Electrum via the gateway.
Features: Full verification, security and privacy from a full node.
Works with pruning and blocksonly. Reasonably simple to code.
Downsides: Adding wallets with historical transaction being added will require rescanning. Users must configure the gateway script with their Electrum master public keys before using.
Type 1 would be combining Bitcoin Core with Electrum. All of Bitcoin's configuration tuning like -blocksonly and -pruning can be used and txindex can be switched off. It would provide a way to use Electrum wallet with as low resource usage as possible while still being a full node. It would also be reasonably simple to code, only requiring Electrum's protocol and Bitcoin's RPC to be implemented and have them connected together.
I've heard a story of a tourist travelling through rural South America with a laptop, every couple of days at the cheap hostels they stayed they would run Bitcoin with -blocksonly to catch up. The type 1 gateway script would allow them to use Electrum if that was their preferred wallet.
Regarding rescanning. The user should have all their Electrum wallets imported into Bitcoin Core's wallet.dat file, so then they can switch between them without rescanning. If a brand new empty wallet with no transactions is created, there is also no need to rescan. The only time a rescan is needed is if new wallets are added which have historical transactions.
Type 2The gateway script connects to the bitcoin p2p network and downloads full blocks (possibly with
committed block bloom filters).
Features: Excellent privacy, almost as good as full node. SPV security just like Electrum today. Doesn't require any setup.
Downsides: Uses (much) more initial bandwidth than an Electrum server. Slower startup. Fairly complicated to code. Requires using new technology (committed bloom filters) before it can be practical.
Type 2 would be trading off bandwidth and speed for privacy. The wallet downloads some full blocks which takes longer, but in return it gets much better privacy. This script could be added to Tails OS as a pre-installed pre-configured script. Note that scanning blocks only needs to start from the wallet creation date, so if the user creates their wallet right now then the gateway script won't need to scan any old blocks.
Thoughts?