Custom Implementation

Implement meta transactions your own way

In order to enable gasless transactions in your Dapp there can be many ways to enable that. For example, DAI token has enabled gasless transactions by introducing a permit function that allows a user to give allowance to other users by just providing EIP-712 style signature from his 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.

Here we have written some standard contracts (Audited) 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 extra smart contracts involved.

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

How to integrate Biconomy?

In order to send gasless transactions in your DApp via Biconomy using custom meta transaction implementation, we'll break down the integration into two steps

  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. ​EIP712MetaTransaction.sol (for EIP-712 signatures)

  2. ​BasicMetaTransaction.sol (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.

EIP-712 type signatures are not supported by hardware wallets. So if you want to support all wallets in your DApp including hardware wallets, go for BasicMetaTransaction.sol option.

Client Side Changes

Next step is Biconomy integration on the client side. This can either be done via SDK integration or API integration. For both cases, first you need to register your DApp on Biconomy Dashboard and get your API Key.

Check out the next section on how to register your DApp on the dashboard.

​