How ethereum-optimism/optimism works
Based on our review of the complete file tree and the README, we see that this is a monorepo for an entire blockchain scaling solution called “Optimism” (the OP Stack). This is a full-stack decentralized system that combines multiple services – from on‐chain smart contracts and consensus clients (op‑node) to off‐chain batch submitters (op‑batcher), fault proof programs (op‑program), dispute game challengers (op‑challenger), output proposers (op‑proposer), preimage oracle services (op‑preimage), and various supporting utilities (op‑service, op‑wheel, a whole contracts package in “packages/contracts-bedrock”, etc.). In other words, this repository contains many discrete components each responsible for a piece of the layer‑2 system that collectively forms Optimism’s rollup architecture.
Main architectural layers and components
• Core protocol services that run as separate “op‑*” binaries:
– op‑node: The consensus (rollup) client that carries out the central state transitions and (likely) handles L1–L2 communication.
– op‑batcher: Collects transactions from L2 and forms batches that are submitted to the L1 chain.
– op‑proposer: Responsible for proposing L2 output updates that get posted to L1.
– op‑challenger: Handles dispute game challenges in cases where a faulty batch or malicious state is detected.
– op‑program: The fault proof program that is part of validating state transitions.
– op‑preimage: Provides oracle bindings for preimage functionality.
• Smart Contracts Layer:
– Found under “packages/contracts-bedrock”; these contracts form the on‑chain logic and include components such as bridges, validators, and messenger contracts.
• Support and Utility Layers:
– Services like “op‑service”, “op‑wheel” and other utility libraries.
– Engaged CI/CD, testing (op‑e2e), deployment tooling, and developer environments (kurtosis‑devnet, ops) serve as the bottom “infrastructure” layer.
• External Dependencies:
– The underlying Ethereum L1 network.
– Developer tooling and external services used for testing, auditing, or communication (such as GitHub Actions, CI pipelines, and docker configurations).
Relationships and interactions between these components
• How the L2 components – op‑node, op‑batcher, op‑proposer, and op‑challenger – interact with each other. For example, transactions submitted to op‑node are batched by op‑batcher; op‑proposer then takes state changes or proofs from op‑node and prepares an output proposal, while op‑challenger monitors for conflicts or fraud.
• Feedback paths and dispute resolution mechanism: for example, if op‑challenger detects a dispute, it triggers a challenge (possibly interacting with op‑program for fault proofs) and the outcome is enforced via smart contracts.
• How the op‑preimage service fits into the data availability or oracle lookups when verifying state or contract inputs.
Detail design patterns and technology choices
• Each “op‑…” component generally is written in Golang (as evidenced by the numerous Go source files) and is deployed as an independent microservice or binary.
• The system uses containerization (Dockerfiles, CI config in .github and .circleci folders) so you might represent container boundaries around each service.
• That the system is modular, with clear separation between the execution node, state batching, output proposal, and challenge mechanisms – a design that favors both robustness and upgradeability.
• The smart contracts are developed as on‑chain modules that are versioned separately (using semver tags with “op‑node/vX.X.X”, etc.) and interact with these off-chain services via established protocols and APIs.
Overall details
• Be detailed in capturing the flow from the L2 entry (transaction processing) to batch submission, output proposers and challenge responses.
• Don’t over-simplify: since the project is modular with many interacting parts, try to break down into at least three layers (off‑chain services, on‑chain contracts, and deployment/operations).