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 Subnet 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 Subnet 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 Subnet. Run the following command replacing the receiver contract address.

cast call --rpc-url mysubnet $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-Subnet message. This will be one of many to come!

Updated:

On this page

Edit on Github