Using the zkVM
Quick Start

Quick Start

1. Install the Nexus zkVM

First, install Rust: Rust Install Instructions (opens in a new tab).

Next, install the RISC-V target:

rustup target add riscv32i-unknown-none-elf

Also, make sure you have a working version of cmake (opens in a new tab).

Then, install the Nexus zkVM:

cargo install --git https://github.com/nexus-xyz/nexus-zkvm nexus-tools --tag 'v1.0.0'

Verify the installation:

cargo nexus --help

This should print all the available commands.

2. Create a new Nexus project

cargo nexus new nexus-project

And change directory to the new project:

cd nexus-project

This will create a new Rust project with the following structure:

./nexus-project
├── Cargo.lock
├── Cargo.toml
└── src
    └── main.rs

And an example zkVM Rust program in ./src/main.rs:

#![no_std]
#![no_main]
 
use nexus_rt::write_log;
 
#[nexus_rt::main]
fn main() {
    write_log("Hello, World!\n");
}

3. Run your program

cargo nexus run

You should see the program print:

"Hello, World!"

3. Prove your program

Generate a zero-knowledge proof for your Rust program using the Nexus zkVM.

cargo nexus prove

This will generate a proof, and store it in ./nexus-proof.

4. Verify your proof

Finally, load and verify the proof:

cargo nexus verify

You should see the program print Verifying Proof... and finally Finished when complete.