A gentle introduction
A State Transition Function (STF) is a core mechanism in blockchain systems that defines how the system evolves from one state to another when transactions are processed. At its essence, the STF takes the current state of the blockchain–a comprehensive snapshot of account balances, smart contract data, and other ledger information–and an input (such as a transaction or a block of transactions) and deterministically computes the new state. This deterministic property is crucial because it ensures that all nodes in a decentralized network arrive at the same result when applying transactions, thereby maintaining consensus across the system.
With Arbitrum, the STF plays an even more pivotal role. Offchain transactions are executed in batches according to this function, with the STF periodically submitting a concise summary of changes to the parent chain. This approach leverages offchain computation to boost throughput and reduce gas costs while anchoring the process to Ethereum's robust security model. To safeguard against incorrect or malicious offchain execution, Arbitrum employs a challenge mechanism known as fraud proofs. If a dispute arises, the STF can be recomputed step-by-step onchain, enabling the network to verify the validity of the offchain computations and ensure that the errors or fraudulent behavior are detected and rectified.
Beyond these foundational aspects, the STF on the Arbitrum Nitro Stack closely mirrors Ethereum's STF in its overall structure but incorporates several key modifications to accommodate the unique requirements of the Arbitrum chain. Essentially, the function receives a sequence of ordered transactions as its input, applies a defined set of rules to these inputs, and produces a new final state that reflects all the updates from the batch of transactions.
With the introduction of Stylus, Arbitrum expands its execution model beyond the Ethereum Virtual Machine (EVM) by adding WebAssembly (WASM)–based smart contract execution. This enhancement allows high-performance smart contracts written in Rust, C, and C++ to run alongside traditional EVM contracts. The integration of 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.
In the following sections, we will explain what these inputs are and how Arbitrum nodes receive them. We will also discuss the rules implemented in the Arbitrum Nitro Stack's STF, highlighting the differences between how state transitions occur in Ethereum, Arbitrum, and Stylus-based execution environments. Stylus-specific execution tasks handled within ArbOS will be covered separately, focusing on host I/O operations, caching, and WASM memory management.