What makes Stylus different

Arbitrum Stylus is a new execution environment that runs alongside the existing EVM on the Nitro stack. While the EVM relies on Solidity and Vyper, Stylus allows developers to write smart contracts in languages that compile to WebAssembly (WASM), such as Rust, C, and C++. This addition doesn't replace Ethereum compatibility; it expands the toolkit available to builders on an optimistic rollup.

For developers migrating from Web2, this shift is significant. The EVM has always been a specialized environment, but Stylus brings the broader Rust and C++ ecosystems to smart contract development. This means you can leverage familiar libraries, tooling, and performance characteristics that you likely already use in traditional backend development. It bridges the gap between legacy codebases and decentralized applications without requiring a complete rewrite in Solidity.

The primary advantage is performance. WASM-based contracts generally execute faster and with lower gas costs than their EVM counterparts for compute-heavy tasks. This makes Stylus particularly attractive for applications that require complex logic, such as high-frequency trading protocols or data-intensive oracle networks. By offloading heavy computation to Stylus, you can keep the EVM focused on its strengths: secure value transfer and simple state management.

Stylus vs. EVM feature comparison

Choosing between the standard Ethereum Virtual Machine (EVM) and Arbitrum Stylus comes down to what you need to build. The EVM is the established standard, running on Solidity or Vyper. Stylus introduces a new layer on top of Arbitrum’s Nitro technology, allowing you to write smart contracts in languages like Rust, C, and C++ that compile to WebAssembly (WASM).

For developers migrating from Web2, this distinction matters. If you need broad compatibility with existing Ethereum tooling, the EVM is the safer bet. If you require high-performance computations or want to reuse existing Rust or C++ libraries, Stylus offers a significant advantage. The table below breaks down the technical differences that affect your daily workflow.

FeatureEVM (Solidity/Vyper)Stylus (Rust/C++)Why It Matters

Tooling and testing in the Stylus ecosystem

Arbitrum Stylus introduces a parallel development track alongside the traditional EVM. Instead of compiling to EVM bytecode, Stylus programs compile to WebAssembly (WASM). This shift allows developers to use languages like Rust, C, and C++, leveraging existing ecosystems of libraries and tools that have matured over decades. For developers migrating from Web2, this means accessing a vast array of pre-built utilities without reinventing the wheel.

The Rust SDK and Nitro integration

The official Stylus SDK is built on top of Alloy, a collection of crates empowering the Rust Ethereum ecosystem. It provides the necessary bindings to interact with the Nitro stack, Arbitrum’s underlying technology. Developers write standard Rust code, which is then compiled into WASM modules. These modules are deployed to the chain and executed by the Nitro VM, which handles the translation between WASM and the EVM environment where necessary.

This approach offers significant performance benefits. WASM execution is generally faster and more efficient than EVM bytecode interpretation, allowing for more complex logic at a lower gas cost. The SDK simplifies this process, offering CLI tools for building, testing, and deploying contracts directly to Arbitrum chains.

Testing with Motsu

Testing is critical in Web3 development, and Stylus provides specific frameworks to handle its unique environment. Motsu is a testing framework designed specifically for Stylus contracts. It provides a Solidity-like testing experience for Rust-based developers, making it easier to write unit tests that mimic the behavior of traditional EVM environments.

Badge text="Motsu provides a Solidity-like testing experience for Rust-based Stylus contracts."

Motsu allows developers to simulate transaction execution, state changes, and contract interactions within a controlled local environment. This reduces the friction of debugging and ensures that contracts behave as expected before deployment. For teams accustomed to EVM testing tools like Hardhat or Foundry, Motsu offers a familiar workflow adapted for the WASM context.

The learning curve for Web2 developers

For Web2 developers, the transition to Stylus is often smoother than to pure EVM development. Rust’s strict type system and memory safety features align well with Web2 engineering practices, reducing the likelihood of common vulnerabilities like reentrancy attacks. However, the learning curve involves understanding the differences between WASM and EVM execution models.

Developers must grasp how gas is measured in a WASM context and how the Nitro stack handles state transitions. While the Rust SDK abstracts much of this complexity, a solid understanding of blockchain fundamentals remains essential. The availability of comprehensive documentation and community resources helps bridge this gap, making Stylus an attractive option for teams looking to bring Web2 efficiency to Web3.

Frequently asked questions about Arbitrum Stylus

What is Stylus in Arbitrum? Stylus allows developers to write smart contracts in languages like Rust, C, and C++, which compile to WASM instead of EVM bytecode. This approach lets you leverage existing Web2 libraries and tooling while maintaining full compatibility with the Arbitrum Nitro stack.

What is the main purpose of Arbitrum? Arbitrum is an Ethereum layer-2 scaling solution designed to improve speed, scalability, and cost-efficiency. By using optimistic rollups, it processes transactions off-chain and posts proofs to Ethereum, offering significantly higher throughput and lower fees than the base layer.

What are the risks of using Arbitrum? As an L2, Arbitrum inherits Ethereum’s security model but introduces its own complexities. These include potential bridge risks when moving assets between L1 and L2, and the reliance on sequencer availability. Developers should also consider the maturity of the WASM ecosystem compared to the established EVM environment.