Building on the SCP Paradigm, DEX Can Achieve AMM Freedom
Web3 is booming, and Arweave is becoming a popular infrastructure choice for developers. PermaDAO is a community where everyone can contribute to the Arweave ecosystem. It's a place to propose and tackle tasks related to Arweave, with the support and feedback of the entire community. Join PermaDAO and help shape Web3!
Author: Kyle @ Contributor of PermaDAO
Introduction to DEX and AMM
DEX (Decentralized Exchange) is a trading platform that operates free from centralized financial institutions, providing trading services through smart contracts and blockchain technology. Unlike centralized exchanges, DEX does not rely on order books to match trades but directly exchanges assets from liquidity pools using the AMM algorithm.
AMM, an acronym for Automated Market Maker, is an algorithm-driven smart contract system that provides liquidity for DEX's token assets, allowing users to trade directly without waiting for matching buy and sell orders.
Advantages of AMM Boosting DEX
The application of AMM in DEX brings more open and flexible asset trading. DEX offers advantages over centralized exchanges, including:
Decentralization and Security: DEX operates without the involvement of centralized financial institutions, reducing the risk of single points of failure and enhancing security.
Trustless Third Parties: Users in DEX do not need to trust third-party intermediaries; all transactions are executed through smart contracts, ensuring transparency and verifiability.
Privacy Protection: DEX does not require users to undergo KYC; involvement only requires an encrypted wallet, protecting individual privacy.
Unrestricted by Time and Location: DEX operates without geographical limitations, allowing users to trade anytime and anywhere with an internet connection.
Classic AMM Models
Constant Product Market Maker (CPMM) Model
The CPMM model, initially proposed by Vitalik and introduced by Hayden Adams in the Uniswap protocol (both V1 and V2), utilizes the simple formula x * y = k, where k is a constant, and x and y represent the quantities of two tokens in the liquidity pool, with their product always equal to k.
CPMM model's liquidity is relatively dispersed, resulting in increased slippage and vulnerability to frontrunning attacks. Impermanent loss and MEV are significant challenges associated with this model.
Concentrated Liquidity Market Maker (CLMM) Model
Uniswap introduced the CLMM model during the upgrade to Uniswap V3. It builds upon the Constant Product Market Maker (CPMM) model, enhancing the constant product formula (x * y = k). CLMM allows liquidity providers to offer liquidity within a custom price range, enhancing capital utilization.
Compared to the CPMM model of Uniswap V2, the CLMM model performs better under the same liquidity funds, with deeper trading depth and reduced slippage. Additionally, setting a narrower price range around $1 can make Uniswap V3 suitable for stablecoin trading scenarios. However, the CLMM model still cannot solve issues like MEV and front-running attacks, and impermanent loss remains relatively high.
Discrete Liquidity Automated Market Maker (DLAMM) Model
The DLAMM model, introduced by iZUMi Finance is distinctly different from CPMM and CLMM. CPMM and CLMM models are continuous curves, making liquidity continuous. In contrast, the DLAMM model consists of discrete points, resulting in discrete liquidity.
Specifically, DLAMM allows liquidity providers to concentrate liquidity at specific price points, similar to limit orders, further increasing capital utilization and reducing transaction slippage. However, due to the nature of limit orders, trades must occur at the set price points, leading to a lack of flexibility.
Proactive Market Maker (PMM) Model
The PMM model, introduced by DODO, adopts a strategy of automatically adjusting liquidity by aggregating it around the market price, leveraging oracle price feeds.
PMM completely changes the mainstream AMM algorithm structure, using a dynamically adjustable algorithm that effectively increases capital utilization, reduces trading slippage, and provides traders with more favorable prices. However, PMM's reliance on oracle feeds poses challenges.
Permaswap: Cross-Chain DEX Supporting Multiple AMM Algorithms
Permaswap is the first real-time and cross-chain DEX in the Arweave ecosystem, built on the everPay protocol. It’s features such as zero gas fees, zero frontrunning slippage, and 100% permanent data storage, providing a more efficient and secure solution for digital asset trading.
Due to the immutability of the blockchain, once a smart contract is deployed on the chain, it cannot be modified. If updates or improvements to the smart contract are desired, a new smart contract must be created for the upgrade. For a DEX, continuous improvement of its AMM model is necessary to meet the evolving market demands. However, achieving a perfect AMM model to cover all needs and solve all problems is challenging.
Nevertheless, Permaswap is a DEX with aggregator-like flexibility, supporting multiple AMM algorithms to provide users with the best prices. How is this achieved? Thanks to its adoption of a new development paradigm—SCP, which is vastly different from the traditional construction path of blockchain projects.
Storage Consensus Paradigm (SCP)
Storage Consensus Paradigm (SCP), introduced by everVision, is the next-generation blockchain application development paradigm. Unlike traditional blockchains, SCP separates computation and storage, meaning on-chain storage and off-chain computation. The blockchain (Arweave) is responsible for storage, while off-chain servers handle computation and store all generated states.
Specifically, SCP adopts a lazy evaluation strategy, with off-chain servers responsible for smart contract computation and state updates, storing them on the blockchain for future verification. Here, the blockchain serves as the data availability layer, ensuring data immutability and traceability for easily verifiable data. Anyone can verify the results of a contract to ensure final consistency. Thus, applications built on the SCP paradigm exhibit high performance and availability comparable to Web2, while maintaining the transparency and trustworthiness of blockchain.
Advantages of SCP
For decentralized exchange Permaswap, under the SCP paradigm, the configuration of smart contracts and algorithms can be more flexible, allowing support for various types of AMM models for LP nodes to choose as needed.
Certainly, Permaswap under the SCP paradigm has other significant advantages:
Image Description: On-chain AMM vs. Permaswap
High Performance: Transaction processing is handled by traditional servers, with the TPS limit determined by server performance and application technical architecture.
Cost-Effective: Utilizes bundle technology to bundle multiple transaction data into one on-chain transaction, theoretically processing one million transactions for only $1.
Real-time Trading: Dedicated nodes handle transactions without waiting for block confirmation, providing an experience close to traditional payment methods.
Security: Adopts a self-custody asset form, with keys and assets held by LP nodes, reducing systemic risks.
No MEV: Uses deterministic bundle transactions, eliminating the need for slippage settings and avoiding transaction sequencing delays.
Permaswap Liquidity Mining
Built on the SCP paradigm, Permaswap can flexibly construct and adopt AMM models. As Permaswap is currently in beta, it temporarily adopts the constant product AMM model with a specific price range, similar to Uniswap V3's CLMM model. Users can choose to provide liquidity without limiting the price range or choose a specific price range during liquidity addition. As the Permaswap network grows, more diverse AMM models will be introduced, gradually becoming a DEX with multiple AMM models.
In the process of Permaswap liquidity mining, two crucial roles in the network are involved: Router nodes and LP nodes. According to the whitepaper, once the Permaswap network enters the Flood stage, individuals and institutions can become Router nodes or LP nodes by staking PSN tokens (not yet issued).
The main functions of the two nodes are as follows:
Router nodes serve as the central hub of the Permaswap network, generating trade orders and handling LP quote information, which, upon user confirmation, are signed and sent to everPay for execution.
LP nodes act as liquidity providers for Permaswap, registering on the Router and signing orders, offering automatic quoting services for market-making transactions.
LP nodes can freely choose specific AMM models and inject funds to provide liquidity. Router nodes, based on user transaction demands, generate optimal prices by combining information from connected LP nodes on their own Router or LP nodes from other Router nodes.
Upon completion of a transaction, Router nodes earn transaction fees, and LP nodes receive liquidity mining incentives. However, if there is malicious behavior by either the Router or LP nodes, their staked PSN tokens will be confiscated, and if the token quantity falls below the threshold, the network will forcefully remove them.
Permaswap is currently open to everyone, allowing the deployment of LP nodes for market-making without the need to stake any collateral. Permaswap has ten liquidity pools available for liquidity addition, including USDC/USDT, AR/USDC, AR/ETH, ETH/USDC, AR/ARDRIVE, USDC/ACNH, AR/ANS, AR/U, AR/STAMP, ETH/MAP.
💡 For information on deploying LP nodes and adding liquidity on Permaswap, refer to the Permaswap Guide.
In the future, Permaswap will launch the native token PSN for liquidity mining incentives, voting governance, node entry collateral, etc. According to the plan, Permaswap will continue to list new assets, providing liquidity for the Arweave ecosystem and assets from multiple blockchains. With more Router nodes and LP nodes joining, Permaswap will gradually form a robust and resilient ecosystem.