Arbitrum Stylus efficiency gains after 2.3 million Rust contracts

Arbitrum Stylus adds a WebAssembly (WASM) virtual machine to the existing Ethereum Virtual Machine (EVM) environment. This dual-VM architecture allows Rust, C, and C++ programs to coexist with Solidity. Developers write code in mainstream languages and compile it to WASM. The system routes calls to either the Nitro-geth runtime or the Stylus-Wasmer runtime based on a contract header. Because WASM compiles to native machine code for ARM or x86 architectures, it executes much faster than the interpreted bytecode of the EVM, which relies on a stack-based machine with a 1024 depth limit. This capability makes complex computations like on-chain chess engines or advanced cryptography viable. Unlike the EVM, which forces all operations into 256-bit words, WASM uses native 32 and 64-bit operations. This alignment with actual hardware allows for more efficient data processing. The architecture also utilizes a different instruction set approach. While the EVM is a stack-based machine, WASM provides a structured execution environment that handles instructions more efficiently. This structural difference helps avoid the arbitrary jumps that make EVM bytecode harder to optimize. The WASM component is not a replacement for the EVM but a complement to it. This architecture is an upgrade to Arbitrum Nitro, the tech stack powering Arbitrum One and Arbitrum Nova. The architecture uses "ink" as a computational cost unit, which is 1/10,000th of a gas unit. This finer granularity allows for more precise pricing for WASM operations.

The transition to WASM execution reduces costs for compute-heavy workloads. For memory-intensive tasks, the savings are massive. A 3.8 MB RAM allocation costs 32 million gas in the EVM, but Stylus handles this for only 64 thousand gas. For oracle workloads, RedStone reports significant savings. When processing 8 data feeds, the computation gas dropped from 161k in the EVM to 87k with Stylus. For a 2-feed scenario, the EVM requires 67k gas whereas Stylus uses only 39k. RedStone also noted that pure computation costs for the EVM were 35k plus 16k per feed, while Stylus was 23k plus 8k per feed. Cryptographic verification costs stay identical between environments, as the ECDSA cost is roughly 3k gas per feed per signer. Storage operations also cost the same across both VMs. However, users must pay a 114 million gas fee to activate a Stylus contract. Total transaction costs also depend on the parent-chain posting component and the child-chain execution component.

Feature EVM (Solidity) Stylus (WASM)
Max Contract Size 24 KB 96 KB
Memory Limit Restricted by gas 8 MB
Execution Speed Interpreted bytecode Near-native machine code
Compute Unit Gas Ink (1/10,000 gas)

The Rust SDK (v0.10.7) provides an ergonomic way to build contracts using the Alloy library. Developers use the stylus-sdk and cargo-stylus crates from the Cargo workspace. The workspace also includes stylus-proc for procedural macros, stylus-core for trait definitions, stylus-test for unit testing, and stylus-tools for deployment. This toolchain requires Rust 1.91.0 or later and the nightly toolchain. The SDK allows a single Rust crate to define types for both an offchain Axum API server and an onchain Stylus contract. The crate compiles as no_std + alloc for the contract and full std for the API server. This setup ensures the same type definitions and validation logic exist on both sides of the chain. Because the compiler enforces type safety, these definitions remain in sync. This eliminates the need to maintain separate TypeScript or Go definitions for a Solidity backend. If you are working with existing Rust backends, you can deploy the same logic onchain. Developers use macros like #[public], #[storage], and #[entrypoint] to structure their contracts. The stylus-test crate provides the TestVM framework, which allows developers to run unit tests without deploying to a blockchain.

Engineers use Stylus for scoring engines, validation pipelines, and compliance checks. A scoring engine implementation uses the I40F24 type to provide precise weighted arithmetic without floating-point issues. The scoring algorithm performs multiple passes over the rules and evaluates every pair of correlated factors through a series of complex decay calculations to ensure that every single execution remains precise and deterministic. This is a heavy workload of looping and math. Once a contract reaches deployment, the logic cannot change. This tamper-proof nature means partners can verify the code used for a score today is the same code used last quarter.

An on-chain chess engine demonstrates another use case. Developers can encode the entire chess board into a 256-bit integer and use an existing Rust crate for the engine logic. This bypasss the gas limits that usually prevent such high-computation tasks in Solidity. The lifecycle of a program involves coding, compilation, activation, execution, and proving. After coding, the developer compiles the code to WASM and posts it onchain. The contract then requires activation via the ArbWasm precompile. During activation, Arbitrum nodes lower the WASM to native machine code. This step includes gas metering and depth-checking to ensure safe execution. However, the implementation adds engineering complexity. Stylus is a second, fully interoperable VM. This adds an additional audit burden for conservative teams. One specific drawback is the activation cost. The 114 million gas fee makes small, single-use computations expensive. Withdrawals to Ethereum take about one week. The 6.4 day dispute window for Arbitrum One creates liquidity delays. The verdict: Stylus effectively bridges the gap between high-performance backend engineering and blockchain verifiability. Will the current 96 KB limit suffice as developers port larger C++ libraries?

Newsletter