Skip to content

sarox0987/nexus-zkvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

The Nexus zkVM

image

Genrating ZK Proof with Nexus zkVM

install dependencies

sudo apt update && sudo apt upgrade
sudo apt install cmake build-essential -y

# install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

# install the RISC-V target
rustup target add riscv32i-unknown-none-elf

# Install the Nexus zkVm
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.0' --force

create a nexus project

cargo nexus new nexus-projectV2
cd nexus-projectV2

add the program code to the ./src/main.rs file

echo '#![cfg_attr(target_arch = "riscv32", 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);
}' > ./src/main.rs

run the program

cargo nexus run

generate a proof for the rust program

cargo nexus prove
Screenshot 2024-07-21 at 12 01 36 AM

save the nexus-proof file in a safe place

you can download the file from VPS with scp if your os is linux or macOS

scp -r root@your-server-ip:/root/nexus-projectV2/nexus-proof .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published