Centralized and Decentralized Exchanges: Introducing RSKSwap
The popularity and significance of cryptocurrencies are steadily on the rise. Promising whitepapers are being launched every day, institutional adoption is witnessing stronger trends and consequently more and more users are coming onboard. Moreover, several retailers are now accepting payments in cryptocurrency, marking definitive progress towards mainstream usage.
As such, financial transactions are some of the most common use cases of existing cryptocurrencies like Bitcoin, Ethereum, Litecoin, etc. The underlying blockchain technology facilitates, secures and records these transactions. Blockchain technology eliminates intermediaries thus enabling peer-to-peer transactions. In other words, blockchain-cryptocurrency ecosystems deliver decentralization as no single entity can create, control or change the rules.
Users require a UI to access blockchain networks and digital assets. Presently, cryptocurrency exchanges are the most commonly-used gateway for this purpose. They are online platforms that enable users to acquire or use cryptocurrencies and have varying degrees of decentralization. In this post, we compare centralized and decentralized exchanges and RSK´s contribution to the ecosystem through RSKSwap.
It’s particularly important to understand the pros, cons and risks associated with both centralized and decentralized exchanges so we encourage our readers to fully educate themselves before exploring the different options available on the market.
- Custody & Control
- Privacy & Data Security
Decentralized Exchanges (DEX)
- Types of Decentralized Exchanges
- The Decentralized Exchange Architecture
- Order Matching & P2P Counterparty Discovery
- On-Chain Transactions
- Decentralized Exchanges Features
- Autonomy & Privacy
- Lower Costs
The Major Challenges for DEX Adoption
- Low Speed & Scalability
- Low Usability
- Low Liquidity
Introducing RskSwap: A Solution for Better Liquidity
- The Swapping Mechanism & The UI
- The Generation of RskSwap Tokens
- Ensuring a Secure Smart Contract
In general, cryptocurrency exchanges are in charge of the custody of the assets deposited by their users and to overlook and provide liquid order books for their users to exchange and trade the listed tokens. Centralized exchanges act as intermediaries who facilitate the trading on their platforms in return for a trading fee. In addition to providing a friendly UX for amateur users, centralized exchanges offer several benefits including fiat-to-crypto conversions, faster processing and payment services.
Centralized exchanges have some unique features that make them quite different from DEXs. Let´s analyze some of these features which set the foundations for DEXs.
Custody & Control
In the crypto space, the ownership of the tokens relies on private keys. Centralized exchanges hold on to their users’ private keys which can represent a problem as exchanges can be shut down by regulators and governments. Custodial exchanges also foster threats like fund loss and other security concerns. As the volume of trading increases, these exchanges become alluring attack choices for hackers.
As a solution to these issues, exchanges use a combination of “hot” and “cold” wallets. While the former stores a part of the users’ assets on-chain, available immediately for trading, the latter holds the rest off-chain. However, users don´t have control over these implementations. Additionally, if the exchange holding your money closes or is taken down, users could potentially lose their assets, irrespective of the type of wallet in which they are stored.
Privacy & Data Security
In compliance with Anti Money Laundering (AML) and other global/local regulations, most centralized exchanges have KYC-based onboarding procedures. Similar to the funds, the users’ personal data is also stored in centralized locations which represent single points of failure.
By definition, a decentralized exchange or DEX is an online platform that connects cryptocurrency buyers and sellers, thus enabling peer-to-peer (P2P) crypto trading. Unlike centralized exchanges, DEXs are non-custodial. This means that they don’t control a user’s private keys. As such, decentralized exchanges are not owned or managed by any single company but are governed distributedly through the majority consensus of the network’s members.
DEX is a major step towards the realization of actual blockchain-based decentralization. While centralized exchanges connect matching orders, DEX platforms connect the traders who issue these orders. DEX users are autonomous in terms of storage and operation of their crypto assets.
Types of Decentralized Exchanges
Broadly, decentralized exchanges can be of two types: currency-centric and currency-neutral. The first type of DEX is built on top of a particular blockchain, i.e. Ethereum. Thus, traders on these platforms can only use the exchange’s native cryptocurrency for transactions on these platforms.
The second type of DEX is designed to be interoperable and does not rely upon any particular native coin. Essentially, the native crypto of currency-centric exchanges acts as a mediator and is a hindrance to absolute P2P transactions.
The Decentralized Exchange Architecture
In common usage, the term Decentralized Exchange covers both the underlying blockchain-based protocol and the applications deployed on this protocol. In the first sense, DEX refers to the framework while in the second it refers to the end-user interface or API.
As mentioned earlier, cryptocurrency exchanges have four main functions. Accordingly, DEX ecosystems have four supporting pillars: the blockchain, a counter-party discovery protocol, order/user linking protocol and a settlement algorithm to facilitate the actual transactions. In relation to these aspects, DEX platforms have varying degrees of decentralization.
Order Matching & P2P Counterparty Discovery
Decentralized order matching is a crucial driving force behind decentralized exchanges. Centralized exchanges define the terms of the matching algorithm while the maker and taker of the order don’t interact with each other. On the contrary, order books in decentralized exchanges display individual (particular) orders, rather than the aggregate of counterparty orders. In order to trade, the user has to identify orders and the corresponding counterparties.
Commonly, there can be three scenarios with order books in decentralized exchanges.
- On-Chain Order Book: As the name suggests, this type of order book is hosted on the blockchain. In other words, the orders are directly presented to the decentralized network and confirmed through consensus. Since all order data is recorded on the blockchain’s distributed ledger, they are fully transparent, auditable as well as permissionless.
- Off-Chain Order Books: This type of order book is hosted off-chain and is usually facilitated by centralized owners. However, off-chain order books also facilitate direct, peer-to-peer counterparty matching.
- Liquidity Reserves: Primarily as a solution to low-liquidity issues, some DEX platforms fully or partially replace order books. In doing so, the network pools or borrows a liquidity reserve, so that assets are readily available for trading. However, in such cases, several factors come into play, including the capacity of the reserve and the pricing.
In general, matching is the process of connecting buy orders to sell orders, based on the conditions mentioned in each. It could either be algorithmically automated or performed manually. Usually, centralized exchanges implement automated order matching protocols.
Aggregating all user orders on their platform, centralized exchanges allow traders to issue specific order types, such as Market Order (buy/sell at current market price) or Limit Order (buy/sell at or below a specified price). Based on these conditions, matching orders are connected automatically.
On the other hand, decentralized exchanges usually follow manual order matching, where makers raise orders with a fixed price and volume. In turn, the taker identifies the order and fills it on the basis of pre-defined conditions. Given the latency in this process, proactive discovery and filling or resting orders becomes a necessity in DEX ecosystems.
Recording transactions directly on the blockchain and not on the exchange platform is a cornerstone of decentralized exchanges. However, despite ensuring decentralization and enhancing transparency, on-chain transaction settlements increase the latency of DEX platforms. Since most existing blockchains face scalability issues, this practice often leads to bottlenecks.
Decentralized Exchanges Features
Instead of vesting them in a singular entity, decentralized exchanges distribute trust and power over a global network. Moreover, being non-custodial is a great upside of DEX platforms and has several positive implications for the end-user.
Autonomy & Privacy
Since DEX users hold their private keys, they have complete ownership of their cryptocurrencies and also control their usage. Moreover, since the users’ data is stored on the distributed network and not in any centralized repository, single entity monitoring is no easy task. This also significantly reduces the risk of data breaches and protects users’ privacy. DEX platforms usually don’t have the need for KYC/AML compliance, meaning that the user doesn’t have to establish its identity.
Decentralized exchanges don’t have a single point of failure, neither in terms of asset storage nor in terms of the overall network. While funds remain in the user’s secured wallet, the network is secured using the underlying blockchain’s protocol and also by the virtue of being decentralized. Thus, the risks of theft and data loss are lower on DEX platforms. However, the fact remains that DEX platforms are exposed to the same security threats as their underlying blockchain. In other words, the platform is only as secure as the blockchain that supports it.
DEX platforms record trades on the blockchain, making them fully accessible to the broader public. Being community-governed, DEX platforms are potentially less vulnerable to price and volume manipulation. The fact that makers and takers are directly responsible for specifying and accepting the terms of trade further enhances the transparency.
The trading costs on decentralized exchanges only involve the blockchain network’s transaction and/or protocol fees, which is almost negligible for most blockchains.
The Major Challenges for DEX Adoption
Decentralized exchanges currently face different obstacles. Let´s briefly analyze some of them:
Low Speed & Scalability
Similar to most blockchain-based solutions, decentralized exchanges have low processing speed and throughput. As such, this limits the overall onboarding capacity of these platforms. In terms of on-chain order books and transaction settlements, these scalability issues directly affect trade on DEX platforms. Performance issues, slower updates, stale orders and inaccurate orders due to time mismatch are some of the most prominent scalability-generated issues with DEX.
The user experience that most of the existing DEX platforms offer is not the best for amateur users. To use these platforms profitably, users need to have a substantial technical understanding of crypto. Moreover, existing platforms have limited functionalities which restrict several aspects of a user’s overall trading scope and experience. The types of orders that users can generate is also significantly limited.
Although liquidity is often regarded as the greatest shortcoming of decentralized exchanges, the problem is invariably linked with low user adoption. While some platforms use liquidity reserves to solve these issues, the practice comes with its own set of shortcomings. First, it’s often reliant on centralized actors, defeating the very purpose of decentralized exchanges. Second, given the market’s high volatility, users need additional services to ensure fair pricing. Third, this model is likely to lean towards large reserve contributors and away from the small ones.
Introducing RskSwap: A Solution for Better Liquidity
RskSwap is an Automated Market Maker or AMM and a fork of UniswapV2. Simply put, AMMs are a specialized form of decentralized exchanges where token prices are determined automatically, using mathematical formulas.
While traditional swap protocols put the onus of market creation on the users, RskSwap automates the process. Built on Uniswap’s pricing protocol, RskSwap automatically ensures the best possible price for trades conducted on the platform. Furthermore, RskSwap is a fully-decentralized, permissionless, secured, and censorship-resistant platform, that allows users to instantly swap ERC20 tokens. In the process, a fee of 0.3% is levied, which incentivizes the liquidity providers (users who have locked their assets). Thus, RskSwap is also self-sustaining.
The Swapping Mechanism & The UI
To swap tokens, you’ll need the RskSwap dApp and a NIFTY or MetaMask wallet. Once you have these set-up, you can start swapping right away. However, you’ll need to have enough RBTC to pay for the transaction, as well as the token that you want to swap.
The process is simple: choose your input and output tokens, click swap and you can immediately see the output token in your wallet. Similarly, anyone can use any ERC20 token on the platform, while the users can freely audit the underlying smart contracts. In case the new token has low liquidity, the generation process is as simple as swapping. Furthermore, any user can contribute to the liquidity pool, using the RskSwap dApp. Combining these aspects, RskSwap substantially facilitates new users entry into DEX.
The Generation of RskSwap Tokens
In essence, RskSwap’s liquidity pools are trading venues for ERC20 tokens, where liquidity contributors deposit their pairs in return of ERC20 pool tokens. As such, the first depositor of a pool is also the price setter and receives incentives for depositing pairs in equal amounts (value). In turn, this prevents arbitrage from going to external parties, especially in cases where the deposit ratio varies from the market rate. Moreover, the subsequent depositors are expected to contribute proportionally for the same reasons.
The pool tokens represent the holder’s contributions to the LP, as well as the 0.3% fee. Since these are also ERC20 tokens, they are interoperable with other dApps or compatible ecosystems. Thus, you can use your RskSwap tokens to exchange or move or pay in any other ERC20-based platform. In order to get back their pool contribution along with the incentives accrued over the period, depositors need to burn (destroy) their pool tokens.
Ensuring a Secure Smart Contract
Vulnerabilities on smart contracts is one of the main areas where decentralized exchanges are prone to breaches. The audit report provides an in-depth analysis for security purposes.
The popularity of cryptocurrencies is steadily rising while more and more users are entering its world of possibilities. Several innovations are underway to make the underlying blockchain technology more robust and usable. However, just like we need browsers to access the internet, we need some gateway to access blockchain ecosystems. This role is currently played by cryptocurrency exchanges and some specific crypto wallets with exchange features. Even though centralized exchanges provide many useful features for end users, decentralized exchanges have also become a very popular option, specially amongst crypto savvy individuals.
Decentralized exchanges are non-custodial and enable peer-to-peer trading. Through on-chain trade settlements and data storage, these platforms enhance transparency and uphold decentralization. However, DEX platforms face similar scalability issues as the underlying blockchain. Low liquidity is also a major hindrance in their journey towards mass adoption.
RskSwap—a Uniswap V2 fork—has been introduced as an AMM. Incentivizing users to contribute to underlying liquidity pools and offering them a unified, easy-to-use token swapping protocol, this platform could be pivotal to mainstreaming DEX. Lastly, RskSwap is yet another step towards RSK promise for true decentralization. For further information, we invite you to join our official RSKSwap Telegram group.