All Collections
v3
Perpetuals
Technical Details
What is on-chain vs. off-chain?
What is on-chain vs. off-chain?

Layer 2 on-chain vs. off-chain

Corey Miller avatar
Written by Corey Miller
Updated this week

On-chain

The on-chain contract contains a mapping from Ethereum addresses to stark-keys, which is used as the off-chain identifier. This promises that if Alice withdraws money from an off-chain vault with a key that belongs to her, only she can actually control these funds on L1.


In addition, the on-chain contract naturally handles registering, depositing and withdrawing USDC from/to the system, and also contains the commitment to the full balance state of the system, found in L2.

Off-chain

The off-chain logic handles trades, liquidations, transfers and deleverages, as well as updating the oracle prices. It stores the entire balance of all the users, and periodically submit STARK proofs, attesting the validity of the balances change, given the user’s transactions.

You can read more about our authors here.

Did this answer your question?