csv-adapter-ethereum 0.1.1

Ethereum adapter for CSV (Client-Side Validation) with storage slot seals and light-client proofs
Documentation

CSV Adapter Ethereum

Crates.io Documentation License

Ethereum adapter for CSV (Client-Side Validation) with nullifier-based seals and MPT proofs.

Overview

This crate implements the AnchorLayer trait for Ethereum, using nullifier registration as L3 Cryptographic single-use enforcement. Unlike Bitcoin's structural single-use, Ethereum requires explicit nullifier tracking via smart contracts.

Key Features

  • Nullifier Seals: Cryptographic single-use enforcement via smart contract registry
  • MPT Proofs: Merkle Patricia Trie inclusion proofs
  • LOG Events: Commitment publication via Ethereum events
  • Alloy Integration: Full compatibility with Alloy 0.9 ecosystem
  • Light Client: State root verification without full node
  • Sepolia/Testnet: Full testnet support

Installation

cargo add csv-adapter-ethereum

Or in your Cargo.toml:

[dependencies]
csv-adapter-ethereum = "0.1"

Features

Feature Description Default
rpc Enable full RPC client with Alloy integration
production Enable all production-ready features (rpc)

Quick Start

Creating an Ethereum Anchor Layer

use csv_adapter_ethereum::EthereumAnchorLayer;

// Create adapter with mock RPC for testing
let adapter = EthereumAnchorLayer::mock();

// Or with real RPC (requires `rpc` feature)
// let adapter = EthereumAnchorLayer::from_rpc(rpc_url, chain_id)?;

Working with Nullifier Seals

use csv_adapter_ethereum::EthereumAnchorLayer;
use csv_adapter_core::{Hash, AnchorLayer};

let adapter = EthereumAnchorLayer::mock();

// Create a nullifier-based seal
let nullifier = Hash::new([0x01; 32]);
let seal = adapter.create_seal_from_nullifier(nullifier)?;

// Publish a commitment
let commitment = Hash::new([0xAB; 32]);
let anchor = adapter.publish(commitment, seal)?;

MPT Proof Verification

use csv_adapter_ethereum::mpt::verify_mpt_proof;

// Verify a storage proof against state root
let is_valid = verify_mpt_proof(
    state_root,
    account_address,
    storage_slot,
    proof_nodes,
)?;

Architecture

EthereumAnchorLayer
├── Nullifier Registry  ← L3 Cryptographic single-use
├── MPT Proofs         ← Merkle Patricia Trie verification
├── LOG Events         ← Commitment publication
├── Finality Checker   ← Block finality verification
└── Alloy RPC          ← Ethereum node interaction (optional)

Seal Lifecycle

  1. Create: Generate a nullifier hash (H(right_id || secret))
  2. Register: Submit nullifier to smart contract (on-chain)
  3. Anchor: Emit LOG event with commitment hash
  4. Verify: MPT proof confirms inclusion in state root

License

This project is dual-licensed under either:

at your option.

Contributing

We welcome contributions! Please see our GitHub repository for more information.