EIP-2771 Approach
Secure Protocol For Native Meta Transactions
Last updated
Was this helpful?
Secure Protocol For Native Meta Transactions
Last updated
Was this helpful?
Inherit contract in your contract.
Set trustedForwarder to while deploying your contract.
Replace msg.sender
in your contract with _msgSender()
.
More details about Standard EIP-2771 Approach can be found .
Now the contracts are updated and deployed, it's time to do the changes in your script.
After Registering Your dApp, SmartContact & Contract method on Desired network on Biconomy Dashboard, copy the <api-key>, you will need it on the client-side code.
Here comes the most important part, you need to pass the normal provider from your connected wallet e.g. window.ethereum
for Metamask in Biconomy options. Using this provider Biconomy will take care of getting the User Signature.
The main provider object to be passed in Biconomy should be JSON RPC provider initialized with network RPC URL on which your Dapp is deployed.
That's it.
So the flow will be, Mexa will take the user signature using the connected wallet and will relay the transaction on your network via Biconomy servers.
In basic terms, you need one provider object for using Gasless SDK (EOA), another for signing meta transactions (to be passed in Biconomy options)
Gasless SDK (EOA) fetches data from Biconomy's servers. Because of this, it's best to initialize your dApp or perform any action after the biconomy.READY
event occurs.
If there is an error while initializing Gasless SDK (EOA), it's good to catch and log a biconomy.ERROR
event for better debugging.
In this scenario, you may need to initialise both instances of Gasless SDK (EOA).
You can use Gasless SDK (EOA) either with or . We'll be making two provider objects, one linked to your dApp's network RPC, and the other to your user's wallet.
for complete example code
for complete example code