stylusguide
  • 1. Welcome to Arbitrum Stylus and Rust
    • Brief Introduction to Arbitrum Stylus
    • Importance of Rust in Blockchain Development
    • What You'll Learn in This Tutorial Series
  • 2. Setting Up Your Development Environment
    • Installing Rust
    • Setting Up Arbitrum Stylus
    • Basic Commands
  • 3. Your First Smart Contract: Hello World
    • Introduction to Smart Contracts
    • Writing the Hello World Contract
    • Deploying and Testing Your Contract
  • 4. Understanding Smart Contract Storage: Simple Storage
    • Basics of Contract Storage
    • Writing the Simple Storage Contract
    • Interacting with Storage Variables
  • 5. Creating Your Own Token: Token Contract
    • Introduction to Tokens and Standards
    • Writing the Token Contract
    • Deploying and Testing Your Token
  • 6. Additional Resources and Next Steps
Powered by GitBook
On this page
  1. 4. Understanding Smart Contract Storage: Simple Storage

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:

  1. 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.

  2. Ephemeral Storage:

    • Temporary data available only during the execution of a contract. Used for local variables within functions.

    • Example: Intermediate calculation results.

Previous4. Understanding Smart Contract Storage: Simple StorageNextWriting the Simple Storage Contract

Last updated 10 months ago