Biconomy Gasless SDK (EOA)
DashboardMediumWebsite
  • 🚀Getting Started
  • Introduction
    • 🤘Why Biconomy?
    • 🙂How we simplify transactions
  • Products
    • 💸Gasless Transactions
      • Choose An Approach to Enable Gasless
        • Standard EIP 2771 Approach
          • 1. Register Artifacts on the Dashboard
          • 2. Code Changes
            • Using SDK
            • Using API
        • Custom Implementation Approach
          • 1. Register Artifacts on the Dashboard
          • 2. Code Changes
            • Using SDK
            • Using API
        • Smart Contract Wallet Approach
          • Gnosis
        • Network Agnostic Transactions
          • EIP-2771 Approach
          • Custom Approach
      • Conditional Whitelisting
      • Gasless SDK (EOA) 3
      • Networks Supported
    • ↔️Hyphen - Instant Cross-Chain Transfers
      • SDK
        • DepositManager
        • TransferManager
        • TokenManager
      • APIs
      • Helper Methods
      • Migrating from Hyphen V1
      • Contract Addresses
      • Hyphen Widget
  • Guides
    • 💻Dashboard
      • DApp Statistics
    • ⛽Gas Tank Deposits
      • Via Dashboard
      • Via Smart Contract
  • api
    • 🔧Native Meta Transaction
      • Get Retried Hashes
    • 🌎Dashboard APIs
    • ⚪Whitelist API
      • Whitelist Destination Address
      • Whitelist Proxy Contracts
    • 〰️ Check Limits
    • 💿Biconomy Data API
      • 👨‍🚀Unique User Data
      • 🧑‍🔧Per User Limits Data
      • ⛽Gas Tank Balance Data
  • SDK
    • 📙Gasless SDK (EOA)
      • Configuration
  • Tutorials
    • 🔰Native Meta Transactions
      • How To Build Your First DApp
        • Write Your First Smart Contract
        • Initialize Web3 on Client Side
        • Executing First Blockchain Transaction
      • Enable Native Meta Transactions
        • Smart Contract
          • Describe Your Structs
          • Declare Your Variables
          • Modify Respective Function
        • Client Side
          • Design Your JSON structure
          • Design Your Domain Separator
          • Design Data Types
          • Define Data To Sign
          • Generate Signatures
      • Integrate Biconomy
        • Register On Dashboard
        • Integrate Gasless SDK (EOA)
      • Summary
  • BICO Staking
    • 🪁Safety Module
  • Get in touch
    • 👥Contact Us
  • Misc
    • 🧩Projects on Biconomy
    • 🌐Supported Networks
    • 📫Contract Addresses
    • ✔︎ Smart Contracts Audit
    • ❓FAQs
Powered by GitBook
On this page
  • Gasless Transactions Using Custom Approach
  • Client Side Changes
  • Why and when should you use this approach?

Was this helpful?

  1. Products
  2. Gasless Transactions
  3. Choose An Approach to Enable Gasless

Custom Implementation Approach

Implement meta transactions your own way

PreviousUsing APINext1. Register Artifacts on the Dashboard

Last updated 9 months ago

Was this helpful?

There can be many ways to enable gasless transactions in your dApp. For example, DAI token has enabled gasless transactions by introducing a that allows a user to give allowance to other users by just providing EIP-712 style signature from their account and anyone can submit that permit transaction and pay the gas fees. The permit function implementation is DAI's way of enabling gasless transactions.

We have written some standard contracts () that can be used to enable gasless transaction functionality in your smart contract itself. So you are able to interact with your smart contracts directly in a gasless way with no other smart contracts involved.

Note: You still need a relayer infrastructure like Biconomy to relay those gasless transactions.

Gasless Transactions Using Custom Approach

In order to send gasless transactions in your dApp via Biconomy using custom meta transaction implementation, the following two integration steps will be required

  1. Smart Contract Changes

  2. Client Side Changes

Smart Contract Changes

In order to allow your Smart Contract to accept meta transactions, it needs to get rid of the dependency on msg.sender and msg.value. The simple way to enable this is to inherit one of the below mentioned smart contracts based on your signature requirements:

  1. (for EIP-712 signatures)

  2. (for personal sign)

After inheriting either one of the above smart contracts, you need to use msgSender() method wherever you use msg.sender

That's it!! You have enabled native meta transaction support in your smart contract.

Client Side Changes

The next step is Biconomy's integration on the client side. This can either be done via Gasless SDK (EOA) integration or API integration. For both cases, first, you need to register your dApp on and get your API Key.

Check out the next section on

Use msgSender(), not msg.sender

Why and when should you use this approach?

When the method you need to make gasless already has user signature as parameter for example permit(...r,s,v) , you can register the contract as Custom and directly register method name itself. Another use case is gasless token approvals on certain chains like Polygon as these contracts already inherit from EIP712MetaTransaction specs and have executeMetaTransaction method available. Also, custom approach can allow you to define your custom structured signatures.

EIP712MetaTransaction base contract is responsible for signature verification and replay protection and calls the generic method executeMetaTransaction method on itself by appending the user address at the end of call data. The msgSender() method in your smart contract (inherited by ) does the rest by returning the correct address for any context. Use msgSender() wherever you use msg.sender.

Example in case of DAI, you can refer to the permit() function in the .

💸
permit function
Audited
EIP712MetaTransaction.sol
BasicMetaTransaction.sol
Biconomy Dashboard
how to register your dApp on the dashboard.
EIP712MetaTransaction
contract code for DAI