From 9011624819ec975eaa41ba1dc641c2371228b0f7 Mon Sep 17 00:00:00 2001 From: riemann Date: Thu, 13 Mar 2025 17:55:54 -0400 Subject: [PATCH 01/11] feat: update compiler & CLI tutorial --- docs/compiler/is_prime_rust.md | 184 +++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 docs/compiler/is_prime_rust.md diff --git a/docs/compiler/is_prime_rust.md b/docs/compiler/is_prime_rust.md new file mode 100644 index 0000000..7cfc350 --- /dev/null +++ b/docs/compiler/is_prime_rust.md @@ -0,0 +1,184 @@ +# Writing a MidenVM Program In Rust + +*Using the Miden compiler to write programs in Rust and generate a proof of computation using the MidenVM CLI* + +## Overview + +In this guide, we will write a simple Rust program that checks whether an integer is prime. We will compile the Rust program into a Miden package and run it in the Miden VM. We will also see how to use the Miden CLI to generate a STARK proof that the computation was performed correctly. + +## What we'll cover + +- Writing basic programs in Rust using the Miden compiler. +- Running programs in the Miden VM. +- Generating a proof of compuation for the `is_prime` program +- Verifying the STARK proof of the `is_prime` program execution + +## Limitations and Important Considerations + +Please note these current limitations of the Miden compiler: +- **No Floating Point Support:** Only integer arithmetic is supported (e.g., `u32`, `u64`, etc.). +- **No Standard Library:** Programs must be written with `#![no_std]`, limiting you to core library functionality. +- **Entrypoint Constraints:** The `entrypoint` function can accept at most **16 inputs** on the stack and produces a single `u32` output. + +## Step 1: Installing the Miden Compiler + +Clone the repository and install the compiler: +```bash +git clone https://github.com/0xpolygonmiden/compiler +cd compiler +git checkout next +``` + +Then install the Miden compiler: +```bash +cargo install --path midenc --locked +``` + +and the cargo-miden toolchain: +```bash +cargo install --path tools/cargo-miden --locked +``` + +## Step 2: Writing the Rust Program + +Outside of the compiler repository, create a new Miden project: +```bash +cargo miden new is_prime +cd is_prime +``` + +Add the following Rust code to `is_prime/src/lib.rs`. This code checks whether a number is prime: +```rust +#![no_std] + +// Custom panic handler since we don't have the standard library. +#[cfg(not(test))] +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +/// Returns true if the integer is prime. +fn is_prime(n: u32) -> bool { + if n <= 1 { + return false; + } + if n <= 3 { + return true; + } + if n % 2 == 0 || n % 3 == 0 { + return false; + } + let mut i = 5; + while i * i <= n { + if n % i == 0 || n % (i + 2) == 0 { + return false; + } + i += 6; + } + true +} + +/// The entry point to the Miden program. +#[no_mangle] +fn entrypoint(n: u32) -> bool { + is_prime(n) +} +``` + +Add this code into your project's `src/lib.rs` file. + +Next, create an `is_prime/inputs.toml` file: +```toml +[inputs] +stack = [2147482583] +``` + +This file sets the value that will be passed into our `entrypoint` function when the program runs. + +## Step 3: Running the Program in the Miden VM + +Compile your program with: +```bash +cargo miden build --release +``` + +Run your compiled Miden assembly program using: +```bash +midenc run target/miden/release/is_prime.masp --inputs inputs.toml +``` + +The output will look like this: +``` +Run program: target/miden/release/is_prime.masp +------------------------------------------------------------------------------- +Executed program with hash 0x79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40 in 2 seconds +Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +VM cycles: 2039234 extended to 2097152 steps (2% padding). +├── Stack rows: 1668454 +├── Range checker rows: 61329 +└── Chiplets rows: 2039234 + ├── Hash chiplet rows: 1792040 + ├── Bitwise chiplet rows: 247192 + ├── Memory chiplet rows: 1 + └── Kernel ROM rows: 0 +``` + +The program returns `1` if the integer passed to the `is_prime` function is prime and `0` if it is not. + +## Step 4: Generating a zk proof of the `is_prime` program execution + +First install the Miden CLI by cloning the Miden VM repository and checking out the `next` branch: +```bash +git clone git@github.com:0xPolygonMiden/miden-vm.git +cd miden-vm +git checkout next +``` + +Build and install the Miden VM CLI: +``` +cd miden +cargo install --path . --features concurrent,executable +``` + +After installation is complete, return to the `is_prime` directory. + +The current input file format for the Miden VM differs slightly from that of the compiler. This means we need to create an `is_prime.inputs` file at the root of the `is_prime` directory: +```json +{ + "operand_stack": ["2147482583"] +} +``` + +Now, using the Miden VM CLI tool, we can prove our program by running the following: +``` +miden prove target/miden/release/is_prime.masp -i is_prime.inputs +``` + +The output should look like this: + +``` +=============================================================================== +Prove program: target/miden/release/is_prime.masp +------------------------------------------------------------------------------- +Proving program with hash 79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40... +Program proved in 85558 ms +Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +``` + +To verify the proof generated in the previous step, run the following: +``` +miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x 79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40 +``` + +The output should look like this: +``` +=============================================================================== +Verifying proof: target/miden/release/is_prime.proof +------------------------------------------------------------------------------- +Verification complete in 5 ms +``` + +## Conclusion + +This tutorial demonstrated how to write a basic program using the Miden compiler and how to prove and verify the execution of the program using the Miden CLI. From 0b459ee1562aa17861ae87e53c94a292646d34c9 Mon Sep 17 00:00:00 2001 From: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com> Date: Fri, 14 Mar 2025 11:19:49 -0400 Subject: [PATCH 02/11] Update docs/compiler/is_prime_rust.md Co-authored-by: Denys Zadorozhnyi --- docs/compiler/is_prime_rust.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/compiler/is_prime_rust.md b/docs/compiler/is_prime_rust.md index 7cfc350..7ad98ba 100644 --- a/docs/compiler/is_prime_rust.md +++ b/docs/compiler/is_prime_rust.md @@ -34,7 +34,7 @@ Then install the Miden compiler: cargo install --path midenc --locked ``` -and the cargo-miden toolchain: +and the cargo-miden cargo extension: ```bash cargo install --path tools/cargo-miden --locked ``` From 9c12fcf062bef52fba20bab46a1737a641c75050 Mon Sep 17 00:00:00 2001 From: riemann Date: Fri, 14 Mar 2025 11:29:59 -0400 Subject: [PATCH 03/11] change wording --- docs/compiler/is_prime_rust.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/compiler/is_prime_rust.md b/docs/compiler/is_prime_rust.md index 7ad98ba..8274652 100644 --- a/docs/compiler/is_prime_rust.md +++ b/docs/compiler/is_prime_rust.md @@ -34,7 +34,7 @@ Then install the Miden compiler: cargo install --path midenc --locked ``` -and the cargo-miden cargo extension: +and the cargo-miden extension: ```bash cargo install --path tools/cargo-miden --locked ``` From ac322e47b70dc98af3c513acbdd2de7a1cb66491 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 31 Mar 2025 10:53:06 -0400 Subject: [PATCH 04/11] feat: update tutorial --- docs/compiler/is_prime_rust.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/compiler/is_prime_rust.md b/docs/compiler/is_prime_rust.md index 8274652..7866bc4 100644 --- a/docs/compiler/is_prime_rust.md +++ b/docs/compiler/is_prime_rust.md @@ -29,14 +29,9 @@ cd compiler git checkout next ``` -Then install the Miden compiler: +Then install the Miden compiler and cargo-miden extension: ```bash -cargo install --path midenc --locked -``` - -and the cargo-miden extension: -```bash -cargo install --path tools/cargo-miden --locked +cargo make build ``` ## Step 2: Writing the Rust Program From de7972796934582e9b825e4e7dce3deea50b247f Mon Sep 17 00:00:00 2001 From: riemann Date: Fri, 2 May 2025 13:14:27 +0300 Subject: [PATCH 05/11] feat: update compiler tutorial --- docs/{ => src}/compiler/is_prime_rust.md | 50 ++++++++++++++++-------- 1 file changed, 33 insertions(+), 17 deletions(-) rename docs/{ => src}/compiler/is_prime_rust.md (88%) diff --git a/docs/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md similarity index 88% rename from docs/compiler/is_prime_rust.md rename to docs/src/compiler/is_prime_rust.md index 7866bc4..16c1224 100644 --- a/docs/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -1,6 +1,6 @@ # Writing a MidenVM Program In Rust -*Using the Miden compiler to write programs in Rust and generate a proof of computation using the MidenVM CLI* +_Using the Miden compiler to write programs in Rust and generate a proof of computation using the MidenVM CLI_ ## Overview @@ -16,33 +16,46 @@ In this guide, we will write a simple Rust program that checks whether an intege ## Limitations and Important Considerations Please note these current limitations of the Miden compiler: + - **No Floating Point Support:** Only integer arithmetic is supported (e.g., `u32`, `u64`, etc.). - **No Standard Library:** Programs must be written with `#![no_std]`, limiting you to core library functionality. - **Entrypoint Constraints:** The `entrypoint` function can accept at most **16 inputs** on the stack and produces a single `u32` output. ## Step 1: Installing the Miden Compiler -Clone the repository and install the compiler: +Ensure you are using the nightly release of the rust toolchain: + +```bash +rustup update nightly +rustup default nightly +``` + +Clone the compiler repository: + ```bash git clone https://github.com/0xpolygonmiden/compiler cd compiler git checkout next ``` -Then install the Miden compiler and cargo-miden extension: +Then install the compiler and cargo-miden extension: + ```bash -cargo make build +cargo install --path tools/cargo-miden +cargo install --path midenc --locked ``` ## Step 2: Writing the Rust Program -Outside of the compiler repository, create a new Miden project: +In a new terminal outside of the compiler repository, create a new Miden project: + ```bash cargo miden new is_prime cd is_prime ``` Add the following Rust code to `is_prime/src/lib.rs`. This code checks whether a number is prime: + ```rust #![no_std] @@ -84,9 +97,10 @@ fn entrypoint(n: u32) -> bool { Add this code into your project's `src/lib.rs` file. Next, create an `is_prime/inputs.toml` file: + ```toml [inputs] -stack = [2147482583] +stack = [29] ``` This file sets the value that will be passed into our `entrypoint` function when the program runs. @@ -94,16 +108,19 @@ This file sets the value that will be passed into our `entrypoint` function when ## Step 3: Running the Program in the Miden VM Compile your program with: + ```bash cargo miden build --release ``` Run your compiled Miden assembly program using: + ```bash midenc run target/miden/release/is_prime.masp --inputs inputs.toml ``` The output will look like this: + ``` Run program: target/miden/release/is_prime.masp ------------------------------------------------------------------------------- @@ -123,30 +140,27 @@ The program returns `1` if the integer passed to the `is_prime` function is prim ## Step 4: Generating a zk proof of the `is_prime` program execution -First install the Miden CLI by cloning the Miden VM repository and checking out the `next` branch: +First cloning the Miden VM repository and install the Miden VM CLI: + ```bash git clone git@github.com:0xPolygonMiden/miden-vm.git -cd miden-vm -git checkout next -``` - -Build and install the Miden VM CLI: -``` -cd miden +cd miden-vm/miden cargo install --path . --features concurrent,executable ``` After installation is complete, return to the `is_prime` directory. The current input file format for the Miden VM differs slightly from that of the compiler. This means we need to create an `is_prime.inputs` file at the root of the `is_prime` directory: + ```json { - "operand_stack": ["2147482583"] + "operand_stack": ["29"] } ``` Now, using the Miden VM CLI tool, we can prove our program by running the following: -``` + +```bash miden prove target/miden/release/is_prime.masp -i is_prime.inputs ``` @@ -162,11 +176,13 @@ Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ``` To verify the proof generated in the previous step, run the following: -``` + +```bash miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x 79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40 ``` The output should look like this: + ``` =============================================================================== Verifying proof: target/miden/release/is_prime.proof From 50f49c4c0430ca45ad6857842b4c4dc95edf2b16 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 5 May 2025 17:54:57 +0300 Subject: [PATCH 06/11] refactor: word choice --- docs/src/compiler/is_prime_rust.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index 16c1224..4e2d5a0 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -4,11 +4,11 @@ _Using the Miden compiler to write programs in Rust and generate a proof of comp ## Overview -In this guide, we will write a simple Rust program that checks whether an integer is prime. We will compile the Rust program into a Miden package and run it in the Miden VM. We will also see how to use the Miden CLI to generate a STARK proof that the computation was performed correctly. +In this guide, we will write a simple Rust program that checks whether an integer is prime. We will compile the Rust program into a Miden package and run it in the Miden VM. We will also cover how to use the Miden CLI to generate a STARK proof that the computation was performed correctly. ## What we'll cover -- Writing basic programs in Rust using the Miden compiler. +- Writing basic *pure* programs in Rust using the Miden compiler. - Running programs in the Miden VM. - Generating a proof of compuation for the `is_prime` program - Verifying the STARK proof of the `is_prime` program execution From deebbb972908a3ec37527175257fd347c9492ad4 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 12 May 2025 20:04:32 +0300 Subject: [PATCH 07/11] feat: update compiler tutorial --- docs/src/compiler/is_prime_rust.md | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index 4e2d5a0..d0c88c4 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -30,19 +30,11 @@ rustup update nightly rustup default nightly ``` -Clone the compiler repository: +Install the `midenc` compiler and `cargo-miden` extension: ```bash -git clone https://github.com/0xpolygonmiden/compiler -cd compiler -git checkout next -``` - -Then install the compiler and cargo-miden extension: - -```bash -cargo install --path tools/cargo-miden -cargo install --path midenc --locked +cargo install cargo-miden +cargo install midenc --locked ``` ## Step 2: Writing the Rust Program @@ -143,15 +135,12 @@ The program returns `1` if the integer passed to the `is_prime` function is prim First cloning the Miden VM repository and install the Miden VM CLI: ```bash -git clone git@github.com:0xPolygonMiden/miden-vm.git -cd miden-vm/miden -cargo install --path . --features concurrent,executable +cargo install miden-vm --version 0.13.0 --features concurrent,executable ``` After installation is complete, return to the `is_prime` directory. The current input file format for the Miden VM differs slightly from that of the compiler. This means we need to create an `is_prime.inputs` file at the root of the `is_prime` directory: - ```json { "operand_stack": ["29"] @@ -170,7 +159,7 @@ The output should look like this: =============================================================================== Prove program: target/miden/release/is_prime.masp ------------------------------------------------------------------------------- -Proving program with hash 79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40... +Proving program with hash c6db9ccd205b2d5139d5a92869a2741a0a8982b8e269a36b7a16d173f467b0c8... Program proved in 85558 ms Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ``` @@ -178,7 +167,7 @@ Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] To verify the proof generated in the previous step, run the following: ```bash -miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x 79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40 +miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x c6db9ccd205b2d5139d5a92869a2741a0a8982b8e269a36b7a16d173f467b0c8 ``` The output should look like this: From b4b5141002b94a6734578c12d15e1b8d95ca7886 Mon Sep 17 00:00:00 2001 From: riemann Date: Tue, 13 May 2025 12:08:56 +0300 Subject: [PATCH 08/11] feat: updates --- docs/src/compiler/is_prime_rust.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index d0c88c4..eb12db2 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -18,7 +18,7 @@ In this guide, we will write a simple Rust program that checks whether an intege Please note these current limitations of the Miden compiler: - **No Floating Point Support:** Only integer arithmetic is supported (e.g., `u32`, `u64`, etc.). -- **No Standard Library:** Programs must be written with `#![no_std]`, limiting you to core library functionality. +- **No Standard Library:** Programs must be written with `#![no_std]`. - **Entrypoint Constraints:** The `entrypoint` function can accept at most **16 inputs** on the stack and produces a single `u32` output. ## Step 1: Installing the Miden Compiler From b243d4ab79d416d86ed8a4df00bf3d37c7393297 Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Thu, 15 May 2025 16:26:56 +0300 Subject: [PATCH 09/11] fix: fmt --- docs/src/compiler/is_prime_rust.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index eb12db2..9985530 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -8,7 +8,7 @@ In this guide, we will write a simple Rust program that checks whether an intege ## What we'll cover -- Writing basic *pure* programs in Rust using the Miden compiler. +- Writing basic _pure_ programs in Rust using the Miden compiler. - Running programs in the Miden VM. - Generating a proof of compuation for the `is_prime` program - Verifying the STARK proof of the `is_prime` program execution @@ -141,6 +141,7 @@ cargo install miden-vm --version 0.13.0 --features concurrent,executable After installation is complete, return to the `is_prime` directory. The current input file format for the Miden VM differs slightly from that of the compiler. This means we need to create an `is_prime.inputs` file at the root of the `is_prime` directory: + ```json { "operand_stack": ["29"] From b8a8d03a48185665b8f30c19bb4a0c26f10a53c1 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 7 Jul 2025 17:08:17 +0300 Subject: [PATCH 10/11] chore: bump compiler version to 0.1.5 --- docs/src/compiler/is_prime_rust.md | 31 ++++++++++--------- .../unauthenticated_note_how_to.md | 4 --- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index 9985530..7656857 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -42,7 +42,7 @@ cargo install midenc --locked In a new terminal outside of the compiler repository, create a new Miden project: ```bash -cargo miden new is_prime +cargo miden new --program is_prime cd is_prime ``` @@ -114,18 +114,19 @@ midenc run target/miden/release/is_prime.masp --inputs inputs.toml The output will look like this: ``` +=============================================================================== Run program: target/miden/release/is_prime.masp ------------------------------------------------------------------------------- -Executed program with hash 0x79689b17ab6286cfde4651ef1f675cab19ad4efd9defd2c43001a06e7cbd8c40 in 2 seconds +Executed program with hash 0x6c5173a2d77d294bbdccf3332092aeee9dc4ad431a0aa25842ef704044565681 in 0 seconds Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -VM cycles: 2039234 extended to 2097152 steps (2% padding). -├── Stack rows: 1668454 -├── Range checker rows: 61329 -└── Chiplets rows: 2039234 - ├── Hash chiplet rows: 1792040 - ├── Bitwise chiplet rows: 247192 - ├── Memory chiplet rows: 1 - └── Kernel ROM rows: 0 +VM cycles: 805 extended to 1024 steps (21% padding). +├── Stack rows: 597 +├── Range checker rows: 83 +└── Chiplets rows: 805 +├── Hash chiplet rows: 728 +├── Bitwise chiplet rows: 72 +├── Memory chiplet rows: 4 +└── Kernel ROM rows: 0 ``` The program returns `1` if the integer passed to the `is_prime` function is prime and `0` if it is not. @@ -135,7 +136,7 @@ The program returns `1` if the integer passed to the `is_prime` function is prim First cloning the Miden VM repository and install the Miden VM CLI: ```bash -cargo install miden-vm --version 0.13.0 --features concurrent,executable +cargo install miden-vm --version 0.14.0 --features concurrent,executable ``` After installation is complete, return to the `is_prime` directory. @@ -160,15 +161,15 @@ The output should look like this: =============================================================================== Prove program: target/miden/release/is_prime.masp ------------------------------------------------------------------------------- -Proving program with hash c6db9ccd205b2d5139d5a92869a2741a0a8982b8e269a36b7a16d173f467b0c8... -Program proved in 85558 ms +Proving program with hash 6c5173a2d77d294bbdccf3332092aeee9dc4ad431a0aa25842ef704044565681... +Program proved in 35 ms Output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ``` To verify the proof generated in the previous step, run the following: ```bash -miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x c6db9ccd205b2d5139d5a92869a2741a0a8982b8e269a36b7a16d173f467b0c8 +miden verify -p target/miden/release/is_prime.proof -i is_prime.inputs -x 6c5173a2d77d294bbdccf3332092aeee9dc4ad431a0aa25842ef704044565681 ``` The output should look like this: @@ -177,7 +178,7 @@ The output should look like this: =============================================================================== Verifying proof: target/miden/release/is_prime.proof ------------------------------------------------------------------------------- -Verification complete in 5 ms +Verification complete in 3 ms ``` ## Conclusion diff --git a/docs/src/rust-client/unauthenticated_note_how_to.md b/docs/src/rust-client/unauthenticated_note_how_to.md index 6c0d331..c11e886 100644 --- a/docs/src/rust-client/unauthenticated_note_how_to.md +++ b/docs/src/rust-client/unauthenticated_note_how_to.md @@ -23,22 +23,18 @@ Alice ➡ Bob ➡ Charlie ➡ Dave ➡ Eve ➡ Frank ➡ ... ## Step-by-step process 1. **Client Initialization:** - - Set up an RPC client to connect with the Miden testnet. - Initialize a random coin generator and a store for persisting account data. 2. **Deploying a Fungible Faucet:** - - Use a random seed to deploy a fungible faucet. - Configure the faucet parameters (symbol, decimals, and max supply) and add it to the client. 3. **Creating Wallet Accounts:** - - Build multiple wallet accounts using a secure key generation process. - Add these accounts to the client, making them ready for transactions. 4. **Minting and Transacting with Unauthenticated Notes:** - - Mint tokens for one of the accounts (Alice) from the deployed faucet. - Create a note representing the minted tokens. - Build and submit a transaction that uses the unauthenticated note via the "unauthenticated" method. From 0bff1d768f42a9420a5119aee74406a846988528 Mon Sep 17 00:00:00 2001 From: GianM Date: Mon, 14 Jul 2025 16:38:01 +0700 Subject: [PATCH 11/11] chore: update compiler tutorial README (#81) --- docs/src/compiler/is_prime_rust.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/src/compiler/is_prime_rust.md b/docs/src/compiler/is_prime_rust.md index 7656857..c64403c 100644 --- a/docs/src/compiler/is_prime_rust.md +++ b/docs/src/compiler/is_prime_rust.md @@ -10,7 +10,7 @@ In this guide, we will write a simple Rust program that checks whether an intege - Writing basic _pure_ programs in Rust using the Miden compiler. - Running programs in the Miden VM. -- Generating a proof of compuation for the `is_prime` program +- Generating a proof of computation for the `is_prime` program - Verifying the STARK proof of the `is_prime` program execution ## Limitations and Important Considerations @@ -37,6 +37,12 @@ cargo install cargo-miden cargo install midenc --locked ``` +If you encounter issues with the `cargo-miden` installation, you can specify a specific nightly version that is known to work with the Miden compiler. + +```bash +cargo +nightly-2025-03-20 install cargo-miden +``` + ## Step 2: Writing the Rust Program In a new terminal outside of the compiler repository, create a new Miden project: @@ -136,7 +142,7 @@ The program returns `1` if the integer passed to the `is_prime` function is prim First cloning the Miden VM repository and install the Miden VM CLI: ```bash -cargo install miden-vm --version 0.14.0 --features concurrent,executable +cargo install miden-vm --version 0.16.2 --features concurrent,executable ``` After installation is complete, return to the `is_prime` directory.