Precise Static Identification of Ethereum Storage Variables

Sifis Lagouvardos, Yannis Bollanos, Michael Debono, Neville Grech, Yannis Smaragdakis · 2025

Read Precise Static Identification of Ethereum Storage Variables by Sifis Lagouvardos, Yannis Bollanos, Michael Debono, Neville Grech, Yannis Smaragdakis (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2503-20690.txt.

Introduction

Sifis Lagouvardos and co-authors present a static analysis that finds data structures inside deployed Ethereum smart contracts, in this 2025 paper. Smart contracts are small programs stored on a blockchain, which serves as their memory. Analysts often have only the deployed code, yet they need to know what data the contract stores. The best prior tool missed nearly all complex structures and handled under half of contracts.

The new method reads the code without running it and reasons about how storage slots are computed. It names the exact types of maps and arrays with about ninety-nine percent precision. Recall passed ninety-two percent, far above the older tool. Often the result even beats the storage map the compiler itself emits. The work aids audits and tools that inspect contracts for flaws.

Catalog record

CREATORSifis Lagouvardos, Yannis Bollanos, Michael Debono, Neville Grech, Yannis Smaragdakis
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE73 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2503-20690

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Precise Static Identification of Ethereum Storage Variables Sifis Lagouvardos, Yannis Bollanos, Michael Debono, Neville Grech, Yannis Smaragdakis Abstract . Smart contracts are small programs that run autonomously on the blockchain, using it as their persistent memory. The predominant platform for smart contracts is the Ethereum VM (EVM). In EVM smart contracts, a problem with significant applications is to identify data structures (in blockchain state, a.k.a. “storage”), given only the deployed smart contract code. The problem has been highly challenging and has often been considered nearly impossible to address satisfactorily. (For reference, the latest state-of-the-art research tool fails to recover nearly all complex data structures and scales to under 50% of contracts.) Much of the complication is that the main on-chain data structures (mappings and arrays) have their locations derived dynamically through code execution. We propose sophisticated static analysis techniques to solve the identification of on-chain data structures with extremely high fidelity and completeness. Our analysis scales nearly universally and recovers deep data structures. Our techniques are able to identify the exact types of data structures with 98.6% precision and at least 92.6% recall, compared to a state-of-the-art tool managing 80.8% and 68.2% respectively. Strikingly, the analysis is often more complete than the storage description that the compiler itself produces, with full access to the source code. 1. Introduction Smart contracts on programmable blockchains have been successfully used to implement complex applications, mostly of a financial nature ( Werner et al. 2023 ) . The dominant platform for smart contracts is the Ethereum VM (EVM): the execution layer behind blockchains such as Ethereum, Arbitrum, Optimism, Binance, Base, and many more. Millions of smart contracts have been deployed on these chains and can be invoked on-demand. Many thousands of them are in active use every day. To enable the persistence of data between different blockchain transactions, contracts employ the blockchain as their persistent memory, to save their state. In EVM terms, this persistent memory is called “ storage ” and is accessed using special random-access instructions. A challenge of high value has emerged out of the use of storage in smart contracts: recovering high-level storage structures from the deployed form of the smart contract, i.e., from EVM bytecode. This task is crucial for several applications: • Security Analysis : A number of smart contract vulnerabilities arise from incorrect handling of storage variables, such as storage collisions in upgradable contracts ( Ruaro et al. 2024 ) . Precise modeling of storage is required for detecting such vulnerabilities. • Decompilation and Reverse Engineering : Tools ( Grech et al. 2022 ; Kolinko and Palkeo 2020 ; Becker 2023 ) that decompile EVM bytecode back to high-level code rely on storage modeling to reconstruct variable declarations and data structures ( Li et al. 2024 ) . • Off-chain Applications : Blockchain explorers, debuggers, and other off-chain tools need to interpret storage data to provide meaningful information to users. They often rely on compiler-generated metadata, which may be incomplete or unavailable ( etherscan.io 2017 ) for interesting smart contracts like proprietary bots or hacker contracts. • Static Analysis and Verification : Precise storage modeling enables advanced static analysis and formal verification of smart contracts, facilitating the detection of bugs and the proof of correctness ( Grech et al. 2018 ; Brent et al. 2020 ; Yang et al. 2024 ; Chen et al. 2024b ) . Smart contracts are written overwhelmingly in the Solidity language, which allows developers to define storage variables ranging from simple value types to complex, arbitrarily nested data structures such as arrays, mappings, and structs. However, when Solidity code is compiled into EVM bytecode, much of the high-level structure and type information is lost. This is because the EVM’s permanent storage is a simple key-value store mapping 256-bit keys to 256-bit values. Due to the luxury of having a large key space, the default pattern for high-level languages targeting the EVM is to translate high-level constructs into low-level storage access patterns using cryptographic hashing and arithmetic operations to compute storage slots dynamically. This transformation creates a significant gap between the high-level representation of storage variables and the low-level state of permanent storage reflected on the blockchain. Existing approaches to storage modeling face significant limitations. Early frameworks ( Albert et al. 2018 ; Tsankov et al. 2018 ) often reasoned about storage operations only when storage indexes were constants, sacrificing precision or completeness when dealing with dynamic data structures. While some tools ( Grech et al. 2018 ; Brent et al. 2020 ) introduced methods to infer high-level storage structures, they lacked support for arbitrarily nested data structures and complex storage patterns. Recent tools like VarLifter ( Li et al. 2024 ) attempt to recover storage layouts but struggle with scalability and completeness, failing to produce output for a substantial portion of real-world contracts. Contributions. This paper introduces dyels , a static analysis approach that accurately infers high-level storage structures from EVM bytecode. Our key contributions are: • Static Storage Modeling : We develop a novel static analysis that fully supports arbitrarily nested composite data structures in Solidity. By employing a recursive storage analysis, dyels scalably and precisely reconstructs complex storage layouts from low-level bytecode. • Evaluation Against Existing Tools : We find the current state-of-the-art tool, VarLifter ( Li et al. 2024 ) , to terminate on only 41.2% of contracts. When successful, VarLifter misses over 30% of storage variables, including most non-trivial structures. This performance underscores the difficulty of the problem being solved. In comparison, dyels analyzes 99.5% of contracts and provides higher-fidelity results, recovering the vast majority (92%) of storage structures with excellent precision (98%). • Enhanced Completeness Beyond Compiler Metadata : We show that dyels can infer storage variables and structures not present in compiler-generated metadata, particularly those involving low-level storage patterns common in upgradable contracts. This enhancement provides a more complete understanding of the contract’s storage layout. The core of dyels is released as open-source software as part of the Gigahorse lifting toolchain 1 1 1 https://github.com/nevillegrech/gigahorse-toolchain and has seen significant adoption in both industry and academia. Its output is integrated into the decompilation of https://app.dedaub.com , the Dedaub security and decompilation tool suite used by over 6,000 registered users. 2. Background We next provide background on the Ethereum Virtual Machine and its storage model. 2.1. Ethereum and the Ethereum Virtual Machine Ethereum is a decentralized blockchain platform that enables the execution of smart contracts—autonomous programs that run on the blockchain. Smart contracts are predominantly written in the Solidity high-level language and are compiled into bytecode for execution on the Ethereum Virtual Machine (EVM). The EVM has dominated as an execution platform and has been adopted by most other programmable blockchains. The EVM is a stack-based virtual machine designed to execute smart contracts securely and deterministically. It operates on 256-bit words, utilizes its own stack , memory , transient storage and persistent storage , and provides a Turing-complete execution environment. This paper focuses on persistent storage or just storage . 2.2. EVM Bytecode Format and Execution Model EVM bytecode is a sequence of instructions, each represented by a single-byte opcode (with an immediate argument for PUSH opcodes). The EVM supports a rich, albeit unconventional set of operations, which

Read the complete text