The zero-knowledge virtual machine.
nexus.xyz »
The Nexus zkVM is a modular, extensible, open-source, and massively-parallelized zkVM, designed to run at a trillion CPU cycles proved per second given enough machine power.
First, install Rust: https://www.rust-lang.org/tools/install.
With the RISC-V target:
rustup target add riscv32i-unknown-none-elf
Then, install the Nexus zkVM:
cargo install --git https://github.com/nexus-xyz/nexus-zkvm nexus-tools
Verify the installation:
cargo nexus --help
This should print the available CLI commands.
cargo nexus new nexus-project
This will create a new Rust project directory with the following structure:
./nexus-project
├── Cargo.lock
├── Cargo.toml
└── src
└── main.rs
As an example, you can change the content of ./src/main.rs
to:
#![no_std]
#![no_main]
fn fib(n: u32) -> u32 {
match n {
0 => 0,
1 => 1,
_ => fib(n - 1) + fib(n - 2),
}
}
#[nexus_rt::main]
fn main() {
let n = 7;
let result = fib(n);
assert_eq!(result, 13);
}
cargo nexus run
This command should run successfully. To print the full step-by-step execution trace on the NVM, run:
cargo nexus run -v
Generate a proof for your Rust program using the Nexus zkVM.
cargo nexus prove
This command will save the proof to ./nexus-proof
.
Finally, load and verify the proof:
cargo nexus verify
Run cargo nexus --help
to see all the available commands.
Also check out the documentation at docs.nexus.xyz, or join our Telegram chat to discuss!
Nexus is committed to open-source. All of our code is dual licensed under MIT and Apache licenses. We encourage and appreciate contributions.