You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/builder/get-started/your-first-smart-contract/create.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ cd ../increment-note
53
53
miden build
54
54
```
55
55
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.
57
57
58
58
## Understanding the Counter Account Contract
59
59
@@ -127,6 +127,10 @@ These imports provide:
127
127
-**`StorageMap`**: Key-value storage within account storage slots
128
128
-**`StorageMapAccess`**: Needed for reading storage values (`get_count` function)
129
129
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
+
130
134
#### Contract Structure Definition
131
135
132
136
```rust
@@ -138,7 +142,7 @@ struct CounterContract {
138
142
}
139
143
```
140
144
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`).
142
146
143
147
**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.
144
148
@@ -158,7 +162,7 @@ The `CounterContract` implementation defines the external interface that other c
158
162
letkey=Word::from_u64_unchecked(0, 0, 0, 1);
159
163
```
160
164
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.
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
+
94
101
</details>
95
102
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.
97
104
98
105
### What Happens During Execution
99
106
@@ -149,7 +156,7 @@ let note_package = Arc::new(
149
156
The `build_project_in_dir()` function:
150
157
151
158
- 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)
153
160
- Generates a package containing the compiled contract bytecode and metadata
154
161
- This is equivalent to manually running `miden build` in each contract directory
0 commit comments