Managing accounts

WARNING Remember your password.

If you lose the password you use to encrypt your account, you will not be able to access that account. Repeat: It is NOT possible to access your account without a password and there is no forgot my password option here. Do not forget it.

Note: the key file name naming convention changed as of 0.9.36. This document is meant to reflect accurate information on accounts as used by the frontier release.

The ethereum CLI geth provides account management via the account subcommand:

account command [arguments...]

Manage accounts lets you create new accounts, list all existing accounts, import a private key into a new account, migrate to newest key format and change your password.

It supports interactive mode, when you are prompted for password as well as non-interactive mode where passwords are supplied via a given password file. Non-interactive mode is only meant for scripted use on test networks or known safe environments.

Make sure you remember the password you gave when creating a new account (with new, update or import). Without it you are not able to unlock your account.

Note that exporting your key in unencrypted format is NOT supported.

Keys are stored under <DATADIR>/keystore. Make sure you backup your keys regularly! See DATADIR backup & restore for more information. The newest format of the keyfiles is: UTC--<created_at UTC ISO8601>-<address hex>. The order of accounts when listing, is lexicographic, but as a consequence of the timespamp format, it is actually order of creation

It is safe to transfer the entire directory or the individual keys therein between ethereum nodes. Note that in case you are adding keys to your node from a different node, the order of accounts may change. So make sure you do not rely or change the index in your scripts or code snippets.

And finally. DO NOT FORGET YOUR PASSWORD

SUBCOMMANDS:

        list    print account addresses
        new     create a new account
        update  update an existing account
        import  import a private key into a new account

You can get info about further subcommands by geth account help <subcommand>

Accounts can also be managed via the Javascript Console

Examples

Interactive use

creating an account

$ geth account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat Passphrase:
Address: {168bc315a2ee09042d83d7c5811b533620531f67}

Listing accounts

$ geth account list
Account #0: {a94f5374fce5edbc8e2a8697c15331677e6ebf0b}
Account #1: {c385233b188811c9f355d4caec14df86d6248235}
Account #2: {7f444580bfef4b9bc7e14eb7fb2a029336b07c9d}

Import private key

$ geth --datadir /someOtherEthDataDir  account import ./key.prv
The new account will be encrypted with a passphrase.
Please enter a passphrase now.
Passphrase:
Repeat Passphrase:
Address: {7f444580bfef4b9bc7e14eb7fb2a029336b07c9d}

Account update

$ geth account update a94f5374fce5edbc8e2a8697c15331677e6ebf0b
Unlocking account a94f5374fce5edbc8e2a8697c15331677e6ebf0b | Attempt 1/3
Passphrase:
0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
Account 'a94f5374fce5edbc8e2a8697c15331677e6ebf0b' unlocked.
Please give a new password. Do not forget this password.
Passphrase:
Repeat Passphrase:
0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b

Non-interactive use

You supply a plaintext password file as argument to the --password flag. The data in the file consists of the raw characters of the password, followed by a single newline.

Note: Supplying the password directly as part of the command line is not recommended, but you can always use shell trickery to get round this restriction.

$ geth --password /path/to/password account new

$ geth --password /path/to/password account update b0047c606f3af7392e073ed13253f8f4710b08b6

$ geth account list

$ geth --datadir /someOtherEthDataDir --password /path/to/anotherpassword account import ./key.prv