Ethereum is a decentralized peer-to-peer network. The main currency of the network is Ether. This is given to the miners as a reward for the processing power used to mine the block. Ether can be exchanged for some other valuable assets or stored in accounts.
Accounts on the Ethereum network differ from traditional accounts. These accounts can be created by anyone. Their main purpose is to hold the Ether and send transactions. The different types of accounts are given below:
Externally owned account (EOA)
Contract account (CA)
EOA accounts are created by using the public-private keys. These accounts are controlled by a private key. A
This account also has some other state fields, which make it functional. These fields are explained below:
Nonce: This represents the number of transactions initiated by the account.
Balance: This represents the balance of the account in Wei.
CodeHash: Empty string as EOA does not have any associated code.
Storage: Empty string as EOA does not have any data to store.
CA is a special type of account where Ether is owned and controlled by a piece of code known as the smart contract instead of an entity. However, they still rely on EOA to deploy it and execute their functions.
Smart contracts are mainly written in solidity and uploaded on the Ethereum network, which performs certain actions when specific conditions are fulfilled. This account has a unique address to receive Ether. However, it does not need any private key to generate the transactions as it is already deployed and trusted by the network.
This account also has some other state fields, which make it functional. These fields are explained below:
Nonce: This represents the number of transactions initiated by the account.
Balance: This represents the balance of the account in Wei.
CodeHash: The hash of the smart contract code is stored in this field.
Storage: This field contains the data of the storage variables within the smart contract.
Note: Wei is a smaller part of Ether. Consider an Ether to be a dollar and Wei a penny. One hundred pennies are equal to a dollar. However, in this case,
Wei equals one Ether.
The differences between the accounts are as follows:
EOA | CA | |
New Account | A new account can be created by anyone using wallets like MetaMask. | A new contract account can only be created from an EOA or a smart contract already deployed on the network. |
Public key | The public key is derived from the ECDSA digital signature algorithm. | No public key. |
Address | The address is derived from the last 20 bytes of the hash of the public key. | The address is calculated when the contract is deployed. |
Private key | It is randomly generated. | It has no private key. |
Note: Read more about Elliptic Curve Digital Signature Algorithm (ECDSA).
Free Resources