Hybrid DEX, The MuesliSwap Way (Building a dApp on Cardano’s eUTxO)
After several months of hard work, the day has finally come — we are officially launching liquidity pools powered by the new Plutus v2 smart contracts, marking a new era of MuesliSwap.
After several months of hard work, the day has finally come — we are officially launching liquidity pools powered by the new Plutus v2 smart contracts, marking a new era of MuesliSwap.
If you are not familiar with MuesliSwap, allow us to go a bit down memory lane: In November 2021, after the Alonzo hard fork bringing smart contract support to Cardano, we launched the first Cardano-native decentralized exchange based on a simple model, where eUTxOs correspond to orders in a decentralized orderbook, locked in a smart contract. Since then, a lot has changed in the ecosystem. Now, after the 2022 Vasil hard fork, we are launching the next development iteration, focused on leveraging new Vasil features for improved efficiency and user experience. Among other things, this iteration will bring liquidity pools that will interact directly with our existing orderbook, along with significant improvements in transaction size and cost.
The coming improvements are enabled by the recent Vasil chain upgrade (hard fork). In order to elaborate on these changes, let’s take a step back and talk about the Extended UTxO model of Cardano.
Most blockchains today are based on one of two existing accounting models. One of these is the UTXO model introduced by Bitcoin, where each wallet contains a set of “Unspent Transaction Outputs” or “UTXOs”, each with a certain value. A UTXO can thus be understood as a digital version of a banknote. The alternative is the account-based model, used by Ethereum. This model instead relies on a central ledger containing the balances of each wallet, similar to accounts in a bank.
Cardano extends the UTxO model with the possibility to add arbitrary logic to a UTXO. For example, a UTXO could be programmed so that it only can be spent if certain conditions are met. This is the basis on which Cardano smart contracts are built. The IOG defines eUTxO as:
‘an extension to Bitcoin’s UTXO model that supports a substantially more expressive form of validation scripts, including scripts that implement general state machines and enforce invariants across entire transaction chains.’
The Vasil hard fork focuses on scalability. There are many benefits of the upgrade, but crucially it allows the use of so called Reference Inputs. Previously, a transaction’s complexity had been limited by the number and size of Smart Contracts involved. With Reference Inputs, this limit has been lowered a lot, as size doesn’t matter anymore! We can now let multiple Smart Contracts interact in a single transaction, such as our unique decentralized order book and our liquidity pools.
The same eUTxO model that allowed us to launch MuesliSwap v1 in November now allows us to launch MuesliSwap v2, based on the unique Hybrid DEX model.
Due to the unique functionalities of eUTxO, we are able to merge our decentralized orderbook with liquidity pools, giving users a unique trading experience. In particular, it is now possible to automatically fill limit orders using the entire liquidity locked in any liquidity pools across the blockchain. This makes markets on MuesliSwap more liquid and efficient!
So what is new and how does it work?
Processing multiple orders in a single transaction
With the introduction of Plutus V2 Reference Inputs, new trades placed on MuesliSwap will now take much less space on the blockchain. Additionally, we are now able to fit multiple contract interactions into a single transaction. Benchmarks have shown a ~10x decrease in transaction size for complex transactions (from 14 kB to 1.3 kB) at a lower or equal transaction cost (~1 ADA). This will allow for efficient trading even under high network load. With the corresponding contract upgrade, we can now greatly increase concurrency of the MuesliSwap orderbook and this will come to the benefit of our users.
Support for an LP-enhanced orderbook
The new protocol allows orders to be filled by any input — not only inputs from the same protocol. This allows for interaction between the decentralized order book protocol and a second contract. The primary use case for this is to allow filling orders with the funds locked in a Liquidity Pool. We have now deployed an AMM protocol that can directly interact with the MuesliSwap orderbook and fill orders automatically.
This also allows for third-party protocols like AMM DEXs or more complex DeFi protocols to interact with MuesliSwap, making it the primary location for placed orders.
Complete interoperability with legacy scripts
MuesliSwap has been operational long before the Vasil hard fork, before the new script language Plutus V2 existed. However, this is not a problem for our upgrade release. The existing legacy orderbook and MILK liquidity pool remain compatible with the newly developed orderbook and pool contracts. No liquidity move event is necessary. The DEX will continue to operate smoothly even through this special event.
Improved support for external market makers
Traditionally, market makers that actively quote prices have been proven as an effective way of bringing liquidity into orderbook exchanges. In the new protocol, liquidity used for satisfying orders does not have to come from the protocol itself. This streamlines the workflow for external market makers: It is no longer necessary to explicitly submit orders onto the blockchain when quoting prices. Instead, buys and sells at the quoted prices can be directly fulfilled, saving transaction costs and improving the market’s efficiency. We’re looking forward to many exciting collaborations in this area!
If you are planning on operating an external market maker for the MuesliSwap protocol, feel free to reach out to our team.
Final Remarks
The reason we decided to build on Cardano has always been the peer-reviewed approach of the network’s development. The eUTxO model has allowed us to launch our unique Hybrid DEX model, one of the first of its kind in the crypto world.
We don’t intend to stop here though. In the following weeks you can expect the launch of yield farming, as well as more exciting additions to our trading protocol.
Follow us on our official channels below:
Website | Twitter | Discord | Telegram | Reddit
SNEKbot by DexHunter on CARDANO
Cardano's Telegram Trading Bot live on Cardano mainnet!TRADE NOW!