⚠️ This repository is no longer maintained by the core team. Community contributions are welcome.
⚠️ This library has not been audited. Use at your own risk.
Cryptographically verify Linea blocks using beacon chain attestations and sequencer signatures.
This library was created as a direct build dependency of the ZkCoprocessor within the Malda Sequencer. The ZkCoprocessor relies on it to cryptographically verify Linea blocks before processing them further.
While built specifically for Linea's consensus model, the verification logic is implemented in a generic way and can be adapted for use in other projects that need similar block verification capabilities.
This project provides tools to prove that a Linea block hash or header is authentic by verifying the sequencer's ECDSA signature. It's designed for use in zkVM environments where trustless verification is required.
For detailed security model and verification logic, see SECURITY.md.
| Crate | Description |
|---|---|
linea-block-verifier |
Umbrella crate re-exporting core and host |
linea-proof-core |
Core verification logic (for zkVM) and basic types |
linea-proof-host |
Host utilities: beacon client, RPC helpers |
verify-header-demo |
CLI demo for header verification |
| Crate | Description |
|---|---|
zkvm/risc0-guest |
RISC Zero guest program for zkVM verification |
zkvm/risc0-host |
RISC Zero host for executing the guest |
| Mode | Description | Use Case |
|---|---|---|
verify_block_hash |
Verifies only the block hash | Faster, minimal proof that block hash is authentic |
verify_header |
Verifies full header + Linea bug detection | Complete validation with field-by-field checks |
# Verify a recent block on Sepolia
cargo run -p verify-header-demo -- --network sepolia recent
# Verify a recent block on Mainnet
cargo run -p verify-header-demo -- --network mainnet recent
# Verify a block hash only (without full header)
cargo run -p verify-header-demo -- --network mainnet hash \
--block-hash 0x6d93533ba354440c035355657195dd7832df0ac3d232904d08e67296fd5ce75c
# Verify from local JSON file
cargo run -p verify-header-demo -- --network mainnet local --file-path header.jsonUse the umbrella crate for convenience:
# For host applications (includes BeaconClient)
linea-block-verifier = { version = "0.1", features = ["host"] }
# For zkVM guests (no_std compatible)
linea-block-verifier = { version = "0.1", features = ["std"] }use linea_block_verifier::core::{verify_header, verify_block_hash, LineaNetwork};
use linea_block_verifier::host::BeaconClient;
// Fetch beacon data
let client = BeaconClient::new("http://beacon-rpc:10080", LineaNetwork::Mainnet);
let verify_input = client.create_verify_input(header).await?;
// Option 1: Verify block hash only (faster)
verify_block_hash(block_hash, &beacon_data, LineaNetwork::Mainnet)?;
// Option 2: Verify full header with Linea bug detection
verify_header(&input_header, &beacon_data, LineaNetwork::Mainnet)?;The zkvm/ directory contains RISC Zero integration for generating zero-knowledge proofs of header verification.
# Build and run the RISC Zero host
cd zkvm/risc0-host
cargo run --releaseThe host will:
- Fetch a recent Linea block and beacon data (or load from
verify_input.binif cached) - Execute both verification modes in the zkVM
- Report cycle counts and timing comparison
cargo build --releaseA flake.nix is provided for reproducible builds, no_std compatibility checking, linting, and formatting.
# Build verify-header-demo
nix build .#verify-header-demo
# Build linea-proof-core for thumbv7em-none-eabi (verifies no_std compatibility)
nix build .#linea-proof-core-no-std
# Run all checks (builds + clippy + formatting)
nix flake check
# Format code (Nix + Rust)
nix fmt
# Enter development shell
nix developcargo testThis project is licensed under the MIT License.