Build Cross-Chain DAPPs between EVM and Cosmos non-EVM chains

112 Views Asked by At

I'm wondering is it possible to build an entire DAPP for example a DEX or NFT marketplace with Axelar that exists on an EVM chain like Avalanche and a Cosmos chain that is non-evm compatible? I am confused how this might work due to the different virtual machines.

I am assuming you cannot just call callContractWithToken() on a gateway contract when trying to implement this.

Thanks

I was reading on sendToken() and callContractWithToken() which is how I have sent tokens between evm chains I know axelar connects cosmos chains as well and am unclear how to send tokens between the chains with different virtual machines.

2

There are 2 best solutions below

0
On

Yes, that's possible.

Let's assume a scenario where you are sending ETH to smart contract A running on Ethereum network (so EVM compatible). Once that's done, you need to a trigger some action on a smart contract B running on Cosmos.

  1. Someone sends ETH by calling sendToken() of contract A
  2. A emits an event called ETHReceived. In solidity, this shall look like:
event ETHReceived(arguments);

sendToken() public payable {
  ...

  emit ETHReceived(arguments);
}
  1. You have some server code that's listening to events from A. If you are using ether.js, it shall look something like:
contract.on('ETHReceived', (...arguments) => {
 // trigger an action on Cosmos chain.
});

In the callback, you can trigger some action on B's function (non-EVM compatible).

So using events, you just communicated between an EVM and non-EVM compatible smart contracts!


Events are the core idea on which Chainlink is built. Refer: https://blog.chain.link/events-and-logging-in-solidity/

0
On

Yes, it is possible to build an entire dApp such as a DEX or NFT marketplace with Axelar that exists on both an EVM chain like Avalanche and a Cosmos chain that is non-EVM compatible.

Axelar delivers secure cross-chain communication for Web3, enabling you to build Interchain dApps that grow beyond a single chain. This means you can build a complete experience for your users that lets them interact with any asset, any application, on any chain with one click.

Axelar supports two main types of interchain capabilities: sending tokens and general message passing. The latter allows you to call smart contract functions across blockchains, which can be used to compose DeFi functions, move NFTs cross-chain, or perform cross-chain calls of any kind that sync state securely between dApps on various ecosystems source.

For EVM chains like Avalanche, validators play a crucial role in supporting and securing the chain. They participate by voting on EVM chain events in a proof-of-stake consensus model. When processing cross-chain messages from a source EVM chain, Axelar validators must query their RPC endpoints from their EVM chain to verify the submitted message source.

For Cosmos chains, all are automatically supported by default source.

In terms of communication, Axelar uses Gateways. On each chain connected to Axelar network, a Gateway is deployed. On EVM chains, it is a smart contract address. On Cosmos and other non-EVM chains, it is an application with logic and the ability to communicate with Axelar network source.

On each chain connected to Axelar network, a Gateway is deployed. On EVM chains, it is a smart contract address. On Cosmos and other non-EVM chains, it is an application with logic and the ability to communicate with Axelar network. This Gateway is used to receive messages from a connected dApp and send them into the Axelar network for routing to any connected chain.