# The Berlin Hardfork: What Changed

Author: Markus Waas

Published: 2021-03-28T02:55:20.000Z

Updated: 2026-09-13T14:25:30.000Z

Source: [https://soliditydeveloper.com/berlin-hardfork](<https://soliditydeveloper.com/berlin-hardfork>)

## Compatibility and review

Before you start

Historical preview of the 2021 Berlin upgrade. Berlin activated at block 12,244,000. Access lists belong to the transaction they warm; they are not a separate transaction that prepares future transactions. Later forks changed refunds and SELFDESTRUCT behavior.

[Official reference](<https://blog.ethereum.org/2021/03/08/ethereum-berlin-upgrade-announcement>)

This article previewed Berlin, scheduled for April 15, 2021 at block 12,244,000. London followed at block 12,965,000 later that year. The sections below retain the original preview context.

![Before and after Berlin](<https://cdn0.scrvt.com/b095ee27d37b3d7b6b150adba9ac6ec8/679bf44c2dd69842/355db2ea80ec/v/003eebc2d2e8/beforeafterberlin.jpeg>)

So let's take a look at the new changes and what you need to know as a developer.

## EIP-2929: Increased gas costs for state access

[EIP-2929](<https://eips.ethereum.org/EIPS/eip-2929>) will increase the gas costs for state access. Those have been historically underpriced and lead to a DOS attack in 2016 where a lot of transactions were spammed that access the state of a large number of accounts. In response the gas costs were increased.

However, an [analysis](<https://arxiv.org/pdf/1909.07220.pdf>) from beginning of 2020 came to the conclusion that they are still too low. The core problem here is that [IO](<https://en.wikipedia.org/wiki/Input/output>) on a computer is very expensive to do. That's why we have things like RAM after all. The researchers found that their specifically crafted transaction would take 20 to 80 seconds for a node to process. In comparison a regular transaction takes only a few milliseconds.

This EIP only increases the gas cost when accessing a storage slot or account for the first time. The new cost for a first time storage slot access will be 2100, while access first first time access for accounts will be 2600. After that for any reads for multiple times, the cost will be reduced to 100, since the data will be in memory.

Further also storing via SSTORE becomes slightly more expensive by an additional 2100 for writing to a slot the first time. To quote the EIP: 'The change is needed to avoid the possibility of a DoS attack that “pokes” a randomly chosen zero storage slot, changing it from 0 to 0 at a cost of 800 gas but requiring a de-facto storage load.'

Lastly, `SELFDESTRUCT` adds 2,600 gas when its beneficiary account is cold. This is an account-access charge, not a 2,100-gas storage-slot charge. Later, London removed its refund and Cancun restricted deletion through EIP-6780.

As [previously discussed](<https://soliditydeveloper.com/openzeppelin-contracts-v4>), the Openzeppelin v4 contracts already adapted to this new EIP and reduced state access where possible.

## EIP-2930: Prepayments for state access

[EIP-2930](<https://eips.ethereum.org/EIPS/eip-2930>) adds an optional access list to the transaction itself. It charges 2,400 gas per listed address and 1,900 per listed storage key; those entries are warm during that transaction, so later eligible reads cost 100 gas. The list can make access costs more predictable, but does not always save gas.

Sending an earlier transaction does not warm state for a later transaction. An affected application must include the list in the same transaction that performs the relevant calls.

## EIP-2718: Typed Transaction Envelope

With [EIP-2718](<https://eips.ethereum.org/EIPS/eip-2718>) we will finally get an easy way to add more transaction types. Previously any new transaction type additions were really hacky and you couldn't tell directly from looking at a transaction if this was a special type of transaction. This made it hard not only for the node software developers, but also for new transaction type standards.

Besides the new EIP-2930 prepayment transaction type, there are several other candidates for added transaction types, such as allowing someone other than msg.sender to pay the gas or multi-sig transactions. After Berlin hardfork, those standards will be easier to implement.

![Subroutines Meme](<https://cdn0.scrvt.com/b095ee27d37b3d7b6b150adba9ac6ec8/581c379fcb970853/06c0d4e48a3c/v/07bf3dacf8d3/subroutines.jpg>)

## Not included: EIP-2315 - Simple Subroutines for the EVM

**On short notice, this EIP was actually removed from the upgrade. For a full discussion of this issue see [here](<https://twitter.com/TimBeiko/status/1367839556125483014>).**

We may get something similar to this EIP in the future, so let's go over it quickly anyways. [EIP-2315](<https://eips.ethereum.org/EIPS/eip-2315>) adds simple [subroutine](<https://en.wikipedia.org/wiki/Subroutine>) support with three new opcodes:

1. `BEGINSUB`
2. `JUMPSUB`
3. `RETURNSUB`

Improving not only the gas costs slightly, but also helping bytecode static analysis tools.

## EIP-2565: Cheaper onchain crypto

Now I'm not talking about cheaper crypto prices. With [EIP-2565](<https://eips.ethereum.org/EIPS/eip-2565>) we get reduced gas costs for one opcode that is in the form of a [precompile](<https://ethereum.stackexchange.com/a/28469/33305>): `ModExp`. This precompile was introduced in [EIP-198](<https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md>) and will perform a [modular exponentiation](<https://en.wikipedia.org/wiki/Modular_exponentiation>) which is useful for many cryptographic schemes such as SNARKs and VDFs.

But apparently the gas costs were chosen way too high for this precompile. A new method to compute the gas costs is added via EIP-2565 to better reflect the computational complexity. As a result, onchain crypto will become cheaper.

****

**Lastly, what do you need to consider as dev?**

For you as a developer I would guess most importantly the increase state access costs will affect you. If you are one of the few for which this completely breaks your contract, consider using the access lists included in the affected transaction, as discussed above. Otherwise for new contracts limit state access as much as you can.
