logoAcademy

Two-Way Communication

Learn about roundtrip messages.

When we send messages with Interchain Messaging, we can see check if a message has been delivered, but we do not get any feedback wether the message has been processed correctly or any return value. If we wanted to achieve this, we need to send a message back from the receiver to the original sender.

What You Will Learn

In this section, you will go through the following topics:

  • Sender & Receiver: Understand how we need to change the contracts to send a message back
  • Send & Track: Send a roundtrip message and follow the logs
  • Adapt the example: Take what you learned and adapt the example

Exercises

You will apply your learned knowledge by building your first Cross-Chain application! This application will be deployed on two chains: C-Chain and your own Avalanche L1, both running on a Local Network.

Therefore, you will deploy two contracts:

  • Sender on Local C-Chain: Send a message with a simple string
  • Receiver on your Avalanche L1: Receives the message, adds something to the string and send it back

At the end of the section, you will be adapting the example to build a cross-chain Avalanche L1 dApp that send a number to a contract on another Avalanche L1 then receives the result of a mathematical operation. This application is similar to the example above, but the message will include a number. The receiving contract will perform a mathematical operation.

On this page