rkdud007 / sp1-storage-proof

storage proof made by sp1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sp1-storage-proof

Disclamer: This project is under development, playing around with sp1 and alloy & reth codes

Goal

program that verify storage proof and return valid value of evm state
    1. input : pass rpc get_ethProof response value as an input of the program
    1. process : calculate storage trie's root base on given path - probably need to add trie implementation, there is gold reth code that im referring
    1. output : provide valid storage value from given key ( slot )

Development

Just sake of convineience, debugging in there https://github.com/rkdud007/playground/blob/main/sp1/src/main.rs for dev purpose

Quick Start

Before, follow SP1 installation

terminal 1:

❯ cd program
❯ cargo prove build

terminal 2:

❯ cd script
❯ cargo run --release

Input data format

 pub struct EIP1186ProofResponse {
    pub address: Address,
    pub balance: U256,
    pub code_hash: H256,
    pub nonce: U64,
    pub storage_hash: H256,
    pub account_proof: Vec<Bytes>,
    pub storage_proof: Vec<StorageProof>,
}


pub struct StorageProof {
    pub key: H256,
    pub proof: Vec<Bytes>,
    pub value: U256,
}

FYI

with alloy depend on keccak precompile library, with computing 6 keccak hash speed around:

Proof generation time: 8s

verification is always around

Verification time: 406.374542ms

The relevat code is in this commit

About

storage proof made by sp1


Languages

Language:Rust 100.0%