RedenCore / Reden

MIT License
9 stars 15 forks source link

Use user's home directory as datadir in snap #31

Closed cimm closed 6 years ago

cimm commented 6 years ago

We added the configuration for the Reden snap a few days ago (see pull request #29). This woks but can potentially lead to important data loss.

Snaps store their data in a confined directory, this directory is removed when you uninstall the snap. While this is a clean and safe design (no write access outside this confined space is needed) this might not be the best option for a cryptocurrency wallet.

If the user accidentally removes the snap it will remove their private keys without asking for confirmation. In other words: it's too easy to loose your most important data.

I therefore propose to create a reden directory in the user's home directory and use that directory as the wallet's datadir.

PS: You are all crypto literate enough to understand you should always backup you wallet file! I don't guarantee this will work perfectly on a first try on all possible Linux distros. Trust but verify!

This means the snap will have read and write access to your homedir (excluding hidden files and directories) but also means you'll keep the full blockchain and wallet.dat if theReden snap is uninstalled.

WARNING You are all crypto literate enough to understand you should always backup your wallet file! I do not guarantee this works perfectly on all possible Linux distros. Trust but verify!

thebeardbe commented 6 years ago

Why not give the user the option what is the dir he wants to install in. It used to be like that, the snap just did not have enough access.

If I understood correctly, the user has no choice but to accept the ~/reden dir. but the user would for example prefer to have it in ~/Documents/wallets/reden can we do that?

cimm commented 6 years ago

The non-snap Qt wallet gives you the option at bootstrap to go for the default installation directory or define one yourself. In the snap version this is both the snap's common directory (snapd overwrites the $HOME environment variable). Meaning the snap will always default to the snap's common folder. This is not clearly shown in the GUI option screen meaning the user has no obvious way to tell it will create his wallet in the common snap folder:

rendewelcomescreen

I changed this behaviour by defining the --datadir param pointing it to the user's real homedir (see the changes in this pull request). Doing so skips the bootstrap GUI option screen, meaning you can no longer select the datadir via the GUI.

I can close this pull request and simply add the home plug to the snapcraft.yaml. This would give users the option to choose ~/Documents/reden if they want. The issue with this it that it still defaults to the snap common directory. If they don't pay attention it will install the wallet in the common folder.

What is the preferred action here?

cimm commented 6 years ago

Closing this pull request, I'll make another where we keep the default snap behaviour (storing the wallet in the snap common folder) but with access to the user's home directory so the user can choose where to install (or backup) their wallet.