A hands-on workshop for building a lottery dApp on Monad/EVM from scratch.
Covers Solidity contracts, Foundry testing, a swappable randomness adapter interface, and a React/wagmi frontend. Structured as a guided course where you write the code step by step - an AI tutor explains each concept and reviews what you wrote rather than handing you the answers.
| Area | Tool |
|---|---|
| Contracts | Solidity ^0.8.24, Foundry/Forge |
| Randomness | Custom IRandomnessAdapter interface (swappable fake/VRF) |
| Frontend | React, TypeScript, wagmi, viem |
| Chain | Monad testnet (local Anvil for early steps) |
A complete lottery dApp across 9 lessons:
- EVM and wallet mental model
- Solidity basics by building
- Foundry test suite
- Lottery contract - rounds, tickets, and prize logic
- Randomness abstraction via a VRF adapter interface
- Frontend wallet connection
- Contract reads and writes from the browser
- Monad testnet deployment
- Security checklist
Step 1 - Load the teaching context into your AI assistant.
Open AGENTS.md and paste it into your AI tool (or point it at the file). This defines the teaching protocol: one concept at a time, the AI waits for you to write the code, then reviews what you wrote. Without it, the AI will just write everything for you.
Step 2 - Follow the docs in order.
docs/00-course-map.md
docs/01-evm-wallet-mental-model.md
docs/02-local-dev-setup.md
docs/03-product-and-protocol-design.md
docs/04-solidity-basics-by-building.md
docs/05-contract-v1-local-lottery.md
docs/06-foundry-tests.md
docs/07-randomness-and-vrf-adapter.md
docs/08-frontend-wallet-and-contract-calls.md
docs/09-deploy-to-monad-testnet.md
docs/10-security-checklist.md
docs/11-learning-roadmap.md
Each lesson ends with a working checkpoint. Complete it before moving on.
Step 3 - Use the reference implementation when stuck.
contracts/src/ and contracts/test/ contain the finished contracts and tests. Look at them after you have tried writing the code yourself.
- Basic programming experience in any language
- No prior Solidity, EVM, or wallet knowledge required
Educational project targeting Monad testnet. Not audited, not intended for production use or real-money gambling. On-chain gambling is jurisdiction-sensitive - understand your local laws before adapting this for any public use.