---
eip: 2330
label: EIP-2330
title: EXTSLOAD opcode
status: Stagnant
type: Standards Track
category: Core
created: 2019-10-29
requires: 2929
official: https://eips.ethereum.org/EIPS/eip-2330
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2330.md
canonical: https://eips.huatuo.xyz/eip-2330/
lang: en
tldr: "Proposes an EXTSLOAD opcode that lets a contract read another contract's storage slot directly, skipping the cost of a CALL plus ABI encoding and decoding."
tags: [evm, opcode, storage, gas, core]
---

# EIP-2330: EXTSLOAD opcode

> A new EVM opcode to read external contract storage data.

**TL;DR:** Proposes an EXTSLOAD opcode that lets a contract read another contract's storage slot directly, skipping the cost of a CALL plus ABI encoding and decoding.

## What problem does it solve?

Anyone off-chain can read any contract's storage, but a contract on-chain cannot. If contract A wants a value held by contract B (a token balance, a registry entry), it has to `CALL` a view function on B. That costs a cross-contract call, ABI encoding and decoding, function dispatch, and often extra `SLOAD`s inside the view function that A never needed.

For lookups that are really just "read one slot of a mapping", most of that gas is overhead. EIP-2330 adds a single opcode that reads the slot directly, which the authors argue can cut the cost of such reads by more than 10x and makes the cost predictable for the caller.

## How it works

- New opcode `EXTSLOAD` at `0x5c`. It pops two stack items, `address` and `slot`, and pushes the 32-byte value stored at `slot` in that account's storage (or `0` if the account does not exist).
- It behaves like `SLOAD` (`0x54`) with an extra address argument. It is read-only; there is no external write counterpart.
- Gas follows the warm/cold model from [EIP-2929](/eip-2929/):
  - account part: `0` if the address is already warm, otherwise `COLD_ACCOUNT_ACCESS_COST`;
  - storage part: `WARM_STORAGE_READ_COST` if the `(address, slot)` pair is warm, otherwise `COLD_STORAGE_READ_COST`.
- The spec notes that after a move to Verkle trees the account part would no longer apply, leaving only the storage-read cost.

The rationale points out that a contract can already opt in to this by exposing a function that `SLOAD`s and returns arbitrary slots. `EXTSLOAD` makes that universal, and the gas model mirrors "one call plus N slot reads".

## Sample code

Reading an ERC-20 balance straight from storage. This assumes the token keeps `mapping(address => uint256) balances` at slot `0`, which you must verify per contract. `EXTSLOAD` is not a real opcode on mainnet, so this is illustrative pseudocode:

```solidity
// Illustrative only: EXTSLOAD (0x5c) is not available on mainnet.
function balanceViaExtsload(address token, address owner) view returns (uint256 bal) {
    // Solidity mapping layout: slot = keccak256(abi.encode(key, mappingSlot))
    bytes32 slot = keccak256(abi.encode(owner, uint256(0)));
    assembly {
        // bal := extsload(token, slot)   // hypothetical opcode
    }
}
```

Today's opt-in equivalent, which some protocols expose on their own contracts:

```solidity
function extsload(bytes32 slot) external view returns (bytes32 value) {
    assembly { value := sload(slot) }
}
```

## Things to know

- **Status: Stagnant.** The opcode was never scheduled into a network upgrade and is not available on Ethereum mainnet.
- Storage layout is not part of a contract's public interface. Code that reads raw slots breaks if the target changes its layout (for example through a proxy upgrade), so this trades safety for gas.
- The proposal also makes a point about developer misconceptions: `private` variables in Solidity are not secret. Everything in storage is already readable off-chain.
- The security section notes that a callee could read the caller's state during re-entrancy; because the opcode cannot write, the authors consider this no worse than calling existing view functions.


---

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