-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accounts, cmd, internal, signer: add note about backing up the keystore #19432
Conversation
accounts/keystore/key.go
Outdated
@@ -179,6 +179,8 @@ func storeNewKey(ks keyStore, rand io.Reader, auth string) (*Key, accounts.Accou | |||
zeroKey(key.PrivateKey) | |||
return nil, a, err | |||
} | |||
fmt.Printf("Your new key is generated. Please backup the key file: %s\n", a.URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used from other locations aswell, we shouldn't fmt.Printf
from within a lower library. If you modify StoreKey
instead, which is only called from accountCreate
, then you can pick out the URL from the returned account
, and either do the printout there, or -- better, return the entire account
instead of just the address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I returned the entire account
instead of just the address.
7529fb7
to
0e076a0
Compare
Looks good. Now please add a log info message for server side when new account is created via rpc aswell |
0e076a0
to
7d79fa1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
internal/ethapi/api.go
Outdated
@@ -295,6 +295,7 @@ func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (a | |||
func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) { | |||
acc, err := fetchKeystore(s.am).NewAccount(password) | |||
if err == nil { | |||
log.Info("Your new key is generated. Please backup the key file", "path", acc.URL.Path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, logs should be shorter than 40 character to keep them aligned. Perhaps let's split there into 3? cc @holiman ?
log.Info("Your new key was generated", "address", /* dunno what goes here */)
log.Warn("Please backup your key file!", "path", acc.URL.Path)
log.Warn("Please remember your password!")
Warn makes sure it's a bit more visible. Open for opposition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do go down this path, do it for the other occurrences too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, sounds good
7d79fa1
to
88c6ffd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kurkomisi Fix the tests please, and run the test suite next time before opening a PR. |
|
How do you backup the keystore file? Every where I go it says "backup keystore" but nowhere does it say "use these steps to backup keystore". I've looked in the Geth tuts: https://geth.ethereum.org/docs/interface/mining |
Fixes #19165
Running
geth account new
:In
geth console
runningpersonal.newAccount()
:clef
: