Using Stylus CLI
Get started with Stylus CLI, a Rust toolkit for developing Stylus contracts
This guide will get you started with cargo stylus a CLI toolkit that helps developers manage, compile, deploy, and optimize their Stylus contracts efficiently.
This overview will help you discover and learn how to use cargo stylus tools.
Installing cargo stylus
cargo stylus is a plugin to the standard cargo tool for developing Rust programs.
Prerequisites
Installation
In your terminal, run:
cargo install --force cargo-stylusAdd WASM (WebAssembly) as a build target for the specific Rust toolchain you are using. The example below sets your default Rust toolchain to 1.91, as well as adding the WASM build target:
rustup default 1.91
rustup target add wasm32-unknown-unknown --toolchain 1.91You can verify the cargo stylus installation by running cargo stylus -V in your terminal, returning something like:stylus 0.10.7
Using cargo stylus
cargo stylus commands reference
For the complete list of cargo stylus commands, flags, defaults, and aliases, see the commands reference.
How-tos
| Topic | Description |
|---|---|
| Learn how to optimize WASM binaries | The cargo-stylus tool allows you to optimize WebAssembly (WASM) binaries, ensuring that your contracts are as efficient as possible. |
| Debug Stylus transactions | A guide to debugging transactions, helping you identify and fix issues. Gain insights into your Stylus contracts by debugging transactions. |
| Verify contracts | Ensure that your Stylus contracts are correctly verified. Step-by-step instructions on how to verify your contracts using cargo-stylus. |
| Run a Stylus dev node | Learn how to run a local Arbitrum dev node to test your Stylus contracts. |