A performant, type-1 zkEVM written in Rust & SP1.

Overview

SP1 Reth

Telegram Chat

SP1 Reth is a 100% open-source POC that showcases how any rollup can use SP1 to build a performant (type-1, bytecode compatible) zkEVM with less than 2000 lines of maintainable Rust code. SP1 Reth achieves incredible performance (around $0.01-0.02 proving cost for an average Ethereum transaction) by leveraging SP1’s open-source, customizable precompile system, with orders of magnitude improvements to come. SP1 Reth points to a future where all rollups can become ZK rollups, utilizing the magic of ZKPs with maintainable software written in Rust.

Blog Post | SP1 Repo | SP1 Docs

Requirements

To reproduce the benchmarks in our blog post, your system will need:

  • 64+ CPUs
  • 512+ GB RAM
  • NVME Hard Drive

We ran our benchmarks on a i4g.16xlarge instance on AWS. You may need to add a swap file on NVME.

Run

Make sure you have mounted your NVME hard drive in a RAID0 setup with at raid0 with a tmp folder.

cd script
TMPDIR=/mnt/raid0/tmp \
SHARD_SIZE=524288 \
RUST_LOG="debug,p3_keccak_air=off" \
RUSTFLAGS="-C target-cpu=native" \
cargo run --release -- \
  --rpc-url <rpc_url> \
  --block-number <block_number>

Lines of Code

$ cloc --by-file --include-lang=Rust primitives program   
      10 text files.
       8 unique files.
       5 files ignored.

github.com/AlDanial/cloc v 1.96  T=0.01 s (707.0 files/s, 264169.2 lines/s)
------------------------------------------------------------------------------------------
File                                        blank        comment           code
------------------------------------------------------------------------------------------
primitives/src/mpt.rs                         124            272           1022
primitives/src/processor.rs                    43             56            316
primitives/src/alloy2reth.rs                    8              3            145
primitives/src/db.rs                           19             11            134
primitives/src/lib.rs                          15             17             24
program/src/main.rs                             6              5             22
------------------------------------------------------------------------------------------
SUM:                                          215            364           1663
------------------------------------------------------------------------------------------

Security

This code has not yet been audited, and should not be used in any production systems.

Acknowledgements

We would like to acknowledge the projects below whose previous work has been instrumental in making this project a reality:

  • Reth: For providing an excellent execution client reference and primitives needed for processing blocks.
  • Revm: For providing core execution primitives and a performant EVM implementation.
  • Alloy: For providing core ethereum primitives and RPC methods.
  • Zeth: SP1 Reth is originally based on Zeth, but we chose to not fork Zeth directly because we noticed there was an opportunity to reuse significantly more code from Reth, Revm, and Alloy.
You might also like...
Collection of cryptographic hash functions written in pure Rust

RustCrypto: hashes Collection of cryptographic hash functions written in pure Rust. All algorithms reside in the separate crates and implemented using

rabe is an Attribute Based Encryption library, written in Rust

Rabe rabe is a rust library implementing several Attribute Based Encryption (ABE) schemes using a modified version of the bn library of zcash (type-3

An extremely high performance matching engine written in Rust.

Galois Introduction Galois is an extremely high performance matching engine written in Rust, typically used for the crypto currency exchange service.

A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

A fast tool to scan prototype pollution vulnerability written in Rust. 🦀
A fast tool to scan prototype pollution vulnerability written in Rust. 🦀

ppfuzz Prototype Pollution Fuzzer A fast tool to scan prototype pollution vulnerability written in Rust. 🦀 Installation Binary Source Dependencies Us

A simple password manager written in rust

Passman - A password manager written in rust. How to use?: USAGE: passman option Currently available options are: new - initalize passman with a new m

A simple password manager written in Rust
A simple password manager written in Rust

ripasso A simple password manager written in Rust. The root crate ripasso is a library for accessing and decrypting passwords stored in pass format (G

Ruo is a dictionary-based password cracker written in rust 🦀 .

Ruo is a dictionary-based password cracker written in rust 🦀 . The primary purpose is to crack weak hashes/commonly used passwords.

Keyhouse is a skeleton of general-purpose Key Management System written in Rust.

Keyhouse Keyhouse is a skeleton of general-purpose Key Management System. Keyhouse is not an off-the-shelf system, and it's not ready for production.

Comments
  • fix: typos

    fix: typos

    I discovered some typos and fix them together.

    The code quality is exceptionally high, so sincerely hope my PR can help make this repository more standardized.

    opened by miles-six 0
🛠️ Uses zkevm-circuits and anvil mainnetfork to prove that a tx solves an EVM challenge

zk-proof-of-evm-execution This is a PoC developed at hackathon that enables a user to prove that they know some calldata that can solve a challenge on

soham 9 Mar 29, 2023
The new, performant, and simplified version of Holochain on Rust (sometimes called Holochain RSM for Refactored State Model)

Holochain License: This repository contains the core Holochain libraries and binaries. This is the most recent and well maintained version of Holochai

Holochain 741 Jan 5, 2023
Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

Google 1.1k Jan 3, 2023
A blazing fast, type-safe template engine for Rust.

markup.rs A blazing fast, type-safe template engine for Rust. markup.rs is a template engine for Rust powered by procedural macros which parses the te

Utkarsh Kukreti 209 Dec 24, 2022
A small, 8-byte, ID type for use in rust applications that need a pretty unique identifier

TinyId A small, 8-byte, ID type for use in rust applications that need a pretty unique identifier that is not required to be cryptographically secure

Tony B 1 May 4, 2022
Rust compile-time type information experiment

Compile-Time Type Information This crate is an experimental standard library side implementation of potential ctti language feature. The idea is to pr

Auri 12 Jan 20, 2023
A type-safe Rust interface to the Nix CLI

runix A typesafe interface to the nix CLI. by flox Installation Install with cargo add (Rust >= 1.64) cargo add runix Alternatively, manually add runi

flox 43 Mar 6, 2023
Onlyfans-type web service based on TOR with maximum privacy features.

onionfans Onlyfans-type web service based on TOR with maximum privacy features. Features "Vanishing" single-use feed CDN links Landing page No JavaScr

Dowland Aiello 8 Sep 14, 2022
A type-safe, K-sortable, globally unique identifier

type-safe-id A type-safe, K-sortable, globally unique identifier. Typed implementation of https://github.com/jetpack-io/typeid in Rust. Examples Stati

Conrad Ludgate 13 Jul 10, 2023
An open source Rust high performance cryptocurrency trading API with support for multiple exchanges and language wrappers. written in rust(🦀) with ❤️

Les.rs - Rust Cryptocurrency Exchange Library An open source Rust high performance cryptocurrency trading API with support for multiple exchanges and

Crabby AI 4 Jan 9, 2023