> For the complete documentation index, see [llms.txt](https://docs.espressosys.com/network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.espressosys.com/network/developer/rollup-developers/op.md).

# OP Stack

This guide is for teams integrating an **existing OP Stack chain** with Espresso. Espresso provides settlement and finality on the chain's blocks. L1 batch posting (where applicable) is a property of the chain framework, not Espresso settlement itself.

Espresso is developing an integration for [OP Chains](https://docs.optimism.io/stack/getting-started).

## Integration overview

The Espresso-OP Stack integration ensures that each batch processed by the rollup is consistent with Espresso-finalized blocks.

To ensure that the batch has been finalized by Espresso, the following checks are performed:

1. **Namespace validation:** Namespacing allows multiple chains to share Espresso's settlement layer simultaneously by associating each chain's transactions with a unique namespace within Espresso blocks. This check ensures that the set of transactions in an OP batch corresponds to the correct namespace.
2. **Espresso finalization check:** Confirms that the OP batch maps to a valid Espresso finalized block.

The flow is as follows:

1. A user submits either a deposit transaction to the L1 or an L2 transaction.
2. The rollup node (`op-node`, running in sequencer mode) fetches any deposit transactions from L1.
3. The rollup node constructs the payload attributes and sends them to `op-geth`, which executes them to create blocks.
4. The `op-batcher` queries the blocks and creates batches accordingly.
5. The batcher then submits these batches to HotShot for finalization via the [submit API](https://github.com/EspressoSystems/gitbook/blob/main/guides/api-reference/espresso-api/submit-api.md).
6. Periodically, the batcher also calls the [availability API](https://docs.espressosys.com/sequencer/api-reference/espresso-api/availability-api) to check for finalized HotShot blocks containing these batches and performs batch consistency checks.
7. The batcher signs the transaction calldata that would be sent to the `Batch Inbox` contract.
8. In the integration, the `Batch Inbox` address is converted from an EOA to a contract containing only a fallback function. This fallback function receives all transactions sent to the contract and verifies the signature to ensure it originates from the trusted batcher:

A small change to the derivation pipeline filters out transactions sent to the batch inbox that caused the contract to revert.

This approach involves running an `op-batcher` in a TEE environment (such as Intel SGX). The batcher signs the transaction calldata. In case the TEE is broken, the batch poster can't impact the safety of the chain. It could, however, temporarily halt the chain's progress, thereby breaking liveness. Bridges relying on Espresso confirmations for faster settlement however need to trust the TEE as well in this integration. In a future update the dependency on TEEs will be removed entirely.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.espressosys.com/network/developer/rollup-developers/op.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
