BLOG — Developer Tutorials

181 days ago

Gasless & Automated Cross-Chain Transfers Powered by Gelato


  • Circle’s CCTP facilitates permissionless USDC transfers via native burning and minting
  • Native burning and minting involves a transaction on the source and destination chain which requires gas and manual user interaction
  • Gelato enables gasless and automated cross-chain transfers in which the USDC itself covers the transaction fee
  • Builders can leverage the new Gasless CCTP SDK for effortless integration into their applications

Moving tokens between chains is a crucial component in achieving blockchain interoperability, allowing users to utilize their assets on multiple networks and providing them with access to various ecosystems. However, existing lock-and-mint bridges fragment liquidity and pose security concerns regarding the backing of their synthetic tokens.

Circle’s Cross-Chain Transfer Protocol addresses these limitations by enabling permissionless USDC transfers between chains via native burning and minting. Nevertheless, a barrier of entry remains - the need for native tokens to facilitate transactions on the source and destination blockchain respectively. By combining Gelato’s Functions and Relayer service with Circle’s CCTP, this process is streamlined, all whilst remaining trust minimized. In this post, we’ll explore the simple integration process of gasless cross-chain transfers into your next project!


  1. Quick Start Guide
  2. How CCTP works
  3. Vision
  4. Gasless & Automated CCTP
  5. Integration
  6. Conclusion

Quick Start Guide

An example implementation is available on GitHub along with quick start instructions and documentation. The repository demonstrates a cross-chain transfer of 10 USDC from Avalanche to Arbitrum.

import { ethers } from "ethers";
import { transfer, ChainId } from "./src/cctp-sdk";
const PRIVATE_KEY = ••;
const main = async () => {
const wallet = new ethers.Wallet(PRIVATE_KEY);
const taskId = await transfer(
ethers. parseUnits ("100", 6),
ethers. parseUnits("1", 6),
ethers. parseUnits ("1", 6),
ChainId. Arbitrum,
ChainId. Avalanche,
wallet.signTypedData. bind (wallet)
console. log("" + taskId);

Note: We bind the ethers signed typed data method so that “this” refers to the wallet.

How CCTP works

  1. USDC is burned on the source chain and this emits an on-chain event
  2. Circle observes this event and signs an attestation signature, authorizing minting on the destination chain
  3. USDC is then minted on the destination chain using the provided attestation

In this case, the limitations are that steps 1 and 3 both require transactions on-chain and consequently native tokens to cover their associated costs. Step 2 can take up to ~13 minutes and the user must be present to initiate the final transactions which makes it a relatively long process. Additionally, once transferred, native tokens are again required to interact with the USDC on the destination chain. Essentially, whilst USDC is free to move around chains, native tokens are not.


Imagine we could move USDC between chains and cover all associated costs using USDC itself. For example, a user could transfer USDC from Ethereum to Avalanche. Once initiated, the transfer is reliably processed in the background and associated transaction costs as well as subsequent fees are covered using USDC itself. At no point, need the user be concerned with acquiring and maintaining various per-chain native tokens (ETH/AVAX). Eliminating this dependence decouples transaction fee payment from native tokens allowing for the unification of assets. The implication is that USDC acts as a blockchain interoperability layer and universal transaction payment solution abstracting away gas token complexities.

Gasless & Automated CCTP

This is made a reality by leveraging Gelato Functions and Gelato Relay to automate the entire process whilst abstracting transaction fee payments away from the user. Relayers put transactions on-chain on a user's behalf, consequently incurring a gas cost that needs to be compensated. This is possible in one of two ways; by sponsoring the transaction with 1Balance or by paying the relay fee synchronously during transaction execution. The latter is ideal as we can use some of the USDC being transferred to cover the fees on both chains. Functions allow us to execute on-chain transactions based on arbitrary on- and off-chain data (APIs, subgraphs, etc). This allows us to index on-chain transfer requests and periodically fetch their corresponding attestation. Once an attestation is issued by Circle, the Web3 Function relays a final transaction on the destination chain minting USDC to the user.

Below is an overview of the flow:

  1. Prompt the user to sign three off-chain signatures upfront. Two of these signatures authorize USDC transfer on the source and destination chain using ERC-3009. The third signature signs the meta-transaction itself enforcing a maximum fee and destination domain intent using ERC-2771. Since all data is verified on-chain to have been signed by the user, we avoid any trust assumptions. Signing upfront improves UX as the user need not be present for the entire process.
  2. Relay a transaction to burn USDC on the source chain. This emits events which are observed by Circle and a Web3 Function.
  3. The Web3 Function indexes all events and periodically fetches attestation signatures from Circle’s attestation service.
  4. Once an attestation is issued, the Web3 Function relays a final transaction on the destination chain using the attestation signature to mint USDC to the user.

Intermediary Forwarder contracts facilitate relay fee payment. These are deployed on each CCTP-compatible network allowing for any-to-any chain transfers.

Note: Gasless refers to the absence of native tokens during transaction fee payment. Gas is still paid by a relayer but abstracted away from the user and compensated in USDC.


All of the logic outlined above is packaged into the new Gasless CCTP SDK allowing for easy integration. Existing bridges can implement this as well as other dApps to power a variety of use cases - the sky's the limit. For example, an NFT marketplace on Avalanche can support USDC payment from a variety of other blockchains, all whilst remaining Avalanche native. An example frontend implementation is available on GitHub:

The SDK provides a transfer method that uses Gelato Relay and Functions under the hood in combination with Circle’s CCTP to gaslessly transfer USDC between chains. The caller provides the address of the EOA which the USDC will be transferred from on the source chain and to on the destination chain. The next argument is the total amount of USDC to be transferred, including the fee amounts. These are capped by specifying a maximum fee amount on the source and destination chain respectively. Following this, the source and destination chain are specified. The final argument is an arbitrary callback function responsible for signing typed data and allows the caller to define custom signing logic as well as performing UI updates and error handling.

await transfer(
owner, // owner account address
amount, // total token amount including fees
srcMaxFee, // max relay fee on the source chain
dstMaxFee, // max relay fee on the destination chain
srcChainId, // source chainId
dstChainId, // destination chainId
signTypedData // callback to sign typed data


Gasless CCTP paves the way for further blockchain interoperability allowing for seamless and secure, gas token agnostic asset transfer. By leveraging Gelato Relay and Functions, USDC serves as a universal fee payment solution abstracting away blockchain complexities and uniting diverse ecosystems. This functionality is made readily available through the implementation of the Gasless CCTP SDK.

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.

  • Gelato RaaS: Deploy your own tailor-made ZK or OP L2 chains in a single click with native Account Abstraction and all Gelato middleware baked in.

  • VRF: Gelato VRF provides fast, on-chain verifiable randomness for blockchain applications.

  • Functions: Serverless, event-driven functions to automate blockchain transactions.

  • Relay: Give your users access to reliable, robust, and scalable gasless transactions via a simple-to-use API.

  • Account Abstraction SDK: 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.