Basics of Contract Storage
What is Storage in Smart Contracts?
Storage in smart contracts refers to the persistent data that contracts maintain on the blockchain. This data is crucial as it allows smart contracts to keep track of various states and information over time. In the context of Arbitrum Stylus and Rust, storage structures are defined within the contract, and they dictate how data is stored and accessed.
Different Types of Storage:
Persistent Storage:
Data that remains on the blockchain even after the execution of the contract. Used for variables that need to be remembered between function calls and transactions.
Example: Balances of accounts in a token contract.
Ephemeral Storage:
Temporary data available only during the execution of a contract. Used for local variables within functions.
Example: Intermediate calculation results.
Last updated