Dog crashes Safe CLI - the hammer strikes again

Playing with the latest release and I could create a wallet but have not yet seen the (zero) balance.

So I sniffed the wallet address with dog and crashed the cli.

Also supplying the balance from stdin does nothing…

willie@gagarin:~$ safe  wallet balance 
...awaiting Wallet address/location from STDIN stream...
safe://hyryynyenpmkjkzpzffy3hic8sybtzmta337d5krxu8n9qjqy78gfkd4bzg4y84y



^C
willie@gagarin:~$ safe  wallet balance safe://hyryynyenpmkjkzpzffy3hic8sybtzmta337d5krxu8n9qjqy78gfkd4bzg4y84y
Error: 
   0: AccessDenied: Couldn't read Wallet found at "safe://hyryynyenpmkjkzpzffy3hic8sybtzmta337d5krxu8n9qjqy78gfkd4bzg4y84y"

Location:
   sn_cli/src/subcommands/wallet.rs:77

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

This is a valid error, you need to make sure the CLI has a keypair so it uses it for every command, otherwise it uses a random one each time, thus what happens is that the Wallet is first created with one key as the owner which is not the same key it uses for when you try to check the balance.

Long story short, make sure you create and set up a keypair for CLI with $ safe keys create --for-cli, after that create a new Wallet and you should be able to check its balance and make deposits to it.

I’ll take a look at the issue with dog in the next few days, I think it’s just that Wallet and a few other data types are not yet supported by dog.

6 Likes

Thank you.
My error was I had missed the --for-cli flag off safe keys create

But now I get a different error ContentError rather than AccessDenied

willie@gagarin:~$ safe keys create --for-cli
New SafeKey created: "safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo"
Key pair generated:
Public Key = 70a5cf9316f52cc238fc25cb59751c790dc5e5edc2addef48dcf469a46547c4b
Secret Key = efc71f320d92a33b229d2f926269d8a31a7c73a75bcea4c83c0477ecd9369fe3
Setting new SafeKey to be used by CLI...
New credentials were successfully stored in /home/willie/.safe/cli/credentials
Safe CLI now has write access to the network
willie@gagarin:~$ safe wallet create
Wallet created at: "safe://hyryynyen6huscqwkyqkrwomp1gt1hadnubg76tb4bboof5t3a761x8d433ny84y"
willie@gagarin:~$ safe wallet balance safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo
Error: 
   0: ContentError: Failed to read balances from Wallet: ContentError: The url safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo has an SafeKey(Public(70a5cf(01110000)..)) address. To fetch register entries, this url must refer to a register.

Location:
   sn_cli/src/subcommands/wallet.rs:77

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

but dog works now :slight_smile:

willie@gagarin:~$ safe cat "safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo"
No content to show since the URL targets a SafeKey. Use the 'dog' command to obtain additional information about the targeted SafeKey.
willie@gagarin:~$ safe dog "safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo"

== URL resolution step 1 ==
Resolved from: safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo
= SafeKey =
XOR-URL: safe://hyryyyyyyqn1h9ras6wscrq8hrzfi17ehxrghm3xpaks777rp37djwt1wxtfo
XOR name: 0x70a5cf9316f52cc238fc25cb59751c790dc5e5edc2addef48dcf469a46547c4b
Native data type: SafeKey
4 Likes

You are using the wrong URL to check the balance, you should use the Wallet’s URL instead of the SafeKey’s URL you just created for CLI, i.e. use $ safe wallet balance safe://hyryynyen6huscqwkyqkrwomp1gt1hadnubg76tb4bboof5t3a761x8d433ny84y

4 Likes

D’uh
It’s a bit late here…

In fact, its nearly early here. I’ll get some kip before I start messing with DBCs

Thanks again :slight_smile:

willie@gagarin:~$ safe wallet balance safe://hyryynyen6huscqwkyqkrwomp1gt1hadnubg76tb4bboof5t3a761x8d433ny84y
Wallet at "safe://hyryynyen6huscqwkyqkrwomp1gt1hadnubg76tb4bboof5t3a761x8d433ny84y" has a total balance of 0.000000000 safecoins
6 Likes

was/is node install working for you?

I installed it manually last night.

Just checked there and it fails trying to install node-0.1.1

willie@gagarin:~/.safe/node$ safe node install
Downloading sn_node version: 0.1.1
Downloading https://sn-node.s3.eu-west-2.amazonaws.com/sn_node-0.1.1-x86_64-unknown-linux-musl.tar.gz...
Error: 
   0: Error downloading release from 'https://sn-node.s3.eu-west-2.amazonaws.com/sn_node-0.1.1-x86_64-unknown-linux-musl.tar.gz'
   1: UpdateError: Download request failed with status: 404

Location:
   sn_cli/src/operations/helpers.rs:92

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
willie@gagarin:~/.safe/node$ safe -V
sn_cli 0.51.3

ok cool.

what is the create coins command?

I got this far

safe wallet create
Wallet created at: "safe://hyryynyen9nkeujixmyd9jroxfb7t3tkoudrauogedjc6ukosyh6g4s7ntkho84y"
josh@pc1:~$ safe wallet balance safe://hyryynyen9nkeujixmyd9jroxfb7t3tkoudrauogedjc6ukosyh6g4s7ntkho84y
Wallet at "safe://hyryynyen9nkeujixmyd9jroxfb7t3tkoudrauogedjc6ukosyh6g4s7ntkho84y" has a total balance of 0.000000000 safecoins

ahh I found it… i think.

$ safe wallet create
Wallet created at: "safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y"

$ safe wallet balance safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y
Wallet at "safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y" has a total balance of 0.000000000 safecoins

$ safe wallet deposit --name my-first-dbc safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y 550ec207952fcb671353628d68a3e6860ba86...
Spendable DBC deposited with name 'my-first-dbc' in Wallet located at "safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y"

$ safe wallet balance safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y
Wallet at "safe://hyryynyengccd6t6zrq4zgq89bo8sec976kguhhp38a6gajxa31ipz96pxjjy84y" has a total balance of 18446744073.709551615 safecoins

ok not quite working/figured out

1 Like

Where are you getting the actual DBC from?

I was going to try line 192 of https://github.com/maidsafe/safe_network/commit/842c77a5fe1c4f13e9a9f37b3b5dea974c0f5a82

There are other DBCs in recent github but I cant find them right now - a DBC that issues the MAX and one for a smaller amount

well I was going to use the playground which is compatible but…

josh@pc1:~/sn_dbc_examples$ cargo build
    Updating crates.io index
    Updating git repository `https://github.com/dan-da/sn_dbc.git`
    Updating git repository `https://github.com/maidsafe/blst-ringct`
error: no matching package found
searched package name: `blst_ringct`
perhaps you meant:      bls_ringct
location searched: https://github.com/maidsafe/blst-ringct
required by package `sn_dbc v2.15.0 (https://github.com/dan-da/sn_dbc.git?branch=decouple_deps#1986cd3b)`
    ... which satisfies git dependency `sn_dbc` of package `sn_dbc_examples v0.1.0 (/home/josh/sn_dbc_examples)`
1 Like

Yes that was my thought too. It compiled fine for me last night - if you use STABLE, nightly gave me a facefull of error msgs that I couldnt handle at that time of night

EDIT
Sorry - sn_dbc compiled OK last night, I never got around to sn_dbc_examples.

2 Likes

I’m getting a bit further with sn_dbc

Im pasting in the DBC from the link above and using the first SecretKey

willie@gagarin:~/projects/maidsafe/sn_dbc$ cargo run --example mint-repl
    Finished dev [unoptimized + debuginfo] target(s) in 5.39s
     Running `target/debug/examples/mint-repl`

 __     _                        
(_  _._|__  |\ | __|_     _ ._|  
__)(_| |(/_ | \|(/_|_\/\/(_)| |< 
 ____  ____   ____   __  __ _       _   
|  _ \| __ ) / ___| |  \/  (_)_ __ | |_ 
| | | |  _ \| |     | |\/| | | '_ \| __|
| |_| | |_) | |___  | |  | | | | | | |_ 
|____/|____/ \____| |_|  |_|_|_| |_|\__|        
  
Type 'help' to get started.

>> help

Commands:
  Mint:    [mintinfo, newmint]
  Client:  [newkey, newkeys, reissue, reissue_auto, decode, verify]
  General: [exit, help]

>> newkey

Poly of existing SecretKeySet (or [n]ew to generate new key): 
n

How many shares needed to sign (m in m-of-n): 1

 -- Poly Hex --
  e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a0000000000000001

 -- SecretKeyShares --
  0. e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a
  1. e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a
  2. e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a
  3. e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a
  4. e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a

 -- PublicKeyShares --
  0. b05ca5a451d9947c3a98359b529437885556b8f6fa9ca0af303afcc7e12fce783fe97edbc4cd2ec7ec8b38196cf1e9e4
  1. b05ca5a451d9947c3a98359b529437885556b8f6fa9ca0af303afcc7e12fce783fe97edbc4cd2ec7ec8b38196cf1e9e4
  2. b05ca5a451d9947c3a98359b529437885556b8f6fa9ca0af303afcc7e12fce783fe97edbc4cd2ec7ec8b38196cf1e9e4
  3. b05ca5a451d9947c3a98359b529437885556b8f6fa9ca0af303afcc7e12fce783fe97edbc4cd2ec7ec8b38196cf1e9e4
  4. b05ca5a451d9947c3a98359b529437885556b8f6fa9ca0af303afcc7e12fce783fe97edbc4cd2ec7ec8b38196cf1e9e4

 -- PublicKeySet --
e4e9f16c19388becc72ecdc4db7ee93f78ce2fe1c7fc3a30afa09cfaf6b85655883794529b35983a7c94d951a4a55cb00000000000000001


Signing Threshold: 0  (1 signers required)

SecretKey: e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a
PublicKey: e4e9f16c19388becc72ecdc4db7ee93f78ce2fe1c7fc3a30afa09cfaf6b85655883794529b35983a7c94d951a4a55cb0


>> reissue

Input DBC, or '[d]one': 
c4a1953dfa419234b8ab9a60dc0e6fc073a1576cf34a45345218b95e445fdfe7cae2cc4050352891483e93e9f6dc311766ead4835324c04a222ed4aace21410625747877cb83eb7b8b59e196c3ff607e097aecb647415024716856f44e5dd4ae47406706769a8f1498d11ecdbd58f7e83b24c3e498425b86a0b2a07d5277322ed2112a3a853a0c36c0e49fa6ce5543a763b8f891d8d98d5c0c509e62408b354eb18b21c417e7b51b043d52bfc2ed6b444b1b7b00f7e5a359ac712dab253404970000000000000001fb0aa04f1d01b1bdb5e033db74c8fa8ce0afa6a98992ffd5a6639bde4fc772c1bd546d885fd355619bd1a226c6cc743f40c939d39634f6bcc15a1a590e40d597d7c9a08e2346cbe7c06e1a514abedc93000000000000000138aab683457882ebc8dc80cd829f9e292837a00789952636524a544ae1fada10439ed9478b6d0127c5fd13ed74e9e18707ea919914faca624361a4cf56c46c5af7311712a4ce792b2c4b3d0dd6fa7e0e5739d453d82f9cd7957421539b6ce3df184007606ccc21ec98fcde61af1ff83a9a1836eb943a8951b5dc368662efdfcccfbefff5cc368353ebb6ea06217dfc317a28312d0436d55d8c210fcb1bb35295dcbe4b1f43e932c630f99b7629f83725efa04b8b5de60ad9c59e6f6ca02f865fcaa78f39f6245122ef72a9a594ece893bdcad0ed9c6d4ef70dbde8e0b6c674eaebb054dc2bae1057718f09d7272c74c322c200f360ac1e593cb4cd9386fff1a680b6334a5c553f25aeb8d5a78b2137e3beb3c686b1141ccfe6303b08882cf564cadab4d29bca09c7c9544ed427003a91d7cd080343cd4cc87e7ba621b0bad37e384428439d0bb0ece88bde3ee3018adb116f40b633c38418a34d6100baa97d84f76d09ede201b47e36a163e8d59f8724188b3f993d73d6ee05f98e665c7368012c9e10f5ca94dabf7b11c71816039a93e0d0ca221b4d69d1c3ce0afc416b8c05e8b49870eba331310eedfb4b866269b99cc1d0ab8ee3e8a3b574fe2bbbd100b882868cfffe28db4ae1ef9345e7bc94d3babdb3abe3708b7913d69c2a9d766f176093c7809358a5876d8aa36cafd671b87a8ff2a8edb14ad93d584ce65c867ac523a91164e2a6320fa22efa817915959a98e4af659c305b5a2f209341caed64a7e22d5e38811d3ad33cfb5252286b126061691e2b47d2f83e15131a0456562449812e0c4590b5ce2556ef9e07113f55aab3c518c74b8cf3703536de6fc83e775d5203b343af00322512fa97584c4522b8715b48b2d428dec09c2a87a5d2577fb9ea0a895fcd2b86a1d251e30b39e50a10596ddef7e61ab01b624b66fbd1528314628d483999ea0d457a625498817bc9b0215808e77d7f544fcd115d80b520d426990093797183e3bd8b70ce540f20045432f7ee915bf993fc1ddfeb2377b2accad1444174cafc74b6eb78fe764bca0d203b05231581f1cec51cc8d9c8557fc3743db85e126570964526c1c36fabedc8f7f7f9cb871895759777311242957e7ffafdcadde45381fb3ebaa89971361667b59c7d6b858be1aeb0eb7ba7dd643c3cb2ca63f9689ea6d3dcfd9c1503e5e6f264c9b2243a11bcf019be5c43902dd850fda28c9d88144d19a6df48a7672ae33b962ee24cbcc9d826f32e9b9ffbf4ea28932027a5b1ff6338142c68ba3353376735244e07dc49a1f92ca55b625a167dd298cbbdb3a3855b8636fb27178b72015b40789257e72f3e452860756392ec9b2173cb4c8f551193b5d6275c937de915379100000000000003a096535faeae2d5b27e4c0b37f2d8667128dbe048a2814ce4d24fc60f7a0dda7c87e1d3b30254c25aba701ff6eeb9ebe88000000000000000138aab683457882ebc8dc80cd829f9e292837a00789952636524a544ae1fada10439ed9478b6d0127c5fd13ed74e9e1875ec7f615f506c5b54a6f2c581b53054eb27f064c3216970f98165341f1f5e25e7508f4d421c3dba24ff7adbe61d61da910f652f9d986fe9649d2937a0f631c5c8d1a922817b5637b263ac7642066e81df5a8c4e8ecb51168fd2349c71534d4ab0000000000000001bd546d885fd355619bd1a226c6cc743f40c939d39634f6bcc15a1a590e40d597d7c9a08e2346cbe7c06e1a514abedc933dfe1a98a93b51d4c1da98fb7f71c82689cb90a92b4b882d2b7ebbfd63f167e82be854194397cba8f0a87a5fcd07848220c26efbccdc78006f7abb47d90d0f5600000000000000010454acf22d354960e1234aa7878e260bfbc16960378064edecba8edcf7245e860000000000000001a460961fa01de9af3e25b9fa2de0eae07fab57a77d008e32eed003fc9b0fab7c88d31227205b67c5869bfa190787a806a72fcf51b7215073a5fa096a33d633a38c1cbc6acb0e9352fa6ada19f2c940c47e47255f0eb1388be73eac4c63e9678586e57f4967288d544910477648557437c78fee95ed7ef617e040dddedcf87f4c447127fa3efdc4bf00000000000000285434cdc90dcf805084231785b0601ef76669a3850767f2e425ca9f823d6dabbe2da9cb85de80e0ff2bbd95e1302a5aa640f8a05e740ba15e12cc1653cf1fb3b07503b97f77e0564498040a9d77f02858dd0f084c98d7880ff61259b068734b08b6274864828e02dbb33cb912b9ae1f48964a9a8db13db72f9e702b9a60da2a6f1b8febd9e851bd678b191121f05b3994c34edb90f6cd72c9b4999fa51209b859bb9f14223e620cb1cc11137cc45f66fa000000000000002047adb7e64b0c19ed1203da940e2154497d81ab0964688819e37542352bb05a0107feb99b49f0234c9eaa95106453d0b2c16551530000000000000000000000000000000000000000000000000000000000000000

Input DBC, or '[d]one': 
d

------------
Output #0
------------

Inputs total: 18446744073709551615.  Remaining: 18446744073709551615
Amount, or '[c]ancel': 5000

[b]earer, [o]wned, [r]andom bearer, or [c]ancel: 
b

SecretKey, or '[c]ancel': 
e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a

------------
Output #1
------------

Inputs total: 18446744073709551615.  Remaining: 18446744073709546615
Amount, or '[c]ancel': 1234567

[b]earer, [o]wned, [r]andom bearer, or [c]ancel: 
b

SecretKey, or '[c]ancel': 
e7961124184f2e274bb08f50769c2a2d25a00247026b506b6b123ec3447edc5a

------------
Output #2
------------

Inputs total: 18446744073709551615.  Remaining: 18446744073708312048
Amount, or '[c]ancel': c

prepare_tx cancelled



Preparing RingCtTransaction...



Writing to Spentbook...


logging input PublicKey(0b2c..2d3b), spentbook 0

Error: ringct error: InputPseudoCommitmentsDoNotSumToOutputCommitments

Caused by:
    InputPseudoCommitmentsDoNotSumToOutputCommitments

>>

EDIT: “mintinfo” may have been a more useful first command

1 Like

The sn_dbc mint-repl example is also what I’ve been using to generate the tests for these commands. Note these commands are yet in development. There are three hard-coded DBCs in the unit tests if you want to use them for playing with the CLI commands without needing to generate them with the mint-repl: safe_network/wallet.rs at main · maidsafe/safe_network · GitHub. Just copy the characters from any of them and paste them into the deposit command.

3 Likes

duly noted :slight_smile:

1 Like
safe wallet balance safe://hyryynyen9nkeujixmyd9jroxfb7t3tkoudrauogedjc6ukosyh6g4s7ntkho84y
Wallet at "safe://hyryynyen9nkeujixmyd9jroxfb7t3tkoudrauogedjc6ukosyh6g4s7ntkho84y" has a total balance of 18446744073.709551615 safecoins

mint-repl is hurting my head… :crazy_face:

1 Like

lessen the hurtage by ignoring everything in sn_dbc_examples for now.

This may not be the correct course of action but your head will hurt less for a while.

1 Like

To be fair though, I think we need a better user experience for this. There is nothing in the CLI that indicates to users that they can fix the problem by creating keys.

4 Likes

Its early days yet - nobody will really complain unless this isn’t fixed by Tuesday - lunchtime.

1 Like

There’s a few different commands that this applies to now though: files, nrs and now wallet. Needs something better for users.

2 Likes