Quick start
This page shows you how to create and prove a Fibonacci program.
Start with the Fibonacci template
- Create project
cargo pico new --template basic Fibonacci
This creates a directory Fibonacci with the basic template, which contains a fibonacci program.
- Build program
# Build program in app folder
cd app
cargo pico build
This will use the Pico compiler to generate a RISC-V ELF that can be executed by the Pico ZKVM.
- Prove program with Pico (Default Path)
# Prove in prover folder
cd ../prover
RUST_LOG=info cargo run --release
The prover subdirectory contains a Rust program that will load an input for the ELF that was just compiled, execute it, and generate a proof. This project has the entire functionality of the Pico SDK at its disposal, and can be customized however you want.
If you simply wish to use the default provided proving clients and options, you can prove using the Pico CLI via
RUST_LOG=info cargo pico prove --input "0x0A000000" --fast --elf /path/to/elf # input n = 10
The input to the fibonacci program is a single u32 specifying which number to compute, so we can directly pass the input with the --input option, supplying little endian bytes. --fast simply tells the prover to skip any recursion steps and terminate after finishing the RISC-V proof.
- Prove program with AOT (Experimental)
AOT is an alternative execution path: the emulator thread can be driven by AOT-compiled chunks generated from the specific guest ELF you are proving, instead of the interpreter. This trades a one-time codegen step for reduced per-proof execution cost.
- One-Time setup
Install the AOT codegen binary:
cargo +nightly-2025-08-04 install \
--git https://github.com/brevis-network/pico \
--tag v2.0.0 \
pico-aot-codegen
- Generate AOT chunks
The generated chunks are tied to the PC ranges of a specific ELF. You must re-generate whenever app/src/ changes.
From the project root, after cargo pico build:
PICO_AOT_RUNTIME_SPEC='git = "https://github.com/brevis-network/pico", tag = "v2.0.0"' \
generate_crates app/elf/riscv64im-pico-zkvm-elf ./aot-generated
PICO_AOT_RUNTIME_SPEC tells the codegen tool to wire pico-aot-runtime as a git dep in the generated chunk crates, so aot-generated/ works at the template root without requiring a local Pico checkout.
- Prove with
--aot
Enable the template’s aot feature and pass the --aot runtime flag:
cd prover
RUST_LOG=info cargo run --release --features aot -- --aot
Project Layout
Fibonacci
|—— app
|—— elf
|—— riscv32im-pico-zkvm-elf
|—— src
|—— main.rs
|—— Cargo.toml
|—— lib
|—— src
|—— lib.rs
|—— Cargo.toml
|—— prover
|—— src
|—— main.rs
|—— Cargo.toml
|—— Cargo.toml
|—— Cargo.lock
|—— rust-toolchain
The template project includes 3 workspace members: app, lib and prover
app: contains the program source code, which will be compiled to RiscV
app/elf: contains ELF with RISC-V instructions.
lib: contains components or utilities shared in multiple modules.
prover: contains the scripts to prepare program input data and execute the proving process.
Start with the EVM template
Minimum memory requirement: 32GB
-
Create and build the EVM Example Project
cargo pico new evm-example --template evm cd evm-example/app/ cargo pico buildThis uses the
evmtemplate, which will set up a proving script that will generate a Groth16 proof suitable for verification via smart contract on an ETH compatible chain. -
Prove program to EVM
cd ../prover RUST_LOG=info cargo run --releaseThis step will locally set up the Groth16 Verifier contract and generate the Pico Groth16 proof. The files will be outputted to the
root/contracts/test_datafolder.
The prover program will then attempt to launch a Docker container to generate the final EVM proof withgnark. This ingeststest_data/proof.jsonand should producetest_data/proof.data. If this file is not produced, you may need to increase the amount of RAM available to the container. -
Test EVM Proof
cd ../contracts mv -f ./test_data/Groth16Verifier.sol ./src/Groth16Verifier.sol forge testThe foundry test script will parse the proof generated in the previous step and interact with the Groth16 Verifier contract. With all tests passing, the EVM quick start is successful.