
smart contractsmart contractto trade assets.
Traditional financial transaction processes often lack transparency and need to rely on intermediaries for execution, and many operations of intermediaries are not disclosed to the public. In contrast, DEX fully discloses the flow of funds and trading mechanism. In addition, since user funds will not pass through third-party cryptocurrency wallets during transactions, DEX can reduce counterparty risks and systemic centralization risks in the cryptocurrency ecosystem.
decentralized financedecentralized financeComposability without permissionComposability without permissionimage description
sourcesource)
first level title
The operating mechanism of the decentralized trading platform
automated market makerautomated market maker(AMM). The DEX aggregator is also a common model. This type of aggregator can search for the best transaction price or the lowest gas fee in the DEX on each chain to best meet the user's transaction needs.
blockchain technologyblockchain technologyAnd non-tamperable smart contracts to ensure extremely high certainty. Centralized trading platforms such as Coinbase or Binance (hereinafter referred to as CEX) use an internal matching transaction engine to conduct transactions, while DEX executes transactions through smart contracts and blockchains. In addition, DEX users can also completely manage account funds independently through their own wallets during transactions.
DEX users generally need to pay two fees, one is the network fee and the other is the transaction fee. The network fee refers to the gas fee for the transaction on the chain, and the transaction fee is paid to the underlying agreement, the liquidity provider of the agreement, the token holder or all the above entities according to the agreement.
The ultimate vision of DEX is to create a permissionless pure chain infrastructure, eliminate any centralized single point of failure risk, and decentralize ownership to distributed members in the community. The most typical approach is to grant administrative power to the governance agreement of a decentralized autonomous organization (hereinafter referred to as DAO). DAOs are formed by concerned communities whose members make key decisions for the protocol through voting.
However, it is no easy task to decentralize the protocol to the greatest extent on the one hand and make the protocol stand out in a highly competitive market on the other hand. The core development team of a DEX is usually better equipped than members of the decentralized community to make comprehensive and rational judgments about key functions of the protocol. But even so, there are still many DEXs that choosedistributed governancesecondary title
Order Book Based DEX
The order book collects unmatched buy and sell orders in the market in real time, which is the basic model of digital trading platforms. The internal system of the trading platform will match the buy and sell orders through the order book.
The purely on-chain order book DEX is not so common in the DeFi field, because such DEX needs to publish every transaction in the order book on the chain. The throughput requirements of the blockchain far exceed the capabilities of most current blockchains, and may seriously threaten network security and decentralization. Therefore, the order book DEXs that appeared in the early days of Ethereum tended to have low liquidity and poor user experience. However, such order book trading platforms provide a very strong proof-of-concept for DEXs to trade using smart contracts.
With the continuous innovation of layer 2 networks such as optimistic rollup and ZK-rollup and high-throughput application-oriented blockchains, the feasibility of on-chain order book trading platforms has become higher and higher, and considerable transaction volume has been achieved. In addition, the hybrid order book model is becoming more and more mainstream. The order book management and matching process will be carried out off the chain, while the transaction settlement will be carried out on the chain.
Automated Market Maker (AMM)
Automated Market Maker (AMM)
Automated market makers are the most common type of DEX. Such DEXs can provide instant liquidity and remove the threshold for liquidity provision. In many cases, users can create marketplaces for any token without permission. AMMs essentially use money bots to continuously quote between two (or more) assets. AMM does not use an order book model, but operates through a liquidity pool. Users can exchange tokens in the liquidity pool, which uses a certain algorithm to determine the transaction price based on the ratio of tokens in the pool.
AMMs can quote prices for users at any time, so they can provide instant liquidity to markets with low liquidity. In the order book DEX, willing buyers must wait for their orders to be matched with sell orders to complete the transaction. Even if the order issued by the buyer is placed at the "front" of the order book, close to the current transaction price, the order may not be executed.
The exchange rate of AMM is determined by smart contracts. Users can obtain liquidity immediately, and liquidity providers (note: users who deposit funds in the AMM liquidity pool) can earn passive income by earning transaction fees. Since AMM can provide instant liquidity and eliminate the threshold for liquidity provision, new tokens on the platform can achieve explosive growth, and it has also spawnedstablecoinExchange and other innovative application scenarios. If you want to know more about AMM, please readThis article about how AMM works。
Although most AMMs currently mainly trade cryptocurrency, in fact AMMs can also tradeNFT, tokens of real-world assets, and carbon credits and other assets.
first level title
What value does a decentralized trading platform have?
Since DEX uses deterministic smart contracts to carry out transactions, it can ensure that transactions are strictly executed in accordance with user-defined methods, and there is no centralized third-party intervention in the process. Traditional financial market operations are opaque and may be manipulated; in contrast, DEX can well guarantee execution and improve the transparency of the underlying trading mechanism.
In the following video, Chainlink co-founder Sergey Nazarov talks about how the market's need for cryptographic security is driving the need for decentralized infrastructure:
Video details: https://youtu.be/D30NUjn_3Es
Since there is no custodian in the process, and users can directly participate in transactions using their own wallets, DEX can reduce counterparty risk. DEX can also disperse the funds in the wallet of the centralized trading platform, so as to reduce the systemic risk of the blockchain industry. In 2014, the bitcoin transactions processed by the centralized trading platform Mt.Gox accounted for a large proportion of the total bitcoin transaction volume, and Mt.Gox suddenly stopped trading after losing hundreds of thousands of bitcoins.
first level title
Risk Consideration of DEX
DEXs can guarantee execution, improve transparency, and provide permissionless access, thereby lowering the barriers to entry for trading and liquidity provision. However, DEX also has a series of risks, including but not limited to the following risks:
Smart Contract Risk——Blockchain can execute financial transactions very securely. However, the code quality of smart contracts depends on the technology and experience of the development team. There will be bugs in the smart contract, and it may also be hacked or manipulated, which may lead to the loss of DEX users' funds. Developers can conduct security audits, code peer reviews, and a comprehensive testing process to eliminate these risks, but they still need to be cautious.
Liquidity Risk——Although DEX is becoming more and more mainstream, some DEX markets still suffer from low liquidity, resulting in large transaction slippage and poor user experience. Due to the network effect of liquidity (note: a market with higher liquidity will also attract more liquidity, while a market with low liquidity will fall into a vicious circle), so most transactions are still on centralized trading platforms, which also It will lead to relatively low liquidity of DEX trading pairs.
Runaway risk -Since on-chain transactions are open and transparent, DEX transactions may be stolen by arbitrageurs orMEV (full name maximal extractable value, Chinese translation is maximum extractable value)Bots launch preemptive attacks to extract value from ordinary users. These bots are similar to high-frequency traders in traditional financial markets. By paying higher transaction fees and taking advantage of network delays, these bots seize market inefficiencies and profit from the transactions of ordinary DEX users.
Centralization risk——While many DEXs want to maximize decentralization and resist manipulation, they still have the potential for centralization risk. These risks include DEX deploying the matching engine on a centralized server, the development team having management authority over DEX smart contracts, and using low-quality token bridges.
Cyber Risk -Since assets are traded on the chain, the cost of DEX will inevitably be high, and once the network is congested or down, the cost will be unbearable. Therefore, DEX users are vulnerable to market fluctuations.
Token risk——Many DEXs allow users to create trading markets without permission (ie: anyone can create a trading market for any token), so compared to centralized trading platforms, buying low-quality or malicious tokens on decentralized trading platforms The risk will be much higher. DEX users need to be aware of some of the risks involved in participating in early-stage projects.
In addition to the above-mentioned risks, self-management of private keys is also a big problem for some users. AlthoughWeb3One of the visions of Bitcoin is to allow individuals to manage their own assets, but many users may still prefer to entrust third parties to custody their assets. However, if a robustSecurity Mechanismfirst level title
How can DEX use Chainlink to improve security and unlock various advanced functions?
OracleOracleServices to improve the robustness of the protocol and provide users with more functions similar to centralized trading platforms.
Chainlink Price FeedsIt can provide users with accurate, safe and reliable financial market data, covering various assets such as cryptocurrency, commodities, foreign exchange and indices, and guarantee the value of tens of billions of dollars for each DeFi application in the multi-chain ecosystem. Using the Chainlink decentralized oracle network, dApps can easily and securely obtain off-chain data in a decentralized manner, and perform operations based on these data.
Equity pledgeEquity pledgeRewards, and issue transaction fees to stakeholders. If the DEX involves margin or futures contracts, Price Feeds can also ensure that the mortgage assets are accurately priced and the liquidation process is triggered in a timely manner.
Chainlink Price Feeds can also further enhance the robustness of the DEX protocol, using reliable price feed data sources to prevent black swan events in the market. A secure price infrastructure can also guarantee the security and accuracy of price monitoring and financial analysis systems, and carry out and manage arbitrage strategies between different decentralized trading platforms.
Chainlink KeepersIt is a decentralized automation solution and can also implement end-to-end for smart contractsautomation, to realize various advanced functions for the DeFi ecology. Chainlink Keepers uses reliable decentralized off-chain computing, monitors whether user-defined conditions are met, and invokes on-chain functions when the conditions are met.
Summarize
Summarize
DEX is the backbone of the cryptocurrency ecology, and users can trade digital assets peer-to-peer without any intermediaries. DEX can provide instant liquidity for newly released tokens, new users can easily join the platform, start trading or provide liquidity without threshold, so it has been more and more widely used in the past few years.
Although we don’t know whether most transactions will be carried out in DEX in the future, and whether the current DEX model can support long-term growth andInstitutional application, but DEX is expected to continue to become an indispensable infrastructure in the cryptocurrency ecosystem, and will continue to improve in terms of transaction scale, smart contract security, governance structure, and user experience.
,existtechnical documentation,existDiscordAsk a question or contactfurther reading。