> For the complete documentation index, see [llms.txt](https://spire-docs.gitbook.io/spire/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spire-docs.gitbook.io/spire/based-stack/customizable-composability.md).

# Customizable composability

<figure><img src="/files/HxS3vQhWIHNBJ8ZmMqul" alt="Banner image"><figcaption></figcaption></figure>

Customizable composability is an important concept at Spire Labs, and the idea is pretty simple. We use the fact that based rollups created with the Based Stack are appchains to customize the rollup contract in ways that are impossible on general-purpose rollups.

We introduce the concept of a “sync function” which is an arbitrary function that can be executed on the L1 to produce arbitrary data as output. Then, we enforce (at runtime) that the inputs to the first transaction (the “sync transaction”) in any appchain block proposal is the output of executing the sync function.&#x20;

{% hint style="info" %}
Note that this does not require any modifications to the VM used.
{% endhint %}

This is interesting because it allows applications to specify read access to Ethereum every time an L2 block is executed. The L2’s execution environment can always have effectively real-time read access to Ethereum. This includes any state:&#x20;

* L1 oracles
* Ethereum history
* ...and more!

For example, imagine an NFT marketplace that would like to allow its users to trade CryptoPunks. Of course, CryptoPunks only exist on Ethereum L1. Implementing this application as an appchain might involve using customizable composability to read the entire state of the CryptoPunks contract into a contract on the appchain. Then, every transaction in the appchain block will have access to the up-to-date state of the CryptoPunks contract.&#x20;

<figure><img src="/files/mqUwFHX1iUIf2TaPHAhk" alt="L1 state interaction example"><figcaption></figcaption></figure>

Functionally, this is a kind of new way to be composed with L1 and is an example of the unique innovation that can be done when implementing appchains vs general purpose rollups.


---

# 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, and the optional `goal` query parameter:

```
GET https://spire-docs.gitbook.io/spire/based-stack/customizable-composability.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
