Skip to content

Commit a2d51b9

Browse files
committed
docs: fix quick start feedback items from review
Address feedback from Dominik's Quick Start review (miden-devrel#126): - Add missing `cd my-test-project` after project creation in installation guide - Add conditional "reuse existing project" note in accounts guide - Add core transaction principle to Two-Transaction Model section - Fix "private asset transfers" wording to match public NoteType usage - Add tip blocks and section markers for duplicated code in notes guide - Add polling loop explanation comments (notes must be committed first) - Fix "Bob's account" to "Bob's client" for technical accuracy - Fix "Miden assembly" to "Miden package (.masp file)" in contract guides - Add felt! macro vs Felt type explanation - Clarify "Miden component" as "Account component" with link - Add "in the counter contract" for clarity - Add Miden Testnet Explorer link after deployment
1 parent ee19b14 commit a2d51b9

10 files changed

Lines changed: 62 additions & 22 deletions

File tree

docs/builder/get-started/accounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ To run the code examples in this guide, you'll need to set up a development envi
115115

116116
### Rust Environment
117117

118-
Create a new Miden Rust project:
118+
If you already created `my-test-project` during [installation](./setup/installation), you can reuse it. Otherwise, create a new project:
119119

120120
```bash title=">_ Terminal"
121121
miden new my-project

docs/builder/get-started/notes.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
sidebar_position: 3
33
title: Notes & Transactions
4-
description: Learn Miden's unique note-based transaction model for private asset transfers.
4+
description: Learn Miden's unique note-based transaction model for asset transfers between accounts.
55
---
66

77
import { CodeTabs } from '@site/src/components';
@@ -30,6 +30,8 @@ Traditional blockchains move tokens directly between account balances. Miden use
3030

3131
## The Two-Transaction Model
3232

33+
A core principle of Miden is that **a transaction is the state transition of a single account**. This means each transaction only modifies one account's state, which enables parallel execution and strong privacy guarantees.
34+
3335
Miden uses a **two-transaction model** for asset transfers that provides enhanced privacy and scalability:
3436

3537
### Transaction 1: Sender Creates Note
@@ -41,7 +43,7 @@ Miden uses a **two-transaction model** for asset transfers that provides enhance
4143

4244
### Transaction 2: Recipient Consumes Note
4345

44-
- **Bob's account** discovers the note (addressed to his ID)
46+
- **Bob's client** discovers the note (addressed to his ID)
4547
- Bob creates a transaction to consume the note
4648
- Tokens move from the note into Bob's vault
4749
- Bob's balance increases, note is nullified
@@ -294,6 +296,10 @@ After minting creates a P2ID note containing tokens, the recipient must **consum
294296

295297
Here's how to consume notes programmatically:
296298

299+
:::tip
300+
This is a complete, self-contained example that includes the setup and minting steps from the previous section. **The new consume logic starts at the `CONSUMING P2ID NOTES` comment.**
301+
:::
302+
297303
<CodeTabs
298304
tsFilename="src/lib/consume.ts"
299305
rustFilename="integration/src/bin/consume.rs"
@@ -422,6 +428,8 @@ async fn main() -> anyhow::Result<()> {
422428
// CONSUMING P2ID NOTES
423429
//------------------------------------------------------------
424430

431+
// Public notes must be committed to a block before they can be consumed.
432+
// Poll until the network includes our mint note in a block.
425433
loop {
426434
// Sync state to get the latest block
427435
client.sync_state().await?;
@@ -532,6 +540,8 @@ export async function demo() {
532540

533541
await client.syncState();
534542

543+
// Public notes must be committed to a block before they can be consumed.
544+
// Poll until the network includes our mint note in a block.
535545
let consumableNotes: ConsumableNoteRecord[] = [];
536546
while (consumableNotes.length === 0) {
537547
// Find consumable notes
@@ -600,6 +610,10 @@ This approach means Alice and Bob's transactions are completely separate and unl
600610

601611
Let's implement the complete flow - mint, consume, then send:
602612

613+
:::tip
614+
This is a complete, self-contained example that includes all previous steps. **The new send logic starts at the `SENDING TOKENS TO BOB` comment.**
615+
:::
616+
603617
<CodeTabs
604618
tsFilename="src/lib/send.ts"
605619
rustFilename="integration/src/bin/send.rs"
@@ -728,6 +742,8 @@ async fn main() -> anyhow::Result<()> {
728742
// CONSUMING P2ID NOTES
729743
//------------------------------------------------------------
730744

745+
// Public notes must be committed to a block before they can be consumed.
746+
// Poll until the network includes our mint note in a block.
731747
loop {
732748
// Sync state to get the latest block
733749
client.sync_state().await?;
@@ -872,6 +888,8 @@ export async function demo() {
872888

873889
await client.syncState();
874890

891+
// Public notes must be committed to a block before they can be consumed.
892+
// Poll until the network includes our mint note in a block.
875893
let consumableNotes: ConsumableNoteRecord[] = [];
876894
while (consumableNotes.length === 0) {
877895
// Find consumable notes
@@ -946,7 +964,7 @@ Send 100 tokens to Bob note transaction ID: "0x51ac27474ade3a54adadd50db6c2b9a2e
946964

947965
**Miden's Note-Based Transaction Model:**
948966

949-
- **Notes** enable private asset transfers between accounts
967+
- **Notes** enable asset transfers between accounts (both public and private)
950968
- **Two-transaction model** provides privacy and parallelization benefits
951969
- **Zero-knowledge proofs** validate transaction execution without revealing details
952970
- **P2ID notes** target specific recipients using their account IDs

docs/builder/get-started/setup/installation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ Test by creating a new project:
149149

150150
```bash title=">_ Terminal"
151151
miden new my-test-project
152+
cd my-test-project
152153
```
153154

154-
If successful, you'll see a new directory with Miden project files.
155+
If successful, you'll see a new directory with Miden project files. The `cd` command enters the project directory, which you'll need for the following guides.
155156

156157
### Troubleshooting
157158

docs/builder/get-started/your-first-smart-contract/create.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ cd ../increment-note
5353
miden build
5454
```
5555

56-
This compiles the Rust contract code into Miden assembly, making it ready for deployment and interaction.
56+
This compiles the Rust contract code into a Miden package (`.masp` file), making it ready for deployment and interaction.
5757

5858
## Understanding the Counter Account Contract
5959

@@ -123,6 +123,7 @@ use miden::{component, felt, Felt, StorageMap, StorageMapAccess, Word};
123123
These imports provide:
124124

125125
- **`component`**: Macro for defining contract components
126+
- **`felt`**: Macro for creating `Felt` literals (e.g., `felt!(1)`)
126127
- **`Felt`/`Word`**: Miden's native field element and word types
127128
- **`StorageMap`**: Key-value storage within account storage slots
128129
- **`StorageMapAccess`**: Needed for reading storage values (`get_count` function)
@@ -138,7 +139,7 @@ struct CounterContract {
138139
}
139140
```
140141

141-
The `#[component]` attribute marks this as a Miden component. The `count_map` field is a `StorageMap` stored in a named storage slot of the account. In v0.13, storage slots are identified by name rather than explicit index numbers — the slot name is derived automatically from the component's package name and field name (e.g., `miden::component::miden_counter_account::count_map`).
142+
The `#[component]` attribute marks this as a Miden [Account component](/core-concepts/miden-base/account). The `count_map` field is a `StorageMap` stored in a named storage slot of the account. In v0.13, storage slots are identified by name rather than explicit index numbers — the slot name is derived automatically from the component's package name and field name (e.g., `miden::component::miden_counter_account::count_map`).
142143

143144
**Important**: Storage slots in Miden hold `Word` values, which are composed of four field elements (`Felt`). Each `Felt` is a 64-bit unsigned integer (u64). The `StorageMap` provides a key-value interface within a single storage slot, allowing you to store multiple key-value pairs within the four-element word structure.
144145

@@ -158,7 +159,7 @@ The `CounterContract` implementation defines the external interface that other c
158159
let key = Word::from_u64_unchecked(0, 0, 0, 1);
159160
```
160161

161-
Both functions use the same fixed key `[0, 0, 0, 1]` to store and retrieve the counter value within the storage map. The `Word::from_u64_unchecked` constructor creates a `Word` from four `u64` values. This demonstrates a simple but effective storage pattern.
162+
Both functions in the counter contract use the same fixed key `[0, 0, 0, 1]` to store and retrieve the counter value within the storage map. The `Word::from_u64_unchecked` constructor creates a `Word` from four `u64` values. This demonstrates a simple but effective storage pattern.
162163

163164
## Understanding the Increment Note Script
164165

docs/builder/get-started/your-first-smart-contract/deploy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Account delta: AccountDelta { account_id: V0(AccountIdV0 { prefix: 7255964780328
9393

9494
</details>
9595

96-
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one!
96+
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one! You can view your account on the [Miden Testnet Explorer](https://testnet.midenscan.com).
9797

9898
### What Happens During Execution
9999

@@ -149,8 +149,8 @@ let note_package = Arc::new(
149149
The `build_project_in_dir()` function:
150150

151151
- Takes the path to your contract's Rust source code
152-
- Compiles the Rust code into Miden assembly
153-
- Generates a package containing the compiled contract bytecode and metadata
152+
- Compiles the Rust code into a Miden package (`.masp` file)
153+
- The package contains the compiled contract bytecode and metadata
154154
- This is equivalent to manually running `miden build` in each contract directory
155155

156156
These packages contain all the information needed to deploy and interact with your contracts on the Miden network.

versioned_docs/version-0.13/builder/get-started/accounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ To run the code examples in this guide, you'll need to set up a development envi
115115

116116
### Rust Environment
117117

118-
Create a new Miden Rust project:
118+
If you already created `my-test-project` during [installation](./setup/installation), you can reuse it. Otherwise, create a new project:
119119

120120
```bash title=">_ Terminal"
121121
miden new my-project

versioned_docs/version-0.13/builder/get-started/notes.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
sidebar_position: 3
33
title: Notes & Transactions
4-
description: Learn Miden's unique note-based transaction model for private asset transfers.
4+
description: Learn Miden's unique note-based transaction model for asset transfers between accounts.
55
---
66

77
import { CodeTabs } from '@site/src/components';
@@ -30,6 +30,8 @@ Traditional blockchains move tokens directly between account balances. Miden use
3030

3131
## The Two-Transaction Model
3232

33+
A core principle of Miden is that **a transaction is the state transition of a single account**. This means each transaction only modifies one account's state, which enables parallel execution and strong privacy guarantees.
34+
3335
Miden uses a **two-transaction model** for asset transfers that provides enhanced privacy and scalability:
3436

3537
### Transaction 1: Sender Creates Note
@@ -41,7 +43,7 @@ Miden uses a **two-transaction model** for asset transfers that provides enhance
4143

4244
### Transaction 2: Recipient Consumes Note
4345

44-
- **Bob's account** discovers the note (addressed to his ID)
46+
- **Bob's client** discovers the note (addressed to his ID)
4547
- Bob creates a transaction to consume the note
4648
- Tokens move from the note into Bob's vault
4749
- Bob's balance increases, note is nullified
@@ -294,6 +296,10 @@ After minting creates a P2ID note containing tokens, the recipient must **consum
294296

295297
Here's how to consume notes programmatically:
296298

299+
:::tip
300+
This is a complete, self-contained example that includes the setup and minting steps from the previous section. **The new consume logic starts at the `CONSUMING P2ID NOTES` comment.**
301+
:::
302+
297303
<CodeTabs
298304
tsFilename="src/lib/consume.ts"
299305
rustFilename="integration/src/bin/consume.rs"
@@ -422,6 +428,8 @@ async fn main() -> anyhow::Result<()> {
422428
// CONSUMING P2ID NOTES
423429
//------------------------------------------------------------
424430

431+
// Public notes must be committed to a block before they can be consumed.
432+
// Poll until the network includes our mint note in a block.
425433
loop {
426434
// Sync state to get the latest block
427435
client.sync_state().await?;
@@ -532,6 +540,8 @@ export async function demo() {
532540

533541
await client.syncState();
534542

543+
// Public notes must be committed to a block before they can be consumed.
544+
// Poll until the network includes our mint note in a block.
535545
let consumableNotes: ConsumableNoteRecord[] = [];
536546
while (consumableNotes.length === 0) {
537547
// Find consumable notes
@@ -600,6 +610,10 @@ This approach means Alice and Bob's transactions are completely separate and unl
600610

601611
Let's implement the complete flow - mint, consume, then send:
602612

613+
:::tip
614+
This is a complete, self-contained example that includes all previous steps. **The new send logic starts at the `SENDING TOKENS TO BOB` comment.**
615+
:::
616+
603617
<CodeTabs
604618
tsFilename="src/lib/send.ts"
605619
rustFilename="integration/src/bin/send.rs"
@@ -728,6 +742,8 @@ async fn main() -> anyhow::Result<()> {
728742
// CONSUMING P2ID NOTES
729743
//------------------------------------------------------------
730744

745+
// Public notes must be committed to a block before they can be consumed.
746+
// Poll until the network includes our mint note in a block.
731747
loop {
732748
// Sync state to get the latest block
733749
client.sync_state().await?;
@@ -872,6 +888,8 @@ export async function demo() {
872888

873889
await client.syncState();
874890

891+
// Public notes must be committed to a block before they can be consumed.
892+
// Poll until the network includes our mint note in a block.
875893
let consumableNotes: ConsumableNoteRecord[] = [];
876894
while (consumableNotes.length === 0) {
877895
// Find consumable notes
@@ -946,7 +964,7 @@ Send 100 tokens to Bob note transaction ID: "0x51ac27474ade3a54adadd50db6c2b9a2e
946964

947965
**Miden's Note-Based Transaction Model:**
948966

949-
- **Notes** enable private asset transfers between accounts
967+
- **Notes** enable asset transfers between accounts (both public and private)
950968
- **Two-transaction model** provides privacy and parallelization benefits
951969
- **Zero-knowledge proofs** validate transaction execution without revealing details
952970
- **P2ID notes** target specific recipients using their account IDs

versioned_docs/version-0.13/builder/get-started/setup/installation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ Test by creating a new project:
166166

167167
```bash title=">_ Terminal"
168168
miden new my-test-project
169+
cd my-test-project
169170
```
170171

171-
If successful, you'll see a new directory with Miden project files.
172+
If successful, you'll see a new directory with Miden project files. The `cd` command enters the project directory, which you'll need for the following guides.
172173

173174
### Troubleshooting
174175

versioned_docs/version-0.13/builder/get-started/your-first-smart-contract/create.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ cd ../increment-note
5353
miden build
5454
```
5555

56-
This compiles the Rust contract code into Miden assembly, making it ready for deployment and interaction.
56+
This compiles the Rust contract code into a Miden package (`.masp` file), making it ready for deployment and interaction.
5757

5858
## Understanding the Counter Account Contract
5959

@@ -123,6 +123,7 @@ use miden::{component, felt, Felt, StorageMap, StorageMapAccess, Word};
123123
These imports provide:
124124

125125
- **`component`**: Macro for defining contract components
126+
- **`felt`**: Macro for creating `Felt` literals (e.g., `felt!(1)`)
126127
- **`Felt`/`Word`**: Miden's native field element and word types
127128
- **`StorageMap`**: Key-value storage within account storage slots
128129
- **`StorageMapAccess`**: Needed for reading storage values (`get_count` function)
@@ -138,7 +139,7 @@ struct CounterContract {
138139
}
139140
```
140141

141-
The `#[component]` attribute marks this as a Miden component. The `count_map` field is a `StorageMap` stored in a named storage slot of the account. In v0.13, storage slots are identified by name rather than explicit index numbers — the slot name is derived automatically from the component's package name and field name (e.g., `miden::component::miden_counter_account::count_map`).
142+
The `#[component]` attribute marks this as a Miden [Account component](/core-concepts/miden-base/account). The `count_map` field is a `StorageMap` stored in a named storage slot of the account. In v0.13, storage slots are identified by name rather than explicit index numbers — the slot name is derived automatically from the component's package name and field name (e.g., `miden::component::miden_counter_account::count_map`).
142143

143144
**Important**: Storage slots in Miden hold `Word` values, which are composed of four field elements (`Felt`). Each `Felt` is a 64-bit unsigned integer (u64). The `StorageMap` provides a key-value interface within a single storage slot, allowing you to store multiple key-value pairs within the four-element word structure.
144145

@@ -158,7 +159,7 @@ The `CounterContract` implementation defines the external interface that other c
158159
let key = Word::from_u64_unchecked(0, 0, 0, 1);
159160
```
160161

161-
Both functions use the same fixed key `[0, 0, 0, 1]` to store and retrieve the counter value within the storage map. The `Word::from_u64_unchecked` constructor creates a `Word` from four `u64` values. This demonstrates a simple but effective storage pattern.
162+
Both functions in the counter contract use the same fixed key `[0, 0, 0, 1]` to store and retrieve the counter value within the storage map. The `Word::from_u64_unchecked` constructor creates a `Word` from four `u64` values. This demonstrates a simple but effective storage pattern.
162163

163164
## Understanding the Increment Note Script
164165

versioned_docs/version-0.13/builder/get-started/your-first-smart-contract/deploy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Account delta: AccountDelta { account_id: V0(AccountIdV0 { prefix: 7255964780328
9393

9494
</details>
9595

96-
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one!
96+
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one! You can view your account on the [Miden Testnet Explorer](https://testnet.midenscan.com).
9797

9898
### What Happens During Execution
9999

@@ -149,8 +149,8 @@ let note_package = Arc::new(
149149
The `build_project_in_dir()` function:
150150

151151
- Takes the path to your contract's Rust source code
152-
- Compiles the Rust code into Miden assembly
153-
- Generates a package containing the compiled contract bytecode and metadata
152+
- Compiles the Rust code into a Miden package (`.masp` file)
153+
- The package contains the compiled contract bytecode and metadata
154154
- This is equivalent to manually running `miden build` in each contract directory
155155

156156
These packages contain all the information needed to deploy and interact with your contracts on the Miden network.

0 commit comments

Comments
 (0)