Cross-Chain Automation for Multichain Apps
Gelato Team
•
Apr 28, 2023

With the proliferation of the multichain landscape, developers are facing the issue of having multiple applications with their own states living on separate blockchains.
To overcome this, cross-chain messaging protocols like LayerZero enable users to send transactions from one chain to another while retaining a high level of data integrity and security.
However, having multiple dApps living on siloed blockchains, each with its own individual state, makes it very difficult to manage automated processes across different smart contracts.
Projects would typically have to build, run and maintain the custom infrastructure that handles the transaction automation on each of these chains in parallel.
This is where Gelato comes in. As web3’s decentralized backend, Gelato enables projects to automate the execution of smart contract functions across all major blockchains.
Prerequisites
If you're not familiar with Gelato and smart contract automation, please refer to our
docs.
For more information on LayerZero and omnichain interoperability, please refer to their
docs.
What is cross-chain automation?
Cross-chain automation powered by Gelato allows developers to automate the execution of arbitrary functions that periodically conduct cross-chain messaging calls via protocols like LayerZero to another chain.
A good use case for cross-chain automation is periodically syncing the state between multiple siloed dApps on multiple chains in order to consolidate the accounting of balances for the entire application.
How Does it Work?
Example for cross-chain ice cream licking: users can try to create an Automate task on Avalanche to lick ice cream on Fantom.
Steps
Enter
0xC8aE2A55bC4Bf3280a38C76077A43D4D4a086272
as a contract addressSelect
initateCCLick
as a function to be automatedEnter
0x126E75609cb5B20D07e9250E38e5fC14dFb7851b
as_dstLicker
Enter the user’s
iceCreamNFT
token id on Fantom as_tokenId
or just use1
as_tokenId
Select the interval and pay with your Gelato Balance
When the task is executed, users can check the events on GelatoLickerDst to see that their ice cream was licked.
GelatoLickerSrc – View on Snowtrace
GelatoLickerDst – View on FTMscan
GelatoLickerSrc
GelatoLickerDst
Omnichain Staking Reward Payouts
Abracadabra is already using LayerZero to optimize the functionality of their protocol.
The team has implemented Gelato and LayerZero to automate and synchronize the payouts of staking rewards across multiple EVM chains.
Abracadabra allows users to stake governance tokens across multiple chains. This is great for the user, but can ultimately cause issues with fractured governance and protocol updates.
With Gelato and LayerZero, this problem is quickly alleviated via the implementation of omnichain governance and staking capabilities.
For example, there will be 100 MIM in rewards paid out every day to all SPELL stakers across all chains. However, those MIM rewards are minted on Ethereum and the right amount of MIM has to be automatically transferred to each supported chain based on the total SPELL staked on each of them.
Tutorial
Abracadabra set up two automation tasks with Gelato and has used LayerZero as their cross-chain messaging protocol of choice.
Task #1:
The first task is conducting daily snapshots of staked $SPELL on multiple EVM chains (ex. Polygon, Arbitrum) and sending this information to Ethereum for aggregation.
Ethereum now knows how much $SPELL was staked on each chain and how much $MIM rewards each chain should receive.
More information can be found in the respective Gelato

Task #2:
The second task then distributes $MIM rewards from Ethereum (hub chain) to all the spoke chains based on the snapshot taken earlier.
More information can be found within the respective Gelato

When Should You Use it?
Smart contract developers looking to solve cross-chain communication can use Gelato and LayerZero in the following way:
Create a task on Gelato Automate that should trigger a periodic cross-chain messaging call and choose when it should execute (e.g. daily or via a dynamic parameter).
Send a message on chain A via the information that you want to pass to chain B.
Create a second task with Gelato which performs the desired action on chain B with the information from chain A.
Gelato & LayerZero: Security Profile
Gelato Automate is made significantly more secure than existing solutions by LayerZero’s omnichain generic messaging technology.
Most cross-chain solutions today wrap assets, pass information through centralized entities, or rely on permissioned validator sets that can be compromised. In the recent year, we’ve seen nearly a billion dollars of losses accrue to bridges based on these technologies.
LayerZero simply passes messages between endpoints on multiple chains and never relies on wrapped assets or centralized validator sets. LayerZero does this using a unique ultralight node model which uses independent Relayers and Oracles to pass and validate messages between chains.
Moreover, LayerZero allows applications to select their own Relayers, Oracles, and security parameters to optimize security requirements to their needs.
The combination of secure messaging and user application configurable security profiles makes Gelato Automate the ideal solution for secure and reliable on-chain automation.
About Gelato
Gelato is a Web3 Cloud Platform empowering developers to create automated, gasless, and off-chain-aware Layer 2 chains and smart contracts. Over 400 web3 projects rely on Gelato for years to facilitate millions of transactions in DeFi, NFTs, and gaming.
Deploy your own tailor-made ZK or OP L2 chains in a single click with native Account Abstraction and all Gelato middleware baked in.
Connect your smart contracts to off-chain data & computation by running decentralized cloud functions.
Automate your smart contracts by executing transactions automatically in a reliable, developer-friendly & decentralized manner.
Give your users access to reliable, robust, and scalable gasless transactions via a simple-to-use API.
Gelato has partnered with Safe to build a fully-fledged Account Abstraction SDK, combining Gelato's industry's best gasless transaction capabilities with the industry's most secure smart contract wallet.
Subscribe to our newsletter and turn on your
Twitter notifications to get the most recent updates about the Gelato ecosystem!
If you are interested in being part of the Gelato team and building the future of the Internet browse the open positions and apply
here.