Smart Contract Masterclass
Learn Solidity and Solana by comparing with your CosmWasm implementation. An interactive course using the LocalMoney P2P trading protocol as a real-world example.
Course Overview
This masterclass teaches you smart contract development across three major blockchain platforms by using the LocalMoney protocol - a P2P fiat-to-crypto trading system that you authored in CosmWasm.
Each module shows the same concept implemented in CosmWasm (your reference), Solidity/EVM, and Solana/Anchor side-by-side, highlighting key differences and patterns.
| Aspect | CosmWasm (Rust) | Solidity (EVM) | Solana (Anchor/Rust) |
|---|---|---|---|
| Language | Rust | Solidity | Rust (Anchor) |
| State Model | Key-value store with cw_storage_plus |
Contract storage slots | Account-based PDAs |
| Entry Points | instantiate, execute, query |
Functions with visibility modifiers | #[instruction] handlers |
| Cross-Contract | SubMessages & Queries | Direct calls & interfaces | CPI (Cross-Program Invocation) |
| Token Standard | CW20 / Bank module | ERC-20 | SPL Token |
| Upgradeability | Built-in migration | Proxy patterns (UUPS/Transparent) | Upgradeable authority |
Modules
Contract Foundations
Project structure, entry points, and basic contract anatomy across all three platforms.
State Management
How to define, store, and query state - from cw_storage_plus to Solidity mappings to Solana PDAs.
Messages & Instructions
How contracts receive and process inputs - ExecuteMsg vs functions vs Anchor instructions.
Escrow Implementation
Token custody patterns - Bank module, ERC-20 vaults, and SPL token accounts.
Trade Lifecycle
State machines, transitions, and dispute resolution across the protocol.
Security Patterns
Access control, reentrancy guards, circuit breakers, and platform-specific vulnerabilities.
Advanced Patterns
Upgradeability, cross-contract calls, fee distribution, and oracle integration.
LocalMoney Protocol Architecture
The LocalMoney protocol consists of interconnected contracts that work together to enable P2P trading:
Protocol Components
- Hub: Central configuration and registry for all contract addresses and protocol parameters
- Offer: Marketplace for buy/sell offers with filtering and pagination
- Trade: Manages the full trade lifecycle from creation to completion/dispute
- Escrow: Secure token custody with automated fee distribution
- Profile: User identity, reputation tracking, and encrypted contact info
- Price Oracle: Fiat currency price feeds for conversion calculations
- Arbitrator: Dispute resolution system with random arbitrator assignment
Getting Started
You should be comfortable with Rust and have written the CosmWasm contracts. Each module will use your existing code as the baseline for learning the other platforms.
Start with Module 1: Contract Foundations to understand how the basic structure of contracts differ across platforms.