EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

cleos create wallet UX tips #4613

Closed jcalfee closed 5 years ago

jcalfee commented 6 years ago

print the wallet path somewhere

--help and when creating the wallet

fix this error if the wallet directly gets reset and keosd is still running

$ rm -fr ~/eosio-wallet 
$ cleos wallet create    
3263801ms thread-0   main.cpp:2756                 main                 ] Failed with error: unspecified (0)

$ pkill keosd
$ cleos wallet create
"/opt/eosio/bin/keosd" launched
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5JNzoDKTzJwXDHD8pZJeQQppvDrrT6ikq9P7y7if2aCazoyScax"
jcalfee commented 6 years ago

If cleos is launching the wallet with defaults like this:

keosd --wallet-dir ~/eosio-wallet --http-server-address=127.0.0.1:8900 

Then can these be defaults when keosd is launched as follows (should behave like the command above):

keosd &
jcalfee commented 6 years ago

Thanks Todd for having a look.

There is one more case for the error: response_content_length >= 0: Invalid content-length response

I'm stuck updating eosjs because I can't create a wallet in the test environment. I did however find a easy way to re-create the error. Here it is:

$ docker run --rm -it eosio/eos:v1.0.9 bash

Is not related to the error above so a simple pkill will not help:

root@f3d38caeff01:/# ps -eaf|egrep nodeos 
root        12     1  0 13:34 pts/0    00:00:00 grep -E --color=auto nodeos

root@f3d38caeff01:/# ps -eaf|egrep keos
root        14     1  0 13:34 pts/0    00:00:00 grep -E --color=auto keos

Make sure there are no invalid wallet directories:

root@b8617cba70af:/# ls /root/eosio-wallet /opt/eosio/bin/data-dir  
ls: cannot access '/root/eosio-wallet': No such file or directory
/opt/eosio/bin/data-dir:

Start nodeos as documented in: https://developers.eos.io/eosio-cpp/docs/introduction-to-smart-contracts

root@f3d38caeff01:/# nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin 2>&1 | egrep -v 'Produced block 0' &
[1] 17
root@f3d38caeff01:/# 1052252ms thread-0   chain_plugin.cpp:209          plugin_initialize    ] initializing chain plugin
1052252ms thread-0   chain_plugin.cpp:395          plugin_initialize    ] Starting up fresh blockchain with default genesis state.
...

Now what is this error??

root@f3d38caeff01:/# cleos wallet create
"/opt/eosio/bin/keosd" launched
1068085ms thread-0   main.cpp:2756                 main                 ] Failed with error: Assert Exception (10)
response_content_length >= 0: Invalid content-length response
tbfleming commented 6 years ago

The 1.0.9 docker image is currently broken. Bart's working on a fix.

jgiszczak commented 6 years ago

Unfortunately no, keosd & can not currently be equivalent to keosd --wallet-dir ~/eosio-wallet --http-server-address=127.0.0.1:8900. It would solve many problems, but right now, keosd links to http_plugin to provide its HTTP support, and the default port is embedded in the plugin. If it's changed in the plugin, then nodeos would have the wrong port since it also links to http_plugin.

jgiszczak commented 5 years ago

Various changes merged to address multiple issues, including defaulting keosd to Unix sockets, improving error messages, and tolerating removal of a wallet file while keosd is running.