Lesson Plans

Lesson 1: Introduction to Solana and Rust

  • Chapter 1: What is Solana?

    • Objective: Understand Solana’s basics.

    • Monaco Task: No coding; read-only content explaining Solana.

  • Chapter 2: Introduction to Rust for Solana Development

    • Objective: Learn basic Rust syntax.

    • Monaco Task: Write a simple function (e.g., fn add(a: u64, b: u64) -> u64 { a + b }).

    • Validation: Real-time syntax checking using a lightweight Rust linter (e.g., WASM-based).

  • Chapter 3: Setting Up Your Development Environment

    • Objective: Explain the typical setup (for awareness).

    • Monaco Task: No coding; note that this course uses an in-browser IDE.

  • Chapter 4: Writing Your First Rust Program

    • Objective: Create a basic Rust program.

    • Monaco Task: Write a "Hello, Solana!" function (e.g., fn greet() -> String { "Hello, Solana!".to_string() }).

    • Validation: Syntax check and display simulated output ("Hello, Solana!") if correct.

  • Chapter 5: Understanding Solana's Architecture

    • Objective: Learn Solana’s structure.

    • Monaco Task: No coding; conceptual content only.


Lesson 2: Getting Started with Anchor

  • Chapter 1: What is Anchor?

    • Objective: Introduce the Anchor framework.

    • Monaco Task: No coding; read-only explanation.

  • Chapter 2: Installing Anchor

    • Objective: Contextualize Anchor setup.

    • Monaco Task: No coding; explain that pre-configured snippets will be used.

  • Chapter 3: Creating Your First Anchor Project

    • Objective: Explore Anchor project structure.

    • Monaco Task: View a pre-scaffolded project (read-only) with files like lib.rs.

  • Chapter 4: Understanding Anchor Macros

    • Objective: Learn Anchor macros (e.g., #[program]).

    • Monaco Task: Write a program skeleton with macros (e.g., #[program] mod my_program {} ).

    • Validation: Syntax validation.

  • Chapter 5: Writing a Simple Anchor Program

    • Objective: Build a basic Anchor program.

    • Monaco Task: Write a deposit function (e.g., pub fn deposit(ctx: Context<Deposit>, amount: u64) -> Result<()> { Ok(()) }).

    • Validation: Syntax check or send to a remote server for compilation feedback.


Lesson 3: Accounts and Data Management

  • Chapter 1: Introduction to Accounts in Solana

    • Objective: Understand accounts.

    • Monaco Task: No coding; conceptual content.

  • Chapter 2: Using Accounts in Anchor

    • Objective: Define accounts.

    • Monaco Task: Write an account struct (e.g., #[account] pub struct User { balance: u64 }).

    • Validation: Syntax check.

  • Chapter 3: Managing Data with Structs and Enums

    • Objective: Use custom data types.

    • Monaco Task: Define a struct (e.g., pub struct Profile { name: String, age: u8 }).

    • Validation: Syntax validation.

  • Chapter 4: Serializing and Deserializing Data

    • Objective: Learn serialization.

    • Monaco Task: Write a function to simulate serialization (e.g., mock output of serialized data).

    • Validation: Simulated result display.

  • Chapter 5: Implementing Account Constraints

    • Objective: Add constraints.

    • Monaco Task: Define an account with constraints (e.g., #[account(mut)] pub user: Account<User>).

    • Validation: Syntax check.


Lesson 4: Instructions and Processing

  • Chapter 1: What are Instructions?

    • Objective: Understand instructions.

    • Monaco Task: No coding; read-only content.

  • Chapter 2: Defining Instructions in Anchor

    • Objective: Write instructions.

    • Monaco Task: Create an instruction (e.g., pub fn increment(ctx: Context<Increment>) -> Result<()> { Ok(()) }).

    • Validation: Syntax validation.

  • Chapter 3: Processing Instructions

    • Objective: Process data.

    • Monaco Task: Implement logic (e.g., ctx.accounts.counter.value += 1;).

    • Validation: Syntax check and simulated state change.

  • Chapter 4: Handling Errors

    • Objective: Manage errors.

    • Monaco Task: Add error handling (e.g., if amount <= 0 { return Err(MyError::InvalidAmount.into()) }).

    • Validation: Syntax check.

  • Chapter 5: Testing Instructions

    • Objective: Simulate testing.

    • Monaco Task: Write a test case (e.g., mock a call to increment).

    • Validation: Simulated pass/fail result.


Lesson 5: Program-Derived Addresses (PDAs)

  • Chapter 1: Introduction to PDAs

    • Objective: Learn about PDAs.

    • Monaco Task: No coding; conceptual content.

  • Chapter 2: Generating PDAs with Anchor

    • Objective: Define PDAs.

    • Monaco Task: Write a PDA account (e.g., #[account(seeds = [b"vote"], bump)] pub vote: Account<Vote>).

    • Validation: Syntax check.

  • Chapter 3: Using PDAs for Data Storage

    • Objective: Store data with PDAs.

    • Monaco Task: Initialize a PDA (e.g., pub fn init_vote(ctx: Context<InitVote>) -> Result<()> { Ok(()) }).

    • Validation: Syntax validation.

  • Chapter 4: Signing with PDAs

    • Objective: Use PDAs as signers.

    • Monaco Task: Write a signing function (e.g., mock a PDA signature).

    • Validation: Syntax check.

  • Chapter 5: Practical Applications of PDAs

    • Objective: Build a voting system.

    • Monaco Task: Implement a voting instruction (e.g., pub fn vote(ctx: Context<Vote>) -> Result<()> { Ok(()) }).

    • Validation: Syntax check and simulated result.


Lesson 6: Cross-Program Invocations (CPIs)

  • Chapter 1: What are CPIs?

    • Objective: Understand CPIs.

    • Monaco Task: No coding; read-only content.

  • Chapter 2: Performing CPIs with Anchor

    • Objective: Write a CPI.

    • Monaco Task: Create a CPI call (e.g., let cpi_ctx = CpiContext::new(program_id, accounts);).

    • Validation: Syntax validation.

  • Chapter 3: Security Considerations for CPIs

    • Objective: Add security checks.

    • Monaco Task: Include checks (e.g., if !ctx.accounts.authority.is_signer { return Err(Error::NotSigner); }).

    • Validation: Syntax check.

  • Chapter 4: Integrating with SPL Tokens

    • Objective: Interact with tokens.

    • Monaco Task: Write a token transfer CPI (e.g., mock a transfer).

    • Validation: Simulated result.

  • Chapter 5: Building Composable Programs

    • Objective: Compose programs.

    • Monaco Task: Write a program calling another (e.g., mock a cross-call).

    • Validation: Syntax check.


Lesson 7: Building a Complete DApp

  • Chapter 1: Project Overview: Decentralized Marketplace

    • Objective: Introduce the project.

    • Monaco Task: No coding; conceptual content.

  • Chapter 2: Setting Up the Project

    • Objective: Explore structure.

    • Monaco Task: View a pre-configured project (read-only).

  • Chapter 3: Implementing the Backend with Anchor

    • Objective: Build backend logic.

    • Monaco Task: Write a list_item function (e.g., pub fn list_item(ctx: Context<ListItem>, price: u64) -> Result<()> { Ok(()) }).

    • Validation: Syntax check or remote compilation.

  • Chapter 4: Creating the Frontend with Web3.js

    • Objective: Connect to the program.

    • Monaco Task: Write JavaScript to call the program (e.g., program.rpc.listItem(price, { accounts: {...} });).

    • Validation: Syntax check and simulated transaction.

  • Chapter 5: Testing and Deploying the DApp

    • Objective: Test the DApp.

    • Monaco Task: Simulate a test (e.g., mock a marketplace transaction).

    • Validation: Simulated success/failure.


How It Works with Monaco

  1. Real-Time Syntax Validation: Integrate a lightweight Rust syntax checker or linter (e.g., a WASM-based tool) into Monaco to provide instant feedback on code correctness.

  2. Simulated Outputs: For tasks requiring execution (e.g., "Hello, Solana!" or instruction processing), display simulated results based on code validity, avoiding actual compilation or blockchain interaction.

  3. Remote Compilation (Optional): For more advanced validation, set up a backend server to compile and test Rust code. Users submit their code via Monaco, and the server returns errors or success messages.

  4. Pre-Configured Snippets: Provide read-only templates or partial code (e.g., Anchor project skeletons) to guide learners without requiring full project setup in the browser.

  5. Interactive Feedback: Like CryptoZombies, include hints, error explanations, and "Next" buttons that unlock when tasks are completed correctly.

Last updated