EVM Architecture Layers
Key: JSON-RPC APIs for external apps
Explanation of EVM Layers
1. Application Layer (Top)
- Smart contracts written in Solidity, Vyper, etc.
- Compiled into EVM bytecode
- Interaction via ABI (Application Binary Interface)
2. Execution Layer (EVM Runtime)
- Executes opcodes (ADD, CALL, SSTORE, etc.)
- Stack-based (max depth 1024)
- Memory: temporary, byte-addressable per call
- Storage: persistent key-value mapping (saved in Merkle Patricia Trie)
3. Gas & Fee Management
- Each operation consumes gas
- Prevents infinite loops (halting guarantee)
- Unused gas refunded; high-cost ops discourage spam
4. State Transition Layer
- Applies transactions to world state
- Updates balances, contract storage, and logs
- Deterministic: same input → same output on all nodes
5. Consensus Layer
- Ethereum now uses Proof of Stake (PoS)
- Validators propose & attest blocks
- Consensus ensures all nodes agree on final state
6. Networking Layer (Bottom)
- Peer-to-peer protocol (devp2p)
- Propagates transactions and blocks
- Exposes JSON-RPC APIs for dApps, wallets, and explorers