Arbitrum Stylus logo

Stylus by Example

Hello World

Learn how to use the console output

Bytes In, Bytes Out

Learn about the basic entrypoint model

First App

Simple counter contract that defines a count value in storage that can be incremented

Primitive Data Types

Learn about booleans, integers, and addresses

Storage Data Types

Defines the basic state variables used in Arbitrum Stylus Rust smart contracts and how they can be used to store and retrieve state from the VM.

Variables

Learn about local, state, and global variables

Constants

How to define constant values in your contract

Mapping

Learn about the mapping data structure

Arrays

A simple arrays example in stylus

Events

Log public events to the blockchain

Call

Call other contracts on Rust Stylus smart contracts

Errors

Errors on Stylus Rust smart contracts

Test

Test on Stylus Rust smart contracts

Sending Ether

Sending Ethers on Stylus Rust smart contracts

Function selector

Compute the encoded function selector of a contract's function

Verifying Signature

An explanation of how to verify a signature signed off chain.

Inheritance

Inheritance in the Stylus Rust SDK

Import interfaces

Import external contract interfaces

Export contract interface

Export the Solidity ABI interface of your Rust contract

VM affordances

Accesing VM affordances in the Stylus Rust SDK

ABI Encode

A simple solidity ABI encode and decode example

ABI Decode

A simple solidity ABI encode and decode example

Hashing with keccak256

A simple solidity ABI encode and decode example

Functions

Learn about function parameters, return types, and visibility