EIP-8120 1-byte load opcodes MLOAD8 and CALLDATALOAD8 (MLOAD8 and CALLDATALOAD8 Opcodes)

No call decision · EVM & execution · EIP status Draft · created 2026-01-07

Adds two new EVM opcodes that read a single byte from memory or calldata in one instruction. Compared to the existing approach, this reduces gas cost and deployed bytecode size.

Why it is needed

Today, even to read just a single byte from calldata or memory in the EVM (Ethereum's smart contract execution engine), you have to use a workaround that first reads an entire 32-byte word and then shifts bits to isolate the single byte you want. For example, reading one byte at a given position in calldata requires three steps: CALLDATALOAD to read 32 bytes, then PUSH1 248 and SHR to shift out 248 bits. This pattern costs 9 gas per read, and each occurrence adds 3 extra bytes to the deployed bytecode. Contracts that interpret calldata as a byte-oriented instruction stream repeat this read pattern constantly, so the unnecessary cost keeps accumulating. This EIP proposes eliminating that waste by adding MLOAD8 and CALLDATALOAD8, which read a single byte directly in one instruction.

What changes

Today

After EIP-8120

Who is affected

In depth

MLOAD8 specification

Takes a single offset from the stack, reads 1 byte from that position in memory, and pushes it onto the stack as a 32-byte word with the byte in the least significant position. Memory expansion occurs before the load, followed by the byte read. If the accessed byte lies beyond the previously allocated memory range, memory is zero-initialized, so the return value is 0. The memory expansion rule is applied the same way as for MSTORE8, extending memory to at least offset + 1 byte. The opcode value is still TBD.

CALLDATALOAD8 specification

Takes a single offset from the stack, reads 1 byte from that position in calldata, and pushes it onto the stack as a 32-byte word with the byte in the least significant position. If offset is greater than or equal to CALLDATASIZE (0x36), it returns 0. This matches the existing CALLDATALOAD behavior where out-of-range reads of calldata are treated as 0, and unlike memory, there is no expansion cost. The opcode value is still TBD.

Gas cost and exceptional conditions

Both opcodes have a base cost of 3 gas. MLOAD8 additionally incurs the memory expansion cost defined by the existing memory access rules. The 3 gas base cost matches MLOAD, MSTORE8, and CALLDATALOAD, keeping it consistent with the existing EVM pricing scheme. If gas runs out during execution or there are insufficient operands on the stack (stack underflow), an exceptional halt occurs and the current call frame is reverted. This is handled the same way as existing EVM behavior.

Rationale: symmetry with MSTORE8, efficiency for byte-oriented contracts

MSTORE8 (0x53) is an instruction that writes a single byte from the stack to memory, but until now there has been no instruction for the reverse direction, reading a single byte. MLOAD8 becomes the natural counterpart to MSTORE8, improving conceptual clarity and developer convenience. In terms of efficiency, reading a single byte from calldata today costs a total of 9 gas via CALLDATALOAD (3 gas), PUSH1 (3 gas), and SHR (3 gas) in sequence, along with the burden of stack manipulation and increased bytecode. Replacing this with a single 3-gas CALLDATALOAD8 saves 6 gas per read and reduces deployed bytecode by about 3 bytes. In contracts that interpret calldata as a byte-oriented instruction stream, these savings accumulate repeatedly.

Opcode value assignment

The final opcode values will be assigned during the review process, but the proposal suggests the 0x4X range, since the 0x5X range, which mainly holds stack, memory, storage, and control flow instructions, is nearly exhausted. As provisional values, it proposes 0x4e for MLOAD8 and 0x4f for CALLDATALOAD8, placing them near the existing data access instructions to reduce the risk of opcode collisions. These values are meant to help clients with early prototyping and collision checks, and may be adjusted during standardization.

Test cases and backwards compatibility

The original presents an example where calldata is 0x0123456789abcdef and memory is 0xfedcba9876543210. PUSH0; CALLDATALOAD8 pushes 0x01, and PUSH1 0x02; MLOAD8 pushes 0xba. Executing CALLDATALOAD8 or MLOAD8 alone with no stack operand causes an exceptional halt. This EIP only adds new opcodes and does not change the meaning of existing instructions, so there are no backwards compatibility issues beyond those that inherently come with a hard fork that adds opcodes.

Current status: Draft

This EIP is in Draft status, created on January 7, 2026. Details including the opcode values may change during standardization, and it has not yet been decided which hard fork, if any, it will be included in. No decision on fork inclusion has been made at core developer calls so far.

Original EIP · ← EIPs