05 l1 ethereum
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 |
| 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 |
| 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 |
| Encoding | RLP (Recursive Length Prefix) |
2. EVM (Ethereum Virtual Machine)
Stackbased virtual machine. 256bit words.
Componentes
- *tack* 1024 items, 256-bit cada.
- *emory* byte-addressable, expandable (gas grows quadratic).
- *torage* persistent key
value, 256bit key → 256-bit value. Most expensive. - *alldata* input read-only.
- *ode* contract bytecode.
- *rogram counter* posição em bytecode.
Opcodes
~140 opcodes. Categorias:
| Categoria | Exemplos | Gas |
|---|---|---|
| *tack* | PUSH1 |
3 |
| *rithmetic* | ADD, MUL, SUB, DIV, MOD, EXP | 3-10 |
| *omparison* | LT, GT, EQ, ISZERO | 3 |
| *itwise* | AND, OR, XOR, NOT, SHL, SHR | 3 |
| *ash* | KECCAK256 | 30 + 6/word |
| *nvironment* | ADDRESS, BALANCE, CALLER, CALLVALUE, GASPRICE | 2-700 |
| *lock* | BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, DIFFICULTY, GASLIMIT, CHAINID | 2-20 |
| *emory* | MLOAD, MSTORE, MSTORE8, MSIZE | 3+ |
| *torage* | SLOAD (2100100), SSTORE (200005000/2900) | very high |
| *ontrol flow* | JUMP, JUMPI, JUMPDEST, PC, GAS, STOP, RETURN, REVERT, INVALID | 1-10 |
| *alls* | CALL, DELEGATECALL, STATICCALL, CALLCODE (deprecated), CREATE, CREATE2 | 700-32000 |
| *ogs* | LOG0-LOG4 | 375 + 8/byte |
| *recompiles* | 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_pricegas_used ≤ gas_limit (rest is refund). Outofgas → revert (mas gas consumed).
Account types
- *OA (Externally Owned Account)* controlled by private key. Pays gas.
- *ontract 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 |
Genesis |
| Homestead | 2016 |
First production release |
| *AO Fork* | 2016 |
Revert DAO hack; ETC split |
| Tangerine Whistle | 2016 |
Anti-DoS gas reprice |
| Spurious Dragon | 2016 |
More DoS fixes; state clearing |
| Byzantium | 2017 |
Difficulty bomb delay; new opcodes (REVERT, RETURNDATA) |
| Constantinople | 2019 |
Bitwise shifting opcodes; CREATE2 |
| Istanbul | 2019 |
Gas reprice; LOGICNOTREPRICED ChainID |
| Muir Glacier | 2020 |
Difficulty bomb delay |
| Berlin | 2021 |
EIP |
| *ondon* | 2021 |
*IP-1559*fee market; difficulty bomb delay |
| Altair (Beacon) | 2021 |
Sync committee; light client support |
| Arrow Glacier | 2021 |
Difficulty bomb delay |
| Gray Glacier | 2022 |
Difficulty bomb delay |
| *he Merge* | 2022 |
*oW → PoS*transition |
| Shapella (Shanghai+Capella) | 2023 |
Staking withdrawals |
| *encun (Cancun+Deneb)* | 2024 |
*IP-4844 blobs* transient storage; KZG point eval |
| *ectra (Prague+Electra)* | 2026-03 (planejada) | EIP |
4. EIPs (Ethereum Improvement Proposals)
Categorias: Core, Networking, Interface, ERC (Application standards).
EIPs Core notáveis
| EIP | Conteúdo |
|---|---|
| *IP-1* | EIP process itself |
| *IP-20* | ERC-20 fungible token standard |
| *IP-55* | Mixed-case checksum address |
| *IP-155* | Replay attack protection (chain ID) |
| *IP-721* | NFT standard (ERC-721) |
| *IP-1155* | Multi |
| *IP-1271* | Smart contract signature validation |
| *IP-1559* | Fee market (base fee + tip; burn) |
| *IP-2535* | Diamond proxy (multi-facet) |
| *IP-2612* | Permit (gasless approval) |
| *IP-2718* | Typed transaction envelope |
| *IP-2929* | Access lists / gas cost increase for storage |
| *IP-2930* | Optional access lists |
| *IP-3074* | AUTH and AUTHCALL (sponsored txs) — superseded por 7702 |
| *IP-3198* | BASEFEE opcode |
| *IP-3529* | Reduce refunds |
| *IP-3675* | Upgrade consensus to PoS (Merge) |
| *IP-3855* | PUSH0 opcode |
| *IP-4337* | Account Abstraction (smart wallets) |
| *IP-4399* | DIFFICULTY → PREVRANDAO (PoS) |
| *IP-4626* | Tokenized vault standard |
| *IP-4788* | Beacon block root in EVM |
| *IP-4844* | Proto-danksharding (blob txs) |
| *IP-5805* | Voting checkpointing |
| *IP-6492* | Universal sig validation for non-deployed wallets |
| *IP-6780* | SELFDESTRUCT semantic change |
| *IP-7002* | Trigger withdrawals from EL |
| *IP-7251* | Max effective balance increase 32 → 2048 ETH |
| *IP-7549* | Move committee index outside attestation |
| *IP-7600* | Hardfork meta — Pectra |
| *IP-7702* | Set EOA code (smart accounts em EOAs) |
| *IP-7742* | Uncouple blob count between CL/EL |
| *IP-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 |
| 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)
*oav Weiss, Sam Wilson, Vitalik 2021–2023* Mainnet mar/2023.
Mecânica
- *serOperation* object describing intended action (user signed).
- *ntryPoint contract* validates + executes UserOps.
- *undler* like miner, but for UserOps; bundles + submits to chain.
- *aymaster* optional sponsor of gas (USDC payment, gas station, etc.).
- *mart wallet* any contract that implements
validateUserOp().
Features unlocked
- *ultisig*natural.
- *ocial recovery*(Argent, Safe).
- *pend limits*built-in.
- *atch txs*(1 sig, many actions).
- *ustom signatures* passkeys (WebAuthn), threshold, post-quantum.
- *asless*(sponsor pays).
- *ession keys*(Web3 games).
- *ubscription*payments.
EIP-7702 (Pectra 2026)
Allow EOA to have code attached temporarily. EOA → smart-account hybrid sem deploy contrato. Simplifies UX massively.
Adoção
- *rgent* *afe (Gnosis)* *oinbase Smart Wallet* *iconomy* *tackup*
- 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
- *MD-GHOST*(Latest Message Driven, Greedy Heaviest Observed SubTree): fork choice — escolhe chain com mais weighted attestations.
- *asper FFG*(Friendly Finality Gadget): every 2 epochs, 2/3+ validators justify → finalize. Justified parent + child = finalized.
Slashing
- *ouble signing*(propose ou attest 2 blocos no mesmo slot).
- *urround voting* attestation que envelopa outra.
Penalties: 1 ETH base + correlation penalty (mais validators slashed simultâneo = maior penalty per).
Withdrawals (Shapella, 2023)
- *artial withdrawal* balance > 32 ETH excess auto-withdrawn.
- *ull withdrawal* voluntarily exit (waiting queue).
- Address bound to validator (no re-routing).
Liquid staking
- *ido* ~30% do total ETH staked. stETH liquid token. Decentralization concern.
- *ocket Pool* decentralized; rETH; 8/16 ETH minipools.
- *oinbase, Binance* custodial liquid staking.
- *rax, Stader, Stakewise*
7. EIP-1559 (London, 2021)
Fee market reform:
- *ase fee* algorithmically determined per block; *urned*
- *riority fee (tip)* paid to validator.
- Block target: 15M gas (half of 30M max).
- If block > target, base fee ↑ 12.5%; if < target, ↓ 12.5%.
*utcomes*
- Predictable fees.
- ETH *eflationary*in high-usage periods (burn > issuance).
- Pre
Merge: burn ~80 ETH/day; postMerge issuance só ~1700 ETH/day vs 13000 pre.
8. EIP4844 — ProtoDanksharding (Dencun, mar/2024)
*lob transactions*
- New tx type (0x03).
- Carry blobs (each 128 KB).
- Max 6 blobs per block.
- *eparate fee market*(blobbasefee).
- Blobs stored ~18 dias (4096 epochs); not in EVM state (cheap).
- KZG commitment scheme (Kate
ZaveruchaGoldberg) — cryptographic proof of inclusion.
*mpact* L2 fees dropped ~10×. Optimistic + zk rollups posting calldata as blobs.
*ull Danksharding*(future): 64 blobs per block, sampling DA committee.
9. MEV
Maximal Extractable Value — profit from reordering, including, excluding txs.
Tipos
- *rbitrage* cross-DEX price differences.
- *iquidations* catch undercollateralized positions.
- *andwich attacks* front
run + backrun vulnerable txs (Uniswap swaps). - *IT (Just
InTime) liquidity* add LP just for one tx, remove. - *ong-tail* NFT mints, oracle manipulation, etc.
Flashbots + mev-boost
*lashbots*(Phil Daian et al. 2020) — research collective.
*EVBoost*(postMerge): separa proposer de builder.
- Validators (proposers) run mev-boost.
- *uilders*construct optimal blocks (run searchers' bundles + own MEV strategies).
- *elays*intermediate (Flashbots, Bloxroute, Eden, etc.).
- Validator picks highest-paying header (via relay).
~90% blocks Ethereum via mev-boost.
Concentration concerns
Top builders (Beaverbuild, rsyncbuilder, Titan) dominam. Censorship — some relays comply OFAC (postTornado Cash), filtering txs. Censored share ~50% pós2022; drops to ~25% via noncensoring relays growth.
Inclusion lists (EIP-7805 FOCIL)
Proposer can force inclusion of txs in next block. Anti-censorship.
MEV mitigation projects
- *owSwap* batch auctions (no per-tx ordering exposure).
- *EV Share*(Flashbots): partial reveal — searcher pays user for hint.
- *rink, Anoma* intent
based, MEVaware. - *EV 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
Rollupcentric scaling. Status: EIP4844 ✅; danksharding pending.
Scourge
MEV mitigation. PBS in-protocol, inclusion lists. Status: research → Pectra.
Verge
*erkle trees* replace MPT (Merkle Patricia Tree) for state. Smaller proofs (~200 bytes vs ~20 KB). Enables stateless clients. *ending*— possible 2026-2027 fork.
Purge
*istory expiry* drop history > 1 ano (EIP4444). *tate expiry* prune inactive accounts. *rehistory 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 |
|---|---|---|
| *eth*(Go Ethereum) | Go | ~55% |
| *ethermind* | C# | ~25% |
| *esu*(Hyperledger) | Java | ~10% |
| *rigon* | Go | ~7% |
| *eth*(Paradigm) | Rust | ~3% (growing) |
Consensus Layer (CL)
| Client | Lang | Share aprox |
|---|---|---|
| *rysm* | Go | ~35% |
| *ighthouse* | Rust | ~30% |
| *eku* | Java | ~20% |
| *imbus* | Nim | ~10% |
| *odestar* | TS | ~5% |
*iversity matters* single-client > 1/3 → bug = correlated slashing risk. Pósnotórios incidentes 2023 com Prysm bug afetando finality.
13. Ecossistema desenvolvedor
Languages
- *olidity*(default; C++-like syntax; ConsenSys + community).
- *yper*(Python
like; securityfocused; menos features). - *ul*(intermediate language; closer to opcodes).
- *uff*(assembly
like, ultraoptimization). - *e*(Rust-inspired, experimental).
Frameworks
- *oundry*(Paradigm; Rust toolkit + Solidity-native test; dominante 2026).
- *ardhat*(Nomic; JS-based; popular legacy).
- *rownie*(Python; declining).
- *ruffle*(legacy; sunset 2023).
Libraries
- *penZeppelin Contracts* standard secure implementations.
- *olmate / Solady*(Vectorized): optimized.
- *RBMath* fixed-point math.
- *ulticall, 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, BLS12381), `06hashemac.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.