Onchain accounts overview

An onchain account has its vault saved onchain, and all balance instructions arrive as L1 transactions. A special property of an onchain account is that it does not require a private (stark) key — enabling smart contracts to be the "owner" of such an account. Thus, L1 players/applications can trade through StarkEx and be matched against any pending orders (both onchain and offchain account orders).

The onchain trading mode enables interoperability between StarkEx applications and L1 applications and can be used for DeFi Pooling or by liquidity aggregators.

Onchain accounts do not scale well — as submitting a trade request for an onchain account requires an L1 transaction that will cost ~60K gas. It is anticipated that dApps will be the primary users of this mode. If you intend to use it as an end-user, double-check it makes sense for your needs.

We will explore the deposit, trade, and withdrawal flows for onchain accounts.

StarkEx for perpetual doesn’t support onchain accounts. This is because the only "real" asset in the perpetual environment is the collateral asset, and all the debt/collateral is managed at L2. L1 vaults are not useful for active trading against the L2 market.