Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://www.rust-lang.org/learn

🟢 Beginner Projects (Focus: Language Basics & Ownership)

CLI Todo App

    Learn: Structs, enums, file I/O, ownership, CLI args.

    Use clap or structopt for parsing arguments.

    Why it helps: Solana programs don’t have GUIs — CLI tools are very common for managing them.

Simple Bank Ledger (in-memory)

    Learn: HashMaps, struct modeling, methods, basic error handling.

    Simulate deposits, withdrawals, and account balances.

    Why it helps: Prepares you to model account state like Solana smart contracts do.

Guessing Game

    Based on the Rust Book.

    Learn: Match statements, error handling, user input.

🟡 Intermediate Projects (Focus: Memory Management & Serialization)

Key-Value Store (like Redis-lite)

    Learn: File-based storage, serde for serialization, traits.

    Optional: Add a simple networking layer (tokio).

    Why it helps: Solana contracts work with serialized data (Borsh, JSON), and you'll need to model state carefully.

Mini Blockchain Simulator

    Build a block struct with hash, transactions, previous hash.

    Add basic proof-of-work (difficulty-based hashing).

    Learn: Hashing (sha2 or blake3), linked structs, data integrity.

    Why it helps: You simulate how blockchain state flows, relevant for understanding Solana’s architecture.

Multiplayer Tic-Tac-Toe (via UDP or JSON API)

    Learn: Networking (tokio, serde_json, warp or actix).

    Optional: Store game state in a file or memory.

    Why it helps: Simulates client-server logic — very useful for Solana off-chain programs.

🔵 Advanced Prep for Solana

Account State Manager

    Model accounts like Solana does: a struct with an ID, balance, and arbitrary data (owned by a "program").

    Simulate instruction parsing and execution.

    Learn: Custom types, ownership + borrowing with references, serialization (borsh or serde).

    Why it helps: Mimics how Solana accounts and instructions are structured.

Transaction Processor

    Create a simple “program” that processes an instruction (e.g., transfer tokens between accounts).

    Use enums to define instruction types.

    Why it helps: Directly maps to Solana’s CPI (cross-program invocation) and instruction dispatching logic.

Tooling to Practice Alongside

Cargo and Crates.io – Learn how to manage dependencies and publish crates.

Unit Testing – Write tests for every module you create; Solana heavily depends on test-driven development.

Linting & Formatting – Use clippy and rustfmt early.

Rust Learning Roadmap for Solana Blockchain

  1. Rust Fundamentals

    Syntax and basic data types: integers, floats, bool, char, tuples, arrays, slices

    Variables and mutability

    Functions and control flow: if, match, loops

    Ownership, borrowing, and references

    Structs and enums

    Pattern matching

  2. Memory Management

    Stack vs heap basics

    Ownership rules and borrowing (immutable & mutable references)

    Lifetimes and how Rust enforces them

    Smart pointers: Box, Rc, RefCell

    Why? Solana programs must be very efficient with memory and data passing.

  3. Error Handling

    Result and Option types

    Error propagation with ? operator

    Custom error types

    Panic vs recoverable errors

  4. Collections and Iterators

    Vectors, HashMaps, Strings

    Iterators and closures

    Option and Result combinators (map, and_then, etc.)

  5. Traits and Generics

    Defining and implementing traits

    Trait bounds and constraints

    Generics and type parameters

    Why? Solana’s Rust programs rely on generic programming for flexible instruction handling.

  6. Modules and Packages

    Crates, modules, and visibility

    Using Cargo for dependency management

    Writing documentation and comments

  7. Advanced Types

    Enums with data (algebraic data types)

    Option and Result enums in depth

    Tuples vs structs vs enums

  8. Macros and Attributes

    Declarative macros (macro_rules!)

    Attribute macros (e.g., #[derive()])

    Why? Macros reduce boilerplate in serialization and testing.

  9. Serialization and Deserialization

    Using serde and borsh

    Defining custom serializers

    Working with binary and JSON formats

    Why? Solana uses borsh for account data serialization.

  10. Concurrency and Asynchronous Programming

    Threads and std::thread basics

    Channels and message passing

    async / await syntax

    Popular async runtimes: tokio and async-std

    Why? Off-chain Solana programs and tooling often need async for networking.

  11. Testing

    Writing unit tests

    Integration tests

    Using mocks and test doubles

    Why? Blockchain code must be rigorously tested for security and correctness.

  12. Unsafe Rust (Optional but useful)

    Raw pointers

    FFI (Foreign Function Interface) basics

    When and why to use unsafe

    Why? Some blockchain internals or performance-critical code might use this.

  13. Profiling and Debugging

    Using cargo fmt, cargo clippy

    Debugging with println!, dbg!, and gdb or lldb

    Benchmarking with criterion crate

Optional Extras for Blockchain Prep:

Cryptography basics in Rust

    Hashing (SHA-256, Blake2, Keccak)

    Public-key cryptography basics (ed25519, secp256k1)

    Using Rust crates like ring, ed25519-dalek, sha2

Understanding low-level byte operations

    Bitwise operations

    Endianness

    Byte arrays and conversions

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages