How Does DEX Operate?

DEX operates on the principles of cryptocurrency i.e., anonymity, peer-to-peer, fast and safe transaction, and that is the reason it is getting more popular everyday. In the absence of the third party, DEX works on smart contracts to facilitate transactions. Smart contracts are automated agreements written in codes shared between the creator and the recipient. These contracts are the agreements between parties’ needs are satisfied. Smart contract consists of multiple stages: 1) agreement, 2) conditions, 3) Coding, 4) Blockchain, 5) Execute, 6) Recording. The smart chain requires two parties to agree on agreement with certain conditions. Th decision is encrypted and stored in the blockchain. Once the client satisfies the contract to which both parties agreed, the funds are automated for transfer to the client and recorded on the blockchain however, if the task is unfinished, the contract is canceled and funds go back to the contractor.
In the absence of the trusted central/third party, the user is in full control of their money, manage their own wallets, and protect their own private keys. DEX works two ways: 1) Order Books, 2) Liquidity Pools. In the first case, the order books operate two ways: the On-Chain Order Books and Off-Chain Order Books. On-Chain Order Books consisted of network nodes that maintain the records of all orders (buy and sell). The spread between these prices determines the depth of the order book and the prevailing market price. This information is often held on-chain while your money is in your wallets that remains off-chain. Th examples of this DEXs include Nash Exchange, Tomo DEX, ViteX, Binance DEX etc. The second approach of DEX uses liquidity pools (SWAPS) instead of order books to facilitate trades or set pricing. The liquidity pool protocol determine the asset pricing and the trade happens peer-to-peer between users’ wallets. The examples of these DEX’s include UNISWAP, Curve, Sushiswap, Balancer, and Bancor.