Ethereum Accounts: Definition, Types and Fields

Today, we will study what are Ethereum Accounts? Types of Ethereum Accounts and the main Fields of Ethereum Accounts and ...


Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum AccountHello friends, hope you are doing good and enjoying your life. Today, I am going to introduce you to Ethereum accounts. I have given you an introduction to blockchain in my previous tutorials, so let’s get started on the essentials of this technology. I am going to start with accounts.

Ethereum Accounts

  • An account is an important component of the Ethereum system.
  • It is the main building block and has a balance in ether (ETH) (Ethereum currency).
  • An account is capable of sending transactions on the Ethereum network.
  • The interactions between different accounts create transactions that are stored in the distributed database.
  • Each transaction involves the sender account, receiver account and contract account.
  • An account can be controlled by a user or it can be a program deployed on the Ethereum blockchain.
Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum Account

Types of Ethereum Accounts

In this section, I am going to describe the two types of accounts in Ethereum, namely externally owned and contract.
  • Each account has a balance property that shows how much balance the account currently holds.
  • Therefore, accounts are classified into two main types:
    1. Externally Owned Accounts
    2. Contract Accounts
Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum Account

Externally Owned Accounts

Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum Account
  • Externally Owned Account is abbreviated as EOA. This is the type of account that is owned by people on the Ethereum network.
  • An individual makes an account on Ethereum and a public-private key pair is generated for the account. The account is not identified by the person’s name or any personal information.
  • The private key of EOA gives control and access to one’s assets and contracts. The private key is kept secured by the user.
  • While, as the name suggests, the public key of the account is open. This key acts as the identity of the account.
  • The public key is generated from the private key via a one-way cryptographic function.
  • As an example, if you create an account on Ethereum, you will keep the private key to yourself while the public key would be shared. Transactions between accounts are carried out through public keys.
  • The address of an Ethereum account is generated through its public key.
  • This type of account interacts with other externally owned accounts and contract accounts. It carries out transactions with the former one and interacts with the latter one by calling and executing its functions.
  • This type of account has no code. It has balance in ether.
  • Now, let’s talk about the second type of Ethereum accounts.

Contract Accounts

Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum Account
  • In this section, I am going to tell you about the second type that is contract accounts.
  • In some ways, contract accounts are similar to externally owned accounts but there are some differences between them too that I will mention later.
  • First, let’s define a contract account. A contract account has a code for a smart contract.
  • The contract account is identified by its public address.
  • This account does not own a private key.
  • These accounts also have balance property and they can hold ether too but these accounts have smart contract code. This code contains functions to execute and state variables.
  • The logic of the smart contract controls this account. The smart contract that is deployed on the Ethereum blockchain is the owner of the contract’s account.
  • When an externally owned account initiates a transaction with a contract account, the code of that contract runs in Ethereum virtual machine. The transaction contains data other than ether that tells information about what functions to run and what parameters should be given to the functions for execution.
This was some introduction to both accounts. Now, I am going to highlight some key differences and similarities between these two types.

Difference in Externally Owned Account and Contract Account

Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum Account
  • An externally owned account (EOA) does not have a code while a contract account has a code.
  • Externally owned accounts have a private key associated with them that contract accounts do not have.
  • An externally owned account can initiate a transaction with another externally owned account or a contract account. But a contract account cannot initiate transactions.
  • A contract account responds to transactions and in doing so it can call further contracts and their functions.
  • Transaction between two EOAs is only of one kind that is the transfer of ether while transactions with a contract account can be of any kind, for example, calling other contract’s functions, deploying another contract, etc.
  • An externally owned account is free to create while creating a contract account has a cost.

Similarities in Externally Owned Account and Contract Account

  • Contract and externally owned accounts both are identified by their public addresses.
  • Both types of accounts can have a balance and are capable of sending and receiving ether.
  • Both of these accounts can interact with smart contracts deployed on Ethereum.
This was a comparison between externally owned and contract account. In the upcoming section, I am going to tell you about the components of an account.

Fields of an Ethereum Account

Ethereum Accounts, ethereum system, ethereum blockchain, Types of Accounts, Externally Owned Accounts, Contract Accounts, Fields of an Ethereum AccountAny Ethereum account, whether an EOA or a contract account contains four fields which are given below:
  1. Nonce
  2. Balance
  3. CodeHash
  4. StorageRoot
I am going to give you an introduction to each of them. The first one on the list is Nonce.

Nonce:

  • The nonce of an account is actually a counter that tells us about the number of transactions sent from that account for an externally owned account.
  • While, for a contract account, this counter indicates the number of contracts created by that account.

Balance:

  • This property shows the balance of the account as the name suggests.
  • The balance is actually in Wei, a unit of ether (ETH) where 1 eth = 1x10e18 Wei.

CodeHash:

  • This field gives the hash value of the contract code of the account.
  • In the case of contract accounts, the smart contract code is hashed and the resulting value is stored in this field.
  • While for externally owned accounts, this field contains the hash value of an empty string.

StorageRoot:

  • The data of an account is stored in the world state trie.
  • Each leaf of this trie represents one account.
  • The storageRoot contains the hash value of the root of the storage trie.
  • This field of account is empty by default.
These are the four fields of an Ethereum account. I hope this article has given you an understanding of Ethereum accounts. I will bring another interesting topic next time for you. Till then, take care!

Leave a Reply

Leave a Reply