In the execution phase, a node (typically a validator or sequencer) takes a list of pending transactions from the mempool and executes them against the current state of the blockchain. This involves running the transaction's code—such as a smart contract function call or a simple token transfer—within a deterministic virtual machine like the Ethereum Virtual Machine (EVM). The output is a set of state transitions, which detail changes to account balances, contract storage, and event logs, before any changes are finalized.
Execution Phase
What is the Execution Phase?
The execution phase is the computational step in a blockchain's block production cycle where pending transactions are processed and their resulting state changes are calculated.
This phase is computationally intensive and must be deterministic, meaning that given the same initial state and transaction input, every honest node must compute the exact same resulting state. In architectures like Ethereum's post-merge consensus-execution split, this phase is handled by a dedicated execution client (e.g., Geth, Nethermind), which works in tandem with a consensus client (e.g., Prysm, Lighthouse). The execution client produces an execution payload, which contains the new state root and transaction receipts, for the consensus layer to package into a block.
The execution phase is distinct from and precedes the consensus phase, where validators agree on the canonical ordering and validity of the proposed block. Key outputs of execution, such as the state root and receipts root, are cryptographically committed to the block header, allowing other nodes to verify the correctness of the execution without re-running every transaction. This separation enhances network efficiency and scalability.
In optimistic rollups and zk-rollups, the execution phase occurs off-chain on a separate layer (L2). A sequencer processes transactions and produces a batch with a new state root. In optimistic systems, this result is assumed valid unless challenged (with fraud proofs), while in zk-rollups, a zero-knowledge proof (validity proof) is generated during execution to cryptographically verify the state transition's correctness before posting data to the main chain (L1).
Understanding the execution phase is critical for developers, as it directly impacts gas costs, transaction ordering (MEV), and smart contract performance. Errors in contract logic are manifested here, and the deterministic nature ensures that all nodes can independently validate the network's state, maintaining blockchain integrity without a central authority.
How the Execution Phase Works
The execution phase is the computational core of a blockchain transaction, where the state-changing logic of a smart contract or transfer is deterministically processed.
The execution phase is the computational step in a blockchain transaction where the intent of a user's transaction—such as a token transfer, a swap on a decentralized exchange, or a complex DeFi interaction—is processed and applied to the global state. It follows the initial validation and precedes final settlement. During this phase, the Ethereum Virtual Machine (EVM) or another blockchain's execution environment interprets the transaction's data and code, performing calculations, reading from storage, and determining the precise changes to account balances, contract storage, and event logs. This phase is where the actual business logic of a smart contract is run.
Execution occurs within a sandboxed environment defined by the transaction's parameters: the gasLimit, gasPrice, recipient address (to), value, and calldata. The EVM executes opcodes sequentially, each consuming a predefined amount of gas. Key operations include reading from SLOAD, writing with SSTORE, performing arithmetic, and making external calls via CALL or DELEGATECALL. The phase produces an execution trace, a detailed log of every computational step, and a resultant state diff—the set of changes to the blockchain's world state that will be committed if the transaction is valid and does not run out of gas.
A critical outcome of the execution phase is the determination of the gas used and the transaction's success or failure status. If execution completes successfully within the gas limit, the computed state changes are considered valid and are passed to the consensus layer for finalization. If execution fails due to an error (e.g., a failed require() statement) or exhausts the provided gas, all state changes from that execution are reverted, but the sender still pays for the gas consumed up to that point. This revert-and-charge mechanism prevents resource abuse while ensuring atomicity—transactions either succeed completely or have no net effect on state, aside from the gas fee.
Key Features of the Execution Phase
The execution phase is where a blockchain's state is deterministically updated by processing a block of transactions. This involves running smart contract code, validating logic, and computing state changes.
State Transition Function
The core mechanism of execution. It takes the pre-state root, a block of transactions, and the block header as inputs to compute a new, valid post-state root. This function is deterministic, meaning the same inputs always produce the same output, ensuring network consensus.
Gas and Resource Accounting
Every computational step (opcode) and storage operation consumes gas. The execution layer tracks this consumption in real-time, halting execution with an 'out of gas' error if the transaction's gas limit is exceeded. This prevents infinite loops and allocates network resources fairly.
EVM Opcode Execution
For Ethereum and compatible chains, execution involves the Ethereum Virtual Machine (EVM) sequentially processing opcodes from transaction calldata. This includes:
- Arithmetic and logical operations
- Reading from and writing to storage
- Making external calls to other contracts
- Accessing block context (e.g.,
block.number)
Transaction Validation & Prechecks
Before state changes, the execution layer performs critical validation:
- Verifying the transaction signature and nonce
- Ensuring the sender's balance covers the gas limit * gas price + value
- Checking the transaction is properly formatted (EIP-1559 base fee, etc.)
Access Lists and State Access
To optimize execution, transactions can include an access list (EIP-2930) specifying which storage slots and addresses will be accessed. This allows clients to warm up these locations, reducing gas costs and enabling more efficient parallel execution in future upgrades.
Post-Execution State Root
The final output of the phase. After all transactions are processed, the execution client computes a cryptographic hash (a Merkle-Patricia Trie root) representing the entire new state of accounts, balances, and contract storage. This root is included in the block header for verification by consensus clients.
The Role of the EntryPoint Contract
The EntryPoint contract is the central, trustless, and upgradeable singleton that orchestrates the execution phase of ERC-4337 account abstraction, validating and executing UserOperations from smart contract wallets.
The EntryPoint contract is the mandatory, singleton smart contract that acts as the trusted verifier and executor for all ERC-4337 UserOperations. Its primary role in the execution phase is to receive bundled operations from Bundlers, validate them against a set of global rules (e.g., signature and nonce verification), and then coordinate the actual execution of transactions on behalf of smart accounts. By centralizing this logic, it ensures a consistent security model and prevents wallet implementations from bypassing critical checks, making the entire system more secure and gas-efficient for the network.
During execution, the EntryPoint performs a strict, two-phase process: verification and execution. In the verification loop, it calls validateUserOp on each smart account to confirm the UserOperation's validity and that the account has prefunded the EntryPoint for its maximum possible gas costs. Only after all operations in a batch pass verification does the execution loop begin. Here, it calls execute (or similar) on the account contract, transferring the required gas and executing the intended logic. This separation prevents denial-of-service attacks and ensures accounts cannot execute without first proving they can pay.
A critical function of the EntryPoint is gas abstraction and reconciliation. It acts as a gas bank, using the prefunded deposits to pay for the execution. After execution, it calculates the actual gas used, refunds any unused amount to the account's deposit, and compensates the Bundler for the transaction's inclusion cost. This mechanism decouples payment from the native token of the chain, allowing sponsors or the accounts themselves to pay fees in any asset the wallet supports, a core feature of the paymaster system integrated into this phase.
The singleton, upgradeable nature of the EntryPoint is essential for ecosystem-wide upgrades and security fixes. Because all ERC-4337 compliant wallets and infrastructure must interact with the official EntryPoint, improvements or critical patches can be deployed once and benefit the entire ecosystem without requiring users to migrate their smart accounts. This design also simplifies auditing and monitoring, as the security of the execution phase converges on a single, heavily scrutinized contract, rather than being distributed across countless wallet implementations.
Actors Involved in Execution
The execution phase of a blockchain transaction involves a coordinated set of specialized participants who validate, process, and finalize the transaction's state changes. These actors are distinct from the consensus layer and are responsible for the computational work.
User / Sender
The entity that initiates a transaction by creating and signing a transaction object. The user specifies:
- Recipient address and value (for transfers)
- Calldata (for smart contract interactions)
- Gas limit and max fee parameters
- A digital signature to authorize the transaction
Execution Client (Node)
Software (e.g., Geth, Erigon, Nethermind) that runs the Ethereum Virtual Machine (EVM). Its core responsibilities are:
- Transaction Validation: Verifies signatures, nonces, and balances.
- State Execution: Computes the new state by running the EVM.
- Gas Accounting: Tracks and enforces gas consumption.
- Block Construction: For proposers, it builds the execution payload.
Block Builder (Proposer)
A specialized actor that constructs the contents of a block (the execution payload). Builders aggregate transactions from the mempool to maximize value (e.g., through MEV). In Ethereum's PBS (Proposer-Builder Separation), the builder role is distinct from the consensus validator. Builders produce blocks containing:
- An ordered list of transactions
- The resulting state root
- Gas used and logs bloom
Validator (Consensus Client)
While primarily a consensus actor, the validator is critical for execution finality. After a block is proposed, validators on the consensus layer:
- Receive the execution payload from the proposer.
- Attest to the validity of the block's header and execution payload.
- Do not re-execute transactions; they trust the execution client's proof of validity.
Mempool / Transaction Pool
A network-wide, peer-to-peer repository of pending transactions broadcast by users. It is not a single actor but a critical system component where:
- Transactions await inclusion in a block.
- Builders and sequencers (on L2s) select and order transactions.
- Basic checks (signature, nonce) are performed to prevent spam.
Sequencer (L2-Specific)
A central actor in Optimistic and many ZK Rollups responsible for transaction execution and ordering. The sequencer:
- Receives user transactions.
- Executes them in its local EVM instance.
- Creates batches or rollups of transaction data.
- Posts compressed data and state commitments to L1. It provides fast, low-cost pre-confirmations to users.
Execution Phase vs. Validation Phase
A comparison of the two primary phases in a modular blockchain's block production pipeline, highlighting their distinct roles, responsibilities, and technical characteristics.
| Feature / Responsibility | Execution Phase | Validation Phase |
|---|---|---|
Primary Role | Transaction execution and state computation | State transition verification and fraud/validity proofs |
Core Activity | Runs smart contract code, updates the state trie | Re-executes transactions to verify the proposed state root |
Key Output | Proposed new state root and transaction receipts | Attestation of validity or a fraud proof challenge |
Node Type | Execution Client (e.g., Geth, Reth) | Full Node or Verifier Node |
Resource Intensity | High (requires significant CPU/RAM) | Lower (optimized for verification) |
Data Dependency | Requires full transaction data and current state | Requires state differences, proofs, and block headers |
Architectural Paradigm | Monolithic (bundled) or Modular (separated) | Inherently modular, often a separate layer |
Failure Consequence | Produces an invalid block | Allows an invalid block to be finalized |
Security & Reliability Considerations
The execution phase is where transaction logic runs and state changes are computed. This critical stage must be secure, deterministic, and resistant to manipulation to ensure network integrity.
Gas & Resource Management
Gas is a unit measuring computational work. Each opcode has a fixed gas cost. This system prevents infinite loops and DoS attacks by requiring users to pay for execution. Key mechanisms include:
- Gas Limit: The maximum gas a user is willing to spend.
- Gas Price: The fee per unit of gas, paid to validators.
- Out-of-Gas Error: Execution halts if gas is exhausted, reverting state changes but still charging for consumed gas.
Deterministic Execution
Every node must compute identical state transitions from the same inputs. Non-deterministic operations (e.g., random number generation without an oracle, system time calls) are prohibited in smart contract opcodes. This ensures consensus on the post-execution state across all network participants, which is fundamental to blockchain reliability.
State Reversion & Exception Handling
Failed transactions must revert cleanly. The EVM uses an exception model where runtime errors (e.g., failed assertions, out-of-gas) trigger a full state reversion, rolling back all changes. Only the gas used up to the failure point is charged. This prevents partial state corruption but introduces risks like reentrancy if state changes are applied before external calls.
Sandboxing & Isolation
The execution environment is sandboxed. Smart contracts run in an isolated virtual machine (e.g., EVM, WASM) with no direct access to the host system's files, network, or other processes. This containment limits the blast radius of a malicious or buggy contract, protecting the node's underlying infrastructure and other contracts from direct interference.
Frontrunning & MEV
The public visibility of transactions in the mempool before execution allows for Maximal Extractable Value (MEV) exploitation. Searchers and validators can reorder, insert, or censor transactions to extract value, often through frontrunning or sandwich attacks. This compromises user fairness and can increase costs. Solutions include encrypted mempools and commit-reveal schemes.
Oracle Reliability
Smart contracts relying on external data via oracles introduce a critical dependency. A faulty or manipulated oracle providing incorrect price feeds, randomness, or event data can lead to incorrect execution and financial loss. Security considerations include using decentralized oracle networks, data attestations, and circuit breakers to mitigate single points of failure.
Common Misconceptions
Clarifying frequent misunderstandings about the execution phase of a blockchain transaction, where smart contract code is actually run and state changes are computed.
No, the execution phase is distinct from transaction finality. Execution refers to the deterministic computation of a transaction's outcome—running smart contract code and calculating state changes—within a single block. Finality is the subsequent, irreversible confirmation that this block and its executed transactions are permanently part of the canonical chain, which may require multiple block confirmations depending on the consensus mechanism (e.g., Ethereum's 12-15 blocks for probabilistic finality). Execution happens once per block proposal; finality is a property achieved over time by the network.
Ecosystem Implementation
The execution phase is the core computational stage of a blockchain transaction, where the state changes specified by a transaction are deterministically computed and validated. This section details the key components and mechanisms that make this phase possible.
Transaction Execution
This is the process of applying a signed transaction to the current blockchain state. It involves several sequential steps:
- Validation: Checking signature, nonce, and sufficiency of the sender's balance for gas and value.
- Gas Prepayment: Deducting the maximum gas fee (
gasLimit * gasPrice) from the sender's account. - State Transition: The EVM processes the transaction logic, updating account balances, storage, or contract code.
- Gas Refund: Unused gas is refunded to the sender, while used gas is paid to the block proposer.
Gas & Fee Markets
Gas is the unit measuring computational work, while gas fees are the payments for that work. This system creates a market for block space.
- Base Fee: A protocol-determined, algorithmically adjusted fee burned with each transaction (EIP-1559).
- Priority Fee (Tip): An optional tip paid to the validator to incentivize inclusion.
- Fee Markets: Users bid via tips during times of high network congestion, creating a dynamic pricing mechanism for execution priority.
State Access & Storage
During execution, smart contracts read from and write to the blockchain's global state. Efficient management is critical for performance and cost.
- Account Storage: Persistent key-value store unique to each smart contract, accessed via
SSTOREandSLOADopcodes. - Warm/Cold Access: EIP-2929 introduced gas cost distinctions to optimize for frequent (warm) vs. first-time (cold) storage accesses.
- State Trie: The entire global state is stored in a modified Merkle Patricia Trie, allowing for efficient cryptographic verification of state roots.
Parallel Execution
A performance optimization where multiple transactions are processed simultaneously, significantly increasing throughput.
- Conflict Detection: The system identifies transactions that access disjoint sets of state (e.g., different accounts) and executes them in parallel.
- EVM-Level: Implementations like Block-STM (used by Aptos, Sui) or Ethereum's proposed Path-Based approach reorder and execute transactions optimistically, resolving conflicts after the fact.
- Benefit: Dramatically improves transactions per second (TPS) without compromising decentralization or security assumptions.
Frequently Asked Questions
The execution phase is the computational core of a blockchain transaction, where the state of the network is actually changed. These questions address its mechanics, components, and significance.
The execution phase is the part of the Ethereum block production process where transactions are processed, smart contract code is run, and the global state is updated. It follows the consensus layer's selection of a block proposal. During this phase, the Ethereum Virtual Machine (EVM) executes the operations specified in each transaction, consuming gas and modifying data in accounts, contract storage, and balances. The output is a new state root, which is a cryptographic commitment to the entire network state after applying all transactions in the block.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.