Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Repo layout
- `docs/`: Docusaurus tutorials plus a Rust crate for doctesting tutorial markdown.
- `examples/`: Complete example projects built with the Miden Rust compiler.
- `rust-client/`: Rust examples that use the Miden client crates.
- `web-client/`: Next.js 15 app for browser examples.
- `masm/`: Miden assembly notes, accounts, and scripts used by tutorials.
Expand Down Expand Up @@ -36,6 +37,16 @@
- Rust runs always start with `cargo clean` for a fresh build.
- Rust retries default to 3 attempts (override with `TUTORIAL_RETRIES=1`).

## Examples

### Miden Bank (`examples/miden-bank/`)
Complete banking application built with the Miden Rust compiler. Companion code for the Building a Bank tutorial.

- Build contracts: `cd contracts/<name> && miden build` (build bank-account first, then others)
- Run integration tests: `cargo test -p integration`
- Uses nightly Rust (configured by `rust-toolchain.toml`)
- Contracts are excluded from the Cargo workspace (compiled with `cargo-miden`)

## Formatting
- Markdown is formatted with Prettier using `.prettierrc`.
- Run from repo root: `prettier --write "**/*.md"`.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ The goal of this repository is to provide clear and practical examples for inter
This repository is organized into several parts:

1. **docs**, contains the README files for the tutorials and guides.
2. **masm**, contains the Miden assembly notes, accounts, and scripts used in the examples.
3. **rust-client**, contains examples for interacting with the Miden Rollup using **Rust**.
4. **web-client**, contains examples for interacting with the Miden Rollup in the browser.
2. **examples**, contains complete example projects (e.g., the Miden Bank built with the Rust compiler).
3. **masm**, contains the Miden assembly notes, accounts, and scripts used in the examples.
4. **rust-client**, contains examples for interacting with the Miden Rollup using **Rust**.
5. **web-client**, contains examples for interacting with the Miden Rollup in the browser.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion docs/src/miden-bank/01-account-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl Bank {
5. **Public methods** are callable by other contracts via generated bindings

:::tip View Complete Source
See the complete bank account implementation in the [miden-bank repository](https://github.com/keinberger/miden-bank/blob/main/contracts/bank-account/src/lib.rs).
See the complete bank account implementation in [contracts/bank-account/src/lib.rs](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/bank-account/src/lib.rs).
:::

## Next Steps
Expand Down
2 changes: 1 addition & 1 deletion docs/src/miden-bank/02-constants-constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl Bank {
5. **Failed assertions** mean no valid proof can be generated

:::tip View Complete Source
See the complete constraint implementation in the [miden-bank repository](https://github.com/keinberger/miden-bank/blob/main/contracts/bank-account/src/lib.rs).
See the complete constraint implementation in [contracts/bank-account/src/lib.rs](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/bank-account/src/lib.rs).
:::

## Next Steps
Expand Down
2 changes: 1 addition & 1 deletion docs/src/miden-bank/03-asset-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ impl Bank {
6. **CRITICAL: Always validate before subtraction** - Felt arithmetic wraps silently!

:::tip View Complete Source
See the complete deposit and withdraw implementations in the [miden-bank repository](https://github.com/keinberger/miden-bank/blob/main/contracts/bank-account/src/lib.rs).
See the complete deposit and withdraw implementations in [contracts/bank-account/src/lib.rs](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/bank-account/src/lib.rs).
:::

## Next Steps
Expand Down
4 changes: 2 additions & 2 deletions docs/src/miden-bank/04-note-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ impl DepositNote {
:::tip View Complete Source
See the complete note script implementations:

- [Deposit Note](https://github.com/keinberger/miden-bank/blob/main/contracts/deposit-note/src/lib.rs)
- [Withdraw Request Note](https://github.com/keinberger/miden-bank/blob/main/contracts/withdraw-request-note/src/lib.rs)
- [Deposit Note](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/deposit-note/src/lib.rs)
- [Withdraw Request Note](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/withdraw-request-note/src/lib.rs)
:::

## Next Steps
Expand Down
4 changes: 2 additions & 2 deletions docs/src/miden-bank/05-cross-component-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ error: dependency 'miden:bank-account' not found
:::tip View Complete Source
See the complete Cargo.toml configurations:

- [Deposit Note Cargo.toml](https://github.com/keinberger/miden-bank/blob/main/contracts/deposit-note/Cargo.toml)
- [Withdraw Request Note Cargo.toml](https://github.com/keinberger/miden-bank/blob/main/contracts/withdraw-request-note/Cargo.toml)
- [Deposit Note Cargo.toml](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/deposit-note/Cargo.toml)
- [Withdraw Request Note Cargo.toml](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/withdraw-request-note/Cargo.toml)
:::

## Next Steps
Expand Down
2 changes: 1 addition & 1 deletion docs/src/miden-bank/06-transaction-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ project-kind = "transaction-script"
5. **Dependencies** - Same Cargo.toml configuration as note scripts

:::tip View Complete Source
See the complete transaction script implementation in the [miden-bank repository](https://github.com/keinberger/miden-bank/blob/main/contracts/init-tx-script/src/lib.rs).
See the complete transaction script implementation in [contracts/init-tx-script/src/lib.rs](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/contracts/init-tx-script/src/lib.rs).
:::

## Next Steps
Expand Down
2 changes: 1 addition & 1 deletion docs/src/miden-bank/07-output-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl WithdrawRequestNote {
7. **Always validate before subtraction** to prevent underflow exploits

:::tip View Complete Source
See the complete implementation in the [miden-bank repository](https://github.com/keinberger/miden-bank).
See the complete implementation in the [examples/miden-bank](https://github.com/0xMiden/miden-tutorials/tree/main/examples/miden-bank) directory.
:::

## Next Steps
Expand Down
6 changes: 3 additions & 3 deletions docs/src/miden-bank/08-complete-flows.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,9 @@ Use these patterns to build:
:::tip View Complete Source
Explore the complete banking application:

- [All Contracts](https://github.com/keinberger/miden-bank/tree/main/contracts)
- [Integration Tests](https://github.com/keinberger/miden-bank/tree/main/integration/tests)
- [Test Helpers](https://github.com/keinberger/miden-bank/blob/main/integration/src/helpers.rs)
- [All Contracts](https://github.com/0xMiden/miden-tutorials/tree/main/examples/miden-bank/contracts)
- [Integration Tests](https://github.com/0xMiden/miden-tutorials/tree/main/examples/miden-bank/integration/tests)
- [Test Helpers](https://github.com/0xMiden/miden-tutorials/blob/main/examples/miden-bank/integration/src/helpers.rs)
:::

Happy building on Miden! 🚀
10 changes: 5 additions & 5 deletions docs/src/miden-bank/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ This tutorial covers the following Miden Rust compiler features:
| `#[tx_script]` | Transaction scripts for account operations | 6 |
| Output Notes | Create notes programmatically | 7 |

## Source Code Repository
## Source Code

The complete source code for this tutorial is available in the **[miden-bank repository](https://github.com/keinberger/miden-bank)**. You can clone it to follow along or reference the implementation:
The complete source code for this tutorial is available in the [examples/miden-bank](https://github.com/0xMiden/miden-tutorials/tree/main/examples/miden-bank) directory of this repository:

```bash title=">_ Terminal"
git clone https://github.com/keinberger/miden-bank.git
cd miden-bank
git clone https://github.com/0xMiden/miden-tutorials.git
cd miden-tutorials/examples/miden-bank
```

## Supplementary Guides
Expand All @@ -202,6 +202,6 @@ If you get stuck during this tutorial:

- Check the [Miden Docs](https://docs.miden.xyz) for detailed technical references
- Join the [Build On Miden](https://t.me/BuildOnMiden) Telegram community for support
- Review the complete code in the [miden-bank repository](https://github.com/keinberger/miden-bank)
- Review the complete code in the [examples/miden-bank](https://github.com/0xMiden/miden-tutorials/tree/main/examples/miden-bank) directory

Ready to build your first Miden banking application? Let's get started with [Part 0: Project Setup](./00-project-setup.md)!
2 changes: 2 additions & 0 deletions examples/miden-bank/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Compiled Miden packages
*.masl
Loading