This repository provides the core traits as well as adapters for various ZKVMs (Zero-Knowledge Virtual Machines) to ensure a unified interface and enable the reuse of guest logic across multiple ZKVM implementations. By writing the code once, we aim to support multiple ZKVMs seamlessly.
Currently, the repository supports the following ZKVMs:
- Risc0
- SP1
- OpenVM
- Valida
-
zkaleido/
Contains core traits to standardize proof generation and verification. -
adapters/
Contains ZKVM-specific adapters. Each adapter implements core interfaces to interact with the underlying ZKVM. -
examples/
Contains guest logic for different programs. These programs demonstrate how to use the adapters for various ZKVMs. -
artifacts/
Contains the build pipeline for generating necessary artifacts, including ELF binaries and other dependencies.
To generate a report of cycle counts for one or more programs, use the following command:
PROGRAMS=<PROGRAM_NAME> just report- Multiple Programs Supported: You can specify multiple programs by separating them with commas.
- Example Commands:
PROGRAMS=fibonacci just report PROGRAMS=fibonacci,sha2-chain just report
- Optional Parameter: If
PROGRAMSis left empty, the report will be generated for all supported programs.
Here is the list of currently supported programs:
fibonaccisha2-chainschnorr-sig-verify
To generate profiling data for a specific ZKVM, use the following commands:
just report-<ZkVm>- For Risc0:
just report-risc0
- For SP1:
just report-sp1
- Similar to the general
just report, you can also pass thePROGRAMSparameter:PROGRAMS=fibonacci just report-risc0 PROGRAMS=fibonacci,sha2-chain just report-sp1
To dump profiling data, set the environment variable ZKVM_PROFILING_DUMP=1 while running any of the above command.
ZKVM_PROFILING_DUMP=1 just reportThe profiling data for SP1 can be viewed using Samply. To view the profile:
samply load <FILENAME>.trace_profileThe profiling data for Risc0 can be viewed using pprof. To view the profile:
go tool pprof -http=127.0.0.1:8000 <FILENAME>.trace_profileIf proof is required, use the following command:
ZKVM=<ZKVM_NAME> PROGRAMS=<PROGRAM_NAME> just proofThe proofs are dumped by default
- Dump Profiling Data: To dump proofs, set the environment variable
ZKVM_PROOF_DUMP=1while running the command:
To clean up generated proofs and profiling data, run:
just prover-cleanThis will remove all .trace_profile and .proof files from the current directory.
-
Generate Report for All Programs:
just report
-
Generate Report for Specific Programs:
PROGRAMS=fibonacci,sha2-chain just report
-
Generate SP1 Report for Specific Programs:
PROGRAMS=schnorr-sig-verify just report-sp1
-
Dump Profiling Data for Risc0:
ZKVM_PROFILING_DUMP=1 PROGRAMS=fibonacci just report-risc0
-
Generate and dump Risc0 Proof
ZKVM=risc0 PROGRAMS=fibonacci just proof
-
Clean Up Generated Data:
just prover-clean
To add support for a new ZKVM:
- Create a new adapter in the
adapters/directory. - Implement the core traits required to interface with the ZKVM.
- Extend the artifact generation logic in
artifacts/as needed.
We welcome contributions to support additional ZKVMs or enhance the functionality of the repository. Feel free to create a pull request or open an issue to discuss your ideas.