Arbitrum Stylus Explained: How Stylus Makes Your Rollup a Destination for Developers

Stylus enables developers to write smart contracts in Rust, C, C++, and other programming languages that compile down to WASM, in addition to Solidity.

Arbitrum Stylus Explained: How Stylus Makes Your Rollup a Destination for Developers

In order for crypto to evolve, we need to empower more developers to build more high-performance apps onchain. That’s exactly what Arbitrum Stylus does.

Stylus is an upgrade that brings WebAssembly (WASM) into the Arbitrum ecosystem. Stylus enables developers to write smart contracts in Rust, C, C++, and other programming languages that compile down to WASM, in addition to the traditional EVM language of Solidity

By leveraging programming languages more widely favored in the web2 world, Stylus grows the number of potential onchain developers by millions. And, due to efficiencies in how WASM code runs compared to Solidity, Stylus chains can enable faster transaction times, lower gas fees, and more complex applications. 

Below, we’ll explain more about how Stylus works, why it’s a game changer for rollups, and how Conduit makes it easy to implement on your chain.

How Arbitrum Stylus works

At its core, Stylus introduces a second WASM-based virtual machine, or WASM VM, that runs alongside the Ethereum Virtual Machine (EVM). Arbitrum has dubbed this the MultiVM paradigm.

Just as the EVM compiles Solidity code into EVM bytecode that it can execute, the WASM VM compiles, Rust, C, C++, and other compatible languages down to WASM, and executes those. While Rust is currently the most deeply supported language on Stylus, with a robust Rust SDK available now, similar support for other languages is on the way. Ultimately, developers can use Stylus to write smart contracts in any WASM-compatible language they like, and Arbitrum invites developers to contribute libraries for their favorite languages. 

The MultiVM framework allows smart contracts written in both Solidity and WASM languages to interact seamlessly. Developers can utilize all supported languages flexibly — for instance, a smart contract written with Solidity can call a Rust program, and vice versa. That’s a huge value add considering the depth of both ecosystems. For instance, many Rust crates contain crypto libraries with no equivalent implementation in Solidity. All of those will now be interoperable with OpenZeppelin’s Solidity smart contract libraries, plus libraries in all other WASM languages Stylus supports. The ability to mix and match existing functionality from so many rich languages will unlock new onchain use cases. 

Stylus also makes it possible for apps to consume RAM more efficiently on the blockchain and execute faster due to WASM’s superior memory optimization. While EVM has strict limitations on memory use, WASM’s architecture significantly improves smart contracts’ ability to handle temporary data. The resulting performance enhancements make it possible to run larger, more complex computations onchain, enabling previously infeasible application use cases through faster contract executions, lower gas fees, and more performant use of memory. For example, Renegade is using Stylus to verify zero-knowledge proofs onchain, enabling it to run a DEX on Arbitrum One free of user-unfriendly MEV tactics like frontrunning. 

Finally, Stylus also improves security against reentrancy attacks. Reentrancy can be difficult to protect against in Solidity programs, as modifications like reentrancyGuard are difficult to implement and not foolproof. But WASM’s memory and execution model allow Stylus to offer cheap reentrancy detection. Stylus’ Rust SDK library also comes with reentrancy disabled by default, though developers can opt out of that protection if they so choose.

Stylus is possible due to Arbitrum’s fraud-proving framework, which uses WASM to replay onchain transactions during disputes of the network state. That framework enables Arbitrum to prove the validity of any program that compiles to WASM.

What Stylus means for rollups

Arbitrum Orbit rollups that implement Stylus stand to gain a significant competitive advantage. For one, Stylus’ support for smart contracts written in popular WASM-compatible languages lets rollups tap into a deeper developer talent pool. That, combined with Stylus’ performance improvements can allow rollups with Stylus to support a larger, more robust ecosystem of onchain apps.

Stylus’ improved performance and scalability enables rollups to lower gas fees and improve execution times for many existing onchain functionalities, improving user experience. But new use cases are also possible. Stylus can support more data-intensive onchain apps — generative art, cryptography, bigger games, and other compute-heavy use cases are now within reach. All of these things can make your chain more attractive to users.

How Conduit helps rollups get the most out of Stylus

Conduit has supported Stylus for rollup developers since the feature was in testnet. Now that Stylus is on mainnet, Conduit is providing Stylus access by default to all new Arbitrum Orbit rollups our users deploy. Already-deployed Conduit rollups on Arbitrum Orbit can also work with us to add Stylus support now.

Conduit also allows rollups to maximize Stylus’ power. We power the highest-performing Arbitrum Orbit rollups, such as the chains behind Proof of Play’s Pirate Nation game, which already achieves gas usage highs of over 65 Mgas/s. Arbitrum Orbit rollups powered by Conduit that implement Stylus will be able to achieve even higher performance, break barriers for onchain compute, and push the boundaries or rollup performance. 

For those reasons, Conduit rollups are notable amongst the earliest adopters of Stylus. One example is Superposition, the first DeFi-native L3 built with Stylus. Currently in testnet, Superposition provides an onchain orderbook, faster execution, zero fees and several other innovative features targeted at traders. Longtail, an AMM built on Superposition, provides a trading experience 4-5x cheaper than other DEXs on Arbitrum, thanks to a novel use of Rust for better storage, all enabled by Stylus. We’re excited for Superposition to hit mainnet, and expect several other Conduit rollups on Stylus to follow suit soon after. 

Do you want a rollup running Stylus as soon as possible? Contact us here to get started.