Skip to main content
Send transactions across multiple chains with a single API call, settling gas payment on just one chain. This simplifies cross-chain operations by eliminating the need for users to hold gas tokens on every chain.

Overview

The sendTransactionMultichain method allows you to:
  • Submit transactions to multiple chains in a single request
  • Pay for all transactions using tokens on just one chain
  • Receive a unique task ID for each transaction to track status independently

How It Works

  1. Single Payment Chain - One transaction in the batch includes the token payment
  2. Sponsored Transactions - All other transactions are marked as sponsored and covered by the payment transaction
  3. Independent Execution - Each transaction executes independently on its respective chain
  4. Individual Tracking - Each transaction returns its own task ID for status tracking

Code Example

import { createGelatoEvmRelayerClient } from '@gelatocloud/gasless';

const relayer = createGelatoEvmRelayerClient({
  apiKey: process.env.GELATO_API_KEY,
  testnet: true
});

// Send transactions to multiple chains
const taskIds = await relayer.sendTransactionMultichain([
  {
    // Transaction on Ethereum - pays for all transactions
    chainId: 1,
    to: '0x55f3a93f544e01ce4378d25e927d7c493b863bd7',
    data: '0x29cb0f49',
    payment: {
      type: 'token',
      address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e' // USDC
    }
  },
  {
    // Transaction on Base - sponsored by the payment above
    chainId: 8453,
    to: '0x45f3a93f544e01ce4378d25e927d7c493b863bd7',
    data: '0x19ca0f49',
    payment: {
      type: 'sponsored'
    }
  },
]);

console.log('Task IDs:', taskIds);
// ['0x0e670ec6...', '0x0cf041f5...', '0x1ab234c7...']

Additional Resources