Skip to main content
Get started with Jolt by creating a simple zkVM program that proves Fibonacci number computation.

Prerequisites

Before you begin, make sure you have completed the installation steps.

Create Your First Project

1

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
2

Understand the guest code

Open guest/src/lib.rs to see the guest program:
guest/src/lib.rs
The #[jolt::provable] macro transforms this function into a zkVM program. It generates:
  • compile_fib() - Compiles the guest to RISC-V ELF
  • prove_fib() - Generates a zero-knowledge proof of execution
  • verify_fib() - Verifies the proof
  • Preprocessing functions for optimization
3

Understand the host code

The host code in src/main.rs orchestrates the proving and verification:
src/main.rs
This code:
  1. Compiles the guest program to RISC-V
  2. Preprocesses (generates proving/verifying keys - done once per program)
  3. Proves execution with input 50
  4. Verifies the proof
4

Run your first proof

Build and run the program:
You should see output like:
The first run will be slow (~1-5 minutes) as it compiles dependencies and the guest program. Subsequent runs are much faster.

What Just Happened?

  1. Compilation: The guest Fibonacci function was compiled to a RISC-V ELF binary
  2. Preprocessing: Jolt generated proving and verifying keys for this specific program
  3. Proving: Jolt executed the guest program, computed the 50th Fibonacci number, and generated a ZK proof
  4. Verification: The verifier checked the proof without re-executing the program
The proof demonstrates that the computation was performed correctly, without revealing the intermediate steps.

Understanding the Macro

The #[jolt::provable] macro accepts several parameters to configure the zkVM:
number
default:"1048576"
Size of the guest heap in bytes (default: 1MB)
number
default:"1048576"
Maximum number of CPU cycles the program can execute
number
default:"4194304"
Size of the guest stack in bytes (default: 4MB)
Example with different parameters:

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 implement Serialize:

Cycle Tracking

Measure performance of specific code sections:
The cycle counts will appear in the execution summary when you use analyze_<function_name>() instead of prove_<function_name>().

Troubleshooting

Make sure you have the RISC-V target installed:
If issues persist, try reinstalling the Jolt CLI:
For development, use analyze_<function_name>() instead of prove_<function_name>() to skip proof generation:
Reduce the trace length or use streaming mode (if available). Also ensure you have sufficient RAM (16GB+ recommended for complex proofs).
For more troubleshooting tips, see Troubleshooting.