5 Cross-chain DeFi Use Cases Unveiled: Analog’s General Message Passing Protocol

  • 5 Cross-chain DeFi Use Cases Unveiled: Analog’s General Message Passing Protocol
  • Cross-chain Decentralized Exchanges
  • Cross-chain lending and borrowing
  • Cross-chain liquidation protocols
  • Cross-chain NFT marketplaces
  • Cross-chain DAO
  • Wrapping Up
Linkedintwitter
TABLE OF CONTENTS

Analog’s General Message Passing (GMP) protocol is a composable cross-chain communication platform that allows developers to transfer messages (data) and value (tokens) seamlessly and securely across chains in a multi-chain ecosystem. As it stands, the blockchain infrastructure has imposed constraints on DApps that intend to operate cross-chain, resulting in fragmented liquidity, assets, and user bases for most applications.

With Analog GMP, DApps can now pass arbitrary messages, tokens, or both messages and tokens across different smart contracts on the supported chains. This creates a cross-chain ecosystem that is far more innovative, secure, and efficient than current cross-chain bridges.

Read “A Deep Dive into Cross-chain Smart Contract Execution Calls | Analog Insights” to learn more about how Analog envisions the future of Web3.

In this post, we delve deeper into five practical DeFi use cases that Analog GMP unlocks in the Web3 space. These examples demonstrate Analog’s GMP capacity as a cross-chain smart contract execution platform, transforming traditional single-chain DApp or multi-chain applications into robust cross-chain DApps.

Cross-chain Decentralized Exchanges

Although Decentralized Exchanges (DEXs) are far more transparent and secure than their centralized counterparts, they are not without challenges. Currently, many DEXs lack interoperability functionality, only supporting trading pairs on a single chain. This limits users from accessing a wide range of assets and liquidity pools.

A cross-chain DEX can help your users mitigate these challenges by allowing them to execute trades that source liquidity from different blockchains. You can also design a cross-chain DEX that allows users to swap native tokens on one chain for native tokens on another connected chain without relying on intermediate (wrapped) tokens or centralized exchanges (CEXs).

Let’s take a look at how traditional cross-chain swap works and how Analog GMP can address their limitations.

Suppose Alice intends to exchange her ETH on Ethereum with ASTR on the Astar blockchain. Here’s a list of steps she needs to follow for the swap to be finalized:

  • First, Alice must find a suitable DEX on the Astar network with enough liquidity for the pair she wants to exchange. This will usually be the pair between the bridged version of ETH(wrapped ETH) and ASTR. If the liquidity for this pair doesn’t exist, Alice must find another asset on the DEX to swap the wrapped ETH with it and then exchange the new asset with ASTR.

  • Before executing the trade, Alice must ensure that she has installed a compatible wallet on the Astar network and has sufficient gas on that chain to pay swap fees.

  • If liquidity is available on the DEX and Alice has configured a compatible wallet with sufficient gas, she must locate an appropriate bridge linking Ethereum and Astar blockchains. Next, she can connect her Ethereum wallet and commence the swap process.

  • Alice initiates the exchange on a DEX on the Astar network to finally receive ASTR tokens.

The above steps are tedious and confusing, especially for novice users such as Alice, who isn’t interested in the intricacies of blockchain interoperability.

Analog GMP supports more efficient liquidity routing via a seamless and seamless message passing between the supported chains, eliminating the need for cross-chain bridges. For example, you could build a cross-chain swap that converts a native token from one blockchain, say Ethereum, to Astar, using USDC as a routing asset.

With this implementation, Alice would only need to send her USDC to a Gateway Smart Contract (GSC) on Ethereum and receive ASTR on the Astar network or vice versa. To actualize this DEX, all you need is to upgrade your DEX to include the business logic with Analog GMP interface (IGmpReceiver) defined below:

interface IGmpReceiver ❴
/**
* @dev Handles the receipt of a single GMP message.
* The contract must verify the msg.sender. It must be the Gateway Contract address.
*
* @param id The EIP-712 hash of the message payload, used as GMP unique identifier
* @param network The chain_id of the source chain that sends the message
* @param source The pubkey/address which sent the GMP message
* @param payload The message payload with no specified format
* @return 32-byte result, which will be stored together with the GMP message
*/
function onGmpReceived(bytes32 id, uint128 network, bytes32 source, bytes calldata payload) payable external returns (bytes32);

Whenever a call is made to the GSC, the USDC gets burnt on the source chain, and the burn event is relayed to the Analog Network, which validates it. Upon successful validation of the burn event, a corresponding native token is minted on the destination chain.

Besides the onGmpReceived () function, the other core functions that the GSC implements are SendMessage() and ReceiveMessage(). The SendMessage() function is implemented on the source chain’s GSC and allows us to execute a contract on the destination chain. It takes as input the address, payload, salt, and gasLimit and constructs a GMP message to be validated and executed by Analog Network. Here’s a snippet of the GMP message:

struct GmpMessage ❴
bytes32 source; // Pubkey/Address of who sends the GMP message
uint128 srcNetwork; // Source chain identifier (for ethereum networks, it is the EIP-155 chain id)
address dest; // Destination/Recipient contract address
uint128 destNetwork; // Destination chain identifier (it's the EIP-155 chain_id for ethereum networks)
uint256 gasLimit; // gas limit of the GMP call
uint256 salt; // Message salt, useful for sending two messages with the same content
bytes data; // message data with no specified format

Notice data can be any message that an application smart contract (ASC)/DApp on chain A wants to send to another ASC/DApp on chain B. The ReceiveMessage() function, on the other hand, is implemented on the destination chain’s GSC and is called whenever Analog Network validates the GMP message.

See our docs for more in-depth information about the GMP protocol.

Cross-chain lending and borrowing

Most DeFi lending and borrowing platforms require users to deposit their collateral on the chain where the protocol is deployed. However, this is not an optimal solution in a multi-chain ecosystem where users leverage multiple DeFi protocols across different chains with their assets scattered across all these networks.

In order to optimize their returns, these users must reevaluate their positions. However, in most cases, their assets are often locked on one blockchain while better yield-earning opportunities exist on another chain. To get superior yield opportunities, users would need to manually liquidate their positions on one chain, bridge the asset to the new chain, and deposit that asset on the target protocol on the new chain.

To complicate matters, such users would need to perform the same processes in reverse to return their assets to the origin blockchain. This can be confusing for even experienced users as it involves many steps. It is also less secure as it introduces many security assumptions due to the use of third-party cross-chain bridges.

Analog GMP is better suited for scenarios like this one. It allows DeFi protocols to operate cross-chain while allowing users to seamlessly utilize their assets on one chain as collateral for another protocol on a supported blockchain without performing multiple manual steps.

For example, you could build a natively cross-chain lending/borrowing DApp that does not use traditional bridges by leveraging Analog GMP. All you need is to upgrade your lending/borrowing business logic with our GMP interface (explained earlier under cross-chain DEXs).

By integrating Analog GMP into your DApp, user assets can remain on their respective native chain where they were initially issued. Analog GMP would then ensure state synchronization and actions through seamless and secure delivery of messages across supported chains.

For example, a user intending to use ETH on Ethereum as collateral for a loan on the Astar network would only need to:

  • Call the SendMessage() function with logic requesting a loan on the Astar network as a payload.

  • The GSC on Ethereum then sends a secure message to the Analog Network for further validation and processing

  • Upon successful validation, the GSC on the Astar network executes the ReceiveMessage () function, which calls the ASC on that chain to issue a loan to the user.

Analog's Public Testnet

Be among the first to experience Analog’s Timechain and the tools that power up the next generation of omnichain DApps.

Cross-chain liquidation protocols

Yield farmers help power the liquidity pools in virtually all the DeFi protocols. But providing liquidity alone isn’t enough. Users need to earn passive income from their investments through activities such as lending assets, borrowing assets, and staking those assets in blockchain ecosystems to earn validator rewards. While this concept needs to be dynamic and agile, the current Web3 environment does not support it.

With Analog GMP, you can build a cross-chain liquidation protocol that allows user-deposited assets to be deployed across multiple DeFi protocols in the Web3 ecosystem. For example, lenders could deposit liquidity on multiple DeFi protocols across different networks, allowing other borrowers to access this liquidity via a single interface.

This way, Analog GMP serves as a central routing and aggregation layer in the Web3 ecosystem. Instead of using bridges to move assets and messages across different chains, users transfer these entities to and from Analog GMP, which handles the rest of the user journey.

Let’s say Alice has debt positions across multiple protocols on different blockchains (e.g., Astar and Polygon) but wants to keep her liquidity safely on Ethereum. Here’s how such a protocol would work at a high level:

  • For each chain where Alice holds a debt position, you integrate Analog GMP by upgrading the ASC/DApp on that specific chain (explained earlier under cross-chain DEXs). Integrating Analog GMP into your protocol enables the ASC/DApp to synchronize the debt ratios of the positions.

  • If the ASC/DApp identifies that any of Alice’s loans are nearing a liquidation threshold, it sends a GMP message to Alice’s liquidity chain (in this instance, Ethereum) to request additional funds to replenish the debt position.

  • When the GSC on Ethereum receives the GMP message, it withdraws liquidity from the relevant protocol on that chain and sends a new GMP message back to the requesting network with the funds. The payload for this message should include sufficient details and assets that fund the position to avoid a liquidation scenario.

Cross-chain NFT marketplaces

Running an NFT marketplace solely on one single chain can serve only some of the market because users are dispersed across multiple blockchain networks. Users need a cross-chain NFT marketplace that enables them to trade their NFTs securely and transparently across different chains while on the move.

For example, such a marketplace could allow them to use NFTs for various use cases across different networks, such as yield farming, collateralized loans, and insurance.

By using Analog GMP, you can implement a cross-chain NFT that allows users access to their NFTs across multiple chains.

Using the lock/mint mechanism, for example, the GMP protocol can guarantee that NFTs remain on their respective native chains where they are hosted while simultaneously syncing their status across various chains to facilitate their utilization in DApps on other blockchains.

In addition to the lock/mint mechanism, you could also leverage the burn/mint mechanism. This guarantees that the bridged NFT cannot be re-minted or redistributed back to the source chain without control of the mint authority wallet. To implement such a protocol, the NFT contract on the source chain would need to be upgraded to integrate the Analog GMP.

The NFT contract on the source chain must also include a logic for minting NFTs on the destination chain whenever the ASC calls the SendMessage() function. Upon successfully validating the GMP message by Analog Network, the message is relayed to the destination chain’s GSC, which calls an ASC on that chain to mint corresponding NFTs.

Cross-chain DAO

Many of today’s DeFi protocols are DAO-enabled. In this instance, a DAO is simply a smart contract deployed on the chain hosting the DeFi protocol that gives token holders a say in the protocol’s decisions. However, in a multi-chain ecosystem, your users may possess tokens across various chains besides those hosting the DAO contract.

In this case, your DAO protocol must act the same across the board, irrespective of the chain hosting the governance tokens. A cross-chain DAO can allow token holders on different chains to participate in the protocol’s governance decisions, fostering a more inclusive and diverse framework.

With Analog GMP, you can now build cross-chain DAOs, allowing token holders to participate in the protocol’s governance decisions — irrespective of the chains their tokens are hosted on.

For example, a DAO proposal on the Ethereum mainnet can be propagated to other smart contracts on the supported chains. You only need to integrate the DAO contract with Analog GMP to reach these chains. Whenever a call is emitted from the mainnet DAO, it is validated and processed by Analog GMP and executed on the supported destination chains after a specified period.

Wrapping Up

From cross-chain DEXs and cross-chain NFT marketplaces to cross-chain DAOs, it is evident that Analog GMP is ushering in a new era of true DeFi composability and a much more streamlined and unified Web3 landscape. If you’re thinking of building a cross-chain DApp, or you’ve already built a DApp and want to go cross-chain, we would love to learn more about it.

Subscribe to our blog

You Might Also Enjoy

Bridges are soon obsolete, what comes next? | Analog Insights

Blockchain interoperability has increasingly become essential to how the Web3 ecosystem evolves. As Layer-1s (L1s) and Layer-2s (L2s) increasingly become specialized, their accrued value becomes more fragmented, effectively addressing one challenge but giving rise to another.

Read more rightArrow

Enhancing Data Retrieval for DApps

Blockchains have radically redefined our interaction with the digital world. Decentralized applications (DApps) are proliferating, creating fresh opportunities...

Read more rightArrow

True Decentralization: Why It Matters Now More Than Ever

Stablecoins are essential in a shifting Web3 space. They protect investors and traders against massive market swings. The unveiling of stablecoins has raised the trust levels in the crypto space…

Read more rightArrow

Bridges are soon obsolete, what comes next? | Analog Insights

Blockchain interoperability has increasingly become essential to how the Web3 ecosystem evolves. As Layer-1s (L1s) and Layer-2s (L2s) increasingly become specialized, their accrued value becomes more fragmented, effectively addressing one challenge but giving rise to another.

Read more rightArrow

Enhancing Data Retrieval for DApps

Blockchains have radically redefined our interaction with the digital world. Decentralized applications (DApps) are proliferating, creating fresh opportunities...

Read more rightArrow

True Decentralization: Why It Matters Now More Than Ever

Stablecoins are essential in a shifting Web3 space. They protect investors and traders against massive market swings. The unveiling of stablecoins has raised the trust levels in the crypto space…

Read more rightArrow
Contact Us
Go to Top