---
eip: 7480
label: EIP-7480
title: EOF - Data section access instructions
status: Stagnant
type: Standards Track
category: Core
created: 2023-08-11
requires: 3540, 3670
official: https://eips.ethereum.org/EIPS/eip-7480
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7480.md
canonical: https://eips.huatuo.xyz/eip-7480/
lang: en
tldr: Adds DATALOAD, DATALOADN, DATASIZE and DATACOPY so EOF contracts can read constants from their data section, replacing CODECOPY-style tricks that EOF forbids.
tags: [evm, eof, opcodes, core]
---

# EIP-7480: EOF - Data section access instructions

> Instructions to read data section of EOF container

**TL;DR:** Adds DATALOAD, DATALOADN, DATASIZE and DATACOPY so EOF contracts can read constants from their data section, replacing CODECOPY-style tricks that EOF forbids.

## What problem does it solve?

The EVM Object Format (EOF, [EIP-3540](/eip-3540/)) splits a contract into separate **code** and **data** sections. Legacy contracts often stored constants or blobs in their bytecode and read them with `CODECOPY` / `CODESIZE`. EOF deliberately bans those code-introspection opcodes, so contracts need a new, explicit way to read their own data section.

EIP-7480 provides that: four instructions, modelled on the existing calldata and returndata opcodes, that read only from the data section.

## How it works

The instructions are valid only inside EOF code. In legacy bytecode they cause an exceptional halt, which matches existing behaviour for undefined opcodes.

| Opcode | Name | Stack | Gas | Behaviour |
| --- | --- | --- | --- | --- |
| `0xd0` | `DATALOAD` | `offset` → `word` | 4 | Load 32 bytes from `data[offset:offset+32]`; bytes past the end read as 0 |
| `0xd1` | `DATALOADN` | → `word` | 3 | Same, but `offset` is a 16-bit big-endian immediate |
| `0xd2` | `DATASIZE` | → `size` | 2 | Push the size of the data section |
| `0xd3` | `DATACOPY` | `mem_offset, offset, size` → | 3 + 3 per word + memory expansion | Copy a slice of data to memory; zero-pad past the end |

`DATALOADN` is cheaper because its offset is fixed at compile time and is checked once during **code validation** ([EIP-3670](/eip-3670/) rules are extended):

- a `DATALOADN` whose `offset + 32` exceeds the data size declared in the container header makes the code invalid;
- relative jumps (`RJUMP`, `RJUMPI`, `RJUMPV`) may not land inside the two immediate bytes that follow `DATALOADN`.

Out-of-bounds reads pad with zeros rather than failing, so compilers can safely remove unused copies without changing behaviour.

## Sample code

Illustrative EOF code-section fragment (mnemonics with their encoding):

```text
d1 0000        DATALOADN 0x0000     ; push data[0:32]   (offset checked at deploy time)
d1 0020        DATALOADN 0x0020     ; push data[32:64]
01             ADD                  ; add the two constants
d2             DATASIZE             ; push data section length
5f             PUSH0                ; offset   = 0 in data
5f             PUSH0                ; mem_offset = 0
d3             DATACOPY             ; copy data[0:size] to memory[0:]
                                    ; (stack before DATACOPY: mem_offset, offset, size)
```

## Things to know

- **Status: Stagnant.** EIP-7480 was part of the EOF bundle tracked in [EIP-7692](/eip-7692/), which is also Stagnant. EOF was not included in the Pectra or Fusaka upgrades, so these opcodes are not live on Ethereum mainnet.
- There is intentionally no `EXTDATACOPY`: one contract cannot read another EOF contract's data section. "Data-only contracts" read via `EXTCODECOPY` are therefore discouraged under EOF.
- The opcode numbers above come from the spec and could change if EOF is revived in a different form.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7480
