logoAcademy

Send a Message

Send your first Cross-Chain message with Teleporter.

The final step, is to send the message between the two chains. Assuming everything went smooth so far, your local C-chain and your Avalanche L1 will have their corresponding parts of the sender/receiver deployed on them.

Send a Message

cast send --rpc-url local-c --private-key $PK $SENDER_ADDRESS "sendMessage(address,string)" $RECEIVER_ADDRESS "Hello"

A relayer launched when you deployed the Avalanche L1 will now take the message and deliver it to the destination.

Verify Message was Received

Now let's check if the "Hello" string sent from our C-chain was actually stored properly on the lastMessage variable on our Avalanche L1. Run the following command replacing the receiver contract address.

cast call --rpc-url myblockchain $RECEIVER_ADDRESS "lastMessage()(string)"

If the output says Hello then the message was successfully delivered and processed.

Congratulations 🎉 You have just sent your first cross-chain message. This will be one of many to come!

On this page