Teleporter Basics
Learn about Teleporter basics.
Teleporter enables you to send messages from one blockchain to another blockchain in the Avalanche network by simply calling the sendCrossChainMessage
on the TeleporterMessenger
contract. This invokes a smart contract on another Subnet, where the called contract implements the ITeleporterReceiver
interface to receive messages on the destination Subnet. We will look at what happens under the hood in a later chapter.
What You Will Learn
In this section, you will go through the following topics:
- Recap: Bytes, Encoding, and Decoding: Understand how data is encoded and decoded in bytes
- Sending messages: Write your first simple sender contract
- Receiving messages: Write your first simple receiver contract
Exercise
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 Subnet, 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 Subnet: Receives the message and saves the most recent string
At the end of the section, you will be adapting the example to build an 'Adder'. This application is similar to the example above, but will the message will include a number. The receiving contract keeps track of the sum of all sent numbers.