Skip to content

Commit 7f7c592

Browse files
committed
docs: fix Your First Smart Contract page issues
- Fix "compiles to Miden assembly" → compiles to .masp package file - Add note explaining felt macro vs Felt type - Fix "Miden component" → "Miden account component" - Clarify storage key strategy wording - Add trace log output and explanation to expected output - Add MidenScan link for verifying deployment Closes #218
1 parent bfdf0a8 commit 7f7c592

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

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

Lines changed: 7 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 `.masp` package file, making it ready for deployment and interaction.
5757

5858
## Understanding the Counter Account Contract
5959

@@ -127,6 +127,10 @@ These imports provide:
127127
- **`StorageMap`**: Key-value storage within account storage slots
128128
- **`StorageMapAccess`**: Needed for reading storage values (`get_count` function)
129129

130+
:::note[`felt` vs `Felt`]
131+
`felt` is a macro (`felt!(1)`) for creating `Felt` values from compile-time constants, while `Felt` is the actual field element type used at runtime. Think of `felt!` as shorthand for creating `Felt` values.
132+
:::
133+
130134
#### Contract Structure Definition
131135

132136
```rust
@@ -138,7 +142,7 @@ struct CounterContract {
138142
}
139143
```
140144

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`).
145+
The `#[component]` attribute marks this as a Miden account 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`).
142146

143147
**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.
144148

@@ -158,7 +162,7 @@ The `CounterContract` implementation defines the external interface that other c
158162
let key = Word::from_u64_unchecked(0, 0, 0, 1);
159163
```
160164

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.
165+
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.
162166

163167
## Understanding the Increment Note Script
164168

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,21 @@ cargo run --bin increment_count --release
8686
Account ID: V0(AccountIdV0 { prefix: 14134910893364381952, suffix: 3644349760121494784 })
8787
Sender account ID: "0xd85b347218c5a80052dbd47b2f36ad"
8888
Counter note hash: "0xf0e821396a896eb9983e682bc056021d57ddcaa43082f34597bf9e026421e566"
89-
Note publish transaction ID: "0xc6f080855724402cadf26650ffe993fe97a127a8f6c9c82ec621960e936e6d732
89+
Note publish transaction ID: "0xc6f080855724402cadf26650ffe993fe97a127a8f6c9c82ec621960e936e6d732"
90+
Trace with id 240 emitted at step 2679 in context 2666
91+
Trace with id 252 emitted at step 2689 in context 2666
92+
... (trace output omitted)
9093
Consume transaction ID: "0x2d1d8510e546ce0fbc22fa7d1a82322259d73cd1d7e0ca86622d0be70fab0548"
91-
Account delta: AccountDelta { account_id: V0(AccountIdV0 { prefix: 7255964780328958976, suffix: 2724050564200846336 }), storage: AccountStorageDelta { values: {}, maps: {0: StorageMapDelta({LexicographicWord(Word([0, 0, 0, 1])): Word([0, 0, 0, 1])})} }, vault: AccountVaultDelta { fungible: FungibleAssetDelta({}), non_fungible: NonFungibleAssetDelta({}) }, nonce_delta: 1 }
94+
Account delta: AccountDelta { ... storage: AccountStorageDelta { ... maps: {0: StorageMapDelta({...: Word([0, 0, 0, 1])})} }, ... nonce_delta: 1 }
9295
```
9396

97+
:::note
98+
The `Trace with id ... emitted at step ...` lines are debug output from the Miden VM and can be safely ignored. Your actual account IDs and transaction IDs will differ from this example.
99+
:::
100+
94101
</details>
95102

96-
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one!
103+
Congratulations, you have successfully deployed the Counter Contract to the Miden Testnet, and incremented its count by one! You can verify your transaction on [MidenScan](https://testnet.midenscan.com) by searching for your transaction ID.
97104

98105
### What Happens During Execution
99106

@@ -149,7 +156,7 @@ let note_package = Arc::new(
149156
The `build_project_in_dir()` function:
150157

151158
- Takes the path to your contract's Rust source code
152-
- Compiles the Rust code into Miden assembly
159+
- Compiles the Rust code into a Miden package (`.masp` file)
153160
- Generates a package containing the compiled contract bytecode and metadata
154161
- This is equivalent to manually running `miden build` in each contract directory
155162

0 commit comments

Comments
 (0)