Dencun on Ethereum: what changed in the EVM and how it affects your contracts
Dencun's nine EIPs for contract developers: TSTORE, MCOPY, SELFDESTRUCT, BLOBBASEFEE, EIP-4788 and the EVM version you compile for.

Dencun is the Ethereum upgrade activated on March 13, 2024 at 13:55 UTC, at epoch 269568. Its name joins those of the two halves upgraded at the same time: Cancun, the execution layer, where the EVM and contracts live, and Deneb, the consensus layer, where validators work. According to the Ethereum Foundation announcement, it included nine improvement proposals, and the best known, EIP-4844, introduced the blobs that layer 2 networks use to publish their data.
For smart contract developers, though, what Dencun left in the code is something else: four EVM changes that compilers have used by default since 2024. Transient storage, the MCOPY opcode, the new SELFDESTRUCT behavior and contract access to the blob fee and the beacon chain root change which patterns work and make it necessary to pin the EVM version to the network being deployed to. The path of blobs from 2024 to Fusaka, with their format and pricing, is covered in our article on EIP-4844 and the cost of blobs; here we focus on what Dencun changed for a contract.
Dencun's nine proposals and who each one affects
The announcement does not assign each proposal to a layer, so the table orders them by practical effect. The first five show up in a contract's code or compilation; the rest affect rollups or validator operations.
| Proposal | What it changes | Who it affects |
|---|---|---|
| EIP-1153 | Transient storage with TSTORE and TLOAD | Contract developers |
| EIP-5656 | MCOPY opcode for copying memory | Compilers and contract developers |
| EIP-6780 | SELFDESTRUCT only deletes the contract in the transaction that created it | Contracts that relied on deleting or redeploying themselves |
| EIP-7516 | BLOBBASEFEE opcode | Rollup contracts and applications that read blob prices |
| EIP-4788 | Beacon chain block root accessible from the EVM | Staking, restaking and bridge protocols |
| EIP-4844 | Blob transactions and their fee market | Rollups and layer 2 networks |
| EIP-7044 | Perpetually valid signed voluntary exits | Validators and staking services |
| EIP-7045 | Wider attestation inclusion window | Validators |
| EIP-7514 | Maximum validator activations per epoch | Validators entering the active set |
None of these proposals changed deployed contracts automatically: existing bytecode stays the same and only uses MCOPY or transient storage if it is recompiled and redeployed. What did change for everyone, deployed or not, was the behavior of SELFDESTRUCT.
Transient storage: what TSTORE and TLOAD hold
EIP-1153 added two opcodes, TSTORE (0x5d) and TLOAD (0x5c), which write and read storage keyed like persistent storage but cleared at the end of the transaction. Each costs 100 gas, the same as a warm storage access, without the cost of writing to state or the refund logic. If a call reverts, transient writes made since it started are undone, as with persistent storage, and inside a STATICCALL, TSTORE throws an exception.
The use case the proposal itself cites is the reentrancy lock, which needs to hold state during the transaction and not afterwards. The 5.x line of OpenZeppelin Contracts includes ReentrancyGuardTransient, a variant of ReentrancyGuard that keeps the lock in transient storage, and since version 0.8.28 Solidity supports transient state variables of value types without inline assembly.
The difference from memory has a consequence the specification points out in its security considerations. Memory is cleared at the end of each call; transient storage lasts for the whole transaction. If a contract leaves a slot set and a later call within the same transaction reads it, it will find that value, which matters when one contract receives several chained calls in a single transaction, as happens when a wallet batches operations. The resulting practice is to clear the slot at the end of the function, unless the value is genuinely meant for a later call.
SELFDESTRUCT after EIP-6780: which pattern stopped working
Since Dencun, under EIP-6780, SELFDESTRUCT executed in a transaction other than the one that created the contract halts execution and sends the entire ether balance to the recipient, but does not delete the code, the storage or the account. It only keeps its previous behavior when the contract is created and destroyed in the same transaction.
The affected pattern is contracts that were upgraded by redeploying at the same address: a factory created the contract with CREATE2, destroyed it with SELFDESTRUCT and created new code at that address. Because the code is no longer deleted, the second creation finds the address occupied and fails. The specification explicitly marks this as unsupported and points to proxy patterns, such as ERC-2535 or a proxy using EIP-1967. An audit of a pre-2024 contract that depends on SELFDESTRUCT has to check what that code path does today, because its effect on mainnet is no longer what was tested when it was written.
MCOPY, BLOBBASEFEE and the beacon chain root
MCOPY, from EIP-5656, copies a range of memory in a single instruction. Its practical weight lies in the compiler: Solidity 0.8.25 made cancun the default EVM version and started using MCOPY in the code it generates for copying byte arrays, instead of mload and mstore loops. A contract recompiled with a recent version may contain MCOPY even though its author never wrote it.
BLOBBASEFEE (0x4a, 2 gas) returns the blob base fee of the current block, which is separate from the execution gas base fee. The proposal intended it so a rollup contract can check its data costs onchain without relying on a third party, and for instruments that spread that cost over time. Solidity exposes it as block.blobbasefee, alongside blobhash() for reading a blob's versioned hash.
EIP-4788 stores the parent beacon block root in a system contract at address 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02, queried by passing it a timestamp. It keeps the last 8,191 entries, roughly one day of blocks. With that root and a Merkle proof, a contract can verify consensus-layer data, such as a validator's balance, without an oracle; the proposal lists staking protocols, restaking and bridges among its uses. The root only proves what belongs to the consensus layer: any other external data still needs its own verification mechanism.
The same contract on two EVM networks: a failure that shows up after deployment
Take, as a hypothetical case, a team that compiles a deposit contract protecting its functions with ReentrancyGuardTransient using Solidity 0.8.38, the latest release, from October 2026. It does not pin an EVM version, so the compiler uses the default, which since version 0.8.31, from December 2025, is osaka. It deploys the same bytecode on Ethereum and on an EVM network that has not yet adopted the Cancun changes.
On Ethereum everything works. On the second network, deployment can succeed, because the EVM does not check which opcodes the code contains when it is deployed, and the first call to a protected function reverts when it reaches TSTORE, an opcode that network does not define. If the contract copies byte arrays, MCOPY causes the same failure on another path. The team finds the problem with funds or integrations already pointing at that address.
The fix is not just a matter of changing a setting. The compiler documentation lets you pin evmVersion for each build target, and with a version earlier than cancun the compiler no longer accepts tstore and tload in assembly, so the contract would have to go back to ReentrancyGuard with persistent storage for that network. The practical decision is to compile once per target network, with the EVM version that network has activated, and to keep that configuration next to the deployed addresses, just like the compiler version. Hardhat and Foundry both let you set it in their configuration; how the two environments differ is covered in our comparison of Hardhat and Foundry.
Dencun for developers: the lasting change is in the EVM you compile for
Dencun is usually remembered for making layer 2 data cheaper, and that effect is real, but for a contract team its most lasting mark is elsewhere. Transient storage provided a cheap, correct tool for state that should only live for one transaction, such as a reentrancy lock; EIP-6780 closed an upgrade pattern that allowed the code at an address to change without its users seeing it; and EIP-4788 made it possible to verify consensus data without an oracle. All three are still in force in November 2026.
The cost is one more dependency to manage. The default EVM version moves forward with each Ethereum upgrade (cancun in 2024, osaka since December 2025, and Solidity already lists amsterdam as experimental for Glamsterdam), while each EVM-compatible network sets its own schedule. "EVM-compatible" does not say which version, and that question, together with the compiler version, belongs in any multi-network deployment.
If you are deploying the same code to several networks or maintain pre-2024 contracts that use SELFDESTRUCT, at Metlabs we build and review smart contracts for Ethereum and EVM-compatible networks: tell us which networks and versions you work with, and we will go through the configuration each deployment needs.
- Ethereum Foundation: Dencun mainnet announcement (2024)
- EIP-1153: Transient storage opcodes
- EIP-6780: SELFDESTRUCT only in same transaction
- EIP-7516: BLOBBASEFEE opcode
- EIP-4788: Beacon block root in the EVM
- EIP-4844: Shard Blob Transactions (2022)
- EIP-7045: Increase max attestation inclusion slot
- EIP-7514: Add max epoch churn limit
- Solidity documentation: using the compiler, EVM version targets
- Solidity 0.8.25 release announcement (2024)
- Solidity 0.8.28 release announcement (2024)
- Solidity releases (GitHub)
- OpenZeppelin Contracts 5.x: utilities API
Frequently asked questions
Got a blockchain project in mind?
From idea to product, strategy and technology must move forward together.







