A gentle introduction
A State Transition Function (STF) determines how blockchain systems change state when processing transactions. The STF takes the current blockchain state (account balances, smart contract data, and ledger information) and an input (transaction or block) to compute the new state deterministically. This deterministic property ensures all network nodes reach the same result, maintaining consensus.
With Arbitrum, the STF plays an even more pivotal role. Arbitrum executes transactions offchain in batches, periodically submitting summaries to the parent chain. This approach leverages offchain computation to achieve higher throughput and lower gas costs while maintaining Ethereum's security. To safeguard against incorrect or malicious offchain execution, Arbitrum employs a challenge mechanism called fraud proofs. If a dispute arises, the STF can be recomputed step-by-step onchain, enabling the network to verify the validity of offchain computations and ensure that errors or fraudulent behavior are detected and rectified.
The Arbitrum Nitro Stack STF mirrors Ethereum's STF with key modifications for Arbitrum chain requirements. The function processes ordered transactions and outputs the updated state from the transaction batch.
Stylus expands Arbitrum's execution model beyond the Ethereum Virtual Machine (EVM) by adding WebAssembly (WASM)–based execution, allowing high-performance contracts in Rust, C, and C++ to run alongside traditional EVM contracts. The integration The Stylus introduces several modifications to the STF, including:
Stylus-specific transaction processing
A modified version of Geth that recognizes and processes Stylus transactions, ensuring proper inclusion in state transitions.
Execution in a WASM runtime
Stylus transactions execute in ArbOS's WASM runtime instead of the EVM, enabling faster execution and more efficient computation.
Stylus gas accounting and pricing
Unlike standard EVM transactions, Stylus transactions introduce new gas pricing models that account for factors such as opcode pricing, host I/O operations, and Ink usage costs.
Interoperability with the EVM
Stylus contracts can interact seamlessly with Solidity contracts, enabling hybrid applications that leverage EVM and WASM execution environments.
These Stylus-related changes aim to maintain compatibility with Ethereum's execution model while introducing a more efficient, flexible, and scalable alternative for smart contract development.
The following sections cover STF inputs, node processing, and implementation rules, highlighting differences between Ethereum, Arbitrum, and Stylus execution environments. Stylus-specific execution tasks handled within ArbOS will be covered separately, focusing on host I/O operations, caching, and WASM memory management.