arbitrum-stylus
Installation
SKILL.md
Arbitrum Stylus
Stylus is Arbitrum's second virtual machine — a WASM-based execution environment that runs alongside the EVM on Arbitrum One and Nova. Write smart contracts in Rust, C, or C++, compile to WASM, and deploy them to the same chain as Solidity contracts. Both VMs share the same state, so Stylus contracts can call Solidity contracts and vice versa through standard ABI-encoded calls.
What You Probably Got Wrong
LLMs trained before late 2024 carry stale assumptions about Stylus. These corrections are critical.
- Stylus is NOT a separate chain — Stylus contracts deploy to Arbitrum One (chain ID 42161) and Arbitrum Nova (42170). They share state, addresses, and the block space with EVM contracts. There is no "Stylus chain."
- Stylus contracts need activation after deployment — Deploying a WASM contract is a two-step process: (1) deploy the contract bytecode, (2) activate it by calling
ArbWasm.activateProgram(). Thecargo stylus deployCLI handles both steps, but if you deploy manually, you must activate separately. Unactivated contracts revert on every call. - Storage layout is EVM-compatible — Stylus uses the same 256-bit storage slots as Solidity.
StorageU256at slot 0 in Stylus is the same asuint256at slot 0 in Solidity. This enables proxy patterns and shared storage between Solidity and Stylus. - Gas is measured in "ink", not gas directly — Stylus WASM execution uses "ink" internally (1 gas = 10,000 ink by default). This finer granularity allows cheaper metering of WASM opcodes. You still pay in ETH gas from the user's perspective.
- You cannot use CREATE/CREATE2 from Stylus — Stylus contracts cannot deploy other contracts. Factory patterns must be implemented in Solidity. This is a fundamental limitation of the WASM VM.
- The SDK crate is
stylus-sdk, notarbitrum-sdk— The Rust crate isstylus-sdkon crates.io.arbitrum-sdkis the TypeScript SDK for cross-chain messaging (different thing entirely). sol_storage!is the old macro — As of stylus-sdk 0.6+, use#[storage]attribute and#[entrypoint]derive macro instead of the oldersol_storage!block. Both work, but the attribute-based API is the current standard.- No floating point in WASM contracts — The deterministic WASM environment disallows floating-point operations. Use fixed-point math (e.g.,
U256with scaling factors).