Cross-Chain Messaging
Learn how to send cross-chain messages with Telepathy.
Last updated
Learn how to send cross-chain messages with Telepathy.
Last updated
With Telepathy, you can send messages from any supported source chain that uses Ethereum consensus to any destination chain that can run the Telepathy light client (currently implemented in EVM).
To use Telepathy to send a message, you need a sending contract on the source chain and a destination contract on the destination chain. We'll go through the process of writing both while integrating with the .
The data contained in a cross-chain message can be anything that fits your needs:
simple informational strings
complex data structures
function calls
This arbitrary message passing is the basis for any kind of cross-chain application you may want to develop.
1) To send a message to another chain from your sending contract, you will need to add the following interface:
2) Store the address of the inside your contract. See the full to determine which address to use for a given chain. For example, on Mainnet the address is 0x41EA857C32c8Cb42EEFa00AF67862eCFf4eB795a
so we store this in our sending contract as
You must require that msg.sender
is the Telepathy Router, or else any contract can call handleTelepathy
.
You must require that the _senderAddress
is the address of the sending contract on the source chain. Otherwise any contract on the source chain can send messages to your contract on the destination chain.
You must return ITelepathyHandler.handleTelepathy.selector
to have our contracts correctly record your message execution status.
Do these need to be separate contracts?
The sending and destination contract can be the same bytecode deployed to both chains, as long the logic for both sending and receiving is present. Alternatively, these contracts can be totally distinct if the separation of code is cleaner for your use-case.
How can I see the status of a message?
How long does it take for a message to be relayed?
3) Send a message using your destination contract address and chainId. To find the chainId number that corresponds to a destination chain, refer to this . For example, the chainId for Gnosis chain is100
:
1) Store the address of the Telepathy Router inside your destination contract. Once again, refer to the .
2) Implement the handleTelepathy
function from the interface on your destination contract:
If you would like to not worry about the above checks, use our abstract contract . You can refer to an example of using the abstract contract .
The Succinct team currently runs a relayer that relays all messages sent on any of the supported source chains with 200k gas for message execution. If your project or team is looking for SLAs around relaying or looking to change these gas parameters, please fill out to discuss options with the Succinct team.
Use the Telepathy for message tracking.
on Ethereum takes ~12 minutes, and there are additional time delays for security purposes. We recommend waiting ~20 minutes before troubleshooting a message.