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:
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:
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:
GitHub Repository: https://github.com/HerodotusDev/opstack_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:
Access the Ethereum block hash.
Send the block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on the OP Stack chain.
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:
Use the OP Stack Indexer to index the block header (pre-image) of the source OP Stack block hash that has settled on L1.
Send the indexed block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on the destination OP Stack chain.
Proceed with the standard Storage Proof Workflow.
OP Stack Data on Starknet
To access OP Stack data from Starknet:
Use the OP Stack Indexer to index the block header (pre-image) of the OP Stack block hash that has settled on L1.
Send the indexed block hash to the Commitments Inbox, Headers Store, and Facts Registry smart contracts deployed on Starknet.
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.
Last updated