MeowSwap.fi
Published in

MeowSwap.fi

MeowSwap Evolves Just As We Do

Welcome back from your winter holidays everyone! Here at MeowSwap, we’ve been very hard at work as is evident from our previous Technical Update Article here, and we want to share some important information with all of you. Today we’d like to invite all of you to take a seat — because class is in session! We’re going to discuss the internal process of the MeowSwap architecture and provide some important details regarding the road ahead towards full decentralization. So get out a pen, a notebook and make sure you’re wide awake from your ‘catnap’!

Some Opening Notes on MeowSwap’s Recent Activities/Updates

Following the launch of MeowSwap a few weeks ago the DEX has come to be the fastest exchange on all of Cardano mainnet and we couldn’t be more proud! We’re managing about forty transactions per block which is something that nearly all of the ‘Cardano-fudders’ had been saying wasn’t possible at all for any Cardano dApp and yet here we are, living proof that a dApp can process way more than one transaction a second! Since MeowSwap has gone live, the DEX has processed over one-thousand transactions processing over $500,000 in trading volume ALL ON ONE MEOW/ADA POOL with no liquidity mining. Needless to say, we’re a working DEX, and now with a proven track record!

With all of that in mind, the next major step is opening the MeowSwap yield farms, liquidity pools, staking, and the further decentralization of the protocol into the hands of the community. To fulfil all of these things the last deliverable we need is the audit results. Following the successful completion of the audit, we’ll then begin rolling out the aforementioned features which are currently unavailable due to our commitment to only launching audited tech when user funds are concerned.

The next few months are going to be an extremely exciting time for MeowSwap as we continue to lead the way as Cardano’s fastest exchange!

Now let us dive deeper into the way MeowSwap has achieved these throughput results as the architecture of our solution has appeared to be somewhat unintuitive for some, causing concerns across the board. Well, here we go.

Market Orders

Initiating the trade Using Cardano’s Layer-1 Settlement Layer

Let’s now take some time to look at our pool depositing, withdrawal and transaction system, as well as how exactly we integrate both Cardano layer-1 and our proprietary layer-2 nodes. We’ll begin first with our inbound transaction system, followed by the AMM calculations occurring on our layer-2 chain and finally the outbound transaction process.

Users begin by connecting their Nami wallet (Yoroi is integrated, but not automated, Gero to follow next week, other wallets to follow shortly) to the MeowSwap dApp. From there they create a swap transaction using their ADA or other Cardano Token balance and the show begins! The inbound transaction is processed directly on Cardano’s layer-1 to be validated. (Cardano’s layer-1 is likewise used for trade settlement after the layer-2 nodes process the trade and send clearing instructions back to the multisig smart contract. We will get there in a moment.) Meanwhile, the inbound transaction amount is kept on a multisig smart contract, i.e. funds never leave Cardano’s layer-1 and the multisig smart contract guarantees that a user’s funds are SAFU. The trade is then elevated to our layer-2 nodes where the actual trade results are calculated (in accordance with the AMM process described in our yellow paper).

Generating clearing instructions and settling the trade

Once the layer-2 nodes are able to detect the funds that have been sent to the multisig smart contract , the layer 2 nodes begin processing the trade calculating the price impact (by moving along the bonding curve), the resulting slippage and the effective exchange rate. The result of these calculations is a set of clearing instructions which is sent back to the multisig smart contract which are thereafter used for trade settlement.

The layer 2 nodes themselves are essentially Cardano oracles and are constantly in-sync with the Cardano chain, thus they are able to see that the multisig did in fact receive the inbound transaction. Following that, using the clearing instructions from above, the outbound transaction is generated, signed and then the swap is executed. The layer-2 nodes sign the calculations, while the layer-1 multisig key holders sign the outbound transaction and the trade results are synced with Cardano’s layer-1. The newly traded assets arrive back into the user’s wallet in the very next block (t+1 after the trade initiation inbound transaction).

Figure 1: The MeowSwap Transaction Flow.

It is important to note here that every layer 2 node (i.e. for the time being, it is equivalent to every multisig smart contract key holder) is an oracle performing AMM calculations and every one of them verifies the transaction flow separately. In other words, no single layer 2 node can tamper with the order tape. Think dYdX for a reference (https://whitepaper.dydx.exchange/, https://docs.dydx.exchange/#general).

Summary

This entire trading process can best be understood as one large calculation. The layer-2 calculation nodes work very similarly to smart contracts as they react to transactions that happen on Cardano’s layer-1, the trades and all the related math happen on the nodes in layer-2 but the funds never leave layer-1. The reason to go for layer 2 is to increase the transaction speed to be competitive with that of other DEX solutions present on L1 networks other than Cardano, such as e.g. Uniswap. Rest assured that before we open the pool creation and liquidity addition as well as staking functionality we will publish the multisig contract along with the audit results.

Liquidity addition

We will explain the pool management functionality in detail by the time we launch this critical piece of functionality (following the audit results).

Currently we are working with a number of Cardano ecosystem key entities to secure the first cohort of key holders and transaction validators making MeowSwap as decentralized and secure as, for example, Polygon network (as, in principle, it functions in exactly the same way). By the time we launch pools and staking, multisig will be secured by these partners.

Forward Onto Decentralization!

Now you’re likely thinking: “Wen 100% Decentralization?”, and well, it’s a gradual process. Cardano didn’t just happen to have smart contracts when it launched a few years ago. There’s been a significant amount of effort put into fleshing out what the system would look like with a UTxO model and this degree of patience, care and dedication to rigour is something we deeply admire about Cardano. We want to ensure that our community — that rightly expects secure and efficient systems — is able to get them without having to worry about suffering from exploits, as has been seen time and time again on other chains.

Keeping that in mind, when users generate the inbound transaction, everything is validated by the key holders of the multisig smart contract and those assets remain on Cardano’s layer-1. Just as a reminder, since all of the calculations are made on the layer-2 nodes, with assets never leaving Cardano’s layer-1, the multi-sig signers are able to verify that these trades (read: calculations) that have happened between the layer-2 nodes are correct. This entire process ensures the integrity of the swap and guarantees that the assets which are returned to the user’s wallet are exactly those traded for.

Looking down the road, the multi-sig signers are on track to be chosen, and in step with that is the ability for all of you to be able to run your own nodes to further decentralize the calculation process on layer-2 by decoupling the layer 1 signers from layer 2 validators. With this in mind, one is able to see that this entire process, from deposit to withdrawal, is under constant scrutiny and soon our community will begin taking part in that process helping further guarantee the integrity of MeowSwap and even earn a bit (or even quite something) in the process by maintaining a layer 2 node!

The road to decentralization is an important journey, it reflects the foundational ethos of Cardano and underlies the spirit of cryptocurrencies, it is a challenge we readily accept and every day we move forward toward that goal.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store