Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome to your fifth lesson in our journey through Ethereum's fundamentals.
In our last session, we explored Ethereum's architecture, defining it as a distributed state machine powered by the Ethereum Virtual Machine (EVM). We learned that the "world state" is essentially a giant database mapping addresses to accounts. We also briefly mentioned that these accounts come in two distinct flavors.
Today, we'll dive deep into those flavors. This lesson's goal is to enable you to differentiate between Externally Owned Accounts (EOAs) and Contract Accounts. This distinction is one of the most fundamental concepts in Ethereum development. For your goal of building a token, you'll be creating a Contract Account (the token itself) that users interact with via their EOAs (their wallets). Understanding their roles, capabilities, and limitations is therefore essential.
The Two Types of Ethereum Accounts
Every action on Ethereum, from sending ETH to interacting with a decentralized application, is initiated by or involves an account. These accounts fall into two categories:
- Externally Owned Accounts (EOAs): Controlled by users via private keys.
- Contract Accounts: Controlled by code deployed to the blockchain.
A great way to frame this, given your background as a backend developer, is to think of an EOA as a user account with a password (the private key), and a Contract Account as a self-contained, server-side application or API that executes predefined logic when called.
Let's watch a short video that provides a clear overview of the properties of these two account types and how they are controlled.
Ethereum Accounts Explained: Smart Contract vs Externally Owned Account (EOA)
This video, 'Ethereum Accounts Explained' from NextGen Vision, offers a concise explanation of the core differences between EOAs and Contract Accounts.
Please watch from 01:55 to 03:45. Focus on: The properties associated with an EOA (nonce, balance) and its control via a private key. The additional properties of a Contract Account (storage hash, code hash) and its control by its own code.
A Deeper Dive into Account Properties
The video gave us a great high-level overview. Now, let's formalize those concepts and break them down component by component.
Externally Owned Accounts (EOA)
An EOA is what you, as a user, would control with a wallet like MetaMask. The name "Externally Owned" comes from the fact that its control mechanism—the private key—exists outside of the Ethereum protocol itself.
- Control Mechanism: A private key. This secret piece of data is the sole "password" that authorizes the account to send transactions. Lose the key, and you lose control of the account and its assets forever.
- Key Capability: Initiating transactions. This is the most important distinction. Every single transaction that changes the Ethereum state must originate from an EOA. A user must sign a transaction with their private key to kick things off.
- Properties:
- Address: A unique public identifier derived from the public key.
- Balance: The amount of ETH the account owns.
- Nonce: A transaction counter. Each time an EOA sends a transaction, its nonce is incremented by one. This is a critical security feature. As a developer, you can appreciate why: it prevents "replay attacks." If you send 1 ETH to Bob in a transaction with nonce
5, Bob can't just copy and re-broadcast that same signed transaction to get another 1 ETH, because the network will be expecting your next transaction to have nonce6.
- Creation: Creating an EOA is free and happens off-chain. It's simply the process of generating a new private/public key pair, which your wallet software handles.
Contract Accounts
A Contract Account is what you will create when you deploy your token smart contract. It doesn't have a private key; its behavior is entirely dictated by its code.
- Control Mechanism: The smart contract's EVM bytecode. This code is immutable—once deployed, it cannot be changed. It defines a set of functions that determine how the account can react to incoming transactions.
- Key Limitation: Cannot initiate transactions. A Contract Account is passive. It cannot "wake up" and start a transaction on its own. It can only execute its code in response to a transaction it receives, either from an EOA or another contract.
- Properties:
- Address: A unique public identifier, programmatically determined when the contract is deployed.
- Balance: The amount of ETH the account holds.
- Nonce: A counter that only increments when the contract account itself creates another contract.
- Code Hash (
codeHash): A hash of the immutable EVM bytecode. This is the contract's logic. - Storage Hash (
storageRoot): The hash of the root of the contract's persistent data storage (a data structure known as a Merkle Patricia Trie). This is the contract's state.
- Creation: Creating a Contract Account requires sending a transaction from an EOA. This deployment costs gas because it consumes network resources (storage on the blockchain).
The following diagram visually summarizes the different components that make up the state of each account type.

Practical Application: Where Are Your Tokens?
This EOA vs. Contract Account distinction perfectly clarifies a common point of confusion: "Where are my ERC-20 tokens stored?" When you create your token, your users won't hold the tokens "in" their MetaMask wallets in the same way they hold ETH.
Instead:
- Your ERC-20 token contract is a Contract Account.
- Inside that contract's persistent storage, there is a data structure—a
mapping—that functions like a hash map or dictionary:mapping(address => uint256). - This mapping associates a user's EOA address with their token balance.
Your wallet (EOA) doesn't hold the tokens. It holds the private key that gives you the authority to send a signed transaction to the token's Contract Account, asking it to update its internal ledger.
Let's watch the final part of the video, which explains this critical concept very clearly.
Ethereum Accounts Explained: Smart Contract vs Externally Owned Account (EOA)
Let's return to the 'Ethereum Accounts Explained' video to see this concept of token ownership in action. The speaker does an excellent job explaining that tokens reside within the smart contract, which merely references your EOA.
Watch from 03:45 to 05:05. This highlights both the power and the potential risks of smart contract code, as it is the ultimate arbiter of token ownership.
Test your understanding!
A new DeFi protocol wants to automatically rebalance its liquidity pools every hour based on market price changes. Can a smart contract be written to "wake up" on its own every hour and execute this rebalancing transaction? Why or why not?
Show answer
No, a smart contract cannot achieve this on its own.
The core reason is that Contract Accounts cannot initiate transactions. They are passive and can only execute their code when triggered by an incoming transaction that originated from an EOA.
To solve this, the protocol would need an "off-chain" component. This is typically a server (often called a "keeper" or "bot") that runs a script. This script monitors the time and, every hour, it uses its own EOA to send a transaction that calls the rebalancing function on the protocol's smart contract. The EOA provides the "spark" that allows the contract's logic to run.
Summary Comparison
Let's consolidate everything into a clear, side-by-side table.
| Feature | Externally Owned Account (EOA) | Contract Account |
|---|---|---|
| Controlled By | Private Key (held by a user) | Its own code (logic on the blockchain) |
| Can Initiate Transactions? | Yes | No (can only react to transactions) |
| Has Associated Code? | No | Yes (immutable EVM bytecode) |
| Creation Cost | Free (off-chain key generation) | Costs Gas (requires a deployment tx) |
| Developer Analogy | A user account with a password | A backend API / server-side application |
Conclusion
In this lesson, we've dissected the two fundamental types of accounts on Ethereum. Grasping this distinction is non-negotiable for any aspiring blockchain developer.
Key Takeaways:
- Externally Owned Accounts (EOAs) are controlled by private keys, can initiate transactions, and have no associated code. They are the "users" of the network.
- Contract Accounts are controlled by their own code, cannot initiate transactions, and contain both logic (code) and state (storage). They are the "applications" on the network.
- Every transaction on Ethereum must originate from an EOA.
- Your future token will be a Contract Account, and its ownership will be a mapping of user EOA addresses to balances within your contract's storage.
Preview of the Next Lesson:
We've spent a lot of time on theory. Now it's time to get your hands dirty and become an active participant in the network. In the next lesson, we will set up a MetaMask wallet and connect to an Ethereum testnet. This will give you your very own EOA, which is the first practical step toward deploying and interacting with your own smart contracts.