chris-belcher/electrum-personal-server

number of connections to eps

3ntranced opened this issue · 10 comments

How many connections can eps handle? When I tried connecting with desktop it disconnected my smartphone.

Only one at a time, as it's a single threaded application.

Understood.

Thank you

Reopening because one day this could be fixed. It's possible to handle multiple connections at once, this thread gives a concrete example of that being useful.

Another concrete example is people setting up one server that multiple mutually-trusting people use; for example one family in a household (although then there can be no surprise birthday gifts, as all the spending will be visible to the server operator).

Would much appreciate this. Electrum is often used for multisig, read-only wallets etc. Having only one user be able to connect at a time limits the functionality of this.

+1 to this feature.
Another scenario would be to have a block explorer running (like btc-rpc-explorer which uses Electrum Server) and also wanting to connect a wallet.

You can try bwt, an alternative personal electrum server implementation written in Rust that supports multiple simultaneous clients.

I would rather keep using EPS, so I came from the future to further push this feature request, I realized the hard way that EPS only supports one client connection, and this is inconvenient when for example you are moving funds between two wallets you own.

I'm afraid this issue isn't a priority for me right now. I'm working a lot on coinswap these days. Also I personally only use Electrum/EPS with one connection at a time. If someone else codes this I can help with review. If not then maybe I can do it in about a year.

Here are some of my thoughts for coding:

  • To help test it's possible to run multiple electrum instances with different data directories, which then create multiple connections to a server. $ electrum --dir /tmp/alice and $ electrum --dir /tmp/bob.
  • Spawning a new thread for each connection is a tempting way to do this, but you'd have to be really careful with concurrency issues. it might not be worth it.
  • Ideally I'd like to avoid requiring any new dependencies or the latest versions of python, because I hear about people running full nodes on old laptops they have lying around which cant always easily get the latest python (though maybe this isn't even worth aiming for, since those old laptops pretty soon wont be able to run Bitcoin Core either). If so then using asyncio maybe isnt worth it.
  • Having the server use a select loop is then probably the best way of doing this.
  • Right now in transactionmonitor.py the dict address_history has a field called subscribed which is a boolean. That wont work in the multi-client server because different clients can subscribe to different addresses, so that field should become a list I guess.