Ethereum Accounts: Definition, Types and Fields

Hello 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.

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

Externally Owned Accounts

  • 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

  • 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

  • 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

Any 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!

Ethereum Blockchain: Definition, Currency, Working & Components

Hello friends, Hope you are doing good. In my last tutorial, I gave you an introduction to blockchain technology and this article is the second one of this series. Today I am going to talk about Ethereum. In simple words, Ethereum is an open-source platform of blockchain technology. But unlike the bitcoin blockchain, it offers more functionality. The blockchain in bitcoin tracks bitcoins only. It tracks the ownership and transfer of bitcoins. While Ethereum is not only a payment network for cryptocurrency but also termed as the world computer due to its wide functionality. First, let’s go through the key introductory points of Ethereum, and then we will dive into the details:

What is Ethereum Blockchain?

  • Ethereum blockchain is an open-source global platform that supports decentralized applications.
  • It offers a programmability feature, coding is done in smart contracts.
  • It runs its own currency named Ether and is abbreviated as ETH.
Now let’s take a look at its invention history, and then I will talk about its features in the next sections.

History of Ethereum

In this section, I will give you an idea that how Ethereum was invented and why there was a need of developing such a platform. When bitcoin was invented and people realized the power of blockchain, developers tried to design new applications other than cryptocurrency. The limited functionality of the existing blockchain made it difficult to build different types of projects and hence, arose the need for a new blockchain.

In 2013, Vitalik Buterin presented a white paper giving the idea of the Ethereum blockchain. Afterward, Vitalik and Gavin Woods worked together and built upon that idea. And guys, finally in 2015, the first block of the Ethereum blockchain was mined. So, this was a little history and now before getting you bored, I will move towards the next section explaining the programmability of Ethereum.

Ethereum Programmability

  • The main function of Ethereum is that it is programmable, which means applications can be built on it.
  • It is a general-purpose blockchain capable of executing code.
  • The language offered by bitcoin was very limited with limited data types and size, but this is not the case with Ethereum.
  • Ethereum is also called Turing complete and I will explain the concept of Turing completeness in the upcoming sections.

Working of Ethereum Blockchain

I am going to tell you about the working of Ethereum Blockchain in this section.
  • The memory in Ethereum stores data and code.
  • The Ethereum blockchain tracks the changes in data and thus it tracks the changes in its memory.
  • Ethereum first loads the program, executes it and finally stores the results in its blockchain.
This procedure is the same as in the computers that we use in our daily life. The difference is that the data in our computer is stored locally while in Ethereum blockchain, the changes in state are distributed and each node has data stored in it. Also, the changes in data are according to the consensus rules. The process can be summarized as:
  • Accepting transactions from different nodes or accounts.
  • Updating the state for accepted transactions.
  • Storing and maintaining the state in its memory.
  • The states are maintained until another accepted transaction happens.
  • This process is repeated for each change.
Now let’s list down some main components of ethereum technology. I am going to give you a simple definition of each one for a basic understanding.

Components of Ethereum Blockchain

The components of Ethereum are given below:

Peer to peer network:

  • Ethereum blockchain is a peer to peer network, all computers or nodes are connected with each other.

Nodes:

  • Any device whether a computer or a mobile, connected to the blockchain containing the data are called nodes. All nodes are connected to each other.

Transactions:

  • The messages exchanged on the network are called transactions. A transaction involves a value, a recipient, a sender, and a data payload.

Consensus Rules:

  • The set of rules that is followed for considering the validity of a transaction and a block in Ethereum I called consensus rules. These rules are enforced by all nodes.

Consensus Algorithm:

  • The consensus algorithm is the procedure to obtain agreement on the longest chain in the distributed Ethereum network. The most commonly used consensus algorithms for Ethereum are proof of work and proof of stake.

State Machine:

  • Ethereum transactions and state changes are processed by the state machine called Ethereum Virtual Machine abbreviated as EVM.
  • Ethereum virtual machine executes the program in machine language.
  • These programs are written in a high level language such as Solidity and then a compile converts the program into bytecode.
  • The program written in a high level language is called a smart contract.
So, these were some components and terminologies associated with Ethereum Blockchain. Next, I am going to introduce the cryptocurrency that Ethereum uses.

Ethereum Currency: Ether

The cryptocurrency used on the Ethereum blockchain is ether (ETH). This cryptocurrency acts as fuel for the execution of smart contracts. This currency is integral and users pay it for using the Ethereum network. The purpose of this currency is:
  • Storing value.
  • Allowing users to perform transactions by exchanging payments.
  • Allowing payments for computational costs of code execution means each transaction executes by paying a small transaction fee.
  • Running applications (Decentralized Applications).
At the time of writing this article, the currency is worth 2355.44 USD. That was some basic idea of the ether, now let’s move towards smart contracts.

Smart Contract

  • A program that executes on Ethereum is called a smart contract.
  • It is a set of rules or codes that control the transfer of value according to programmed conditions.
  • One feature of a smart contract is immutability. Immutability means that the code of a smart contract cannot be changed after its deployment.
  • Smart contracts are deterministic. The outcome of the smart contract execution is the same for anyone running it.
Before concluding this article on Ethereum introduction, I will give you an idea of Turing completeness as I mentioned earlier.

Turing Completeness

  • Ethereum is a Turing complete system.
  • Ethereum can read and write data to memory and execute programs in the Ethereum virtual machine.
  • It can compute any program that a Turing complete machine can.
  • The main difference provided by Ethereum is that it combines computing power with blockchain.
  • All of the characteristic features of blockchain are combined with the programmability feature and that makes Ethereum a useful invention.
That was all for today. I hope you have got an idea about Ethereum. Next time we will move towards the interesting features of this technology and also we would talk about dApps in upcoming articles. Till then, take care!
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir