---
eip: 2970
label: EIP-2970
title: IS_STATIC opcode
status: Stagnant
type: Standards Track
category: Core
created: 2020-09-13
official: https://eips.ethereum.org/EIPS/eip-2970
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2970.md
canonical: https://eips.huatuo.xyz/eip-2970/
lang: en
tldr: Proposed an IS_STATIC opcode that tells a contract whether it is running inside a STATICCALL, so it can allow read-only calls while blocking state changes.
tags: [evm, opcode, staticcall, account-abstraction, core]
---

# EIP-2970: IS_STATIC opcode

> Add a ISSTATIC (0x4A) opcode that pushes 1 if the current context is static (ie. the execution is in a STATICCALL or a descendant thereof, so state-changing operations are not possible), and 0 if it is not.

**TL;DR:** Proposed an IS_STATIC opcode that tells a contract whether it is running inside a STATICCALL, so it can allow read-only calls while blocking state changes.

## What problem does it solve?

[EIP-214](/eip-214/) added `STATICCALL`, which runs code in a context where any state change (storage writes, logs, value transfers, contract creation) causes a failure. Code running inside it, however, has no direct way to ask "am I static right now?".

That matters for account abstraction. Under [EIP-2938](/eip-2938/), a contract account might want to let outsiders make harmless read-only calls into it while rejecting anything that changes state. To do that, it needs to know whether the current context is static.

## How it works

The proposal adds one opcode:

- `IS_STATIC` at `0x4A` pushes `1` if the current execution is inside a `STATICCALL` (or anything called from one), and `0` otherwise.

Today the only way to find out is a hack: make a small `CALL` to code that emits a `LOG` and exits. In a static context the `LOG` fails, so the call returns 0. The spec calls this fragile, because it depends on gas costs, and wasteful.

## Sample code

Illustrative only. `IS_STATIC` was never activated, so this is pseudocode for the proposed behaviour:

```python
def op_is_static(evm):
    evm.stack.push(1 if evm.message.is_static else 0)
```

The workaround the EIP wants to replace, in Solidity:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract StaticProbe {
    function emitLog() external {
        require(msg.sender == address(this));
        emit Probe();
    }
    event Probe();

    // Returns true if called inside a STATICCALL. Costs gas and relies on
    // LOG being forbidden in static context.
    function isStatic() public returns (bool) {
        (bool ok, ) = address(this).call{gas: 5000}(abi.encodeCall(this.emitLog, ()));
        return !ok;
    }
}
```

## Things to know

- Status is **Stagnant**. The abstract, backwards-compatibility and security sections were never filled in.
- Opcode `0x4A` was later assigned to `BLOBBASEFEE` by [EIP-7516](/eip-7516/), so if this idea were revived it would need a different opcode number.
- Its driving use case, [EIP-2938](/eip-2938/) account abstraction, also did not ship; later account-abstraction work took other routes.
- The probe workaround above is sensitive to gas schedule changes; treat it as a demonstration, not production code.


---

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