Utilizing Multichain Bridge and Moonbeam to bring Liquidity to Polkadot Parachains
Tags: rust, web3, blockchain, defi
Published: 2023-01-27 17:15:27

Unlocking Ethereum liquidity is widely considered of paramount importance to any DeFi protocol’s success no matter the chain it chooses to launch on. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6eengpcl856chnprii60.png)

This DefiLlama chart illustrates almost 60% of all Defi TVL is locked on Ethereum. This makes bridging liquidity from Ethereum a high priority for Equilibrium. 

This article will examine [Equilibrium](https://equilibrium.io/)’s bridging solution that allows for cross-chain transfers between EVM networks and Polkadot parachains. It’s a unique contribution to the parachain ecosystem since it pioneers the concept of one parachain using another as a bridge. A brief overview of the underlying tech will also be provided. Let’s start with the basics. 

Multichain is an open-source project that builds interoperable infrastructure for cross-chain interactions. It supports over eighty blockchain networks with approximately$1.6B TVL. Multichain has a history of reliability and trustworthiness stretching back to July 2020. Let’s examine Multichain’s Cross-Chain Bridge and Router.
 
## Multichain Cross-Chain Bridge

The bridge fundamentally allows an asset to be sent from one chain to another. Let’s briefly describe how it works. 

First an asset is locked on a token wrapper controlled by the Router contract on the source chain side. An MPC (Multi-party computation) Network with 28 validators verifies the transactions on the source chain and then signs token minting or withdrawal transactions on the target chain. A wrapped asset is then minted or native asset is withdrawn on the target chain. Wrapped assets can be burned to facilitate transfers from the target chain to the original one. 

More info on the [Cross-Chain Bridge](https://docs.multichain.org/getting-started/how-it-works/cross-chain-bridge).
Active MPC validator set can be found [here](https://scan.multichain.org/#/network).

## Multichain Cross-Chain Router

The Router enables asset transfers for native tokens and those created with Multichain Bridge (bridged) between two or more chains. Liquidity pools support native assets since Multichain can not mint or burn those tokens. This requires tokens to be supplied to liquidity pools externally. Bridged assets do not require liquidity pools because Multichain controls the supply of those assets by minting and burning bridged tokens. 

It’s also possible to combine native and bridged assets when a project adds support for extra chains via the router. Tokens on the chains supported by Multichain are considered bridged, while pre-existing tokens are considered native. 

More info on the [Cross-Chain Router](https://docs.multichain.org/getting-started/how-it-works/cross-chain-router).

## 
SMPC network

Multichain uses a Secure Multi Party Computation (SMPC) network of nodes. These nodes generate parts of the private key for signing transactions. An algorithm selects a set of nodes from the network to do this. Selected nodes then sign transactions collectively. This mechanism is used for every supported network.  

More info on [SMPC](https://docs.multichain.org/getting-started/security/security-model).

## Moonbeam EVM parachain

Moonbeam is a parachain on Polkadot designed as an onramp for developers. It’s an Ethereum-compatible L1 smart contract platform. Moonbeam is one of the ecosystem's biggest and best-known projects, the first winner of parachain auctions on Polkadot. Moonbeam enables developers to go cross-chain with their existing Ethereum dapps as well as create new cross-chain projects. 

## XCM

XCM stands for Cross-Consensus Message. It is how Polkadot brings interoperability to its projects. XCM format defines how messages are sent between blockchains, effectively connecting parachains to the relay chain and each other. This delivers on the promise of cross-chain application interoperability as more and more projects launch on Polkadot parachains allowing users to interact with all of them from a single dapp. 

The main use case for XCM currently is accessing tokens in cross-chain dapps. Smart contracts on Moonbeam can communicate directly to perform transactions and other activities. 

More info about XCM on [Polkadot Wiki](https://wiki.polkadot.network/docs/learn-xcm) and [Moonbeam](https://moonbeam.network/blog/xcm-on-polkadot/).

## XC-20 tokens

XC-20 is a token standard for ERC-20 tokens on Moonbeam. These tokens are cross-chain-ready and transferable across the entire Polkadot ecosystem. This is useful for applications that want to integrate native tokens as ERC-20s. 

See [Moonbeam docs](https://docs.moonbeam.network/builders/xcm/xc20/overview/) for a detailed breakdown of how XC-20 works.

## How it all comes together on Equilibrium

In [Equilibrium](https://equilibrium.io/)’s case, both EQ and EQD tokens are controlled by Multichain, meaning that Multichain routers have minting and burning rights for these tokens. These minting and burning actions allow for control over the supply of these assets on the chain where the smart contract resides. This means all that is required for the bridge to work is a supply of assets on the chain where the token was originally minted. This is what bridging looks like for EQD:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g88hsqw0hsj64b0xj45l.png)

The Equilibrium team developed a proxy contract that implements AnycallProxyBase interface and allows token transfer from Moonbeam to another parachain in the Polkadot ecosystem. This solution may be used by any team which wants to use a Multichain bridge in their parachain.

For a more in-depth look into how it works see [github](https://github.com/anyswap/multichain-smart-contracts/blob/main/contracts/router/proxy/AnycallProxyBase.sol).

Moonbeam contains system contracts that connect EVM and Substrate parts of the network.
Using this contract, users may transfer XC-20 tokens from their Moonbeam EVM address to another parachain with substrate-type addresses.

The xTokens -transfer method allows sending XC-20 and pays fees in this token.

Using this method will move XC-20 tokens from a user to a sovereign account of the destination parachain in Moonbeam. The same value will be deposited to a recipient in the destination parachain.

Equilibrium put together two great things - a custom proxy call and "xTokens" contract and made automated deposits to Equilibrium or any other parachain from Multichain-supported networks possible. 

Here is a generalized overview of what happens to the tokens under the hood using WBTC, ETH and USDC as an example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5x74fw4t064w900qxt5.png)

Equilibrium implemented `XcmTransferProxy` for transferring tokens from Moonbeam to another parachain without additional user transactions. The code for this is on [Github](https://github.com/anyswap/multichain-smart-contracts/blob/main/contracts/router/proxy/XcmTransferProxy.sol). 

Here’s how it streamlines the token transfer process: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkx6gtn8pf3pqiqcv5u1.png)

## Withdrawal flow optimization

One of future Moonbeam runtime releases will enable the EVM call by XCM feature. It will be a powerful tool enabling interaction with EVM contracts on Moonbeam from any parachain.
Withdrawals from Equilibrium or any parachain will be enabled without additional user transactions on Moonbeam after the feature is released.

This is what withdrawal flow looks like now compared to after optimization:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fryzflq7upnu0izcqap3.png)

Bridging liquidity across different chains is a complex and challenging process to streamline. Equilibrium has made a momentous step forward by developing a custom bridging solution. It benefits the project and ecosystem as a whole in two significant ways. Firstly it unlocks Defi TVL on Etherium and brings it to Polkadot parachains, and secondly, it facilitates the realization of Equilibrium’s mission to make [EQD](https://medium.com/equilibrium-eosdt/equilibrium-101-eqd-stablecoin-99d6494f0030) a cross-chain stablecoin. 

This kind of cooperation between Equilibrium and Moonbeam in developing a solution that can be used by all parachains and benefits the entire ecosystem is the manifestation of a long-term vision of interoperability and value accrual that is now becoming a reality.