Storage Proofs
HomeDashboard
  • Getting Started
    • Introduction
    • Use Cases
    • Quick Start Guide
    • Key Concepts
  • Storage Proofs
    • Overview
    • Workflow
      • Workflow Examples
    • Accessing Block Hash
  • Solutions
    • Storage Proof API
      • Authentication
      • Payload Examples
    • Turbo
      • Workflow
      • RPC Endpoint
      • Turbo Compute
  • Architecture
    • Overview
    • Smart Contracts
    • Cross-Chain Storage Proofs
      • Native Messaging Systems
      • OP Stack Chains
  • Guides
    • Using Storage Proof API
    • Integrating Storage Proofs
    • Building a Storage Proof Powered Bridge
    • Writing Turbo Smart Contracts
    • Sending Turbo Transactions
  • References
    • Contract Addresses
    • Supported Networks
    • Glossary
  • Media Links
    • Twitter
    • Telegram
Powered by GitBook
On this page
  • Optimism Bedrock
  • Block Hash Commitment
  • L2OutputOracle Contract
  • Accessing L2 Output
  • OP Stack Indexer
  • Cross-Chain Workflow Examples
  • Ethereum Data on OP Stack
  • OP Stack Data on Another OP Stack Chain
  • OP Stack Data on Starknet
  • Conclusion
  1. Architecture
  2. Cross-Chain Storage Proofs

OP Stack Chains

Storage Proofs can enable historical and cross-chain data access for OP Stack chains like Optimism, Base, and Zora, the process leverages the unique architecture of these Layer 2 (L2) solutions. This page explains how Storage Proofs work in the context of OP Stack chains.

Optimism Bedrock

The first crucial step in the Storage Proof Workflow is accessing the block hash. For OP Stack chains, we need to understand how L2 data gets committed to Layer 1 (L1).

Block Hash Commitment

Since the launch of Optimism Bedrock, the block hash of an L2 block is committed to L1. Importantly, the structure of the block header on Optimism Bedrock mirrors that of the Ethereum Virtual Machine (EVM).

L2OutputOracle Contract

The L2OutputOracle contract plays a pivotal role in this process. It emits OutputProposed events when new L2 outputs are proposed. The event structure is as follows:

event OutputProposed(
    bytes32 indexed outputRoot,
    uint256 indexed l2OutputIndex,
    uint256 indexed l2BlockNumber,
    uint256 l1Timestamp
);

Accessing L2 Output

To retrieve the L2 output, call the getL2Output read method using the l2OutputIndex. The returned output is the pre-image of the outputRoot, composed of:

version, l2_block_state_root, l2_withdrawals_storage_root, l2_block_hash

The l2_block_hash can be extracted from this pre-image and utilized in the Storage Proof process.

OP Stack Indexer

To facilitate the indexing of OP Stack events, we've developed the OP Stack Indexer:

  • Purpose: Monitors Ethereum for all OP Stack events

  • Functionality: Indexes Output Roots in a database

  • Supported Rollups: Optimism, Base, Zora, and other OP Stack-based rollups

Cross-Chain Workflow Examples

Ethereum Data on OP Stack

To access Ethereum data from an OP Stack chain:

  1. Access the Ethereum block hash.

  2. Send the block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on the OP Stack chain.

  3. Proceed with the standard Storage Proof Workflow.

OP Stack Data on Another OP Stack Chain

To access data from one OP Stack chain on another:

  1. Use the OP Stack Indexer to index the block header (pre-image) of the source OP Stack block hash that has settled on L1.

  2. Send the indexed block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on the destination OP Stack chain.

  3. Proceed with the standard Storage Proof Workflow.

OP Stack Data on Starknet

To access OP Stack data from Starknet:

  1. Use the OP Stack Indexer to index the block header (pre-image) of the OP Stack block hash that has settled on L1.

  2. Send the indexed block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on Starknet.

  3. Proceed with the standard Storage Proof Workflow.

Conclusion

The Storage Proof system for OP Stack chains leverages the L2 output commitment process to enable secure cross-chain data access. By understanding and utilizing the L2OutputOracle contract and the OP Stack Indexer, developers can create powerful cross-chain applications that maintain the security guarantees of both L1 and L2 networks.

PreviousNative Messaging SystemsNextUsing Storage Proof API

Last updated 10 months ago

GitHub Repository:

https://github.com/HerodotusDev/opstack_indexer