# EPF Final Report: zkVM Optimization Research & Hybrid Ethereum Implementation
### Introduction
During the EPF cohort, my work focused on two critical frontiers of Ethereum's technical roadmap: optimizing the performance of Zero-Knowledge Virtual Machines (zkVMs) and re-imagining the Execution Layer architecture through RISC-V.
My fellowship was divided into two distinct phases:
1. **zkVM Research:** Deep-diving into trace generation bottlenecks, Linux ABI compatibility for bare-metal execution, and precompile strategies.
2. **Hybrid Ethereum Node:** Designing and building a RETH-based node capable of dual execution (EVM and RISC-V) to explore a transition away from the EVM while maintaining backward compatibility.
You can find the complete weekly development log here: [EPF Development Log](https://hackmd.io/@0xdeveloperuche/HJD7M2tebg).
### Abstract
This project bridges the gap between theoretical cryptographic research and practical client implementation. The first phase investigated the "trace generation bottleneck" in zkVMs, analyzing the ZisK architecture and establishing a data-driven framework for "Fat vs. Lean" precompiles. This research demonstrated that algorithmic software optimization often yields better sustainability than aggressive hardware acceleration.
The second phase prototyped a "Hybrid Ethereum" framework. By instrumenting a RETH node to support a RISC-V execution sandbox, I developed a system where legacy EVM contracts run via a `mini-evm-interpreter` inside a RISC-V environment. This proves the feasibility of migrating Ethereum’s execution layer to a standard ISA without breaking existing smart contracts.
### Phase One: zkVM Research and Prototyping
The primary objective of this phase was to identify and mitigate performance bottlenecks preventing widespread zkVM adoption.
#### Trace Generation & ZisK Architecture
I began by deconstructing the **ZisK zkVM**, which achieved a 1.5GHz trace generation speed. My analysis revealed their breakthrough relied on Ahead-of-Time (AOT) compilation (translating RISC-V to x86) and a "memoryless re-execution" model that splits proving into a fast sequential phase and a parallel witness generation phase.
* **Output:** I built a Proof-of-Concept (PoC) using `reth-stateless` to perform stateless Ethereum block validation entirely within the `ziskemu` emulator.
#### Linux ABI & Bare-Metal Execution
To run complex clients like Geth inside a zkVM, I analyzed the system call (syscall) gap between Rust and Go binaries.
* **Findings:** While Rust binaries (`reth-stateless`) rely on simple memory models (`brk`), Go binaries (Geth) require complex threading and memory management (`clone`, `futex`, `mmap`).
* **Solution:** I successfully compiled a bare-metal version of Geth using the Tamago toolchain, proving that the Go runtime can be constrained (disabling GC, single-threading) to run in a verifiable environment without a full OS.
#### The "Fat vs. Lean" Precompile Study
The culmination of this phase was a rigorous benchmark of cryptographic primitives inside the **SP1 zkVM**. I compared specialized ("fat") precompiles against optimized software libraries assisted by generic ("lean") precompiles.
**Key Results:**
* **Specialization Wins on Speed:** A specialized `bn` precompile reduced proving time for pairings from ~5 hours to **41 minutes**.
* **Software Optimization is Critical:** A highly optimized library (`arkworks`) running in pure software was **3.8x faster** than a less optimized library, proving that software architecture is as important as hardware acceleration.
* **Conclusion:** I authored a technical report advocating for "lean" precompiles to prevent ecosystem fragmentation, arguing that software optimization + generic precompiles offer the best balance of speed and sustainability.
### Phase Two: Hybrid Ethereum Node Development
The second phase focused on the "Hybrid Ethereum" project—an experimental architecture replacing the EVM with a RISC-V Instruction Set Architecture (ISA).
#### Architecture & Tooling
I developed a full suite of tools to support this new paradigm:
* **`cargo-hybrid`:** A CLI tool enabling developers to scaffold, compile, and deploy Rust-based smart contracts directly to the hybrid node.
* **Hybrid Node:** A fork of **RETH** engineered to support a dual-VM architecture. It utilizes a "Magic Number" system to differentiate between standard EVM bytecode and RISC-V binaries at runtime.
#### The `mini-evm-interpreter`
To ensure backward compatibility, I designed and implemented the `mini-evm-interpreter`. This is a system contract written in Rust that runs *inside* the RISC-V sandbox. It intercepts legacy EVM opcodes and translates them into RISC-V syscalls, allowing existing Ethereum contracts to execute on the new architecture without modification.
#### Benchmarking & Documentation
I conducted extensive benchmarking comparing the Hybrid VM against standard EVM (revm) implementations.
* **Deliverable:** All findings, installation guides, and architecture specs were compiled into the [Hybrid Book](https://hybrid-book.vercel.app/).
* **RISC-V Benchmarking:** Validated the performance of native RISC-V contracts versus their emulated EVM counterparts.
#### Capstone: Prysm Optional Proofs
In the final weeks (Weeks 19-20), I contributed to the **Prysm** consensus client. I prototyped "Optional Execution Proofs," a feature allowing Stateless Attestors to verify execution payloads via cryptographic proofs without running a full execution client. This work aligns the hybrid node research with the broader stateless Ethereum roadmap.
I would like to extend my deepest gratitude to my mentor, **[Kev](https://x.com/kevaundray)**, for his invaluable guidance, particularly regarding the Lighthouse integration approaches and navigating complex consensus logic.
A special thanks to the program moderators, **Josh and Mario**, for organizing a seamless cohort. This fellowship has been a transformative experience, allowing me to tackle some of the most complex engineering problems in the ecosystem while collaborating with brilliant minds. I am proud of the contributions made to zkVM efficiency and Ethereum's execution architecture and look forward to continuing this work.