A Fibonacci sequence calculator running inside the ZisK zkVM. The guest computes Fibonacci(n) and the host generates a zero-knowledge proof of that computation.
- Sends n=10 as input to the guest
- Guest computes Fibonacci(10) = 55 inside the ZisK VM
- Generates a VADCOP STARK proof of the computation
- Verifies the proof
fibonacci/
├── Cargo.toml # Workspace
├── guest/
│ ├── Cargo.toml
│ └── src/main.rs # Runs inside zkVM: computes Fibonacci(n)
├── host/
│ ├── Cargo.toml
│ ├── build.rs # Cross-compiles guest to RISC-V ELF
│ └── src/main.rs # Sends input, proves, verifies
└── lib/
├── Cargo.toml
└── src/lib.rs # Shared types (FibResult)
- ZisK v0.16.0 installed via
ziskup - Linux x86_64 (required for proof generation)
- 16 GB RAM minimum, 64 GB recommended
cargo run --release[1/3] Executing...
Fibonacci(10) = 55
Cycles: 10645
[2/3] Generating proof...
[3/3] Verifying...
Proven: Fibonacci(10) = 55
Proof verified!
Runs inside the ZisK VM:
- Reads n from the host via
io::read() - Computes Fibonacci(n) iteratively
- Commits the result via
io::commit()(becomes public output in the proof)
Runs natively on your machine:
- Sends n=10 as input to the guest
- Executes the guest in the VM (fast sanity check, no proof)
- Proves the execution (generates a VADCOP STARK proof)
- Verifies the proof against the verification key
FibResult- n and the computed value (committed as public output)
cargo run --release does everything:
host/build.rscross-compiles the guest to a RISC-V ELFinclude_elf!("guest")embeds the ELF into the host binary- The host binary runs: execute, prove, verify
MIT