Prerequisites
Before you begin, make sure you have completed the installation steps.Create Your First Project
Create a new Jolt project
Use the Jolt CLI to scaffold a new project:This creates a workspace with two parts:
guest/- Code that runs inside the zkVM (RISC-V)src/(host) - Code that compiles, proves, and verifies guest execution
Understand the guest code
Open The
guest/src/lib.rs to see the guest program:guest/src/lib.rs
#[jolt::provable] macro transforms this function into a zkVM program. It generates:compile_fib()- Compiles the guest to RISC-V ELFprove_fib()- Generates a zero-knowledge proof of executionverify_fib()- Verifies the proof- Preprocessing functions for optimization
Understand the host code
The host code in This code:
src/main.rs orchestrates the proving and verification:src/main.rs
- Compiles the guest program to RISC-V
- Preprocesses (generates proving/verifying keys - done once per program)
- Proves execution with input
50 - Verifies the proof
What Just Happened?
- Compilation: The guest Fibonacci function was compiled to a RISC-V ELF binary
- Preprocessing: Jolt generated proving and verifying keys for this specific program
- Proving: Jolt executed the guest program, computed the 50th Fibonacci number, and generated a ZK proof
- Verification: The verifier checked the proof without re-executing the program
Understanding the Macro
The#[jolt::provable] macro accepts several parameters to configure the zkVM:
Size of the guest heap in bytes (default: 1MB)
Maximum number of CPU cycles the program can execute
Size of the guest stack in bytes (default: 4MB)
Next Steps
Core Concepts
Learn about the guest/host architecture
Runtime Advice
Provide non-deterministic hints to speed up proving
CLI Reference
Explore all CLI commands
API Reference
Dive into the full API documentation
Common Patterns
Multiple Functions
You can mark multiple functions as provable in the same guest:Working with Complex Types
Functions can accept and return complex types that implementSerialize:
Cycle Tracking
Measure performance of specific code sections:analyze_<function_name>() instead of prove_<function_name>().
Troubleshooting
Guest build fails
Guest build fails
Make sure you have the RISC-V target installed:If issues persist, try reinstalling the Jolt CLI:
Proving is very slow
Proving is very slow
For development, use
analyze_<function_name>() instead of prove_<function_name>() to skip proof generation:Out of memory during proving
Out of memory during proving
Reduce the trace length or use streaming mode (if available). Also ensure you have sufficient RAM (16GB+ recommended for complex proofs).