OP Stack

Storage Proofs on Optimism and OP Stack Blockchains

Background

The first step in the Storage Proof Workflow is always accessing the block hash. Due to this, to enable cross-chain data access on OP Stack chains, we need to understand what data gets committed to L1.

Since the launch of Optimism Bedrock, the block hash of an L2 block is committed to L1. The structure of the block header on Optimism Bedrock is the same as on EVM.

The L2OutputOracle contract emits OutputProposed events when new L2 outputs are proposed. The event structure is:

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

Calling the getL2Output read method using l2OutputIndex returns output. This pre-image of outputRoot is made of the following values:

version, l2_block_state_root, l2_withdrawals_storage_root, l2_block_hash

The l2_block_hash can be decoded from the pre-image and sent to a Header Store smart contract deployed on Optimism or other OP Stack rollups.

OP Stack Indexer

GitHub: https://github.com/HerodotusDev/opstack_indexer

The OP Stack Indexer is responsible for monitoring Ethereum for all OP Stack events. Output Roots are indexed in a database. The repository supports OP Stack rollups such as Optimism, Base, and Zora.

Workflow Examples

Ethereum on OP Stack

Step 1: Access the block hash.

Step 2: Send block hash to Commitments Inbox, Headers Store and Facts Registry smart contracts, which are deployed on OP Stack.

Step 3: Proceed with Storage Proof Workflow.

OP Stack on OP Stack

Step 1: Index the block header(pre-image) of an OP Stack block hash that has already settled on L1. This can be done using the OP Stack Indexer.

Step 2: Send block hash to Commitments Inbox, Headers Store and Facts Registry smart contracts, which are deployed on OP Stack.

Step 3: Proceed with Storage Proof Workflow.

OP Stack on Starknet

Step 1: Index the block header(pre-image) of an OP Stack block hash that has already settled on L1. This can be done using the OP Stack Indexer.

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

Step 3: Proceed with Storage Proof Workflow.

Last updated