Skip to main content
Meta-transactions allow users to interact with smart contracts without paying gas fees. A relayer (like Gelato) pays the gas fees and executes the transaction on behalf of the user through:
  1. EIP-712 Typed Data Signing: Users sign structured data instead of raw transactions
  2. Contract Inheritance: Contracts inherit meta-transaction functionality
  3. Signature Verification: Contracts verify user signatures and execute functions on their behalf

Contract Conversion

Original Contract

Meta-Transaction Enabled Contract

To enable meta-transactions:
  1. Inherit from EIP712MetaTransaction
  2. Replace msg.sender with msgSender()

Key Changes

  • Inheritance: Passes contract name and version for EIP-712 domain separation
  • msgSender(): Returns the original user address (not the relayer address)

What EIP712MetaTransaction Provides

  • executeMetaTransaction(): Main function to execute meta-transactions
  • getNonce(address user): Get user’s nonce for replay protection
  • msgSender(): Returns the original user address
  • EIP-712 domain separation to prevent signature collisions

Client Implementation

Setup EIP-712 Types and Domain

Complete Example

EIP712MetaTransaction.sol

Create this base contract in your project to inherit meta-transaction functionality:
This contract uses OpenZeppelin’s ECDSA library for signature recovery. Install it with: