05 — Ethereum (L1)

A "world computer". Plataforma de smart contracts mais usada. Atualmente settlement + DA layer para ecosistema massivo de L2s.


1. Especificações fundamentais

Spec Valor
Mainnet 2015-07-30 (Frontier release)
Whitepaper 2013-12 (Vitalik Buterin)
Yellow Paper 2014 (Gavin Wood) — spec formal
Cofounders Buterin, Wood, Lubin, Hoskinson, Di Iorio, Alisie, Chetrit, Wilcke (foram cedo)
Consensus PoS Casper FFG + LMD-GHOST (post-Merge set/2022)
Slot 12 segundos
Epoch 32 slots (~6.4 min)
Finality 2 epochs (~12.8 min)
Block time 12 segundos
Block gas limit 30M (target), 60M (max via EIP-1559)
Supply No hard cap; deflacionário após Merge + EIP-1559 burn
Smallest unit 1 wei = 10⁻¹⁸ ETH
Address 20 bytes (Keccak-256 of pubkey, last 20 bytes)
Tx model Account-based
VM Ethereum Virtual Machine (EVM) — Turing-complete
Languages Solidity, Vyper, Huff, Yul, Fe
Signature secp256k1 ECDSA (legacy); BLS12-381 (consensus)
Hashes Keccak-256 (não SHA-3-256, padding diferente)
Encoding RLP (Recursive Length Prefix)

2. EVM (Ethereum Virtual Machine)

Stack-based virtual machine. 256-bit words.

Componentes

  • Stack: 1024 items, 256-bit cada.
  • Memory: byte-addressable, expandable (gas grows quadratic).
  • Storage: persistent key-value, 256-bit key → 256-bit value. Most expensive.
  • Calldata: input read-only.
  • Code: contract bytecode.
  • Program counter: posição em bytecode.

Opcodes

~140 opcodes. Categorias:

Categoria Exemplos Gas
Stack PUSH1-32, POP, DUP1-16, SWAP1-16 3
Arithmetic ADD, MUL, SUB, DIV, MOD, EXP 3-10
Comparison LT, GT, EQ, ISZERO 3
Bitwise AND, OR, XOR, NOT, SHL, SHR 3
Hash KECCAK256 30 + 6/word
Environment ADDRESS, BALANCE, CALLER, CALLVALUE, GASPRICE 2-700
Block BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, DIFFICULTY, GASLIMIT, CHAINID 2-20
Memory MLOAD, MSTORE, MSTORE8, MSIZE 3+
Storage SLOAD (2100100), SSTORE (200005000/2900) very high
Control flow JUMP, JUMPI, JUMPDEST, PC, GAS, STOP, RETURN, REVERT, INVALID 1-10
Calls CALL, DELEGATECALL, STATICCALL, CALLCODE (deprecated), CREATE, CREATE2 700-32000
Logs LOG0-LOG4 375 + 8/byte
Precompiles 0x01-0x09: ecrecover, sha256, ripemd160, identity, modexp, ecadd, ecmul, ec_pairing, blake2f varies

Gas

Cada operação custa gas. Tx envia gasLimit + gasPrice (legacy) ou maxFeePerGas + maxPriorityFeePerGas (EIP-1559).

tx_cost = gas_used × gas_price

gas_usedgas_limit (rest is refund). Out-of-gas → revert (mas gas consumed).

Account types

  • EOA (Externally Owned Account): controlled by private key. Pays gas.
  • Contract Account: controlled by code. Has storage, code, balance. No private key.

Both have 20-byte address.


3. Hard forks históricos

Hard fork Data Mudanças
Frontier 2015-07-30 Genesis
Homestead 2016-03-14 First production release
DAO Fork 2016-07-20 Revert DAO hack; ETC split
Tangerine Whistle 2016-10-18 Anti-DoS gas reprice
Spurious Dragon 2016-11-22 More DoS fixes; state clearing
Byzantium 2017-10-16 Difficulty bomb delay; new opcodes (REVERT, RETURNDATA)
Constantinople 2019-02-28 Bitwise shifting opcodes; CREATE2
Istanbul 2019-12-08 Gas reprice; LOGICNOTREPRICED ChainID
Muir Glacier 2020-01-02 Difficulty bomb delay
Berlin 2021-04-15 EIP-2929 gas; access lists (EIP-2930); typed txs (EIP-2718)
London 2021-08-05 EIP-1559 fee market; difficulty bomb delay
Altair (Beacon) 2021-10-27 Sync committee; light client support
Arrow Glacier 2021-12-09 Difficulty bomb delay
Gray Glacier 2022-06-30 Difficulty bomb delay
The Merge 2022-09-15 PoW → PoS transition
Shapella (Shanghai+Capella) 2023-04-12 Staking withdrawals
Dencun (Cancun+Deneb) 2024-03-13 EIP-4844 blobs; transient storage; KZG point eval
Pectra (Prague+Electra) 2026-03 (planejada) EIP-7702 (EOA→smart account); EIP-7251 (max balance 2048 ETH); BLS12-381 precompiles

4. EIPs (Ethereum Improvement Proposals)

Categorias: Core, Networking, Interface, ERC (Application standards).

EIPs Core notáveis

EIP Conteúdo
EIP-1 EIP process itself
EIP-20 ERC-20 fungible token standard
EIP-55 Mixed-case checksum address
EIP-155 Replay attack protection (chain ID)
EIP-721 NFT standard (ERC-721)
EIP-1155 Multi-token standard (ERC-1155)
EIP-1271 Smart contract signature validation
EIP-1559 Fee market (base fee + tip; burn)
EIP-2535 Diamond proxy (multi-facet)
EIP-2612 Permit (gasless approval)
EIP-2718 Typed transaction envelope
EIP-2929 Access lists / gas cost increase for storage
EIP-2930 Optional access lists
EIP-3074 AUTH and AUTHCALL (sponsored txs) — superseded por 7702
EIP-3198 BASEFEE opcode
EIP-3529 Reduce refunds
EIP-3675 Upgrade consensus to PoS (Merge)
EIP-3855 PUSH0 opcode
EIP-4337 Account Abstraction (smart wallets)
EIP-4399 DIFFICULTY → PREVRANDAO (PoS)
EIP-4626 Tokenized vault standard
EIP-4788 Beacon block root in EVM
EIP-4844 Proto-danksharding (blob txs)
EIP-5805 Voting checkpointing
EIP-6492 Universal sig validation for non-deployed wallets
EIP-6780 SELFDESTRUCT semantic change
EIP-7002 Trigger withdrawals from EL
EIP-7251 Max effective balance increase 32 → 2048 ETH
EIP-7549 Move committee index outside attestation
EIP-7600 Hardfork meta — Pectra
EIP-7702 Set EOA code (smart accounts em EOAs)
EIP-7742 Uncouple blob count between CL/EL
EIP-7805 FOCIL (Fork-Choice enforced Inclusion Lists)

ERCs aplicação (alguns dos mais relevantes)

ERC Standard
ERC-20 Fungible token
ERC-721 NFT
ERC-777 Advanced token (hooks)
ERC-1155 Multi-token (semi-fungible)
ERC-1271 Contract signature
ERC-1400 Security tokens
ERC-2981 NFT royalties
ERC-3525 Semi-fungible tokens
ERC-4337 Account Abstraction
ERC-4626 Vault
ERC-5192 Soulbound tokens (non-transferable)
ERC-6551 Token-bound accounts (NFTs as wallets)
ERC-7521 Generalized signed message intent

5. Account Abstraction (ERC-4337)

Yoav Weiss, Sam Wilson, Vitalik 2021–2023. Mainnet mar/2023.

Mecânica

  • UserOperation: object describing intended action (user signed).
  • EntryPoint contract: validates + executes UserOps.
  • Bundler: like miner, but for UserOps; bundles + submits to chain.
  • Paymaster: optional sponsor of gas (USDC payment, gas station, etc.).
  • Smart wallet: any contract that implements validateUserOp().

Features unlocked

  • Multisig natural.
  • Social recovery (Argent, Safe).
  • Spend limits built-in.
  • Batch txs (1 sig, many actions).
  • Custom signatures: passkeys (WebAuthn), threshold, post-quantum.
  • Gasless (sponsor pays).
  • Session keys (Web3 games).
  • Subscription payments.

EIP-7702 (Pectra 2026)

Allow EOA to have code attached temporarily. EOA → smart-account hybrid sem deploy contrato. Simplifies UX massively.

Adoção

  • Argent, Safe (Gnosis), Coinbase Smart Wallet, Biconomy, Stackup.
  • Pimlico, Alchemy bundlers.
  • Pectra (mar/2026) deve acelerar adoção massiva.

6. Consensus layer (Beacon Chain)

Validators

  • 32 ETH stake (até Pectra; depois flexible até 2048 ETH).
  • 1M validators ativos (32M ETH staked).
  • Eligibility: deposit + 64-256 epoch entry queue.

Slot / epoch

  • 12s slot, 32 slots/epoch (~6.4 min).
  • Validator chosen via RANDAO per slot to propose block.
  • Random subset (committee) attests per slot.

Casper FFG + LMD-GHOST

  • LMD-GHOST (Latest Message Driven, Greedy Heaviest Observed SubTree): fork choice — escolhe chain com mais weighted attestations.
  • Casper FFG (Friendly Finality Gadget): every 2 epochs, 2/3+ validators justify → finalize. Justified parent + child = finalized.

Slashing

  • Double signing (propose ou attest 2 blocos no mesmo slot).
  • Surround voting: attestation que envelopa outra.

Penalties: 1 ETH base + correlation penalty (mais validators slashed simultâneo = maior penalty per).

Withdrawals (Shapella, 2023)

  • Partial withdrawal: balance > 32 ETH excess auto-withdrawn.
  • Full withdrawal: voluntarily exit (waiting queue).
  • Address bound to validator (no re-routing).

Liquid staking

  • Lido: ~30% do total ETH staked. stETH liquid token. Decentralization concern.
  • Rocket Pool: decentralized; rETH; 8/16 ETH minipools.
  • Coinbase, Binance: custodial liquid staking.
  • Frax, Stader, Stakewise.

7. EIP-1559 (London, 2021)

Fee market reform:

  • Base fee: algorithmically determined per block; burned.
  • Priority fee (tip): paid to validator.
  • Block target: 15M gas (half of 30M max).
  • If block > target, base fee ↑ 12.5%; if < target, ↓ 12.5%.

Outcomes:

  • Predictable fees.
  • ETH deflationary in high-usage periods (burn > issuance).
  • Pre-Merge: burn ~80 ETHday; post-Merge issuance só ~1700 ETHday vs 13000 pre.

8. EIP-4844 — Proto-Danksharding (Dencun, mar/2024)

Blob transactions:

  • New tx type (0x03).
  • Carry blobs (each 128 KB).
  • Max 6 blobs per block.
  • Separate fee market (blobbasefee).
  • Blobs stored ~18 dias (4096 epochs); not in EVM state (cheap).
  • KZG commitment scheme (Kate-Zaverucha-Goldberg) — cryptographic proof of inclusion.

Impact: L2 fees dropped ~10×. Optimistic + zk rollups posting calldata as blobs.

Full Danksharding (future): 64 blobs per block, sampling DA committee.


9. MEV

Maximal Extractable Value — profit from reordering, including, excluding txs.

Tipos

  • Arbitrage: cross-DEX price differences.
  • Liquidations: catch undercollateralized positions.
  • Sandwich attacks: front-run + back-run vulnerable txs (Uniswap swaps).
  • JIT (Just-In-Time) liquidity: add LP just for one tx, remove.
  • Long-tail: NFT mints, oracle manipulation, etc.

Flashbots + mev-boost

Flashbots (Phil Daian et al. 2020) — research collective.

MEV-Boost (post-Merge): separa proposer de builder.

  1. Validators (proposers) run mev-boost.
  2. Builders construct optimal blocks (run searchers' bundles + own MEV strategies).
  3. Relays intermediate (Flashbots, Bloxroute, Eden, etc.).
  4. Validator picks highest-paying header (via relay).

~90% blocks Ethereum via mev-boost.

Concentration concerns

Top builders (Beaverbuild, rsync-builder, Titan) dominam. Censorship — some relays comply OFAC (post-Tornado Cash), filtering txs. Censored share ~50% pós-2022; drops to ~25% via non-censoring relays growth.

Inclusion lists (EIP-7805 FOCIL)

Proposer can force inclusion of txs in next block. Anti-censorship.

MEV mitigation projects

  • CowSwap: batch auctions (no per-tx ordering exposure).
  • MEV Share (Flashbots): partial reveal — searcher pays user for hint.
  • Brink, Anoma: intent-based, MEV-aware.
  • MEV Blocker: RPC that routes via private mempool.

10. Stats (mai/2026 aprox)

  • Marketcap: ~US$ 600B.
  • Daily txs: ~1.5M (mainnet) + 50M (combined L2s).
  • TPS: ~15 sustained mainnet; effective com L2 ~1500.
  • Validators: ~1M.
  • Staked ETH: ~30%.
  • ETH supply: ~120M.
  • Burn rate cumulative: ~5M ETH burned since EIP-1559.

11. Roadmap

Vitalik's roadmap atualizado (2022, 2023, 2024):

Merge ✅ (set/2022)

PoW → PoS.

Surge

Rollup-centric scaling. Status: EIP-4844 ✅; danksharding pending.

Scourge

MEV mitigation. PBS in-protocol, inclusion lists. Status: research → Pectra.

Verge

Verkle trees: replace MPT (Merkle Patricia Tree) for state. Smaller proofs (~200 bytes vs ~20 KB). Enables stateless clients. Pending — possible 2026-2027 fork.

Purge

History expiry: drop history > 1 ano (EIP-4444). State expiry: prune inactive accounts. Pre-history removal: pre-Merge state simplification.

Splurge

Miscelânea: account abstraction completion, EVM improvements (EOF — Ethereum Object Format), endgame.


12. Clients (multi-client diversity)

Execution Layer (EL)

Client Lang Share aprox
Geth (Go Ethereum) Go ~55%
Nethermind C# ~25%
Besu (Hyperledger) Java ~10%
Erigon Go ~7%
Reth (Paradigm) Rust ~3% (growing)

Consensus Layer (CL)

Client Lang Share aprox
Prysm Go ~35%
Lighthouse Rust ~30%
Teku Java ~20%
Nimbus Nim ~10%
Lodestar TS ~5%

Diversity matters: single-client > 1/3 → bug = correlated slashing risk. Pósnotórios incidentes 2023 com Prysm bug afetando finality.


13. Ecossistema desenvolvedor

Languages

  • Solidity (default; C++-like syntax; ConsenSys + community).
  • Vyper (Python-like; security-focused; menos features).
  • Yul (intermediate language; closer to opcodes).
  • Huff (assembly-like, ultra-optimization).
  • Fe (Rust-inspired, experimental).

Frameworks

  • Foundry (Paradigm; Rust toolkit + Solidity-native test; dominante 2026).
  • Hardhat (Nomic; JS-based; popular legacy).
  • Brownie (Python; declining).
  • Truffle (legacy; sunset 2023).

Libraries

  • OpenZeppelin Contracts: standard secure implementations.
  • Solmate / Solady (Vectorized): optimized.
  • PRBMath: fixed-point math.
  • Multicall, Permit2, ERC-4337 reference.

Auditoria

OpenZeppelin, Trail of Bits, ConsenSys Diligence, Cantina (formerly Spearbit), Code4rena (crowdsourced), Sherlock, Zellic, Halborn.

Indexing

The Graph (decentralized), Goldsky, Subsquid, Alchemy.


14. Ethereum Classic (ETC)

Fork resultante do DAO bailout reversion (jul/2016). Mantém immutability principle.

  • Marketcap: US$ 5B (1% Ethereum).
  • PoW Ethash + Etchash. 51% attack survivors em 2020.
  • Adoção marginal; ideological holdout.

15. Referência cruzada

  • Cripto primitives: ../cryptography/05-assimetrica.md (secp256k1, BLS12-381), 06-hash-e-mac.md (Keccak).
  • L2 scaling: 07-l2-scaling.md.
  • Smart contracts deep: 08-smart-contracts.md.
  • DeFi built on Ethereum: 09-defi.md.
  • DAO hack, Parity, Ronin: 14-incidentes.md.
  • Tokenomics ETH: 12-tokenomics.md.