Skip to main content
Herhangi bir sunucuda yapabilirsiniz. Sürekli çalışacak bir şey değil proof aldığınızda işlem bitecek. Kullandığım sunucu: Ubuntu 22.04

Güncelleme

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

Rustup kurulumu

1 seçeneğini seçiyoruz
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Rust kurulumu tamamlandıktan sonra

. "$HOME/.cargo/env"
rustup target add riscv32i-unknown-none-elf

Nexus tool kurulumu

Burası biraz uzun sürer - hatalar görürseniz sorun yok.
cargo install --git https://github.com/nexus-xyz/nexus-zkvm nexus-tools --tag 'v1.0.0'

Nexus oluşturuyoruz

cargo nexus new nexus-project

Main.rs değiştireceğiz

cd nexus-project
nano ./src/main.rs

İçersindeki kodları silip aşağıdaki bloğu girin

#![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);
}
CTRL + X tıklayın. Y tıklayıp Entera tıklayın.

Contratı run edelim

cargo nexus run
cargo nexus run -v

Prove etmesini bekleyelim işlemlerin

cargo nexus prove

Verify işlemini tamamlayalım

cargo nexus verify
nexus-project dizinde ki nexus-proof dosyamızı kaydedip saklayalım.