# OP Stack

## Background

The first step in the [Storage Proof Workflow](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/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](https://etherscan.io/address/0xd2e67b6a032f0a9b1f569e63ad6c38f7342c2e00) contract emits OutputProposed events when new L2 outputs are proposed. The event structure is:&#x20;

{% code overflow="wrap" %}

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

{% endcode %}

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

```
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

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2FEf95DTdOJ4stqsH4lDFE%2FGraphs%20for%20Documentation-42.png?alt=media&#x26;token=20969d3d-658f-4937-a557-9f05ae5dac44" alt="" width="375"><figcaption><p>Ethereum on OP Stack</p></figcaption></figure>

**Step 1:** [Access the block hash](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/accessing-block-hash).&#x20;

**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](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/workflow).

### OP Stack on OP Stack

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2FhOyve0aE2f0vCzRzGysk%2FGraphs%20for%20Documentation-41.png?alt=media&#x26;token=a1461ab1-6bda-4d1d-9c8f-b21f3ec7bfc8" alt="" width="563"><figcaption><p>OP Stack on OP Stack</p></figcaption></figure>

**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](https://github.com/HerodotusDev/opstack_indexer).&#x20;

**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](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/workflow).

### OP Stack on Starknet

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2FTiHn1lj12Lh3uKbINI2i%2FGraphs%20for%20Documentation-43.png?alt=media&#x26;token=63e9fc3d-893e-4323-adcf-d6d1a309edbb" alt="" width="563"><figcaption><p>OP Stack on Starknet</p></figcaption></figure>

**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](https://github.com/HerodotusDev/opstack_indexer).&#x20;

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

**Step 3:** Proceed with [Storage Proof Workflow](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/workflow).
