Creating accounts

Creating a new account

geth account new

Creates a new account and prints the address.

On the console, use:

> personal.newAccount("passphrase")

The account is saved in encrypted format. You must remember this passphrase to unlock your account in the future.

For non-interactive use the passphrase can be specified with the --password flag:

geth --password <passwordfile> account new

Note, this is meant to be used for testing only, it is a bad idea to save your password to file or expose in any other way.

Creating an account by importing a private key

    geth account import <keyfile>

Imports an unencrypted private key from <keyfile> and creates a new account and prints the address.

The keyfile is assumed to contain an unencrypted private key as canonical EC raw bytes encoded into hex.

The account is saved in encrypted format, you are prompted for a passphrase.

You must remember this passphrase to unlock your account in the future.

For non-interactive use the passphrase can be specified with the --password flag:

geth --password <passwordfile> account import <keyfile>

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.

Warning: when you copy keys into an existing node's keystore, the order of accounts you are used to may change. Therefore you make sure you either do not rely on the account order or doublecheck and update the indexes used in your scripts.

Warning: If you use the password flag with a password file, best to make sure the file is not readable or even listable for anyone but you. You achieve this with:

touch /path/to/password 
chmod 700 /path/to/password
cat > /path/to/password
>I type my pass here^D

Updating an existing account

You can update an existing account on the command line with the update subcommand with the account address or index as parameter.

geth account update b0047c606f3af7392e073ed13253f8f4710b08b6
geth account update 2

The account is saved in the newest version in encrypted format, you are prompted for a passphrase to unlock the account and another to save the updated file.

This same command can therefore be used to migrate an account of a deprecated format to the newest format or change the password for an account.

For non-interactive use the passphrase can be specified with the --password flag:

geth --password <passwordfile> account new

Since only one password can be given, only format update can be performed, changing your password is only possible interactively.

Note: Account update has the a side effect that the order of your accounts changes.

After a successful update, all previous formats/versions of that same key will be removed!