EIP-2929: Increased Gas Costs for State Access
EIP-2929, introduced with the Berlin hard fork, modifies how gas costs are calculated for state access operations on Ethereum. It increases costs for the first time an address or storage slot is accessed within a transaction, while
Structure, readability, internal linking, and SEO metadata were automatically checked. This article is continuously updated and is educational content, not financial advice.
Definition
EIP-2929, or Ethereum Improvement Proposal 2929, represents a significant protocol change introduced with the Berlin hard fork. Its primary purpose is to adjust the gas costs associated with accessing the Ethereum state, specifically increasing the cost for certain operations when they are performed for the first time within a transaction. This modification aims to more accurately reflect the computational resources consumed by these operations and enhance the network's resilience against denial-of-service (DoS) attacks.
EIP-2929 is an Ethereum Improvement Proposal that increases the gas cost for the initial access of specific state elements (like storage slots or contract addresses) within a transaction, while subsequent accesses to the same elements become comparatively cheaper.
Key Takeaway
The core impact of EIP-2929 is a rebalancing of gas costs, making “cold” state accesses (the first time a specific state element is read or written in a transaction) significantly more expensive, while “warm” accesses (subsequent reads or writes to an already accessed element) are either cheaper or remain at their previous cost. This encourages developers to optimize smart contracts for efficient state access patterns and provides a more robust economic model for network resource usage.
Mechanics
Before the Berlin hard fork, the gas costs for operations like SLOAD (reading from storage) or CALL (interacting with another contract) were fixed, regardless of whether that specific storage slot or contract address had been accessed earlier in the same transaction. This fixed cost model did not fully account for the underlying computational and I/O overhead involved in fetching data from the Ethereum state tree for the first time. Each initial access requires traversing the Merkle Patricia Trie, which is a more resource-intensive operation than accessing data that has already been loaded into memory during the current transaction's execution.
EIP-2929 addresses this by introducing the concepts of “cold” and “warm” access. When an opcode attempts to access an address or a storage slot, the Ethereum Virtual Machine (EVM) first checks if that specific element has already been added to a transaction-specific set of accessed_addresses or accessed_storage_keys. If the element is not in these sets, it's considered a cold access, incurring a higher gas cost. The element is then added to the respective set. If the element is already present, it's a warm access, and a lower gas cost is applied. This mechanism ensures that the initial, more expensive retrieval of state data is paid for, while subsequent, cheaper accesses within the same transaction benefit from the data already being “cached” or readily available.
Specifically, the gas cost for SLOAD (reading a storage slot) increased from 800 gas to 2100 gas for a cold access. For warm accesses, the cost was reduced to 100 gas. Similarly, the gas costs for the CALL opcode family (CALL, CALLCODE, DELEGATECALL, STATICCALL), BALANCE, and the EXT* opcode family (EXTCODESIZE, EXTCODEHASH, EXTCODECOPY) were increased to 2600 gas for cold accesses. Warm accesses for these opcodes typically incur a cost of 100 gas. An important exemption applies to precompiled contracts, which are special contracts at fixed addresses (0x01 to 0x09) that execute complex cryptographic or utility functions more efficiently; accesses to these are not subject to the EIP-2929 cost increases. This differentiation is crucial because precompiles are fundamental to many cryptographic operations and are already highly optimized.
Trading Relevance
EIP-2929 significantly impacts the economics of interacting with the Ethereum blockchain, particularly for decentralized applications (dApps) and smart contracts. For users, this means that transactions involving contracts that perform many unique state accesses, especially across different contracts or numerous storage slots, will likely incur higher gas fees. This can affect the cost of operations like interacting with complex DeFi protocols, minting NFTs from new collections, or executing transactions that touch a wide array of contract states for the first time in a given block. Developers must now consider these gas cost implications when designing and optimizing their smart contracts. Contracts that frequently access the same storage slots or interact repeatedly with the same external contracts within a single transaction will benefit from the “warm” access discounts, leading to more efficient execution.
Conversely, contracts that were not designed with EIP-2929 in mind, particularly older, non-upgradeable contracts, might become more expensive to use. This could lead to a decrease in their usability or even render some operations economically unfeasible if the gas costs become prohibitively high. To mitigate this, EIP-2930, introduced alongside EIP-2929 in the Berlin hard fork, offers a solution: Access Lists. An access list allows a transaction sender to explicitly declare which addresses and storage slots their transaction intends to access. By pre-declaring these, the EVM can treat these specified accesses as “warm” from the outset, even if they would otherwise be “cold.” This feature provides a mechanism for users and wallets to optimize gas costs for legacy contracts without requiring contract modifications, effectively reducing the impact of EIP-2929's cold access penalties.
Risks
The introduction of EIP-2929 carries several risks, primarily centered around increased transaction costs and potential compatibility issues for existing smart contracts. For dApps that were deployed before the Berlin hard fork and rely on a large number of unique state accesses within a single transaction, the increased gas costs for cold accesses could make their operations significantly more expensive. This might lead to a degraded user experience, reduced adoption, or even render certain functionalities economically unviable. Developers of such contracts, if they are upgradeable, might need to refactor their code to minimize cold state accesses or encourage the use of EIP-2930 access lists.
Furthermore, the complexity introduced by the cold/warm access model can be a challenge for both developers and users. Developers need a deeper understanding of EVM execution and state access patterns to write gas-efficient code. Users, especially those interacting with older contracts, might face unexpectedly high gas fees if they are unaware of the EIP-2929 changes and do not utilize access lists. This could lead to confusion and frustration within the ecosystem. While EIP-2929 aims to improve network security and efficiency, the transition period and the need for adaptation present inherent risks related to economic disruption and potential fragmentation if parts of the ecosystem fail to adapt effectively.
History and Examples
EIP-2929 was formally introduced as part of the Berlin hard fork, which went live on the Ethereum mainnet on April 14, 2021. This hard fork was a significant network upgrade, bundling several Ethereum Improvement Proposals aimed at improving the network's efficiency, security, and economic model. The primary motivation behind EIP-2929 was to address long-standing concerns about the underpricing of state access operations, which made the Ethereum network vulnerable to denial-of-service (DoS) attacks. Attackers could craft transactions that repeatedly accessed different parts of the state tree, forcing nodes to perform expensive I/O operations for a relatively low gas cost, thereby slowing down the network.
A concrete example of EIP-2929's impact can be seen in a transaction that interacts with multiple distinct ERC-20 tokens. Before EIP-2929, if a transaction called balanceOf on ten different ERC-20 contracts, each CALL operation would incur a fixed gas cost. After EIP-2929, if these ten contracts had not been accessed previously in the transaction, each of the ten CALL operations would be a “cold” access, costing 2600 gas each, significantly higher than the previous cost. However, if the transaction then called balanceOf on one of those same ten contracts again, that second access would be “warm” and cost only 100 gas. This illustrates how the EIP incentivizes consolidating state accesses or using access lists. Another example is a complex DeFi strategy involving multiple swaps across different decentralized exchanges (DEXs) or interacting with various lending protocols. Each interaction with a new contract or a new storage slot within a contract would trigger a cold access, potentially increasing the overall transaction cost.
Common Misunderstandings
One of the most prevalent misunderstandings regarding EIP-2929 is that it represents a blanket increase in all Ethereum transaction gas costs. This is inaccurate. EIP-2929 does not uniformly raise the gas price for every operation; instead, it specifically targets and increases the cost of initial state accesses within a transaction. Transactions that primarily interact with already “warm” state elements, or those that are carefully optimized to minimize unique state accesses, might see minimal or even reduced overall gas costs due to the lower warm access fees. The increase is conditional, applying only when an address or storage slot is accessed for the first time in a given transaction's execution context.
Another common misconception is that EIP-2929 makes all older smart contracts unusable or prohibitively expensive. While it's true that some legacy contracts might incur higher gas costs due to their state access patterns, the introduction of EIP-2930 (Access Lists) provides a crucial mitigation strategy. Users and wallets can leverage access lists to pre-declare the state elements a transaction will touch, effectively turning what would have been cold accesses into warm ones and thereby reducing the gas cost. This means that even for non-upgradeable contracts, there's a mechanism to manage and potentially reduce the impact of EIP-2929's cost increases, preventing widespread disruption to the existing dApp ecosystem. The EIP was designed to improve the network's health, not to break existing functionality without providing a pathway for adaptation.
Summary
EIP-2929 fundamentally altered the gas cost model for state access operations on Ethereum, introduced with the Berlin hard fork. It distinguishes between “cold” (first-time) and “warm” (subsequent) accesses to addresses and storage slots within a transaction, significantly increasing the gas cost for cold accesses while making warm accesses cheaper. This change aims to more accurately reflect the computational resources consumed by state retrieval and enhance network security against DoS attacks. While it can lead to higher transaction costs for certain dApps, especially older ones, it also incentivizes gas-efficient contract design and is complemented by EIP-2930's access lists, which allow users to optimize costs by pre-declaring state accesses. Understanding EIP-2929 is essential for developers and users navigating the evolving economics of the Ethereum blockchain.
OKX · Official Biturai Partner
Trade smarter with OKX.
Access spot and derivatives markets, automate strategies with trading bots, use advanced order tools, and verify 1:1 reserves every month.
- Spot and derivatives markets
- Trading bots and advanced orders
- 1:1 reserves with monthly Proof of Reserves
- Account protection and 24/7 monitoring
Partner link · Biturai may receive compensation when it is used · not investment advice
