How chainwayxyz/citrea works
Project type and purpose
• Citrea is a blockchain rollup system (“the first rollup that enhances Bitcoin blockspace with ZK”) built in Rust on a forked Sovereign‑SDK.
• It integrates with Bitcoin as its L1, provides an EVM‑compatible L2 execution shard, and uses zero‑knowledge proofs (via Risc0/SP1 circuits) plus optimistic verification (BitVM) on Bitcoin.
File structure
• Top‑level binaries (bin/citrea, bin/cli) act as entrypoints for the rollup node and its CLI.
• The crates/ directory contains standalone services & libraries:
– bitcoin-da: Data availability provider for Bitcoin blocks & headers
– sequencer: L2 block builder, commitment generator, mempool
– fullnode: L2 state sync, server RPC, metrics
– batch‑prover & light-client-prover: off‑chain ZK proof generators
– l2-block-rule-enforcer & soft-confirmation-rule-enforcer: enforce protocol rules
– citrea-stf + evm: state transition function & EVM execution engine
– common: shared RPC/server utilities, config, caching
– sovereign-sdk & rollup-interface/module‑system: core SDK abstractions & plugin framework
• guests/: Risc0 and SP1 guest circuits for ZK proof execution
• resources/: configuration, genesis, Docker, test data, dashboards
• docs/, Dockerfiles, CI workflows, Makefiles, and GitHub actions for build/test/deploy
README for architecture hints
• Citrea uses BTC as its native asset, no separate token.
• It leverages zero‑knowledge proofs for each transaction, optimistically verified on Bitcoin.
• Key components (sequencer, full node, prover services) are referenced in docs but not yet diagrammed.
Be detailed but concise
• Essential services and their interconnections.
• Avoid over‑splitting: group related crates under the same service.