Insight Into the Key Components of Magpie and How They Work

The Decentralized Finance (DeFi) ecosystem is booming and new exchanges are being launched every day. While many make their debut with the motive to compliment the numbers, Magpie Protocol came into the scene with targeted solutions.

Magpie Protocol
4 min readSep 21, 2022

DeFi users are quite familiar with how the majority of decentralized exchanges (DEXs) work and the design of Magpie is meant to enable a simplified and swift token swap either on or between a variety of chains. The chart below shows how the Magpie protocol works for the average user.

Simplified as this image looks, a lot actually goes on behind the scenes. While the aim is not to bore Magpie users with the intricacies in the design of the protocol, this article may be beneficial to users who want to know more about how the protocol operates.

Key Operational Components of Magpie Protocol

As a uniquely designed liquidity aggregator, Magpie removes the intricacies that are associated with bridging assets.

Unlike its peers, Magpie utilizes single asset liquidity pools through which most of the initiated swaps are made.

The protocol’s operation revolves around its four major components which include:

  • Magpie Aggregator
  • Cross-chain messaging
  • Liquidity network
  • User interface

The infrastructure of Magpie’s aggregator is based on a microservices structure where each service runs on its own and has its own purpose.

This determines the best path to swap any token pair and as the goal of a liquidity aggregator is to help the user get the best price on each swap, this component of Magpie helps to perform cross and on-chain swaps efficiently.

Wormhole generic messaging protocol is used as a cross-chain messaging solution in Magpie protocol, wherein Magpie sends a message containing information to complete the cross-chain swap on the destination chain when the user initiates their swap from the initial sender chain.

User assets are first converted to a stablecoin which is deposited onto a bridge while simultaneously a cross-chain message is published using Wormhole.

Upon the completion of this swap, VAA is produced by Wormhole Guardian Nodes after getting a two-thirds majority among the 19 Guardian nodes, this VAA is proof of the message which is then published on the origination/sender chain. Now this VAA is used by the Magpie Relayer to swap stablecoins to the user’s target assets on the destination chain.

The liquidity network consists of stablecoin liquidity pools on each supported network, Magpie will primarily aggregate through the bridge Stargate.

The fourth major component is the user interface that brings everything together for a user.

Magpie’s Microservices

Just like a functioning ecosystem, the identified Magpie components are interconnected.

While the Aggregator scouts the best pricing, it only does this based on the information from the Pool Explorer Service. Magpie’s Pool Explorer Service is one of the protocol’s five highly functional microservices.

Besides the explorer, the Token Explorer Service helps in updating Magpie’s token list in tandem with the integrated DEXs.

Should an exchange listed in the Magpie aggregation tool add a new token, Token Explorer adds this token. The explorer also helps to update the USD prices of all the digital currencies that are swappable on the Magpie protocol.

The design of the Magpie Protocol is such that enables users to access all they need without resorting to help from the community. Activities like regular updates of balances and insights on transaction status must also be easily accessible, and this is made available with the help of the User Service.

The fourth service is the Relayer Service and it listens to the SwappedIn event on all supported chains. This tool queries the wormhole guardian network to get VAA for any SwapIn transaction and then it calls swapOut on the target chain.

The last service is the Message Broker tool that handles internal communications amongst these protocols.

Courting a Smooth System

Like every DeFi protocol around today, Magpie is essentially controlled by a smart contract. This means that all of the components function automatically and in a very swift manner.

The intricate communications between the chains and each of the components of the Magpie Protocol occur in a matter of seconds or a few minutes depending on network congestion.

A new user visiting Magpie’s website will be able to feel the simplicity and the difference in design. The outlook, operations, performance, ease of use, and low cost of Magpie is one that will be appealing to both new and experienced DeFi users.

For more news and updates about Magpie, join our Discord, Twitter, and Telegram

--

--

Magpie Protocol

Future of cross-chain exchange infrastructure. Chain-Agnostic & Non-custodial liquidity aggregation protocol.