Skip to content
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

import/export accounts #550

Merged
merged 12 commits into from
Mar 26, 2015
Merged

Conversation

zelig
Copy link
Contributor

@zelig zelig commented Mar 23, 2015

#541

https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts

  • cli: add passwordfile flag
  • cli: change unlock flag only takes account
  • cli: with unlock you are prompted for password or use passfile with password flag
  • cli: unlockAccount used in normal client start (run) and accountExport
  • cli: getPassword used in accountCreate and accountImport
  • accounts: Manager.Import, Manager.Export
  • crypto: SaveECDSA (to complement LoadECDSA) to save to file
  • crypto: NewKeyFromECDSA added (used in accountImport and New = generated constructor)

@zelig zelig force-pushed the frontier/cli-key branch 4 times, most recently from e18bfef to 2704b7e Compare March 23, 2015 22:53

Note:
Since you can directly copy your encrypted accounts to another ethereum instance, this import/export mechanism is not needed when you transfer an account between nodes.
`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap these strings at column 80.

@zelig zelig force-pushed the frontier/cli-key branch from 2704b7e to 1147eb0 Compare March 24, 2015 16:53
@obscuren
Copy link
Contributor

@zelig zelig force-pushed the frontier/cli-key branch 2 times, most recently from 7352dfc to 22fd1e2 Compare March 24, 2015 22:58
@@ -101,6 +101,17 @@ func (am *Manager) firstAddr() ([]byte, error) {
return addrs[0], nil
}

func (am *Manager) getKey(addr []byte, keyAuth string) (*crypto.Key, error) {
if len(addr) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good idea. Unlock(nil, ...) should never work.
It's like saying: "please unlock some random account with this passphrase".

This change is also unrelated to the account import/export.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error needs to be returned if an invalid addr is passed.

@zelig zelig force-pushed the frontier/cli-key branch from d4bd44c to dd8344b Compare March 25, 2015 16:13
@fjl
Copy link
Contributor

fjl commented Mar 25, 2015

We can merge this once you remove crypto.SaveECDSA.

@fjl
Copy link
Contributor

fjl commented Mar 25, 2015

Also maybe squash the changes together if you want.

am := utils.GetAccountManager(ctx)
auth := unlockAccount(ctx, am, account)

err := am.Export(keyfile, common.FromHex(account), auth)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't export private keys directly to disk. Export encrypted keys only. Maybe supply an additional tool to actually export the private key.

People tend to forget they exported something to file. Ending up with your HDD compromised will lead to your private keys being compromised. We should try to do everything we can do minimise the risk. Supplying an additional tool means "look, you can do it, we don't recommend it, but feel free to use this tool."

Importing is a different story. Would it be possible to check the format of the key and assume either "encrypted key" or "unencrypted key"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current files have different JSON schema for encrypted and unencrypted, but it's not very clean to use compared to a proper header. @fjl and I discussed this before and talked about adding a common format with a header that specifies whether what follows is encrypted or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so currently there are 2 consistent options which both make sense:

1 leave everything there as is.

  • we support unencrypted keys anyway as part of the cli with a simple flag then no point in worrying about unencrypted export for now.
  • Its all developers anyway. and it is hidden in a subcommand. You really need to be tech savvy to do this.

2 full paranoid mode:

  • remove export
  • remove plain text key-store
  • remove --unencrypted-keys flag

testers can setup a coinbase and unlock it all non-interactively with the following commands:

ethereum -datadir /tmp/eth/42 -logfile /dev/null -password <(echo -n notsosecret) account new 
ethereum -datadir /tmp/eth/42 -logfile /dev/null -port 30342  js <(echo 'console.log(admin.nodeInfo().NodeUrl)') > enode
ethereum -datadir /tmp/eth/42 -logfile 42.log -port 30342- password <(echo -n notsosecret) -unlock coinbase .....<further flags to run the node>

and therefore test team won't even need a custom built client

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option number 2 :-)

zelig added 10 commits March 26, 2015 19:00
- cli: add passwordfile flag
- cli: change unlock flag only takes account
- cli: with unlock you are prompted for password or use passfile with password flag
- cli: unlockAccount used in normal client start (run) and accountExport
- cli: getPassword used in accountCreate and accountImport
- accounts: Manager.Import, Manager.Export
- crypto: SaveECDSA (to complement LoadECDSA) to save to file
- crypto: NewKeyFromECDSA added (used in accountImport and New = generated constructor)
- extract accounts.getKey method - if given empty address it retrieves coinbase (first account)
- cli -unlock coinbase will unlock coinbase
- accounts: remove Manager.getKey
- cli: for -unlock coinbase, use account manager Coinbase()
zelig added 2 commits March 26, 2015 19:00
- remove account export functionality from CLI
- remove accountExport method,
- remove unencrypted-keys flag from everywhere
- improve documentation
@zelig zelig force-pushed the frontier/cli-key branch from dd8344b to 7577d12 Compare March 26, 2015 19:04
zelig added a commit to ethersphere/system-testing that referenced this pull request Mar 26, 2015
obscuren added a commit that referenced this pull request Mar 26, 2015
@obscuren obscuren merged commit 829240c into ethereum:develop Mar 26, 2015
@zelig zelig mentioned this pull request Mar 26, 2015
@obscuren obscuren mentioned this pull request Mar 26, 2015
4 tasks
nolash pushed a commit to nolash/go-ethereum that referenced this pull request May 25, 2018
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Nov 22, 2021
elee1766 pushed a commit to elee1766/go-ethereum that referenced this pull request Dec 23, 2023
s1na pushed a commit to s1na/go-ethereum that referenced this pull request Dec 2, 2024
Implement EIPs to support the increase of TX size limit configuration.
EIPs: 2464, 2364, 2124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants