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:
make report PROGRAMS=<PROGRAM_NAME>
- Multiple Programs Supported: You can specify multiple programs by separating them with commas.
- Example Commands:
make report PROGRAMS=fibonacci make report PROGRAMS=fibonacci,sha2-chain
- Optional Parameter: If
PROGRAMS
is left empty, the report will be generated for all supported programs.
Here is the list of currently supported programs:
fibonacci
sha2-chain
schnorr-sig-verify
To generate profiling data for a specific ZKVM, use the following commands:
make report-<ZkVm>
- For Risc0:
make report-risc0
- For SP1:
make report-sp1
- Similar to the general
make report
, you can also pass thePROGRAMS
parameter:make report-risc0 PROGRAMS=fibonacci make report-sp1 PROGRAMS=fibonacci,sha2-chain
To dump profiling data, set the environment variable ZKVM_PROFILING_DUMP=1
while running any of the above command.
ZKVM_PROFILING_DUMP=1 make report
The profiling data for SP1 can be viewed using Samply. To view the profile:
samply load <FILENAME>.trace_profile
The profiling data for Risc0 can be viewed using pprof. To view the profile:
go tool pprof -http=127.0.0.1:8000 <FILENAME>.trace_profile
If proof is required, use the following command:
make proof ZKVM=<ZKVM_NAME> PROGRAMS=<PROGRAM_NAME>
The proofs are dumped by default
- Dump Profiling Data: To dump proofs, set the environment variable
ZKVM_PROOF_DUMP=1
while running the command:
To clean up generated proofs and profiling data, run:
make prover-clean
This will remove all .trace_profile
and .proof
files from the current directory.
-
Generate Report for All Programs:
make report
-
Generate Report for Specific Programs:
make report PROGRAMS=fibonacci,sha2-chain
-
Generate SP1 Report for Specific Programs:
make report-sp1 PROGRAMS=schnorr-sig-verify
-
Dump Profiling Data for Risc0:
ZKVM_PROFILING_DUMP=1 make report-risc0 PROGRAMS=fibonacci
-
Generate and dump Risc0 Proof
make proof ZKVM=risc0 PROGRAMS=fibonacci
-
Clean Up Generated Data:
make 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.