logoAcademy

Two-Way Communication

Learn about roundtrip messages.

When we send message 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 an a cross-Avalanche L1 dApp that send a number to a contract on another Avalanche L1 and receives the result of a mathematical operation. This application is similar to the example above, but will the message will include a number. The receiving contract performs a mathematical operation.

Updated:

On this page

Edit on Github