Decentralized exchange software rarely needs to be written from scratch. Most DEXs are forks of open-source AMM contracts, white-label packages built on those forks, or front ends over existing liquidity.
This page compares the ready-made routes so you can choose a code base, check what its license allows and plan how to attract liquidity. For a ground-up engineering walkthrough of AMM and order book design, read the DEX development guide.
What DEX software includes
A working DEX has three layers, and a package may cover some or all of them:
- On-chain contracts. A factory deploys pools, pool contracts hold reserves and price trades, and a router handles multi-hop swaps, slippage limits and deadlines. Optional contracts cover farms, staking, governance tokens and fee distribution.
- Indexing. A subgraph or custom indexer turns contract events into pool statistics, charts and history, which a front end cannot compute efficiently from raw RPC calls.
- Front end. The app connects wallets, loads token lists, finds the best route, warns about price impact and offers screens to manage liquidity.
Decentralized exchange software options compared
| Option | What you get | Fits | Main risks |
|---|---|---|---|
| Fork a constant-product AMM (Uniswap v2 style) | Simple contracts with a long record in production | A new chain without a native DEX, or a team with in-house Solidity skills | License terms, bugs added by your changes, no difference from other forks |
| Fork a concentrated-liquidity AMM (Uniswap v3 style) | Liquidity in price ranges and several fee tiers | Trading venues on chains with active market makers | Harder math and a harder front end. Liquidity providers must manage positions. |
| Build on an existing protocol (Uniswap v4 hooks, Balancer pools) | Custom pool logic that shares the protocol's liquidity and security | A new fee or pricing idea without a whole new DEX | You own any bug in your hook, and the protocol sets limits |
| White-label DEX script | A packaged fork with a user interface and admin panel | Fast launches on small budgets | Unknown code origin, hidden admin keys, weak audit history |
| Aggregator front end | A swap interface that routes through existing DEXs via an aggregator API | Wallets and apps that need swaps, not a venue | Dependence on the aggregator, and no liquidity of your own |
AMM designs you can fork
Constant product (x·y=k)
Each pool holds two tokens, and the product of the two reserves stays constant during swaps, so the price moves along a curve as one side of the pool shrinks. Liquidity providers deposit both tokens and receive pool shares called LP tokens. The design is simple and well tested, but its weakness is capital efficiency, because most liquidity sits at prices that never trade. Uniswap's documentation describes the design, and SushiSwap and PancakeSwap both began as Uniswap v2 forks.
Concentrated liquidity
Liquidity providers choose a price range, which puts more depth near the current price, so traders get better prices with less capital in the pool. The cost is complexity:
- Positions are NFTs, not interchangeable LP tokens.
- Fee accounting works per price tick.
- Liquidity providers face larger impermanent loss when the price leaves their range.
Most professional liquidity on EVM chains now sits in pools of this kind. The Uniswap clone guide explains how the versions differ.
Hooks on Uniswap v4
Uniswap v4 launched in January 2025. All pools live in one contract, and each pool can attach a hook contract that runs custom code before or after swaps and liquidity changes. A hook can add dynamic fees, limit orders or access rules without a separate DEX, but the hook author is responsible for the hook's security.
Stable-swap curves
Curve-style formulas keep the price nearly flat around 1:1, which suits stablecoin pairs and liquid staking pairs. The amplification parameter needs careful tuning, because attackers can exploit a badly tuned pool when a peg breaks.
On-chain order books
Fast chains such as Solana, and app-specific chains, can run central limit order books on-chain. An order book suits professional traders but needs market makers from the first day, which an AMM does not.
Licenses to read before you fork
Open-source code is not always free to copy for commercial use, and some DEX code uses the Business Source License (BUSL), which blocks production use for a period and then converts to an open license.
| Code | License |
|---|---|
| Uniswap v2 core | GPL-3.0 |
| Uniswap v3 core | BUSL-1.1 until 1 April 2023, then GPL-2.0-or-later |
| Uniswap v4 core | BUSL-1.1. The license converts to MIT on 15 June 2027 or on an earlier date set by Uniswap governance. Additional use grants come through governance. |
Before you fork any code, check:
- The license file in the exact repository and commit you fork.
- Whether the front end, SDKs and routing service use different licenses from the contracts.
- Whether names and logos are protected trademarks even when the code is open.
How to evaluate a white-label DEX package
White-label vendors sell speed, so you must check what you will deploy. Ask for these items:
- Code origin. Ask which upstream repository and commit the package uses and what the vendor changed, because a clean diff against upstream is the fastest way to review.
- Audit evidence. Ask for an audit of the vendor's modified contracts, not only the upstream project's audit, since new bugs often appear in changes to fee logic or token handling.
- Admin powers. List every owner-only function and check whether the operator can pause swaps, change fees, mint reward tokens or upgrade contracts. Each power should sit behind a multisig and a timelock.
- Full source ownership. Get the contracts, front end, indexer and deployment scripts, with the right to change them.
- Token handling. Check that the router handles fee-on-transfer and rebasing tokens correctly, or rejects them safely.
- Front-end security. Attackers have hijacked DNS and hosting to swap contract addresses in DEX front ends, so ask about deployment controls and consider builds hosted on IPFS.
Treat the code of a white-label DEX vendor as untrusted until someone reviews it.
Liquidity: a problem software cannot solve
A new DEX with shallow pools quotes poor prices, so aggregators send trades to other venues and traders do not return. Teams use one or more of these methods:
- Seed pools from the project treasury.
- Pay liquidity providers in a governance token, though this liquidity mining often attracts capital that leaves when rewards drop.
- Partner with token projects that launch on the same chain.
- Recruit professional market makers for concentrated pools.
If users only need to swap, an aggregator integration costs less than building liquidity. The DEX aggregator guide covers that route.
Security checklist for any DEX deployment
- Use a time-weighted average price or an external price feed for any logic that depends on price, because attackers can move a pool's spot price within one transaction using a flash loan.
- Guard against reentrancy, especially with tokens that call back on transfer, such as ERC-777 tokens.
- Enforce the user's minimum output and deadline in the router to limit sandwich attacks.
- Verify every deployed contract on the block explorer and publish the addresses.
- Commission an independent smart contract audit of every modified contract and run a bug bounty.
- Monitor pools for unusual activity, and document a pause procedure if the design includes a pause.
Which option fits which project
- A new layer 1 or layer 2 chain without a native DEX. Deploy an audited constant-product fork early to give the chain its first DEX. Chain foundations often give ecosystem grants for this work, and other projects can integrate a simple design more easily.
- A token project that wants its own venue. This choice usually fails, because liquidity does better in an established DEX on the same chain, where aggregators already route trades. A separate exchange splits liquidity and adds contracts to secure.
- A team with a new pricing idea. Build the idea as a pool type or a hook on an established protocol, so the new code stays small enough to audit, and the protocol provides the rest.
- A wallet, game or payments app that needs swaps. Integrate an aggregator or a DEX SDK, and add an interface fee if you want; the app needs no contracts of its own.
- A venue for professional traders. Look at an order book on a fast chain or a hybrid exchange model instead of an AMM fork.
Every route needs operations after launch: indexer uptime, token list curation, front-end hosting and incident response. Curation includes removing scam tokens from the default list.
DEX software costs and timelines
These figures are estimates for typical scopes, not quotes:
| Scope | Team | Time |
|---|---|---|
| Constant-product fork with light changes, branded interface, indexer and farms | Two or three engineers | Four to eight weeks, plus a month or more of audit lead time |
| Concentrated-liquidity fork with a full front end and position management | A small full-stack and Solidity team | Three to six months |
| Custom pool logic or hooks on an existing protocol | Depends on the logic | Varies widely with complexity |
In every case, budget separately for audits, a bug bounty, liquidity incentives and indexer hosting.
Frequently asked questions
Is forking Uniswap legal?
The answer depends on the version and its license on the day you deploy. Uniswap v2 and v3 core now use GPL licenses, while Uniswap v4 core uses the Business Source License until its change date. Read the license in the repository you fork, and get legal advice if you are unsure.
What is the difference between a DEX and a DEX aggregator?
A DEX holds liquidity in its own pools, while an aggregator holds no liquidity and splits orders across many DEXs to find the best price. An aggregator needs no liquidity of its own but depends on other projects' pools.
Do I need my own token to launch a DEX?
No. Many DEXs use a token for liquidity rewards and governance. A token also adds legal questions and selling pressure, and many swap venues launched without one.
How do DEXs make money?
Swap fees go to liquidity providers, and a protocol fee switch can send a share of those fees to the treasury. Some front ends add an interface fee, but higher fees make a DEX less competitive in aggregator routing.
Can a white-label DEX vendor take the funds?
Yes, if the vendor or an unknown key keeps admin rights, so confirm that ownership of every contract moves to your multisig and that no hidden privileged functions remain.
Which chain should I deploy DEX software on?
Choose a chain where your target tokens and users already are, where room exists for another venue, and where your audit firm has experience. Launching on many chains at once splits liquidity into small pools on each chain.