The macOS app currently doesn’t work properly when more than one account. I’d like to start a discussion for how we approach multiple users using Blockstack on the same machine. Does each user get their own instance of Core? Does everyone share one system wide instance of Core?
I’ll start the discussion by describing what we do on the Blockstack macOS app, some of the problems we encounter when multiple users try to use Blockstack at the same time and some possible solutions.
macOS multi-user problems
We’re currently (v0.4.1) extracting a prebuilt Blockstack Core virtualenv at
/tmp/blockstack-venv each time the Blockstack macOS app runs. We’re also running Core, the Portal proxy & CORS proxy on fixed ports.
On multi-user macOS systems these are a few of the problems that occur when more than one user tries to run Blockstack:
- Port conflicts when both user accounts have Blockstack running at the same time
- The second user account to run Blockstack does not have ownership of
/tmp/blockstack-venvand is unable to remove it without requesting permission elevation (
sudo) and can’t install its own version.
- Even if the user account could remove
/tmp/blockstack-venv, doing so while the other user is potentially running Blockstack Core would cause problems when returning to the other user account.
Potential one node per user solutions
Problems 2 and 3 are relatively easy to solve in the case where only one user is running Blockstack at a time: we can remove
/tmp/blockstack-env/ when the app exits. This doesn’t solve the problem where more than one user is running (potentially different versions of) Blockstack at a time (ie. fast user switching).
Problem 1 can be solved by dynamically selecting available ports at run. We’d have to figure a method of communicating these changing ports to the Portal web app and apps that use Blockstack on each run or giving them some method to discover this information. We’d also have to figure out how to make a location portable Core virtualenv so that each user could use her own copy of the Core code.
System-level Core node
Another approach is to install Core at the system level - one Core installation per machine. It would run at OS start up before users logged in. We’d need to remove user state from Core.
Multi-user support isn’t immediately the highest of priorities. (I’ve added it our backlog) My sense is that only a minority of the users in our initial audience have multiple accounts on their machines. This functionality is probably more important on Windows & Linux where multi-user deployments are more common. Having said that, figuring this out will also help us to reason about how Core nodes will work on devices that are naturally multi-user such as home routers.
I would tend toward installing one Core node per system.
I’ve created the following issue in the Portal repo to track multi-user support on macOS and will include a link back to our discussion: