Accounts play a central role in Ethereum. There are two types of accounts:
- Externally owned accounts (EOA), that are referred simply as accounts.
- Contract Accounts, referred as contracts.
These entities have states and so are called state objects. Contracts have both balance and contract storage, but the accounts have only balance. The state of all accounts is the state of the Ethereum network which is updated with every block and which the network needs to reach a consensus about. To interact with the Ethereum blockchain via transactions, accounts are essential for users.
Accounts represent identities of external agents (e.g., human personas, mining nodes or automated agents) and use public key cryptography to sign transaction so that the EVM can securely validate the identity of a transaction sender.
All accounts are defined by a pair of private key and a public key. Accounts are indexed by their address that is derived from the public key by taking the last 20 bytes. Every private key/address pair is encoded in a keyfile. Keyfiles are JSON text files which can be opened and viewed in any text editor. The critical component of the keyfile (account’s private key), is always encrypted with the password entered when the account is created. Keyfiles are found in the keystore subdirectory of the Ethereum node’s data directory.
Creating a key is equivalent to creating an account.
- One need not tell anybody what they are doing.
- One need not synchronize with the blockchain.
- There is no need to run a client.
- One need not even connect to the internet.
The new account will not contain any Ether! But it’ll belong to the one who created it and they can be certain that without their key and password, nobody else can ever access it.
CREATING AN ACCOUNT
Using geth account new
Once the geth client is installed, creating an account is just executing the geth account new command in a terminal.
For non-interactive use, a plaintext password file is supplied as an argument to the –password flag. The information in the file comprises of the raw bytes of the password optionally followed by one newline.
|$ geth –password /path/to/password account new|
To list all the accounts with keyfiles currently in the keystore folder use the list subcommand of the geth account command:
|$ geth account list|
The filenames of keyfiles have the format UTC–<created_at UTC ISO8601>-<address hex>. When listing, the order of accounts is, lexicographic, but as a consequence of the timestamp format, it is actually the order of creation.
Using geth console
In order to create a new account using geth, first, start geth in console mode (or one can use geth attach to attach a console to an already running instance). The console allows to interact with the local node by issuing commands.
Using Mist Ethereum wallet
The wallet app versions are available for Linux, Mac OS X, and Windows.
Creating an account using the GUI Mist Ethereum wallet is easier. In fact, the first account is created during the installation of the app.
- Download the latest version of the wallet app for an existing operating system. Opening the Wallet App will kick off syncing a full copy of the Ethereum blockchain on the computer.
- Run the Ethereum-Wallet executable file, after unzipping the downloaded folder.
- Wait for the blockchain to fully sync, then follow the instructions on the screen and first account will be created.
- When the Mist Ethereum wallet is launched for the first time, the account created during the installation process will be seen. It will be named MAIN ACCOUNT (ETHERBASE) by default.
5. Creating additional accounts is easy; just click on ADD ACCOUNT in the app’s main screen as shown in the picture above and enter the required password.
NOTE: Since the Mist wallet is still in active development, the details of the steps outlined above may change with upgrades.
All the options related to key management available using geth can be used the same way in eth.
Ethkey is a CLI tool of the C++ implementation that allows to interact with the Ethereum wallet. With it, one can list, inspect, create, delete and modify keys, and inspect, create and sign transactions.
Enter a MASTER passphrase (Strong random password) to protect the key store: a “master” passphrase will be asked for which protects the privacy and acts as a default password for any keys. Confirm it by entering the same text again.
After creating a key using the new command, enter a passphrase to secure this account. It will prompt to enter a passphrase to protect this key. If an enter is just pressed, it’ll use the default “master” passphrase. In general, one should try to use a different passphrase for each key since it prevents one compromised passphrase from giving access to other accounts.
Once the passphrase is entered, it will ask to confirm it by entering again. Since own passphrase is given, it will even ask to provide a hint for this password, which will be displayed whenever it asks to enter it. The hint is stored in the wallet and is itself protected by the master passphrase.
All normal (direct) ICAP addresses begin with XE so it’s easy to recognize them. Notice also that the key has another identifier after Created key, known as the UUID. This is a unique identifier for the key. It also happens to be the filename for the key, which can be found in either ~/.web3/keys (Mac or Linux) or $HOME/AppData/Web3/keys (Windows). To make sure if it is working properly list the keys in the wallet.