# matter-labs/zksync-os-server architecture

> Architecture diagram of the GitHub repository matter-labs/zksync-os-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/matter-labs/zksync-os-server
- Repository: https://github.com/matter-labs/zksync-os-server

## Overview

ZKsync OS Server is a ZK Stack sequencer. Its principal workflow accepts transactions through JSON-RPC, executes them into blocks, forms batches, obtains proofs, and submits batch operations to L1; state and API data are persisted separately. The repository also includes peer networking, L1 event watchers, and replay storage. The README documents the broad sequencer-to-batcher and downstream separation; several implementation links below are dashed because the relevant orchestration source was not sampled.

Main entry points: [`lib/sequencer/src/execution/block_executor.rs`](https://github.com/matter-labs/zksync-os-server/blob/main/lib/sequencer/src/execution/block_executor.rs) (Block Execution), [`node/bin/src/prover_api/fri_proving_pipeline_step.rs`](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/fri_proving_pipeline_step.rs) (FRI Pipeline), [`lib/l1_sender/src/pipeline_component.rs`](https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_sender/src/pipeline_component.rs) (L1 Sender), [`lib/rpc/src/tx_handler.rs`](https://github.com/matter-labs/zksync-os-server/blob/main/lib/rpc/src/tx_handler.rs) (JSON-RPC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Transaction Ingress"]
  node_rpc["JSON-RPC<br/>[tx_handler.rs]"]
  node_mempool["Transaction Pool<br/>[pool.rs]"]
end

subgraph group_execution["Sequencing and State"]
  node_sequencer["Block Execution<br/>[block_executor.rs]"]
  node_state[("Persistent State<br/>[repository.rs]")]
end

subgraph group_batching["Batch and Proof"]
  node_batcher["Batch Builder<br/>[batch_builder.rs]"]
  node_prover_input["Prover Input<br/>[mod.rs]"]
  node_fri_step["FRI Pipeline"]
  node_fri_jobs["FRI Job Manager<br/>[fri_job_manager.rs]"]
  node_proof_storage[("Proof Storage<br/>[proof_storage.rs]")]
end

subgraph group_l1["L1 Integration"]
  node_l1_sender["L1 Sender"]
  node_l1_commands["L1 Operations<br/>[mod.rs]"]
  node_l1_watcher["L1 Watchers<br/>[watcher.rs]"]
end

subgraph group_support["Node Services"]
  node_p2p["Peer Network<br/>[service.rs]"]
  node_replay["Replay Archive<br/>[component.rs]"]
end

node_client(("RPC Client"))
node_l1{{"L1 Network"}}

node_client -->|"submits transactions"| node_rpc
node_rpc -.->|"forwards transactions"| node_mempool
node_mempool -.->|"supplies transactions"| node_sequencer
node_sequencer -.->|"persists state"| node_state
node_sequencer -->|"produces blocks"| node_batcher
node_batcher -.->|"generates inputs"| node_prover_input
node_prover_input -.->|"feeds proving"| node_fri_step
node_fri_step -->|"adds jobs"| node_fri_jobs
node_fri_jobs -->|"stores failures"| node_proof_storage
node_fri_step -.->|"forwards proofs"| node_l1_sender
node_l1_sender -->|"runs operations"| node_l1_commands
node_l1_sender -.->|"submits batches"| node_l1
node_l1 -.->|"emits events"| node_l1_watcher
node_p2p -.->|"coordinates updates"| node_l1_watcher

click node_rpc "https://github.com/matter-labs/zksync-os-server/blob/main/lib/rpc/src/tx_handler.rs"
click node_mempool "https://github.com/matter-labs/zksync-os-server/blob/main/lib/mempool/src/pool.rs"
click node_sequencer "https://github.com/matter-labs/zksync-os-server/blob/main/lib/sequencer/src/execution/block_executor.rs"
click node_state "https://github.com/matter-labs/zksync-os-server/blob/main/lib/storage/src/db/repository.rs"
click node_batcher "https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/batcher/batch_builder.rs"
click node_prover_input "https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_input_generator/mod.rs"
click node_fri_step "https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/fri_proving_pipeline_step.rs"
click node_fri_jobs "https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/fri_job_manager.rs"
click node_proof_storage "https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/proof_storage.rs"
click node_l1_sender "https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_sender/src/pipeline_component.rs"
click node_l1_commands "https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_sender/src/commands/mod.rs"
click node_l1_watcher "https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_watcher/src/watcher.rs"
click node_p2p "https://github.com/matter-labs/zksync-os-server/blob/main/lib/network/src/service.rs"
click node_replay "https://github.com/matter-labs/zksync-os-server/blob/main/lib/replay_archive/src/component.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rpc,node_mempool,node_client toneBlue
class node_sequencer,node_state toneAmber
class node_batcher,node_prover_input,node_fri_step,node_fri_jobs,node_proof_storage toneMint
class node_l1_sender,node_l1_commands,node_l1_watcher toneRose
class node_p2p,node_replay,node_l1 toneIndigo
```

## Components

### Transaction Ingress

- [JSON-RPC](https://github.com/matter-labs/zksync-os-server/blob/main/lib/rpc/src/tx_handler.rs): `lib/rpc/src/tx_handler.rs`
- [Transaction Pool](https://github.com/matter-labs/zksync-os-server/blob/main/lib/mempool/src/pool.rs): `lib/mempool/src/pool.rs`

### Sequencing and State

- [Block Execution](https://github.com/matter-labs/zksync-os-server/blob/main/lib/sequencer/src/execution/block_executor.rs): `lib/sequencer/src/execution/block_executor.rs`
- [Persistent State](https://github.com/matter-labs/zksync-os-server/blob/main/lib/storage/src/db/repository.rs): `lib/storage/src/db/repository.rs`

### Batch and Proof

- [Batch Builder](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/batcher/batch_builder.rs): `node/bin/src/batcher/batch_builder.rs`
- [Prover Input](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_input_generator/mod.rs): `node/bin/src/prover_input_generator/mod.rs`
- [FRI Pipeline](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/fri_proving_pipeline_step.rs): `node/bin/src/prover_api/fri_proving_pipeline_step.rs`
- [FRI Job Manager](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/fri_job_manager.rs): `node/bin/src/prover_api/fri_job_manager.rs`
- [Proof Storage](https://github.com/matter-labs/zksync-os-server/blob/main/node/bin/src/prover_api/proof_storage.rs): `node/bin/src/prover_api/proof_storage.rs`

### L1 Integration

- [L1 Sender](https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_sender/src/pipeline_component.rs): `lib/l1_sender/src/pipeline_component.rs`
- [L1 Operations](https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_sender/src/commands/mod.rs): `lib/l1_sender/src/commands/mod.rs`
- [L1 Watchers](https://github.com/matter-labs/zksync-os-server/blob/main/lib/l1_watcher/src/watcher.rs): `lib/l1_watcher/src/watcher.rs`

### Node Services

- [Peer Network](https://github.com/matter-labs/zksync-os-server/blob/main/lib/network/src/service.rs): `lib/network/src/service.rs`
- [Replay Archive](https://github.com/matter-labs/zksync-os-server/blob/main/lib/replay_archive/src/component.rs): `lib/replay_archive/src/component.rs`

### Other components

- **RPC Client**
- **L1 Network**

## Connections

- RPC Client → JSON-RPC: submits transactions (evidence: `README.md`)
- JSON-RPC → Transaction Pool: forwards transactions
- Transaction Pool → Block Execution: supplies transactions
- Block Execution → Persistent State: persists state (evidence: `README.md`)
- Block Execution → Batch Builder: produces blocks (evidence: `README.md`)
- Batch Builder → Prover Input: generates inputs
- Prover Input → FRI Pipeline: feeds proving
- FRI Pipeline → FRI Job Manager: adds jobs (evidence: `node/bin/src/prover_api/fri_proving_pipeline_step.rs`)
- FRI Job Manager → Proof Storage: stores failures (evidence: `node/bin/src/prover_api/fri_job_manager.rs`)
- FRI Pipeline → L1 Sender: forwards proofs
- L1 Sender → L1 Operations: runs operations (evidence: `lib/l1_sender/src/pipeline_component.rs`)
- L1 Sender → L1 Network: submits batches
- L1 Network → L1 Watchers: emits events
- Peer Network → L1 Watchers: coordinates updates
