beginner

Hello Stylus

15 min
3 objectives
Welcome to Stylus! In this first challenge, you'll write your first Stylus smart contract that stores and retrieves a greeting message. Stylus allows you to write smart contracts in Rust that compile to WebAssembly and run on Arbitrum. This gives you access to Rust's powerful type system, memory safety, and performance while building decentralized applications. ## Your Task Create a simple contract that: 1. Stores a greeting message using `StorageString` 2. Has a getter function to retrieve the greeting 3. Has a setter function to update the greeting ## Key Concepts - The `#[storage]` macro defines your contract's state - The `#[external]` macro exposes functions to external callers - `StorageString` is a special type for storing strings efficiently on-chain

Learning Objectives

  • Understand basic Stylus contract structure
  • Use the #[storage] macro for state variables
  • Implement getter and setter functions
lib.rs

Click "Run Code" to validate your solution