Introduction to Ethereum Accounts
An Ethereum account is a fundamental entity within the Ethereum blockchain. It holds a balance of Ether (ETH) and has the capability to send transactions. Accounts can be controlled by individual users or exist as deployed smart contracts, forming the backbone of all interactions on the network.
Prerequisites
This guide is designed to be beginner-friendly. However, a basic understanding of blockchain technology and Ethereum's core concepts will be helpful for grasping the more technical aspects of account management.
Types of Ethereum Accounts
The Ethereum network supports two distinct types of accounts:
- Externally Owned Accounts (EOAs): Controlled by whoever holds the private key.
- Contract Accounts: Controlled by their internal code (smart contracts) and deployed on the network.
Both account types share the ability to:
- Receive, hold, and send ETH and other tokens.
- Interact with other deployed smart contracts.
Key Differences Between Account Types
Externally Owned Accounts (EOAs)
- Creating an EOA is free.
- They can initiate transactions.
- Transactions between EOAs are limited to transfers of ETH and tokens.
Contract Accounts
- Creating a contract has a cost, paid as "gas," because it consumes network storage and computational resources.
- They can only send transactions in response to receiving a transaction.
- Transactions sent to a contract account can trigger its code to execute complex operations, such as transferring tokens or even creating other new contracts.
Anatomy of an Ethereum Account
Every Ethereum account, regardless of its type, contains four critical fields of data:
- Nonce: A counter that ensures each transaction is processed only once. For an EOA, this represents the number of transactions sent from it. For a contract account, it represents the number of contracts it has created.
- Balance: The amount of Wei (the smallest denomination of Ether, where 1 ETH = 1e+18 Wei) held by this address.
- codeHash: This hash refers to the code of an account on the Ethereum Virtual Machine (EVM). For contract accounts, this is the hash of the code that gets executed when the account receives a message call. For EOAs, the codeHash field is simply the hash of an empty string.
- storageRoot: Often called the storage hash. This is a 256-bit hash of the root node of a Merkle Patricia Trie—a data structure that encodes the storage contents of this account.
Externally Owned Accounts and Key Pairs
An EOA is essentially a cryptographic pair of keys: a public key and a private key.
- Private Key: A secret 64-character hexadecimal string that is used to digitally sign transactions, proving ownership of the account. It must be kept secure at all times.
- Public Key: Derived from the private key using cryptographic algorithms. It can be shared publicly.
- Public Address: The account's public address is generated by taking the last 20 bytes of the Keccak-256 hash of the public key and prefixing it with
0x.
This cryptographic foundation prevents malicious actors from forging transactions. When you "own" crypto, you are actually in possession of the private key that controls the assets on the ledger. To send ETH, the owner must sign the transaction with their private key, and the network can use the resulting signature to verify the transaction's origin.
How to Create an Externally Owned Account
Account creation typically involves a library generating a cryptographically secure random private key.
- A 64-character hexadecimal private key is generated.
- This private key is often encrypted with a user-defined password for security.
- A public key is then derived from the private key using the Elliptic Curve Digital Signature Algorithm (ECDSA).
- The public address is finally generated from the public key.
Example of a private key:fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036415f
In application development, you can use JavaScript libraries like web3.js or ethers.js to handle this process and subsequently send transactions to the network. 👉 Explore more strategies for secure key generation
Understanding Contract Accounts
Contract accounts also have a standard 42-character hexadecimal address, such as:0x06012c8cf97bead5deae237070f9587f8e7a266d
A contract's address is deterministically generated at the time of deployment. It is derived from the address of its creator (the EOA that deployed it) and that creator account's nonce at the time of deployment. This ensures every contract address is unique.
Validator Keys in Ethereum's Proof-of-Stake
With Ethereum's transition to a Proof-of-Stake (PoS) consensus mechanism, a new type of key was introduced: the BLS key.
These keys are used to identify validators—participants who stake ETH to secure the network. A key advantage of BLS cryptography is that signatures can be aggregated, significantly reducing the bandwidth required for the network to reach consensus. This efficiency allows for a much larger number of validators without imposing impractical hardware requirements.
Accounts vs. Wallets: A Critical Distinction
It is important to differentiate between an account and a wallet.
- Account: Refers to the actual key pair (public address and private key) that represents ownership on the blockchain.
- Wallet: Is an application, interface, or physical device that lets you interact with and manage your Ethereum accounts. It safeguards your private keys and helps you create, sign, and broadcast transactions.
Frequently Asked Questions
What is the main difference between an EOA and a contract account?
The core difference lies in control and initiation. An EOA is controlled by a private key and can initiate transactions. A contract account is controlled by its code and can only execute operations in response to a transaction sent to it.
Is it free to create an Ethereum account?
Yes, creating a new externally owned account (EOA) is completely free. You only incur costs (gas fees) when you interact with the network, such as by sending ETH or deploying a smart contract.
Can someone steal my crypto if they have my public address?
No, your public address is safe to share. It is like your public username. The critical piece that must never be shared is your private key, which is like your password. Ownership and the ability to spend funds are secured by the private key.
How is a smart contract address determined?
A contract's address is generated from the combination of its creator's address and the nonce of the creator's account at the time of the contract deployment. This method ensures the address is predictable and unique.
What is a wallet's role if my funds are on the blockchain?
Your funds are always on the blockchain. Your wallet does not "hold" them; it holds the private keys that prove you own those funds. The wallet provides a user-friendly interface to view your balance, create transactions, and securely sign them with your private keys before broadcasting them to the network. 👉 Get advanced methods for securing your digital assets
What are BLS keys used for in Ethereum?
BLS keys are used by validators in Ethereum's Proof-of-Stake system. They allow for efficient signature aggregation, which is crucial for scaling the consensus mechanism to hundreds of thousands of participants without overwhelming the network.