What are Ethereum Accounts?
Ethereum is a digital, blockchain-based open source digital cryptocurrency platform which also has the functionality of smart contracts. The cryptocurrency of Ethereum is called Ether (ETH). The Ethereum network is like a blockchain network but it also enables apps and contracts instead of only making transactions.
A smart contract is a program that runs on the Ethereum blockchain, they are used to define an agreement or a contract and make sure that it is being followed, an amazing use case of smart contracts would be in ensuring quality management of factory-made products by providing transparency and traceability regarding product origins and other information about things eaten on a daily basis from a global supply chain.
The following topics will be discussed here:
- What Are Ethereum Accounts?
- Types Of Ethereum Accounts
- Types Of Contract Accounts
- Externally Owned vs Contract
- Different Fields In Ethereum accounts
- Externally Owned Accounts And Key Pairs
Let’s discuss each of these topics in detail.
What are Ethereum Accounts?
An Ethereum account is similar to a bank account, but for ethers or ETH, where Ethereum can be held, transferred to other accounts, and can also be used to execute smart contracts. An Ethereum account is an entity that is composed of an Ethereum address along with a private key. The first 20 bytes of the SHA3 hashed public key is the Ethereum address.
Types of Ethereum Accounts
Below are the two types of Ethereum Accounts:
1. Externally Owned Account: This is the most basic type of Ethereum account, it functions similarly to a bitcoin account. A private key controls the Ethereum address for EOAs. A person can open as many EOAs as they require. It is created whenever a wallet is created, and it is made with a private key that is required to access EOAs, check balances, send and receive transactions, and establish smart contracts.
- Transactions from an external account to a contract account can trigger code that can execute many different actions, such as transferring tokens or even creating a new contract.
- Externally Owned Accounts cannot list incoming transactions.
2. Contract-Based Account: Contract-based accounts can perform all of the functions of an externally owned account, but unlike EOAs, they are formed when a contract code is deployed, are governed by contract codes, and are accessed using a unique address. When one party accepts a contract, a unique account is formed which contains all of the charges associated with that contract. Each contract is granted a distinct serial number, which is referred to as a contract account.
- A contract account can list incoming transactions.
- Contract accounts can be set up as Multisig Accounts.
- A Multisig Account can be structured such that it has a daily limit that you specify, and only if the daily limit is exceeded will multiple signatures be required.
- Creating contract accounts costs gas because they use the valuable computational and storage resource of the network.
- Contract accounts can’t initiate new transactions on their own. Instead, contract accounts can only fire transactions in response to other transactions they have received either from an externally owned account or from another contract account.
Types of Contract Accounts
Below are the three types of contract accounts:
- Simple Account: The account is created and owned by a single account holder.
- Multisig (multisignature) Account: A Multisig Wallet contains several owner Accounts, one of which is also the creator Account.
- Simplest Account: A Multisig Wallet contains several owner Accounts, one of which is also the creator Account.
Externally Owned Accounts vs Contract Based Accounts
Below are the differences between Externally owned accounts and contract-based accounts.
|S. No.||Externally Owned Accounts||Contract Accounts|
|1.||This account is controlled by humans.||This account is controlled Contract Code.|
|2.||The private key is needed to access EOAs.||No key is needed to access EOAs.|
|3.||EASs are created automatically on creating a wallet.||CA require EOAs to be activated.|
|4.||EOAs do not have their own associated code.||CAs have their own associated code.|
|5.||No execution fee is associated with EOAs.||The execution fee is associated with CAs.|
|6.||Code hash is an empty string.||Code hash represents the code associated with the account.|
Different Fields in Ethereum Accounts
- Nonce: The nonce in an Ethereum account indicated the number of transactions that have been sent from that account. This ensures that each transaction is made only once by taking count every time it takes place.
- Ether Balance: The balance of an Ethereum account denotes the amount of ether present in an ether repository of the current ether account.
- Contract Code: This is non-mandatory to fill, in case it is present since not all accounts have a contract code. But note, that they cannot be altered once executed.
- Storage: This field remains not filled unless mentioned.
- Code Hash: The value of the code hash for Contract Accounts will be a hash that refers to the code present in that Ethereum account and since no code is associated with externally owned Ethereum accounts, therefore, code hash will be an empty string.
Externally Owned Accounts and Key Pairs
An Ethereum account is a private-public key pair that may be linked to a blockchain address.
- It is a “owned” or “externally owned” account if the private key is known and controlled by someone.
- Otherwise, we’re talking about smart-contract accounts if the private key is unknown and just an address exists.
Contract accounts do not have a private key connected with them, although externally owned accounts have. Control and access to one’s assets and contracts are granted through the EOA private key.
- Control and access to one’s assets and contracts are granted through the EOA private key. The user keeps the private key safe.
- While, as the name implies, the account’s public key is open. This key serves as the account’s identity. A one-way cryptographic function is used to produce the public key from the private key.
- For example, if you create an account on Ethereum, you will retain the private key to yourself while sharing the public key. Transactions between accounts are completed using public keys.