---
eip: 7519
label: EIP-7519
title: Atomic Storage Operations SCREDIT and SDEBIT
status: Stagnant
type: Standards Track
category: Core
created: 2023-09-16
requires: 2200, 2929
official: https://eips.ethereum.org/EIPS/eip-7519
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7519.md
canonical: https://eips.huatuo.xyz/eip-7519/
lang: en
tldr: Proposed two EVM opcodes, SCREDIT and SDEBIT, that add to or subtract from a storage slot in one step with overflow checks, giving parallel EVMs a safe primitive for balances and counters.
tags: [evm, opcodes, storage, parallel-execution, core]
---

# EIP-7519: Atomic Storage Operations SCREDIT and SDEBIT

> Add atomic operations for incrementing and decrementing storage slots

**TL;DR:** Proposed two EVM opcodes, SCREDIT and SDEBIT, that add to or subtract from a storage slot in one step with overflow checks, giving parallel EVMs a safe primitive for balances and counters.

## What problem does it solve?

Many chains, especially Layer 2s, are experimenting with executing transactions in parallel. The usual approach is optimistic concurrency control: run transactions side by side, then re-run any whose reads were invalidated by another transaction's writes. That breaks down for the most common write of all, updating a balance or counter. Two transfers that both touch the same balance always conflict, even though "add 5" and "subtract 3" could be applied in either order.

EIP-7519 adds opcodes that express "add to this slot" and "subtract from this slot" directly. Because the EVM knows the intent, a parallel engine only has to check that the slot cannot overflow or underflow under any ordering, not that every read stayed the same.

## How it works

Two opcodes, each popping two stack items (`slot`, `value`) and pushing nothing. Opcode numbers are still `TBD` in the spec.

| Opcode | Effect | Fails when |
| --- | --- | --- |
| `SCREDIT` | `storage[slot] += value` | the result would be ≥ 2^256 |
| `SDEBIT` | `storage[slot] -= value` | the result would be < 0 |

On overflow or underflow the frame **halts exceptionally** (all gas in the frame is consumed), unlike the silent wrap-around of `ADD`/`SUB`.

Gas is charged **exactly like `SSTORE`**, including the warm/cold slot rules of [EIP-2929](/eip-2929/) and the net-metering of [EIP-2200](/eip-2200/), and any future `SSTORE` repricing applies automatically. The spec argues the extra work (an add and compare) is negligible next to the storage I/O.

Only persistent storage is covered. Transient storage ([EIP-1153](/eip-1153/)) is excluded because there is no parallelism inside a single transaction.

## Sample code

The opcode replaces this load / check / store sequence. Today in Solidity:

```solidity
// What SDEBIT(slot, amount) and SCREDIT(slot, amount) do, written with today's opcodes
mapping(address => uint256) internal balanceOf;

function _transfer(address from, address to, uint256 amount) internal {
    balanceOf[from] -= amount;   // SLOAD, SUB with underflow check, SSTORE  -> SDEBIT
    balanceOf[to]   += amount;   // SLOAD, ADD with overflow check,  SSTORE  -> SCREDIT
}
```

Execution pseudocode from the spec, condensed:

```python
def scredit(slot, value):
    new = storage[slot] + value
    if new >= 2**256:
        raise ExceptionalHalt("scredit overflow")
    storage[slot] = new

def sdebit(slot, value):
    new = storage[slot] - value
    if new < 0:
        raise ExceptionalHalt("sdebit underflow")
    storage[slot] = new
```

## Things to know

- Status is **Stagnant**. The opcodes have no assigned byte values and are not scheduled for any Ethereum upgrade.
- The spec states general concurrency primitives (locks, semaphores) are out of scope; the target is token balances and similar counters.
- An exceptional halt consumes all gas in the current call frame, which is harsher than Solidity's checked-arithmetic `revert`. Callers should account for this.
- The new failure point is something auditors would need to consider when reasoning about reentrancy.
- Implementing the operations as a system contract instead of opcodes was considered, mainly for L2s, but rejected because of the code size needed for each call.


---

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