> For the complete documentation index, see [llms.txt](https://layer-akira.gitbook.io/layerakira-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layer-akira.gitbook.io/layerakira-documentation/integration/technical-overview/exchange-flow.md).

# Exchange flow

Our order book design is comprised of two parts:

**1) LayerAkira Smart Contract ("Smart Contract"):**

* The Smart Contract holds the user funds and performs necessary validation checks before any trading activity is executed, whether initiated by a user or by the Exchange on behalf of a user.
* Allows users to perform certain activities (e.g. withdrawals) on-chain without direct interaction with the Exchange
* Emits events to the blockchain for each trading activity.

**2) LayerAkira Exchange ("Exchange"):**

* Provides [endpoints](/layerakira-documentation/integration/endpoints.md) through which users can perform trading activities in a CEX-like manner
* Ensures that all trading activities are processed fairly and are valid.&#x20;

{% hint style="info" %}
fair" refers to *when* the trade arrives to the Exchange

"valid" refers to the execution semantic
{% endhint %}

* Responsible for consuming emitted events by the Smart Contract to maintain a valid state of off-chain order book and off-chain user balances.
* Responsible for batching all trading activities into the rollup and pushing it on-chain as soon as possible to keep the smart contract state updated with the off-chain state.&#x20;
* Responsible for maintaining the CLOB and providing access to it through [endpoints](/layerakira-documentation/integration/endpoints.md) for both users from our ecosystem and outside of our ecosystem through Routers.

<figure><img src="https://623361034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1Ws1OrrN2m59LyR2E92s%2Fuploads%2FmVnVjH0Qf0fgbCLy6fCB%2FBlue%20Purple%20Futuristic%20Modern%203D%20Tech%20Company%20Business%20Presentation%20(2).png?alt=media&amp;token=896d7459-17b7-4ba7-9a5b-9369b4986ab6" alt=""><figcaption></figcaption></figure>
