Home

Awesome

SP1 Ethereum Storage Proofs

This project demonstrates how to generate a zero-knowledge (zk) proof of a storage slot from the Ethereum mainnet using Succinct's SP1 zkVM. The SP1 zkVM is a versatile tool for creating and verifying zk proofs for various applications, including blockchain data verification without revealing the underlying data. This guide will walk you through setting up the project, installing dependencies, and running the program to generate and verify zk proofs for Ethereum storage slots.

Getting Started

Prerequisites

Installation

  1. Clone the Repository
    • Start by cloning this repository to your local machine.
  git clone https://github.com/aerius-labs/sp1-ethereum-storage-proofs.git
  1. Switch to Rust Nightly -Navigate into the project directory and switch to Rust's nightly compiler.
  cd sp1-ethereum-storage-proofs
  rustup override set nightly
  1. Build the zkVM program
cd program
cargo prove build
  1. Run prover
cd script
RUST_LOG=info cargo run --release

Usage

To generate and verify a zk proof for an Ethereum storage slot, you need the Ethereum address, the storage key, and the block number. The main function in main.rs demonstrates how to generate a zk proof for a specified storage slot.

  1. Configure Input Parameters
    • Open main.rs and set the eth_address, storage_key, and block_number to the Ethereum address, storage key, and block number for which you want to generate a zk proof.
let eth_address = "0x...";
let storage_key = "0x...";
let block_number = Block::Latest; // Or Block::Number(u64)
  1. Run the Program
    • Execute the program to generate and verify the zk proof.
cargo run --release

The program will output the proof generation and verification times, indicating successful execution.

Understanding the Code

The project includes several key components:

Benchmarks

Number of levels to storage root - 5

HardwareProof genProof verification
Apple silicon M16.1 s500 ms
AMD Ryzen 9 5900X5.3 s405 ms

Additional Information

For more details on SP1 zkVM and its capabilities, refer to the Succinct Labs documentation. This documentation provides comprehensive guidance on working with the SP1 Prover and Verifier, alongside other advanced features of the SP1 zkVM.