Miden game that showcases (almost) all Miden features
- Ngôn ngữ chính
- Rust
- Star
- 18
- Fork
- 34
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
# Miden book - example application
So my current idea for the Miden book would be to merge the tutorial and the protocol sections into one section.
I took my inspiration from the Rust book. So ideally, we also have the user to build an application that incrementally gets more complex by adding more and more features. Until all main Miden features are explained conceptually and with code examples. Ideally, we have the `midenup` command already. But the the structure should not change much.
I am not sure yet which application we want the user to build. But I have one suggestion.
## Suggestion - Avalon like game
We could let users build a simple game - like Avalon. This will let the user learn all Miden concepts, I believe. And it shows Miden's hybrid approach of private and public transactions and state.
### Avalon - Game Flow
See [here](https://en.wikipedia.org/wiki/The_Resistance_(game)) for a game explainer
1. **Game Setup**
- Each player deploys a private account (stores their personal state) and generates a secret `s`.
- A public game account is initialized.
- Each player registers his identity commitment (=`H(s)`) in a `StorageMap` of the public account.
2. **Role Assignment**
- An oracle assigns secret roles (seeded from randomness).
- Each player receives their role as a private note (NFT) from the game account. There are _traitors_ and _knights_.
3. **Team Proposals** (Round-based)
- A player proposes a team for the mission (a set of `N` selected players) to the game account (direct execution).
- Other players approve or reject the proposal via a network note to the game account.
- If the proposal passes:
- A new `missionID` is assigned
- The selected players' commitments are collected into a new Merkle tree (root stored as `missionRoot` in the game account)
- The game account emits `N` `VotingSwapNotes` with `missionRoot`
- If three proposals fail in a row, the traitors win.
4. **Mission Execution** (Semaphore Voting)
- Each selected player creates a new private account locally (to break linkability).
- Each selected player consumes one `VotingSwapNote` with the new private account. That automatically creates
- A network note `voteNote` back to the game account that includes the players `vote` and `nullifier` = `H(secret || missionID)`.
- Consumption fails, if the player cannot prove his identity commitment is in the `missionRoot`
5. **Mission reveal**:
- Game account consumes all `voteNote` checking that each nullifier has not been used before.
- Updates the mission vote tally (successCount / failCount). As each vote arrives, the game account only updates the aggregate tally.
- Once all votes are in, the game account determines mission success or failure based on the fail count.
6. **Endgame**
- After 5 missions (3 wins needed to succeed), the game ends.
- The game account determines the winning team.
### Miden learnings
In building this game, builders would learn a lot of Miden concepts and use the Rust and the WebClient.
Chapter | Goal | Miden Concepts
-- | -- | --
Game setup | Account creation | Private and public accounts, clients
Role Assignment | Send private notes to players | Notes, oracle, FPI, NFTs
Team proposals | Simple public smart contract interaction | Network notes, custom notes and smart contracts
Mission Execution | Private smart contract interaction | Custom note swap logic, nullifiers, note tags and recipient logic
Mission Reveal | Autonomous smart contracts | Complex smart contract logic
From Rust to Web | Rust client and WebClient interaction | Frontend integration, wallet adapter
Hướng dẫn đóng góp
Hướng nghiên cứu
The issue describes a comprehensive example application for the Miden book. Start by reviewing the existing Miden tutorials and book structure to understand the current content. Examine the Miden concepts listed (private/public accounts, notes, NFTs, smart contracts, nullifiers) and see how they are currently explained. The goal is to design a tutorial that incrementally builds an Avalon-like game, so outline the chapters and map each to existing Miden examples and code.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- blockchain, documentation, game-dev
- Loại issue
- Tài liệu
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 30/100