Ethereum operates on an account-based model, distinguishing it from Bitcoin's UTXO (Unspent Transaction Output) system. Each user can create accounts to hold Ether (ETH) or ERC-20 standard tokens. This design enables more complex functionalities like smart contracts and decentralized applications (dApps).
Key Takeaways
- External Accounts: Controlled by private keys, used by individuals.
- Contract Accounts: Governed by smart contract code, enabling automated logic.
- Account Fields: Nonce, balance, codeHash (contracts only), and storage.
- State Transitions: Transactions modify account states stored in Merkle Patricia Trees (MPT).
Types of Ethereum Accounts
1. External Accounts (EOAs)
- Control: Managed via private keys.
- Functionality: Can initiate transactions but lack code storage.
Fields:
- Nonce: Count of transactions sent from the account.
- Balance: Amount of ETH held.
- Storage: Typically empty for EOAs.
2. Contract Accounts
- Control: Governed by deployed smart contract code.
- Code Immutability: Once deployed, code cannot be altered (ensures trustlessness).
Additional Field:
- codeHash: Hash of the Ethereum Virtual Machine (EVM) bytecode.
- Limitations: Cannot initiate transactions; only executes when triggered by an EOA or another contract.
👉 Learn how smart contracts revolutionize automation
Account Fields Explained
| Field | External Account | Contract Account |
|---|---|---|
| Nonce | ✅ | ✅ |
| Balance | ✅ | ✅ |
| codeHash | ❌ | ✅ |
| Storage | ❌ (Optional) | ✅ |
Transactions and State Storage
- Transactions: Include recipient address, sender signature, ETH value, and optional data.
- Blockchain Storage: Ethereum blocks store account states (not raw transactions) as MPTs for efficiency and scalability.
- State Transition: Each transaction updates the global state (e.g., modifying balances or contract storage).
Example: A contract enforcing multisignature approvals requires multiple signatures to execute transfers, enhancing security.
FAQs
Q1: Can contract accounts hold ETH?
A: Yes, contract accounts have balances just like EOAs and can receive/send ETH.
Q2: Why can’t contract accounts initiate transactions?
A: They lack private keys; execution depends on external triggers (e.g., EOAs or other contracts).
Q3: Is it possible to upgrade a smart contract?
A: No—codeHash is immutable. However, proxy patterns can enable upgradability via delegate calls.
Q4: How does Ethereum’s account model differ from Bitcoin’s?
A: Bitcoin uses UTXOs, while Ethereum’s accounts simplify tracking balances and enable smart contracts.
👉 Discover advanced Ethereum security practices
Conclusion
Ethereum’s dual-account system underpins its versatility, supporting everything from simple transfers to decentralized finance (DeFi) protocols. Understanding these fundamentals is crucial for developers and users navigating the ecosystem.
### SEO Keywords:
- Ethereum accounts
- External vs. contract accounts
- Smart contract codeHash
- Ethereum state transitions
- Merkle Patricia Tree
- ERC-20 tokens
- Multisignature contracts