An account is the minimum storage requirement, just like an address in the Bitcoin protocol. The concept of an account is different than that of a wallet, which can, in fact, manage multiple accounts. There are two types of accounts on Ethereum – namely externally owned accounts and contract accounts, which differ fundamentally from each other, but nonetheless also share certain similarities.
ETHEREUM ACCOUNT ESSENTIALS
- An account is the most basic means of storing of ETH.
- There are two types of accounts on Ethereum:
- An externally owned account (EOA) is controlled by a private key.
- A contract account (CA) is controlled by a piece of code in place of the private key.
- Each account, regardless of its type consists of the following four elements:
- Nonce – a number corresponding to the amount of (a) transactions sent from or (b) contracts created by an account
- Balance – amount of wei owned by an account
- storageRoot – a hash of the root node of a hash tree that encodes the storage contents of the account
- codeHash – a hash of the account’s EVM code
ETHEREUM ACCOUNT ESSENTIALS
Types of accounts
First of all, there are two types of accounts in terms of how they are controlled. Externally owned accounts, also initialized to EOAs, are ordinary user accounts which are basically just pairs of private and public keys. The other type are so-called contract accounts. Unlike externally owned accounts, which are controlled by a private key, a contract account is controlled by code.
Externally owned account
The basic function of an externally owned account is that it can hold an ether balance. Externally owned accounts are further capable of sending and receiving transactions.
The concept of externally owned accounts is quite similar to the concept of addresses in the Bitcoin protocol. That being said, an Ethereum account is controlled by a private key that corresponds to its public key. The latter is hashed to determine the account address, while the former is used to generate signatures and authorize outbound transactions.
But because the Ethereum blockchain has an extended functionality that goes beyond that of the Bitcoin protocol, sending a transaction from an externally owned account is not limited to cryptocurrency transfers alone. Instead, an account is also capable of triggering contract code, meaning that it can be used to deploy smart contracts or trigger smart contract functionality.
Much like an externally owned account, a contract account (sometimes spelled contracts account) can hold a balance of ether or ERC-20 tokens. However, while externally owned accounts are controlled by a private key, this is not the case with contract accounts.
Unlike externally owned accounts, contract accounts are controlled by smart contract code. This means that there is no private key that would allow an external owner of the account to spend the coins held at the contract account’s address. Instead, code execution is triggered by transactions or messages (i.e. calls) that are received from other contracts.
Whenever called upon, a contract account performs various operations of arbitrary complexity. A contract account can manipulate its persistent storage (storage that is retained even if you are not connected to the Ethereum network; similar to HDD as opposed to RAM on your computer), which means that its state is not always the same and can change when the account is called upon. Additionally, a contract account is able to call other contracts.
The architecture of an account
Regardless of whether considering an externally owned account (a user account controlled by a private key) or a contract account (an account controlled by code), each Ethereum account has a basic state that always comprises the following four elements:
- Firstly, there is the nonce. In the case of externally owned accounts, nonces represent the number of transactions sent from the account’s address. For contract accounts, the nonce is the number of contracts created by the account.
- Then there is balance, which refers to the amount of wei owned by the account address. There are 10^18 wei per one unit of ether.
- The third constituent is the so-called storageRoot, which is a 256-bit hash that encodes the account’s stored contents.
- The last part is the codeHash, which is the hash of the account’s EVM code. Since hashing is deterministic, the codeHash is immutable and cannot be altered after generation. When it comes to externally owned accounts, which contain no smart contract code, an empty string is hashed to create the codeHash.
If you are interested in investing in ETH, the easiest and safest way to do so is to allow a reliable, professional exchange to sort out all the details for you, so you can concentrate on your investment. Bitstamp is the world’s longest-standing exchange, and one of the few in the world that allows you to trade fiat currency for cryptocurrencies like ETH.
This webpage has been approved as a financial promotion by Bitstamp UK Limited which is registered with the UK’s Financial Conduct Authority. Please read the Risk Warning Statement before investing. Cryptoassets and cryptoasset services are not regulated by the Financial Conduct Authority. You are unlikely to be protected if something goes wrong. Your investment may go down as well as up. You may be liable to pay Capital Gains Tax on any profits you earn.