Demex is a trading platform conceived for a fully decentralized future where borderless access to any market and financial instrument is possible. It aims to let its users enjoy strong privacy and unrivalled security. Only a highly robust technology is able to support its bold aspirations at scale. To that, Demex is often described as a 2nd-generation derivatives DEX that is built on top of a Layer 2 scaling solution. But what exactly is a Layer 2 DEX?
Diving under the hood
Layer 1 blockchains such as Bitcoin and Ethereum form the foundation of most of the crypto world. They typically consist of older (1st or 2nd generation) blockchain protocols and usually use the Proof-of-Work mechanism, which requires miners to solve mathematical puzzles to generate blocks (hashing). For L1 blockchains that have a large mining community, the cost of attack is usually very high, making the protocol very secure. The tradeoff however, is that this is computationally expensive, energy inefficient, and slow. This cost is passed down to the users of the protocols, which eventually leads to extremely high network fees in widely used protocols, such as Ethereum.
Designed to tackle these scalability issues, Layer 2 solutions are secondary frameworks or protocols built atop of this base layer that can function independently while remaining anchored to the security of the main L1 chain. L2 solutions use various techniques to connect to the L1 chains, including Optimistic Rollups, ZK-rollups and Sidechains. Each solution is implemented differently, and this has implications in terms of performance, security, and decentralization. A brief comparison is shown in the table below:
|Plasma||ZK Rollups||Optimistic Rollups||Sidechain|
transactions, and users
prove their ownership
submitting a validity
proof to main chain
assumes transactions are
valid by default and
only runs fraud proof,
in the event of a challenge.
|Protocol with own validator
set, derived from blockchain
frameworks like Cosmos or
|Transaction Throughput||~10k TPS||~3k TPS||~300 TPS||~1-100K TPS|
|Withdrawal Time||1 week||~10 mins||1 week||1 confirmation (dependent
on block time)
|Programmability||Limited as of now||Limited as of now||Flexible||Flexible and interoperable
with other chains
Source: Matter Labs, The Block Research, ethereum.org
The L2 protocol that Demex runs on is called Switcheo TradeHub, a custom-built sidechain that utilizes Cosmos SDK as it’s primary building block. Switcheo TradeHub comes with a highly scalable order matching engine, and a liquidity pool module that is able to interoperate with the protocol’s order books. It uses the delegated Proof-of-Stake (dPOS) system built into Tendermint Core as the underlying consensus mechanism, meaning that it is run by a decentralized network of validator nodes. You can think of this as having each validator node host a copy of Switcheo’s order matching engine, so that they can ensure that all other nodes also process trade transactions correctly.
Switcheo TradeHub reduces cost for users by offloading transactions (such as trade requests) from the L1 chains onto Switcheo TradeHub. Only deposit and withdrawal transactions incur network fees on the L1 chains, while all other transactions are sent to the L2 protocol, and are accepted by Switcheo TradeHub nodes. More information about Switcheo TradeHub works can be found in an earlier blog post.
What does it mean for traders?
In popular L1 protocols such as Ethereum and Bitcoin, network congestion still remains a thorn in the flesh for users, as they need to compete against each other to get transactions fulfilled. In a space where asset prices fluctuate constantly, timing is crucial and any delay in the execution of orders could be devastating for traders. This problem will only be exacerbated as crypto gains further traction with institutional investors and retail traders as we approach mass adoption.
Network latency which leads to congestion can be largely attributed to the clunkier Proof-of-Work (PoW) mechanism that L1 blockchains use. Over time, the difficulty of the mathematical problems miners need to solve increases. This makes it harder and slower for new blocks to be created, leading to congestion as transactions pile up.
In contrast, Switcheo TradeHub is a sidechain that adopts the dPOS consensus system. Through this model, network latency is reduced while ensuring network security remains uncompromised. It does this by allowing users of the network (i.e. delegators) to delegate tokens to a validator of their choice, entrusting them with authority to validate new blocks. The dPOS system is proven to be more efficient than PoW and PoS models, with the ability to process a higher number of transactions per second (TPS). As a Layer 2 DEX, most transactions on Demex are settled on Switcheo TradeHub and verified through the dPOS system. It has been tested to handle up to 10,000 TPS, allowing traders to enjoy fast transactions even when user volumes on the blockchain are high.
Tying in closely with the network congestion are the exorbitant fees incurred when L1 blockchains are at their maximum capacity and transactions cannot occur as quickly. L1 DEXs rely on a single blockchain with a limited capacity to validate and process every type of transaction. This means that a L1 DEX user would be competing with all other users of the blockchain (e.g. Gambling apps, CDP users, Oracles, Cryptokitties, etc.), resulting in high per-transaction fees. Network congestion has continued to be a major drawback for DeFi, preventing users with smaller assets under management (AUMs) from participating. This is especially true given how the current ecosystem is largely built on a single blockchain - Ethereum.
The reason why L2 crypto platforms like Demex are able to set relatively low network fees is because transactions are processed on a low cost secondary layer, with the additional benefit of lower block latencies. As such, a more inclusive and attractive ecosystem can be created for all traders, and not just those with large amounts of capital.
Sophisticated Financial Instruments
DeFi has experienced tremendous growth in the past year. Yet, beyond products and services offered by the deluge of DeFi projects, the market for more sophisticated financial instruments such as decentralized derivatives is still very much in its infancy. This is because L1 blockchains were not built with the intention of supporting complex programs such as sophisticated financial constructs. For example, Ethereum caps the maximum complexity of all programs combined at a certain number of instructions (currently defined by the block limit of only 12.5m gas)! This forces developers to move components of their dApp to centralized off-chain operators, or scale with a L2 solution.
Derivatives such as futures, options and warrants, are examples of programs that are too complex to be directly implemented in full on current L1 protocols. Even if implementation on L1 protocols is possible, they are still too computationally expensive, which translates to impossible costs for users. This is another reason why many newer dApps on Ethereum can cost hundreds of dollars to execute, even when the gas price is relatively low.
L2 protocols resolve this by allowing developers to create the infrastructure needed to support these financial instruments by offloading transaction data from L1 chains to the L2 solution. As a custom-built sidechain for trading, Switcheo TradeHub was designed specifically to support any kind of financial instrument at scale. This ensures that costs can remain low for users while maintaining high transaction throughput. In a truly decentralized fashion, Switcheo TradeHub allows for anyone to list any type of market or product using its native L2 liquidity protocol in combination with the on-chain governance module.
The communication or lack thereof between different blockchains continues to persist in the crypto space today. Tokens that originate from one particular network (e.g. ERC-20, NEP-5, Bitcoin) are generally isolated from other blockchains which hinders the full potential of blockchain technology. It also impedes on user experience, forcing users to jump through hoops in order to trade assets across different networks.
When blockchain ecosystems are able to communicate with each other, the utility of applications and digital assets that run on each network is significantly improved. We see this in the rise of interoperable protocols such as Stargate on Cosmos, Polkadot and Poly Network, which indicates a strong signal of the value in cross-chain communication. By integrating with L2 scaling solutions, seamless and instantaneous transactions across multiple blockchains can be facilitated at low-costs to create a more inclusive financial ecosystem.
Switcheo TradeHub runs in parallel to L1 blockchains such as Ethereum and Neo, where bridges can be built to facilitate cross-chain transactions. With Cosmos as an underlying technology, Switcheo TradeHub has the ability to communicate directly with other IBC-compliant blockchains, expanding our ecosystem. Furthermore, Switcheo is also part of the Poly Network alliance, enabling integration across participating blockchains such as Neo, Zilliqa, Binance Smart Chain, Elrond, Ontology, Ethereum and Huobi Eco Chain. This means that applications running on Switcheo TradeHub, such as Demex, will be able to support trading of cryptoassets across these chains and more in the future.
Paving the way for a decentralized future
Layer 2 technologies present a myriad of opportunities that can take DeFi to the next level. As a L2 DEX, Demex aims to break new ground using this technology to provide sophisticated products and catering to the evolving needs of traders. By pioneering technologies such as AMMs that are integrated with central-limit order books, permissionless derivatives markets and bootstrappable insurance funds, Demex is put at the forefront of the decentralized movement.