Skip to main content

Installation

Requirementsโ€‹

Before you begin, you need to install the following tools:

Tool for installing all the Stylus essentials for development. Stylusup will install the latest stable versions of:

  • Rust (if not present) to provide the core programming environment.
  • cargo-stylus (latest version) a tool for creating and managing Stylus projects.
  • Adding WebAssembly support to compile Rust code for blockchain environments.
  • Optionally collecting and sending telemetry data to track installation statistics.
curl -s https://stylusup.sh/install.sh | sh

Alternatively: Install Rust and the Stylus CLI tool with Cargo:โ€‹

Install Rust:โ€‹

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Check the Rust installation guide for more information.

Install the Stylus CLI tool with Cargo:โ€‹

cargo install --force cargo-stylus cargo-stylus-check

Prerequisite:

  • cargo-stylus version ^0.6.1
  • rustc version match with packages/stylus/your-contract/rust-toolchain.toml

Set default toolchain match rust-toolchain.toml and add the wasm32-unknown-unknown build target to your Rust compiler:

rustup default 1.89
rustup target add wasm32-unknown-unknown --toolchain 1.89

You should now have it available as a Cargo subcommand:

cargo stylus --help

Setupโ€‹

For a simplified setup, Scaffold-Stylus offers a npx tool that guides you interactively through the setup:

npx create-stylus@latest

You will be presented with a series of prompts:

  • Project Name: Enter a name for your project, e.g., my-dapp-example.

Once the setup is complete, navigate to the project directory:

cd project-name

If you want to use extensions, you can add the -e flag followed by the extension name:

npx create-stylus@latest -e extension-name

For more information about available extensions and how to use them, check out the Extensions section


Alternative: Start from GitHubโ€‹

If you prefer, you can start by cloning the Scaffold-Stylus repository directly and running it locally. This gives you full access to all source code and configuration.

  1. Clone the repository and install dependencies:
git clone https://github.com/Arb-Stylus/scaffold-stylus.git
cd scaffold-stylus
yarn install
# Initialize submodules (required for Nitro dev node)
git submodule update --init --recursive