User Experience for the CLIs

Pulling all the CLI issues into one thread at the request of @chriso Why not sn_node in /usr/local/bin? - #3 by chriso

I’ll try to move or link previous relevant posts here

Meantime please find a tale of NRS woe or stupidity - you choose

steps to re-create
fire up a 20.node baby-fleming with the latest release
create keys and a wallet
create a new top-level domain


willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs register mydomain
New NRS Map created for "safe://mydomain"
The container for the map is located at safe://hyryygy1sooy6ue4c9u1ra8bnuugyeuxwpotwfo7ncuhnr7g68bqibng7man7a
+---+----------+-----------------+
| + | mydomain | safe://mydomain |
+---+----------+-----------------+

Put a folder of files

willie@gagarin:~/projects/maidsafe/safe_network$ safe files put -r ../to-upload/
FilesContainer created at: "safe://hyryyrywd51e46pwwsewjra4ouuofz4kno3aqdpthnefc89f3ca39imuo4enra?v=hewsndu6trt65iq9jtg5a1jz9fdhorz5tskg9n5foze6a9mck3fio"
+---+------------------------------------------------+--------------------------------------------------------------------+
| + | ../to-upload/at-the-top.txt                    | safe://hy8oycyq7ani7se5myqbn45a76pxoee4coq46s4jawjayq4dwtqtrz1cytw |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/file1.txt                         | safe://hy8oycyknqysiqp1h5phdf76wnraokoeqq7gben9e1rfndmi7dneuqe89my |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myfolder                          |                                                                    |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myfolder/file2.txt                | safe://hy8oycypk7o5yq3a1beyjfbjs9z5q4okyh458mw4zu8kad8k9zfg3ndbs3e |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myotherfolder                     |                                                                    |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myotherfolder/new.txt             | safe://hy8oycypyg8ubt9yywrpjckz6xgkbijr7phmz1nptcmnwbtanex1ja3csnh |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myotherfolder/subfolder           |                                                                    |
|---+------------------------------------------------+--------------------------------------------------------------------|
| + | ../to-upload/myotherfolder/subfolder/file3.txt | safe://hy8oycyewufyjonzy766sng9qzycz4hhuf379am88ghm99otfnqw91spgph |
+---+------------------------------------------------+--------------------------------------------------------------------+

Give this container a friendly name in my new domain.

willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs add files.mydomain -l safe://hyryyrywd51e46pwwsewjra4ouuofz4kno3aqdpthnefc89f3ca39imuo4enra?v=hewsndu6trt65iq9jtg5a1jz9fdhorz5tskg9n5foze6a9mck3fio
Existing NRS Map updated. 
Now at version hjmd5d56outcnmbbche7czujdptxjmexhiqq5bnqwj7wjzbzwayky. 
+---+----------------+-------------------------------------------------------------------------------------------------------------------------------+
| + | files.mydomain | safe://hyryyrywd51e46pwwsewjra4ouuofz4kno3aqdpthnefc89f3ca39imuo4enra?v=hewsndu6trt65iq9jtg5a1jz9fdhorz5tskg9n5foze6a9mck3fio |
+---+----------------+-------------------------------------------------------------------------------------------------------------------------------+

Try to look at the entirety of safe://mydomain

willie@gagarin:~/projects/maidsafe/safe_network$ safe cat mydomain
NRS Map Container at safe://mydomain
Listing NRS map contents:
files.mydomain: safe://hyryyrywd51e46pwwsewjra4ouuofz4kno3aqdpthnefc89f3ca39imuo4enra?v=hewsndu6trt65iq9jtg5a1jz9fdhorz5tskg9n5foze6a9mck3fio

Feel somewhat underwhelmed and try something else

willie@gagarin:~/projects/maidsafe/safe_network$ safe cat files.mydomain
Files of FilesContainer (version hewsndu6trt65iq9jtg5a1jz9fdhorz5tskg9n5foze6a9mck3fio) at "safe://files.mydomain":
+------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------+
| Name                               | Type            | Size  | Created    | Modified   | Link                                                               |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /at-the-top.txt                    | text/plain      | 33    | 1678290421 | 1678290421 | safe://hy8oycyq7ani7se5myqbn45a76pxoee4coq46s4jawjayq4dwtqtrz1cytw |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /file1.txt                         | text/plain      | 1285  | 1678290421 | 1678290421 | safe://hy8oycyknqysiqp1h5phdf76wnraokoeqq7gben9e1rfndmi7dneuqe89my |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myfolder                          | inode/directory | 0     | 1678290421 | 1678290421 |                                                                    |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myfolder/file2.txt                | text/plain      | 43532 | 1678290421 | 1678290421 | safe://hy8oycypk7o5yq3a1beyjfbjs9z5q4okyh458mw4zu8kad8k9zfg3ndbs3e |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myotherfolder                     | inode/directory | 0     | 1678290421 | 1678290421 |                                                                    |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myotherfolder/new.txt             | text/plain      | 22    | 1678290421 | 1678290421 | safe://hy8oycypyg8ubt9yywrpjckz6xgkbijr7phmz1nptcmnwbtanex1ja3csnh |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myotherfolder/subfolder           | inode/directory | 0     | 1678290421 | 1678290421 |                                                                    |
|------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------|
| /myotherfolder/subfolder/file3.txt | text/plain      | 17    | 1678290421 | 1678290421 | safe://hy8oycyewufyjonzy766sng9qzycz4hhuf379am88ghm99otfnqw91spgph |
+------------------------------------+-----------------+-------+------------+------------+--------------------------------------------------------------------+

OK my files are where I put them but why can’t I see ALL of safe://mydomain with one command? Try

safe files tree

willie@gagarin:~/projects/maidsafe/safe_network$ safe files tree mydomain
Error: 
   0: UrlError: InvalidXorUrl: Problem parsing the URL "mydomain": relative URL without a base
   1: InvalidXorUrl: Problem parsing the URL "mydomain": relative URL without a base

Location:
   sn_cli/src/subcommands/files.rs:419

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
willie@gagarin:~/projects/maidsafe/safe_network$ safe files tree safe://mydomain
Error: 
   0: Make sure the URL targets a FilesContainer

Location:
   sn_cli/src/subcommands/files.rs:421

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

So both attempts there fail :frowning:

This works as expected, however :slight_smile:

willie@gagarin:~/projects/maidsafe/safe_network$ safe files tree safe://files.mydomain
safe://files.mydomain
├── at-the-top.txt
├── file1.txt
├── myfolder
│   └── file2.txt
└── myotherfolder
    ├── new.txt
    └── subfolder
        └── file3.txt

3 directories, 5 files

lets try adding a file to safe://mydomain


willie@gagarin:~/projects/maidsafe/safe_network$ echo "That's plenty" >> plenty.txt
willie@gagarin:~/projects/maidsafe/safe_network$ safe files put plenty.txt 
FilesContainer created at: "safe://hyryyry11ipbycmkg6i6s47cs134iqrtnc6mjqr9a8berjniiya1tow1jtcnra?v=he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy"
+---+------------+--------------------------------------------------------------------+
| + | plenty.txt | safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh |
+---+------------+--------------------------------------------------------------------+

OK

willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs add -l safe://hyryyry11ipbycmkg6i6s47cs134iqrtnc6mjqr9a8berjniiya1tow1jtcnra?v=he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy safe://mydomain
Error: 
   0: UrlError: InvalidXorUrl: path contains empty component
   1: InvalidXorUrl: path contains empty component

Location:
   /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/convert/mod.rs:726

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Not OK

And neither are

willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs add -l  safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh safe://mydomain
Error: 
   0: UrlError: InvalidXorUrl: path contains empty component
   1: InvalidXorUrl: path contains empty component

Location:
   /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/convert/mod.rs:726

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

nor



willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs add -l  safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh safe://mydomain/plenty
Error: 
   0: UrlError: InvalidXorUrl: path contains empty component
   1: InvalidXorUrl: path contains empty component

Location:
   /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/convert/mod.rs:726

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Sanity check

willie@gagarin:~/projects/maidsafe/safe_network$ safe cat safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh 
That's plenty
willie@gagarin:~/projects/maidsafe/safe_network$ safe dog  safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh 

== URL resolution step 1 ==
Resolved from: safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh
= File =
XOR-URL: safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh
XOR name: 0xf878f7d86ee5f870c718c1fd8fcc3d14c41ce0de15693b85ea66cbf0c9c2c187
Native data type: PublicFile
Media type: text/plain

Yep, entirely as expected…

but…

willie@gagarin:~/projects/maidsafe/safe_network$ safe nrs add -l  safe://hyryyry11ipbycmkg6i6s47cs134iqrtnc6mjqr9a8berjniiya1tow1jtcnra?v=he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy safe://mydomain/plenty
Error: 
   0: UrlError: InvalidXorUrl: path contains empty component
   1: InvalidXorUrl: path contains empty component

Location:
   /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/convert/mod.rs:726

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
willie@gagarin:~/projects/maidsafe/safe_network$ safe cat safe://hyryyry11ipbycmkg6i6s47cs134iqrtnc6mjqr9a8berjniiya1tow1jtcnra?v=he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy
Files of FilesContainer (version he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy) at "safe://hyryyry11ipbycmkg6i6s47cs134iqrtnc6mjqr9a8berjniiya1tow1jtcnra?v=he89fqnyxpejk3ugza77k9jzpbqoz3cgrb3jdcaaja3cxgdjeb7jy":
+-------------+------------+------+------------+------------+--------------------------------------------------------------------+
| Name        | Type       | Size | Created    | Modified   | Link                                                               |
|-------------+------------+------+------------+------------+--------------------------------------------------------------------|
| /plenty.txt | text/plain | 14   | 1678290980 | 1678290980 | safe://hy8oycyxaxd57o5zf9bacqggb9s8haxewaoqqbzoipr7am4ug3xacuosboh |
+-------------+------------+------+------------+------------+--------------------------------------------------------------------+

So I have two problems here
safe files tree safe://mydomain does not perform as intuitively as a n00b would think as it goes NOT show the sub-domain(s)

And Im still mystified about this “empty document” error …

7 Likes
1 Like

Nice work! This will be a good place to keep track of things and update on progress.

5 Likes

safe wallet --help shows a couple of things that feel could be improved for UX

safe wallet reissue - can this be renamed to the more familiar safe wallet spend? The term reissue is specific and leads to a curiosity around the unique features of dbcs (which is neat), but I feel it’s much clearer for day-to-day users as spend.

safe wallet create only works when connected to the network. Offline wallet creation requires safe wallet create --dry-run (and I think this is ephemeral so isn’t really creating a wallet?). A local-only way to create and store wallets would be helpful, perhaps should even be the default. Maybe add an option to safe wallet save or something like that for adding wallets to an account on the network? In my mind the wallet interactions should mostly be local and only require network for broadcast of signed transactions. This probably also has flow-on effects in the code to facilitate hardware wallet signing.

10 Likes

Thanks Ian. Good suggestions. I definitely agree with using spend.

Regarding the wallet creation, can I just clarify, would you want to be able to deposit in the wallet while offline? Or simply just create a wallet and have it persist to the network later?

5 Likes

How about safe wallet pay ?

maybe using offline rather than dry-run would be much more meaningful. But maybe a message when offline saying its offline, and provide the option to create it offline. Either as a prompt or display the option to add to the command that the user must use

1 Like

Creating a wallet should just be creating keys, so I don’t believe it should require network access at all. My guess would be there is just some legacy code in the path, but I’d be curious to hear if there is some “valid” reason.

6 Likes

Not sure!

The wallet stuff is a little complicated, we can’t simply apply blockchain ideas here. The fundamental difference is SN is like a harddrive but spread across the network, as secure (or more secure) than your local drive. So the idea of ‘offline private keys only’ is historically driven by blockchain concepts of security, and may not be as applicable here.

I guess it depends on what ‘deposit in the wallet’ really means. On blockchain this means you can scan the ledger for your addresses/txs/deposits and then act on them in an offline/local way for signing transactions using that deposit info.

So I guess it makes sense that safe wallet deposit would also work offline, with a second way to check the if deposit is valid (or not). For example safe wallet deposit checks the deposit using the network and safe wallet deposit --offline assumes existence of the dbc being deposited without any network check.

Yeah offline seems simpler to understand than dry-run. I thought dry-run might have been a standard term from the clap crate that parses command line args, but the clap docs don’t show the term dry-run, so it seems like a SN specific term and could possibly be changed to offline. I think offline is probably clearer.

I guess one semantic difference here is dry-run implies nothing has changed (both locally and on the network), whereas offline might mean things have changed locally but not on the network. Not sure what meaning or behavior we want to pursue, or how much it matters to most people.

I understand the history here is that wallets in sn_cli are intrinsically tied to accounts for convenience, so it’s an online action by default (because accounts are a fundamentally online thing).

We need to seriously consider whether SN is a more secure environment than the local drive (it’s certainly possible). If it is, then it makes sense for all activity to happen online rather than offline. But from a blockchain perspective the offline scenario is held in high regard, and I tend to agree that some offline environments are safer than SN would be. A very good debate can be had on this topic for sure, but it’s probably veering off topic.

I agree that private keys generally should stay local / offline and should have the minimum possible exposure.

9 Likes

Offline actions can be useful for clients with intermittent internet connections.

10 Likes

DBCs can function with just a spendbook for reissuing/splitting and all transfers of DBC tokens take place out-of-band via email, messenger, sms, or whatever.

So to me, any payment layer and/or network storage should be a value-add optional convenience. It should not prevent base functionality, which can work without “payments”.

One could even use DBC’s entirely offline because they can be physically transferred between people without ever contacting a mint.

This would of course open the recipient to double-spend risk. But it could be useful for example when you and your buddy are in a remote area with no network access and need to divvy up the lunch bill. ie, situations of high trust, low risk.

Perhaps more interestingly a bearer DBC could very well be stored on something like an opendime and passed around between people indefinitely.

I guess in the final analysis it doesn’t matter too much what this particular wallet does because if the token were to become successful, many different wallet implementations and payment systems would exist. :wink:

9 Likes

Reading that seems an assumption that online is available. I wonder there are so many cases where intermittent or no access for a time, might see users prefer to take actions offline where possible.

And noting the chatter from national digital currency seem to suggest they are looking at options for payments offline that are mitigated by usual limits by amounts and other attributes.

Would be nice if there was option to anticipate offline and setup allowed limits… spawning cashlike option but beyond me to understand how…

5 Likes

I think it does matter
IMHO this wallet should do the core functions well and leave the edge cases (offline) until later. Get testing with this new wallet ASAP, note its shortcomings and address them in future iterations.

@JimCollinson has done a lot of UX/UI work, lets eee how valid that remains before we head off adding features and possibly reinventing work he has already done.

5 Likes

Thanks for the detail here.

Just wanted to say I have read through the post, but I will need to look into the current implementation in more detail before I can respond properly. I definitely will, but not sure when.

@bochaco may also be interested in this discussion and have some knowledge to bring to bear on it.

5 Likes

Just wanted to provide a bit of an update on my current work and ask a question related to it.

I just merged the first PR for safeup:

At the moment it just has one command for installing the client binary, so not much there. The remaining functionality will be getting added soon, but it’s now pending another piece of work.

I had to wait until the node binary was renamed before I could add functionality for installing that. So I started on that, but ran into an issue with the testnet binary and sn_launch_tool, which were written to expect the node to have a certain name. It’s been a bugbear of mine that we’ve had this proliferation of different ways for launching a testnet, because it involves updating different things whenever you make a change to the node’s CLI.

We’ve settled on now using the testnet binary as the way for launching a local network. The sn_launch_tool repository will be archived, and the whole node command will still be removed, as planned. So if you want to launch local networks, we’ll be recommending using the testnet binary. Putting it into safeup was an option, but we wanted something in the safe_network repo. I am thinking about adding the testnet binary to the release process if anybody would want this? So the binary would be attached to the release as per safe and safenode. Otherwise, you’d need to just build it from source.

6 Likes

Can you tell us what the differences are between testnet and run-baby-fleming? In the past I’ve had one succeed and the other (usually testnet) fail.

1 Like

To be honest, I’m not sure what the difference is. That’s part of the problem here. Too many different ways.

3 Likes

Lets clear it up, let’s think where everything should fit and make it a reality

1 Like

Well, that’s what we’ve just done really. It will be in one place, the testnet binary.

2 Likes

Can safeup have options to install different things (safenode, testnet etc) including an all which means everything?

P.S. I’m not sure about the name safeup. Isn’t there a more general user friendly name - very few will know of rustup and I’m not sure even those who do will twig what safeup does until they are told. I’m not sure if there’s a standard term or if we should go with something like safeinstall or safeupdate or maybe getsafe.

So getsafe node, getsafe testnet, getsafe all?

3 Likes