2025-05-14 12:59:49 +02:00
# Nomos Sovereign Rollup Example
2025-05-16 17:11:59 +02:00
This repository contains a proof-of-concept implementation of a Risc0-based sovereign rollup showcased by Nomos during IFT All-Hands 2025 in Split. The system demonstrates a complete end-to-end sovereign rollup architecture with EVM compatibility.
2025-05-14 12:59:49 +02:00
2025-05-16 17:11:59 +02:00
## Overview
2025-05-14 12:59:49 +02:00
2025-05-16 17:11:59 +02:00
This implementation consists of three main components:
2025-05-14 12:59:49 +02:00
2025-05-20 12:17:24 +02:00
1. **Sequencer Node** : A Reth-based execution node that processes transactions and submits blocks to Nomos.
2025-05-16 17:11:59 +02:00
2. **Prover** : Generates zero-knowledge proofs for block execution, ensuring the correctness of state transitions.
3. **Light Node** : Verifies proofs and block data, enabling trustless verification of the rollup state.
The system integrates with a fork of zeth (an Ethereum STF):
👉 [logos-co/zeth ](https://github.com/logos-co/zeth )
Additionally, the repository includes a fully functioning Uniswap example:
- [Uniswap's Contracts ](./nomos-example-uniswap-contracts/ ) - Smart contracts for the DEX
- [Nomoswap: Uniswap Frontend ](./nomos-example-uniswap/ ) - Web interface for interacting with the DEX
- [Blockscout: Block Explorer ](./nomos-example-blockscout/ ) - Block explorer for the rollup
2025-05-16 17:19:37 +02:00
## Architecture
```
+----------------+ +--------------+ +----------------+
| Sequencer |----->| Prover |< ---- | Light Node |
| (EVM) | | (Risc0) | | (Verifier) |
+----------------+ +--------------+ +----------------+
| |
v v
+----------------+ +----------------+
| Nomos Node |< -------------------------- | Consensus / DA |
| (DA Layer) | | Verification |
+----------------+ +----------------+
```
The system works as follows:
1. Sequencer processes transactions and sends blocks to the Nomos data availability layer
2. Prover generates ZK proofs of block execution
3. Light Node fetches blocks from the sequencer and verifies proofs
4. Light Node confirms block data is available on Nomos
2025-05-16 17:11:59 +02:00
## Prerequisites
- Rust
- Cargo
2025-05-16 17:19:37 +02:00
- Just
- Risc0
2025-05-16 17:11:59 +02:00
- Access to a Nomos node
## Installation
1. Clone the repository:
```bash
2025-05-16 17:19:37 +02:00
git clone https://github.com/your-org/nomos-example-sovereign.git --recurse-submodules
2025-05-16 17:11:59 +02:00
cd nomos-example-sovereign
```
2025-05-16 17:19:37 +02:00
2. Build zeth:
```bash
cd zeth
just build
```
GPU acceleration (Apple Metal and CUDA) is supported and greatly improves performance. To enable it, compile zeth appropriately with:
```bash
just metal
```
or
```bash
just cuda
```
2. Build the remaining components:
2025-05-16 17:11:59 +02:00
```bash
cargo build --release
```
## Running the Sovereign Rollup
### 1. Start the Sequencer Node
The sequencer node processes transactions and submits blocks to Nomos:
```bash
NOMOS_EXECUTOR="https://nomos.url" \
NOMOS_USER=your_username \
NOMOS_PASSWORD=your_password \
cargo run --release --bin evm-sequencer-node
```
Environment variables:
- `NOMOS_EXECUTOR` : URL to the Nomos testnet node
- `NOMOS_USER` and `NOMOS_PASSWORD` : Authentication credentials for the Nomos node, if required
The sequencer exposes RPC endpoints on:
- HTTP: http://localhost:8545
2025-05-16 17:19:37 +02:00
- WebSocket: wss://localhost:8546
2025-05-16 17:11:59 +02:00
### 2. Start the Prover
The prover generates zero-knowledge proofs for block execution:
```bash
cargo run --release --bin evm-prover -- \
--rpc http://localhost:8545 \
--start-block 0 \
--batch-size 10 \
--interval 5 \
--zeth-binary-dir /path/to/zeth/bin
```
Parameters:
- `--rpc` : URL to the sequencer's RPC endpoint
- `--start-block` : Block number to start proving from
- `--batch-size` : Number of blocks to prove in a batch
- `--interval` : Polling interval in seconds
- `--zeth-binary-dir` : Path to the directory containing the zeth binary
The prover service will be available at: http://localhost:8070
2025-05-16 17:19:37 +02:00
### 3. Start the Light Node [experimental]
2025-05-16 17:11:59 +02:00
2025-05-16 17:19:37 +02:00
The light node validates proofs and verifies block data. Please note that this is an experimental feature and may not be fully functional.
2025-05-16 17:11:59 +02:00
```bash
cargo run --release --bin evm-lightnode -- \
--rpc http://localhost:8545 \
--ws-rpc wss://localhost:8546 \
--prover-url http://localhost:8070 \
2025-05-16 17:19:37 +02:00
--nomos-node https://nomos.url \
2025-05-16 17:11:59 +02:00
--batch-size 10 \
--zeth-binary-dir /path/to/zeth
```
Parameters:
- `--rpc` : HTTP RPC endpoint of the sequencer
- `--ws-rpc` : WebSocket RPC endpoint of the sequencer
- `--prover-url` : URL to the prover service
- `--nomos-node` : URL to the Nomos testnet node
- `--batch-size` : Number of blocks in a proof batch
- `--zeth-binary-dir` : Path to the directory containing the zeth binary
2025-05-16 17:19:37 +02:00
## Example Application: Deploying Uniswap
2025-05-16 17:11:59 +02:00
Follow these steps to deploy and interact with Uniswap on the sovereign rollup:
1. Deploy the [Uniswap's Contracts ](./nomos-example-uniswap-contracts/ )
```bash
cd nomos-example-uniswap-contracts
# Follow instructions in the README
```
2025-05-14 12:59:49 +02:00
2. Deploy [Nomoswap ](./nomos-example-uniswap/ )
2025-05-16 17:11:59 +02:00
```bash
cd nomos-example-uniswap
# Follow instructions in the README
```
3. (Optional) Deploy [Blockscout ](./nomos-example-blockscout/ )
```bash
cd nomos-example-blockscout
# Follow instructions in the README
```
Each component's directory contains a detailed README with specific setup instructions.