> ## Documentation Index
> Fetch the complete documentation index at: https://services.krayir.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Nexus Proof

<Info>
  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**
</Info>

#### Güncelleme

```bash theme={null}
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

```bash theme={null}
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

#### Rust kurulumu tamamlandıktan sonra

```bash theme={null}
. "$HOME/.cargo/env"
rustup target add riscv32i-unknown-none-elf
```

#### Nexus tool kurulumu

Burası biraz uzun sürer - hatalar görürseniz sorun yok.

```bash theme={null}
cargo install --git https://github.com/nexus-xyz/nexus-zkvm nexus-tools --tag 'v1.0.0'
```

#### Nexus oluşturuyoruz

```bash theme={null}
cargo nexus new nexus-project
```

#### Main.rs değiştireceğiz

```bash theme={null}
cd nexus-project
nano ./src/main.rs
```

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

```bash theme={null}
#![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

```bash theme={null}
cargo nexus run
cargo nexus run -v
```

#### Prove etmesini bekleyelim işlemlerin

```bash theme={null}
cargo nexus prove
```

#### Verify işlemini tamamlayalım

```
cargo nexus verify
```

<Warning>
  **nexus-project** dizinde ki **nexus-proof** dosyamızı kaydedip saklayalım.
</Warning>
