Ethereum storage writes: original is not the previous value

Explainer6 min read

Follow an Ethereum storage slot through three fictional writes. Learn original, current and new values, and why a reset does not erase execution costs.

Fictional Ethereum storage comic: Brokzi in orange workshop overalls pins an Original 7 plate in a bolted frame while replacing Current 9 with New 0. The fixed starting value contrasts with the changing slot; these are teaching values, not token amounts.
AI-assisted editorial illustration · Brokzi
On this page

A contract writes a value, changes it again, then puts it back. Did the second write become the new starting point? For Ethereum's storage accounting, that is the wrong baseline.

Original means the value at the start of the transaction. Current means the value immediately before this storage write. New means the replacement this write would store. Earlier writes can change current without changing original.

This explainer helps readers make sense of SSTORE, the Ethereum Virtual Machine instruction that writes persistent contract storage. It uses the model in EIP-2200 and the definitions it carries over from EIP-1283. Both specification pages are Final. Their historical gas tables are not a current fee quote.

Original, current and new answer different questions

Think about one slot in one contract's persistent storage. A slot holds a value; an application decides what that value represents. The numbers below are plain teaching values, not ETH, token balances or prices.

TermQuestion it answersWhen it changes in this example
OriginalWhat did this slot hold before this transaction's execution?At the boundary to a later transaction, not after each write
CurrentWhat does it hold immediately before this write?As earlier writes in this transaction take effect
NewWhat replacement would this write store?Each write supplies its own replacement

EIP-1283 describes original as the value restored if the current transaction is reverted. For this straight-line example, that is the transaction-start value. It is not the slot's first-ever value, a value saved when the contract was deployed, or whatever a user last saw in a wallet.

Keep the contract and slot fixed too. Comparing two different storage locations would answer a different question. With a proxy, even identifying whose storage is being used deserves care; our proxy and upgradeability explainer covers that boundary.

Follow one slot through three writes

Assume the slot starts at 7. All three writes below belong to one fictional transaction. Assume they succeed, with no intervening reverted call frames and no other writes to this slot.

WriteOriginalCurrent before the writeNew replacementRelationship before this write
A779Current equals original; the value changes
B790Current differs from original; the value changes
C707Current differs from original; the write restores original

After A, the slot's current value is 9. Its original value is still 7. Write B does not get to call 9 the original simply because A happened immediately before it.

After C, the current value returns to 7. This does not erase A and B from execution history. It changes the relationship used by the next write: current and original match again.

Our assumed successful transaction ends with the slot back at 7. A later transaction establishes its own original baseline from the state it starts with. That baseline may happen to have the same number. It is still a new transaction boundary, not a boundary created by the previous write.

What a dirty storage slot actually means

In this accounting model, a slot is called dirty when its current value differs from its original value. The word describes a comparison. It does not mean corrupted storage, malicious code or an unsafe token.

Before B, current is 9 and original is 7, so the slot is dirty. Before C, current is 0 and original is 7, so it is still dirty. After C restores 7, that difference disappears.

This is why “the slot was written earlier” and “current differs from original now” are not interchangeable. Earlier execution can write a value and subsequently restore it. To classify a later operation, read the values at that operation, not just the count of earlier writes.

Among the value comparisons, EIP-2200 checks whether current equals new before comparing original with current. Other execution conditions still apply. If a write asks to store 7 when current is already 7, it falls into this no-op branch. No-op here means no value change; it does not promise zero execution cost.

Otherwise, compare original with current to distinguish the remaining cases. These comparisons explain the model without requiring a live contract or a gas calculator.

Resetting a value does not make the transaction free

EIP-2200 also uses these relationships when adjusting a refund counter. That is execution accounting, not a separate payment a reader should claim from a website.

Restoring the original value does not mean all the intervening computation disappears. Nor does a refund-counter adjustment alone tell you the final fee paid. The applicable protocol rules and the rest of the transaction matter.

We deliberately do not copy the specification's historical gas constants into a present-day fee estimate. This article answers which values are being compared. For an included transaction's actual charged execution, the separate failed-transaction gas guide explains receipts, gas usage and unit price.

Do not confuse a storage-accounting reset with REVERT, either. C writes 7 as another operation in an ongoing successful execution. A revert rolls back the affected execution scope. Our table assumes that rollback does not occur; it is not a model of every possible nested-call trace.

Persistent storage is not transient storage

The slot in this example is persistent storage. Its final value can carry into later transactions when execution commits.

Transient storage has a transaction-lifetime boundary of its own. A persistent slot does not become transient just because a contract writes it several times or restores its starting value.

Likewise, the three labels here are not three independent copies an application can spend or retrieve as funds. They describe the values needed to reason about one storage operation and its accounting.

A small worksheet for reading a trace

For each relevant write, record:

  1. The transaction boundary, storage-owning contract and slot.
  2. The original value at the transaction's start.
  3. The current value immediately before this operation.
  4. The new replacement, if this operation completes.
  5. Whether current equals new; if not, whether current equals original.

If a trace includes reverted branches, first establish which writes survive in the scope you are reading. Do not blindly feed every displayed attempted write into the straight-line table above.

The useful habit is simple: keep original pinned while following current through the transaction. The previous write changes what is there now. It does not move the transaction's starting line.

Sources

Primary specifications checked 24 November 2026. This is a documentation-based explanation, not a contract audit, gas-saving recommendation or measurement of a live network. No RPC call, deployment, wallet connection, signature or transaction was performed. The table is fictional, and no current fork-specific gas or refund rate is asserted.

See something wrong? Brokzi logs material changes. Prepare a correction note.

About the byline

Brokzi Editorial

The accountable byline for Brokzi’s explainers, definitions, news notes, and corrections.

Editorial responsibility →