📝Hi, I’m 10. This is the popular science branch of the #区块链发展史 series. This issue’s content: How your transaction is completed - decentralized exchanges!

A decentralized exchange (DEX) is a trading platform that does not require an intermediary or third-party institution. It allows users to exchange tokens directly on the blockchain through smart contracts.

👇👇👇

Decentralized exchanges implement transactions through two core components: Automated Market Maker (AMM) and Liquidity Pool

This is an introduction post about AMM and LP: https://www.binance.com/zh-CN/feed/post/372558024433?ref=167859860&utm_medium=web_share_copy

#️⃣ The transaction process of decentralized exchanges:

  • Select the token pair you want to trade on the exchange, such as ETH/USDT.

  • The exchange finds the corresponding liquidity pool contract based on the selected token pair and reads the number and proportion of tokens in the liquidity pool from it.

  • The exchange calculates the price of the token based on the AMM formula, the number and proportion of tokens in the liquidity pool. This price changes in real time because the number and proportion of tokens in the liquidity pool will change with the transactions of other users.

  • Enter the number of tokens you want to exchange on the exchange, for example, how much USDT to exchange for 1 ETH.

  • The exchange uses the AMM formula again to calculate the exchange rate based on the number of tokens entered. This exchange rate also changes in real time because the number and ratio of tokens in the liquidity pool will change with the transactions of other users.

  • The exchange finds the corresponding fee rate based on the selected token pair and calculates the fee to be paid. This fee is used to compensate liquidity providers (LPs) and maintain the operation of the exchange.

  • After confirming the transaction request, the exchange sends the transaction request to the blockchain and waits for blockchain confirmation.

  • The exchange broadcasts the transaction to the blockchain network and waits for the nodes on the blockchain to receive and verify the transaction.

  • If the nodes on the blockchain verify the transaction, they will add the transaction to a new block and broadcast the block to the blockchain network. If the verification fails, the transaction fee is wasted.

  • If a consensus on the block is reached on the blockchain network, the block will be added to the blockchain and become an irreversible record.

  • The exchange will deduct the sold tokens from the liquidity pool and issue the purchased tokens to LP. At the same time, the exchange will also distribute the handling fees to LP and issue reward tokens to LP.

If you think 10 is well written, please like, comment, forward and follow. Your support is my greatest motivation. Thank you!!! 🎉

Finally, welcome everyone to join the Chromosome Community, grow bigger and stronger together, and go to the bull market together! The entrance is in the personal profile!!!

#Crypto #DEX