How to Build a DEX Like Aster, Step by Step
Aster runs two trading modes side by side: a Pro order book and a one-click Simple Mode pool. Here is what to build, in order, to match that design.
On this page
Short answer
Aster is a decentralised perpetual exchange with two trading modes: Pro, an order-book venue, and Simple Mode, a pool-based venue with one-click trades. Building one like it means building a matching engine, a liquidity pool, an oracle, a risk engine and a yield layer.
What is Aster, and what makes its DEX different?
Aster is a decentralised perpetual exchange that lets traders open long and short positions on crypto prices without giving up custody of their funds. It grew from the merger of Astherus and APX Finance, and it runs on several chains including BNB Chain, Ethereum, Arbitrum and Solana.
What sets Aster apart is that it runs two trading modes side by side. Pro mode is an order-book venue for advanced traders, while Simple Mode is a pool-based venue where a trader opens a position in one click against a shared liquidity pool. Both modes sit on the same platform, so a user can switch between them without moving funds to another service.
Aster also ties yield into trading. Collateral can be a yield-bearing asset, such as a liquid staking token or the USDF stablecoin, so the funds backing a position can keep earning while the position is open. For the wider exchange picture, see DEX vs CEX.
Two trading modes: Pro order book and Simple Mode
Aster Pro is the order-book mode. Traders see bids and asks, place limit and market orders, use advanced order types and trade with multi-asset margin. It suits traders who want control over price and size, and it supports high-frequency and institutional-style trading through an API.
Simple Mode is the pool-based mode. A trader picks a market and a direction, and the position opens against the ALP liquidity pool in one click, with no margin deposit step. It supports very high position multiples, up to 1001x, and it is built to resist front-running, with a circuit breaker that pauses trading if the price moves too far from the oracle price.
Use this table to compare the two modes:
| Feature | Pro mode | Simple Mode |
|---|---|---|
| Matching | Central limit order book | Shared liquidity pool (ALP) |
| Orders | Limit, market, advanced types | One-click open and close |
| Margin | Multi-asset margin | No margin deposit step |
| Position multiple | High, per market | Up to 1001x |
| Best for | Advanced and API traders | Fast, simple trades |
| Key protection | Hidden orders | Circuit breaker and MEV resistance |
A DEX like Aster needs both modes to serve both groups. Pro mode keeps the traders who need depth and control, and Simple Mode keeps the traders who want speed and a simple screen.
The parts you need to build
A DEX like Aster is built from several parts that must work together. Each part has a clear job, and a weak part limits the whole exchange.
| Part | What it does | Why it matters |
|---|---|---|
| Matching engine | Pairs bids and asks in the order book | Decides speed and price quality |
| Liquidity pool | Backs Simple Mode positions | Sets how large a trade can be |
| Oracle and price feed | Reports the market price | Stops bad prices from liquidating users |
| Margin and risk engine | Tracks collateral and liquidations | Keeps the exchange solvent |
| Wallet connection | Links the user's wallet | Keeps custody with the user |
| Yield layer | Lets collateral earn while posted | Improves capital efficiency |
| Settlement contracts | Move funds when a trade closes | Make trades final on chain |
Start with the matching engine, the pool, the oracle and the risk engine. The yield layer and the extra chains can come later, but a DEX that launches without a sound risk engine will not survive its first sharp price move.
For the build side of a simpler DEX, see how to build a DEX.
The chain-specific guide how to build a Solana DEX covers the same parts on one chain.
The build steps for a DEX like Aster
Build the exchange in order, and test each part before the next one depends on it. A perpetual DEX is harder than a spot DEX, because open positions carry risk until they close.
- Choose the chains and the model. Pick which chains to launch on and whether to start with an order book, a pool, or both.
- Build the matching engine. Write the order-book logic, test it with heavy load and measure how fast it matches.
- Build the liquidity pool. Set the pool rules, the fees and the limits on how much of the pool one trade can use.
- Connect the oracle. Use more than one price source, and add a circuit breaker that pauses trading if the sources disagree.
- Build the risk engine. Set margin rules, liquidation rules and the fund that covers losses when a liquidation fails.
- Add wallet connection and settlement. Let users trade from their own wallets and settle every trade on chain.
- Audit, test and launch small. Audit the contracts, run a testnet with real traders, then launch with low limits and raise them slowly.
Keep custody with the user from the start. A DEX that holds user funds is a centralised exchange with extra steps, and it needs the licences and audits that go with one.
Liquidity, oracles and risk controls
Liquidity is the first risk. A pool that is too small will move the price against a large trade, and an order book with thin depth will show wide spreads. Seed the pool before launch, set a cap on how much of the pool one trade can take, and watch depth every day.
Oracles are the second risk. A perpetual exchange lives or dies by its price feed, because the feed decides liquidations. Use several sources, compare them on every update and pause trading if they disagree by more than a small margin. Aster's circuit breaker follows this pattern: it stops trading when the price moves too far from the oracle price.
The third risk is MEV, where a trader sees a pending trade and places their own trade first to profit from it. Simple Mode reduces this by keeping execution on chain and limiting what can be seen before a trade lands. Hidden orders help in Pro mode by keeping an order's size and direction out of the public book until it executes.
Example (hypothetical): a first-week liquidity pool
Example (hypothetical): a new DEX launches a Simple Mode pool with 200,000 USDC of liquidity. In the first week, traders open 50 positions worth 500,000 USDC in total, using an average multiple of 10x, so the pool backs 50,000 USDC of margin.
One trader opens a long position of 10,000 USDC at 10x, worth 100,000 USDC of exposure. The pool takes 1% of the trade as a fee, which is 100 USDC, and the position's liquidation price sits 9% below the entry price. If the price falls 9%, the position closes and the pool keeps the margin.
By the end of the week the pool has collected 2,500 USDC in fees from 50 trades, and no single trade used more than 5% of the pool. The team decides the pool is deep enough to raise the per-trade cap from 5% to 8%, and to add a second market the following week.
What are the common mistakes?
Most DEX failures come from launching with thin liquidity, a single price source or no risk engine. The trading screen is the easy part; the parts that keep the exchange alive are the ones users never see.
- Launching with a pool too small for the trades you advertise
- Trusting one oracle and skipping the circuit breaker
- Letting one trade take a large share of the pool
- Setting position multiples so high that small moves wipe users out
- Skipping the audit and launching with untested contracts
- Adding new chains before the first chain is stable
- Hiding fees and liquidation prices from the trading screen
Key takeaways
- Aster runs two modes: Pro order book for advanced traders and Simple Mode pool for one-click trades.
- Start with the matching engine, the pool, the oracle and the risk engine.
- Use several price sources and a circuit breaker that pauses trading when they disagree.
- Cap how much of the pool one trade can take, so a single trade cannot drain it.
- Keep custody with the user; a DEX that holds funds is a centralised exchange.
- Launch with low limits and raise them only after real trading with no incidents.
Frequently asked questions
What is Aster?
Aster is a decentralised perpetual exchange that grew from the merger of Astherus and APX Finance. It runs on several chains, including BNB Chain, Ethereum, Arbitrum and Solana, and it offers two trading modes: Pro, an order-book venue, and Simple Mode, a pool-based venue.
How does Simple Mode work?
Simple Mode opens a position against a shared liquidity pool in one click, with no margin deposit step. It supports very high position multiples, up to 1001x, and it is built to resist front-running, with a circuit breaker that pauses trading if the price moves too far from the oracle price.
What is the ALP liquidity pool?
ALP is the shared liquidity pool that backs Simple Mode positions on Aster. Traders open positions against the pool instead of against other traders, and the pool collects fees from each trade. The pool needs a cap on how much of it one trade can use.
Why does a DEX need more than one oracle?
A perpetual exchange uses its price feed to decide liquidations, so a wrong price can close positions that should stay open. Using several sources and pausing trading when they disagree stops one bad feed from causing losses.
Can collateral earn yield while it backs a position?
On Aster it can. Collateral may be a yield-bearing asset, such as a liquid staking token or the USDF stablecoin, so the funds backing a position can keep earning while the position is open.
How long does it take to build a DEX like Aster?
A small team can ship a basic perpetual DEX in months, but a two-mode exchange with a yield layer takes longer. The matching engine, pool, oracle and risk engine come first, and the yield layer and extra chains can follow after launch.