# Architecture

zkHub applies zero-knowledge rollups (zk-rollup) scaling solutions to ensure fund security while achieve great system performance (high TPS, fast finality).



## Fund Transfer

<figure><img src="https://4265258021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqDmTycWFovIEE5hpM7uK%2Fuploads%2FNWNGDK68lxISo6HNGyH8%2FFund_Transfer.png?alt=media&#x26;token=31f83e5b-7db1-4cb8-9405-481ebd6a558c" alt=""><figcaption></figcaption></figure>

When users deposit funds to zkHub from a zk-rollup network, funds will be transferred to zkLink’s contract. After obtaining the Deposit Event, if it is the first time the user deposits, a default account will be created. The zkLink Validator will continue to synchronize with on-chain activities. After receiving notification from the zkLink Validator, the zkHub should maintain a copy of the user account balance data locally in the zkHub.

When user withdraw, user submits the Transaction Signature to the zkHub, and after the zkHub confirms the Signature, it is sent to the zkLink Validator. Once zkLink Validator implement the zero-knowledge proof and upload it to zk-rollup networks, the fund can be received.



## Multi-chain Synchronization

<figure><img src="https://4265258021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqDmTycWFovIEE5hpM7uK%2Fuploads%2FTUbUxRYKyuoURRBkw2yv%2FSynchronization.png?alt=media&#x26;token=695930f4-202d-484c-a94d-2caf59319aee" alt=""><figcaption></figcaption></figure>

Built upon zkLink’s zk-Rollup trading infrastructure, zkHub is connected to multiple zk-rollup networks in Ethereum ecosystem. zkHub allows users to trade multi-chain assets on a unified user interface, and multi-chain token portfolios can be managed with a single wallet.

Tokens issued on Ethereum and different zk-rollups by the same entity, for instance, USDT ERC20, USDT BEP20, USDT ARB, etc — will be merged into a single USDT token in zkHub.

Through zkLink Nexus, multi-chain state synchronization is achieved via Ethereum. It allows for a secure and effective synchronization of states cross-L2s, ensuring that deposit fraud issues are prevented.



## Trading

<figure><img src="https://4265258021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqDmTycWFovIEE5hpM7uK%2Fuploads%2FPaSXBCKkQtLIwrYGyBb7%2FTrading.png?alt=media&#x26;token=9e3d2b27-a0a7-4de8-b807-a4ac5f296dd1" alt=""><figcaption></figcaption></figure>

zkHub applies order book model to provide the best trading experience and flexibility. In order to save computational resources and the gas cost of zero knowledge proving, off-chain applications will process computation tasks including account risk management, order placement and match engine.

To order to ensure trading security, trades (matched orders) that could change account balance will be sent to provers to generate zero-knowledge proofs. Trades will be batched and rolled up to update the state of smart contracts on zk-rollup networks.
