EIP-1153: Transient Storage Opcodes (TSTORE / TLOAD)
EIP-1153 (Cancun, 2024) introduced two new opcodes — TSTORE and TLOAD — that read/write storage that lives only for the duration of a single transaction. Persistent storage (SSTORE) costs 20,000 gas; transient storage costs 100 gas.
Use Cases
- Re-entrancy guards: a
boolflag set during entry, checked on re-entry, cleared at the end of the call. Without TSTORE this requires writing a regular storage slot at 20K gas. - Inter-call communication: a contract that needs to pass non-trivial state through a callback no longer pays for permanent storage.
- Cached computation: expensive views computed once per transaction.
Neo Equivalent
Neo's storage API supports the same pattern via per-transaction storage scopes. A contract can use a small, manually-managed transient store: write a value, use it, delete it before the transaction ends. The cost is similar to permanent storage at write/delete, but the value is gone after the tx — no permanent state bloat.
For the most common use case (re-entrancy guards), the standard Neo idiom is to use a contract-local boolean stored in transient memory implemented through a deliberate Put then Delete pattern, OR to use the Runtime.GetTrigger() == TriggerType.Application check combined with Runtime.ExecutingScriptHash != Runtime.CallingScriptHash to detect external entry. Neo VM's call semantics prevent a re-entrancy hazard pattern much more strongly than EVM's, so guards are needed less often.
Live on Neo TestNet
Both implementations are deployed on Neo N3 TestNet (network magic 894710606).
| Implementation | Contract Hash | Deploy Tx |
|---|---|---|
Solidity (neo-solc) | 0x7e4e48124ed93c56eb4715965bb5b91fd0eb1a66 | (reused — see 0x7e4e48124ed93c56eb4715965bb5b91fd0eb1a66) |
Neo C# (nccs) | 0xe67e6815ad4d151bf87667af4e9aa9cbc3eaa7bf | (reused — see 0xe67e6815ad4d151bf87667af4e9aa9cbc3eaa7bf) |
Cross-implementation invocations match on isLocked. Source pairs under docs/standards-mirror/deployments/eip-1153/.
